diff --git a/node_modules/.bin/flatiron b/node_modules/.bin/flatiron deleted file mode 120000 index cdca976..0000000 --- a/node_modules/.bin/flatiron +++ /dev/null @@ -1 +0,0 @@ -../flatiron/bin/flatiron \ No newline at end of file diff --git a/node_modules/.bin/vows b/node_modules/.bin/vows deleted file mode 120000 index 0386e59..0000000 --- a/node_modules/.bin/vows +++ /dev/null @@ -1 +0,0 @@ -../vows/bin/vows \ No newline at end of file diff --git a/node_modules/api-easy/.npmignore b/node_modules/api-easy/.npmignore deleted file mode 100644 index 787e90e..0000000 --- a/node_modules/api-easy/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules/ -node_modules/* -npm-debug.log -test/uploads/* diff --git a/node_modules/api-easy/.travis.yml b/node_modules/api-easy/.travis.yml deleted file mode 100644 index c958222..0000000 --- a/node_modules/api-easy/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 - - 0.7 - -notifications: - email: - - travis@nodejitsu.com - irc: "irc.freenode.org#nodejitsu" - diff --git a/node_modules/api-easy/LICENSE b/node_modules/api-easy/LICENSE deleted file mode 100644 index 1f01e2b..0000000 --- a/node_modules/api-easy/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011 Nodejitsu Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/api-easy/README.md b/node_modules/api-easy/README.md deleted file mode 100644 index 2033b5c..0000000 --- a/node_modules/api-easy/README.md +++ /dev/null @@ -1,163 +0,0 @@ -# APIeasy [![Build Status](https://secure.travis-ci.org/flatiron/api-easy.png)](http://travis-ci.org/flatiron/api-easy) - -A fluent (i.e. chainable) syntax for generating vows tests against RESTful APIs. - -## Installation - -### Installing npm (node package manager) -``` bash - $ curl http://npmjs.org/install.sh | sh -``` - -### Installing APIeasy -``` bash - $ [sudo] npm install api-easy -``` - -## Purpose -APIeasy is designed to be a simple way to test RESTful APIs in [node.js][0] and Javascript. The primary design goal was to reduce the number of lines of test code required to fully cover all primary and edge use cases of a given API over HTTP. - -## Getting Started -Most of the documentation for this library is available through the [annotated source code, available here][1] thanks to [jashkenas][2] and [docco][3]. If you're not feeling up for that, just keep reading here. tldr;? [Read how to use APIeasy in your own projects][4] - -If you're going to use APIeasy (and I hope you do), it's worth taking a moment to understand the way that [vows][5] manages flow control. Read up here on [vowsjs.org][5] (Under "Structure of a test suite"), or just remember vows uses this grammatical structure: - -``` - Suite → Batch* - Batch → Context* - Context → Topic? Vow* Context* -``` - -Got it? Good. There is a 1-to-1 relationship between a APIeasy suite and a vows suite; APIeasy is essentially a simpler syntax to manage a particular set of vows-based tests that conform to this pattern: - -1. Tests are performed by making HTTP requests against an API server -2. Assertions are made against the HTTP response and JSON response body -3. Rinse. Repeat. - -Here's a sample of the boilerplate code that APIeasy eliminates: - -``` js - var request = require('request'), - vows = require('vows'), - assert = require('assert'); - - vows.describe('your/awesome/api').addBatch({ - "When using your awesome api": { - "and your awesome resource": { - "A POST to /awesome": { - topic: function () { - request({ - uri: 'http://localhost:8080/awesome', - method: 'POST', - body: JSON.stringify({ test: 'data' }), - headers: { - 'Content-Type': 'application/json' - } - }, this.callback) - }, - "should respond with 200": function (err, res, body) { - assert.equal(res.statusCode, 200); - }, - "should respond with ok": function (err, res, body) { - var result = JSON.parse(body); - assert.equal(result.ok, true); - }, - "should respond with x-test-header": function (err, res, body) { - assert.include(res.headers, 'x-test-header'); - } - } - } - } - }).export(module); -``` - -This same code can be implemented like this using APIeasy: - -``` js - var APIeasy = require('api-easy'), - assert = require('assert'); - - var suite = APIeasy.describe('your/awesome/api'); - - suite.discuss('When using your awesome API') - .discuss('and your awesome resource') - .use('localhost', 8080) - .setHeader('Content-Type', 'application/json') - .post({ test: 'data' }) - .expect(200, { ok: true }) - .expect('should respond with x-test-header', function (err, res, body) { - assert.include(res.headers, 'x-test-header'); - }) - .export(module); -``` - - -## Using APIeasy in your own project -There are two ways to use APIeasy in your own project: - -1. Using npm -2. Using vows directly - -### Using APIeasy with npm -If you've used the `npm test` command in [npm][7] before, this should be nothing new. You can read more about the [npm test command here][8]. All you need to do is add the following to your `package.json` file: - -``` js - { - "dependencies": { - "api-easy": "0.2.x" - }, - "scripts": { - "test": "vows test/*-test.js" - } - } -``` - -**Note:** `test/*-test.js` is at your discretion. It's just an expression for all test files in your project. - -After adding this to your `package.json` file you can run the following to execute your tests: - -``` bash - $ cd path/to/your/project - $ npm install - $ npm test -``` - -There is also a full working sample of how to use this approach [here][9]. - -### Using APIeasy with vows -When you install APIeasy or take it as a dependency in your `package.json` file it will not install [vows][5] globally, so to use vows you must install it globally. - -``` bash - $ [sudo] npm install vows -g -``` - -After installing vows you can simply run it from inside your project: - -``` bash - $ cd /path/to/your/project - $ vows -``` - -## Roadmap - -1. [Get feedback][6] on what else could be exposed through this library. -2. Improve it. -3. Repeat (1) + (2). - -## Run Tests -
-  npm test
-
- -#### Author: [Charlie Robbins](http://nodejitsu.com) - -[0]: http://nodejs.org -[1]: http://flatiron.github.com/api-easy -[2]: http://github.com/jashkenas -[3]: http://github.com/jashkenas/docco -[4]: #using-api-easy -[5]: http://vowsjs.org -[6]: http://github.com/flatiron/api-easy/issues -[7]: http://npmjs.org -[8]: https://github.com/isaacs/npm/blob/master/doc/test.md -[9]: https://gist.github.com/1039425 diff --git a/node_modules/api-easy/docs/api-easy.html b/node_modules/api-easy/docs/api-easy.html deleted file mode 100644 index c2f29ad..0000000 --- a/node_modules/api-easy/docs/api-easy.html +++ /dev/null @@ -1,406 +0,0 @@ - api-easy.js

api-easy.js

/*
- * api-easy.js: Top-level include for the api-easy module.
- *
- * (C) 2011, Nodejitsu Inc.
- *
- */
-
-var assert = require('assert'),
-    fs = require('fs'),
-    path = require('path'),
-    qs = require('querystring'),
-    request = require('request'),
-    vows = require('vows');

Check for version info in package.json

require('pkginfo')(module, 'version');

APIeasy.describe(text, vowsSuite)

- -

This is the main (and sole) entry point for APIeasy. -It responds with an object literal that manages an -underlying vows suite. Each call to APIeasy.describe() -will create a vows suite, with the corresponding text -passed to this method.

exports.describe = function (text) {
-  return {

State / Context management:

- -
    -
  • suite: The underlying vows suite
  • -
  • discussion: Ordered list containing the set of text to use before each test
  • -
  • outgoing: Shared options to be passed to the request module on each test.
  • -
  • befores: Mapping of named functions to execute before each test to modify the - outgoing request options.
  • -
  • options: Various configuration options for managing nuances of state / scope.
  • -
  • paths: The set of paths representing the location of the current resource / - API method being tested by this object.
  • -
  • batch: The object literal representing the current batch of vows tests to - eventually be pass to vows .addBatch().
  • -
  • batches: The set of all batches that have been added to the vows suite - associated with this object.
  • -
    suite: vows.describe(text),
-    discussion: [],
-    outgoing: {
-      headers: {}
-    },
-    befores: {},
-    options: {},
-    paths: [],
-    batch: {},
-    batches: [],
-    

Add and Remove BDD Discussion

- -

Simple pathing for adding contextual description to sets of tests. -Each call to discuss will create an object in the nested vows -structure which has that text as the key in the parent. e.g.:

- -
APIeasy.describe('your/awesome/api')
-        .use('localhost', 8080)
-        .discuss('When using your awesome API')
-          .discuss('and an awesome resource')
-          .path('/awesome-resource')
-            .get().expect(200)
-          .undiscuss().unpath()
-          .discuss('and a super resource')
-          .path('/super-resource')
-            .get().expect(404);
-
    discuss: function (text) {
-      this.discussion.push(text);
-      return this;
-    },
-    undiscuss: function (length) {
-      length = length || 1;
-      this.discussion.splice(-1 * length, length);
-      return this;
-    },
-    

Setup Remote API Location / Options

- -

Configure the remote host, port, and miscellaneous -options of the API that this suite is testing.

    use: function (host /* [port, options] */) {
-      var args = Array.prototype.slice.call(arguments),
-          options = typeof args[args.length - 1] === 'object' ? args.pop() : {},
-          port = args[1];
-
-      this.host   = host || 'localhost';
-      this.port   = port || 80;
-      this.secure = options.secure || false;

TODO (indexzero): Setup this.options here (i.e. options for the SUITE, not the REQUEST) -What are useful options to expose?

      return this;
-    },
-    

Configure Headers

- -

Manipulate the HTTP headers that are sent to your API using these methods. -They are designed to mimic the node.js core HTTP APIs.

    setHeaders: function (headers) {
-      this.outgoing.headers = headers;
-      return this;
-    },
-    setHeader: function (key, value) {
-      this.outgoing.headers[key] = value;
-      return this;
-    },
-    removeHeader: function (key, value) {
-      delete this.outgoing.headers[key];
-      return this;
-    },
-    

Manipulate Base Path

- -

Control the base path used for a given test in this suite. Append a path -by calling .path(). Remove the last num paths from the suite by calling -.unpath(num). Set the root path using .root(path)

    path: function (uri) {
-      this.paths.push(uri.replace(/^\/|\/$/ig, ''));
-      return this;
-    },
-    unpath: function (length) {
-      length = length || 1;
-      this.paths.splice(-1 * length, length);
-      return this;
-    },
-    root: function (path) {
-      this.paths = [path];
-      return this;
-    },
-    

Dynamically set Outgoing Request Options

- -

Often it is necessary to set some HTTP options conditionally or based on -results of a dynamic and/or asynchronous operation. A call to .before() -will enqueue a function that will modify the outgoing request options -before the request is made for all tests on the suite.

    before: function (name, fn) {
-      this.befores[name] = fn;
-      return this;
-    },
-    unbefore: function (name) {
-      delete this.befores[name];
-      return this;
-    },
-    

Add HTTP Request-based Tests

- -

The .get(), .post(), .put(), .del(), and .head() -methods add a new context and topic to the vows structure maintained -by this APIeasy suite. The nuts and bolts of this are in the "private" -method _request().

- -

Each method invocation returns the suite itself so that -.expect() and other assertion method(s) can be called -afterwards to add assertions to this context.

    get: function (/* [uri, params] */) {
-      var args = Array.prototype.slice.call(arguments);
-      args.splice(1, -1, null);
-      return this._request.apply(this, ['get'].concat(args));
-    },
-    post: function (/* [uri, data, params] */) {
-      var args = Array.prototype.slice.call(arguments);
-      return this._request.apply(this, ['post'].concat(args));
-    },
-    put: function (/* [uri, data, params] */) {
-      var args = Array.prototype.slice.call(arguments);
-      return this._request.apply(this, ['put'].concat(args));
-    },
-    del: function (/* [uri, data, params] */) {
-      var args = Array.prototype.slice.call(arguments);
-      return this._request.apply(this, ['delete'].concat(args));
-    },
-    head: function (/* [uri, params] */) {
-      var args = Array.prototype.slice.call(arguments);
-      args.splice(1, -1, null);
-      return this._request.apply(this, ['head'].concat(args));
-    },
-    uploadFile: function (/* [uri, filepath, filePartName] */) {
-      var args = Array.prototype.slice.call(arguments),
-          filepath = args.splice(1, 1),
-          filePartName = args.splice(1, 1),
-          filename = path.basename(filepath);
-          
-      args.push(function (outgoing, callback) {

TODO replace request/multipart with better implementation with -low memory consumption

        fs.readFile(filepath[0], function (err, fileData) {
-          outgoing.multipart = [{
-              'content-type': 'application/octet-stream',
-              'Content-Transfer-Encoding': 'binary',
-              'Content-Disposition': 'form-data; name="' + filePartName + '"; filename="' + filename + '"',
-              'body': fileData
-          }];
-          
-          request(outgoing, callback);  
-        });
-      });
-      
-      return this._request.apply(this, ['post'].concat(args));
-    },
-    

Add Test Assertions

- -

Add test assertions with .expect(). There are a couple of options here:

- -
    -
  1. Assert a response code: suite.expect(200)
  2. -
  3. Assert a JSON result: suite.expect({ some: 'value' })
  4. -
  5. Use a custom assertion: suite.expect('should be custom', function (err, res, body) { ... })
  6. -
    expect: function (/* [text, code, result, assert] */) {
-      var args = Array.prototype.slice.call(arguments),
-          text, code, result, test, context;
-      
-      args.forEach(function (arg) {
-        switch (typeof(arg)) {
-          case 'number': code = arg; break;
-          case 'string': text = arg; break;
-          case 'object': result = arg; break;
-          case 'function': test = arg; break;
-        }
-      });
-      
-      context = this._currentTest(this.current);
-      

When using a custom test assertion function, both the assertion function -and a description are required or else we have no key in the JSON structure to use.

      if (text && !test || test && !text) {
-        throw new Error('Both description and a custom test are required.');
-      }
-      

Setup the custom test assertion if we have the appropriate arguments.

      if (text && test) {
-        context[text] = function (err, res, body) {
-          assert.isNull(err);
-          test.apply(context, arguments);
-        };
-      }
-      

Setup the response code test assertion if we have the appropriate arguments.

      if (code) {
-        context['should respond with ' + code] = function (err, res, body) {
-          assert.isNull(err);
-          assert.equal(res.statusCode, code);
-        };
-      }
-      

Setup the JSON response assertion if we have the appropriate arguments.

      if (result) {
-        context['should respond with ' + JSON.stringify(result).substring(0, 50)] = function (err, res, body) {

Pass any and all errors from parsing and asserting -the JSON returned to the underlying vows suite.

          assert.isNull(err);
-          var testResult = JSON.parse(body);
-          assert.deepEqual(testResult, result);
-        };
-      }
-      
-      return this;
-    },
-    

Create some helper methods for setting important options -that will be later passed to request.

    followRedirect: function (follow) {
-      this.outgoing.followRedirect = follow;
-      return this;
-    },
-    maxRedirects: function (max) {
-      this.outgoing.maxRedirects = max;
-      return this;
-    },
-    

Perform Sequential Tests Easily

- -

Since this object literal is designed to manage a single vows suite, -we need a way to add multiple batches to that suite for performing -sequential tests. This is precisely what .next() does. It will:

- -
    -
  1. Add the current batch (or 'vows'), this.batch, to the vows suite
  2. -
  3. Add this same batch to the set of batches on this.batches
  4. -
  5. Create a new empty object literal to use for this.batch.
  6. -
  7. Reset the context for the this.current test.
  8. -
    next: function () {
-      this.suite.addBatch(this.batch);
-      this.batches.push(this.batch);
-      this.batch = {};
-      this.current = '';
-      return this;
-    },
-    

Run Your Tests

- -

Again, since we are managing a single vows suite in this object we -should expose an easy way to export your tests to a given target without -needing to call apiEasySuite.suite.export(module). You should only -call this method once in a given test file.

- -

You can also call .run() which will run the specified suite just -as if you were using vows directly.

    export: function (target) {
-      if (this.batch) {
-        this.next();
-      }
-      
-      this.suite.export(target);
-      return this;
-    },
-    run: function (options, callback) {
-      if (this.batch) {
-        this.next();
-      }
-      
-      if (!callback) {
-        callback = options;
-        options = {};
-      }
-      
-      this.suite.run(options, callback);
-      return this;
-    },
-    

Use Vows from APIeasy

    addBatch : function () {
-      if (this.batch) {
-        this.next();
-      }
-      

injects easy methods into vows' suite to be able -to switch back to APIEasy context

      var self = this;
-      ['get', 'post', 'del', 'put', 'head', 'uploadFile'].forEach(function (methodName) {
-        if (typeof self.suite[methodName] === 'undefined') {    
-          self.suite[methodName] = function () {
-            return self[methodName].apply(self, arguments);
-          }
-        }  
-      });
-      
-      return this.suite.addBatch.apply(this.suite, arguments);
-    },
-    

Helpers and Utilities

- -

_request() exists for the sake of DRY and simplicity and is designed to handle -a variety of interal usage(s) exposed indirectly through the .get(), -.post(), .put(), .del() and .head(). Nothing to see here unless you're -interested in improving APIeasy itself.

    _request: function (/* method [uri, data, params] */) {
-      var self    = this,
-          args    = Array.prototype.slice.call(arguments),
-          method  = args.shift(),
-          uri     = typeof args[0] === 'string' && args.shift(),
-          data    = typeof args[0] === 'object' && args.shift(),
-          params  = typeof args[0] === 'object' && args.shift(),
-          

custom request implementation function (outgoing, callaback), -should invoke callback(err, response, body) once done

          requestImpl = typeof args[0] === 'function' && args.shift(),
-          port    = this.port && this.port !== 80 ? ':' + this.port : '',
-          outgoing = clone(this.outgoing),
-          fullUri, context;
-      

Update the fullUri for this request with the passed uri -and the query string parameters (if any).

      fullUri = distillPath(uri ? this.paths.concat([uri]) : this.paths);
-      

Append the query string parameters to the fullUri. It's worth mentioning -here that if only a single object is provided to _request() it will assume -that it is the request body, not the params hash.

      if (params) {
-        fullUri += '?' + qs.stringify(params);
-      }
-      

If the user has provided data, assume that it is JSON -and set it to the body property of the options.

- -

TODO (indexzero): Expose more properties available by the -request module

      if (data) {
-        if (this.outgoing.headers['Content-Type'] == 'application/x-www-form-urlencoded') {
-          outgoing.body = qs.stringify(data);
-        } 
-        else {
-          outgoing.body = JSON.stringify(data);
-        }
-      }
-      

Set the uri and method properties of the request options outgoing -using the information provided to this instance and _request().

      outgoing.uri = this.secure ? 'https://' : 'http://';
-      outgoing.uri += this.host + port + fullUri;
-      outgoing.method = method;
-      

Create the description for this test. This is currently static. -Remark (indexzero): Do users care if these strings are configurable?

      this.current = ['A', method.toUpperCase(), 'to', fullUri].join(' ');
-      context = this._currentTest();
-      

Add the topic for the specified request to the context of the current -batch used by this suite.

      context[this.current] = {
-        topic: function () {

Before making the outgoing HTTP request for this topic, execute -all known before funtions available to this suite. These functions -are by definition synchronous add vows before a given test if -this data is fetched asynchronously.

          Object.keys(self.befores).forEach(function (name) {
-            outgoing = self.befores[name](outgoing);
-          }); 
-          
-          if (requestImpl)
-            requestImpl(outgoing, this.callback);
-          else
-            request(outgoing, this.callback);
-        }
-      };
-      

Set the outgoing request options and set of before functions on the topic. -This is used for test assertions, general consistency, and basically -just knowing what every topic does explicitly.

      context[this.current].topic.outgoing = outgoing;
-      context[this.current].topic.before   = this.befores;
-      return this;
-    },
-    

The vows data structure is read as a sentence constructred by -keys in a nested JSON structure. This helper method is designed to -get the current test context (i.e. object) by nesting into the -JSON structure using this convention.

    _currentTest: function (text) {
-      var last = this.batch;
-      

Nest into the batch JSON structure using the current discussion text.

      this.discussion.forEach(function (text) {
-        if (typeof last[text] !== 'object') {
-          last[text] = {};
-        }
-        

Capture the nested object

        last = last[text];
-      });
-      
-      return text ? last[text] : last;
-    }
-  };
-};

A simple function that performs a deep clone on the specified obj. -We use this in APIeasy to create multiple copies of the options -passed to request because they are considered mutable by request -and we strive to make each request idempotent.

function clone (obj) {
-  var copy = {};
-  for (var i in obj) {
-    if (Array.isArray(obj[i])) {
-      copy[i] = obj[i].slice(0);
-    }
-    else {
-      copy[i] = obj[i] instanceof Object ? clone(obj[i]) : obj[i];
-    }
-  }
-
-  return copy;
-}

Helper function used to join nested paths created by -multiple calls to .path().

- -
suite.path('/a-path')
-     .path('/hey-another-path')
-     .path(...)
-
function distillPath (paths) {
-  return '/' + paths.map(function (p) {
-    return p.replace(/^\/|\/$/ig, '');
-  }).join('/');
-}
-
-
\ No newline at end of file diff --git a/node_modules/api-easy/docs/docco.css b/node_modules/api-easy/docs/docco.css deleted file mode 100644 index bd54134..0000000 --- a/node_modules/api-easy/docs/docco.css +++ /dev/null @@ -1,194 +0,0 @@ -/*--------------------- Layout and Typography ----------------------------*/ -body { - font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; - font-size: 15px; - line-height: 22px; - color: #252519; - margin: 0; padding: 0; -} -a { - color: #261a3b; -} - a:visited { - color: #261a3b; - } -p { - margin: 0 0 15px 0; -} -h4, h5, h6 { - color: #333; - margin: 6px 0 6px 0; - font-size: 13px; -} - h2, h3 { - margin-bottom: 0; - color: #000; - } - h1 { - margin-top: 40px; - margin-bottom: 15px; - color: #000; - } -#container { - position: relative; -} -#background { - position: fixed; - top: 0; left: 525px; right: 0; bottom: 0; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - z-index: -1; -} -#jump_to, #jump_page { - background: white; - -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; - -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; - font: 10px Arial; - text-transform: uppercase; - cursor: pointer; - text-align: right; -} -#jump_to, #jump_wrapper { - position: fixed; - right: 0; top: 0; - padding: 5px 10px; -} - #jump_wrapper { - padding: 0; - display: none; - } - #jump_to:hover #jump_wrapper { - display: block; - } - #jump_page { - padding: 5px 0 3px; - margin: 0 0 25px 25px; - } - #jump_page .source { - display: block; - padding: 5px 10px; - text-decoration: none; - border-top: 1px solid #eee; - } - #jump_page .source:hover { - background: #f5f5ff; - } - #jump_page .source:first-child { - } -table td { - border: 0; - outline: 0; -} - td.docs, th.docs { - max-width: 450px; - min-width: 450px; - min-height: 5px; - padding: 10px 25px 1px 50px; - overflow-x: hidden; - vertical-align: top; - text-align: left; - } - .docs pre { - margin: 15px 0 15px; - padding-left: 15px; - } - .docs p tt, .docs p code { - background: #f8f8ff; - border: 1px solid #dedede; - font-size: 12px; - padding: 0 0.2em; - } - .pilwrap { - position: relative; - } - .pilcrow { - font: 12px Arial; - text-decoration: none; - color: #454545; - position: absolute; - top: 3px; left: -20px; - padding: 1px 2px; - opacity: 0; - -webkit-transition: opacity 0.2s linear; - } - td.docs:hover .pilcrow { - opacity: 1; - } - td.code, th.code { - padding: 14px 15px 16px 25px; - width: 100%; - vertical-align: top; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - } - pre, tt, code { - font-size: 12px; line-height: 18px; - font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; - margin: 0; padding: 0; - } - - -/*---------------------- Syntax Highlighting -----------------------------*/ -td.linenos { background-color: #f0f0f0; padding-right: 10px; } -span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } -body .hll { background-color: #ffffcc } -body .c { color: #408080; font-style: italic } /* Comment */ -body .err { border: 1px solid #FF0000 } /* Error */ -body .k { color: #954121 } /* Keyword */ -body .o { color: #666666 } /* Operator */ -body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ -body .cp { color: #BC7A00 } /* Comment.Preproc */ -body .c1 { color: #408080; font-style: italic } /* Comment.Single */ -body .cs { color: #408080; font-style: italic } /* Comment.Special */ -body .gd { color: #A00000 } /* Generic.Deleted */ -body .ge { font-style: italic } /* Generic.Emph */ -body .gr { color: #FF0000 } /* Generic.Error */ -body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -body .gi { color: #00A000 } /* Generic.Inserted */ -body .go { color: #808080 } /* Generic.Output */ -body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -body .gs { font-weight: bold } /* Generic.Strong */ -body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -body .gt { color: #0040D0 } /* Generic.Traceback */ -body .kc { color: #954121 } /* Keyword.Constant */ -body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ -body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ -body .kp { color: #954121 } /* Keyword.Pseudo */ -body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ -body .kt { color: #B00040 } /* Keyword.Type */ -body .m { color: #666666 } /* Literal.Number */ -body .s { color: #219161 } /* Literal.String */ -body .na { color: #7D9029 } /* Name.Attribute */ -body .nb { color: #954121 } /* Name.Builtin */ -body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ -body .no { color: #880000 } /* Name.Constant */ -body .nd { color: #AA22FF } /* Name.Decorator */ -body .ni { color: #999999; font-weight: bold } /* Name.Entity */ -body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -body .nf { color: #0000FF } /* Name.Function */ -body .nl { color: #A0A000 } /* Name.Label */ -body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -body .nt { color: #954121; font-weight: bold } /* Name.Tag */ -body .nv { color: #19469D } /* Name.Variable */ -body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -body .w { color: #bbbbbb } /* Text.Whitespace */ -body .mf { color: #666666 } /* Literal.Number.Float */ -body .mh { color: #666666 } /* Literal.Number.Hex */ -body .mi { color: #666666 } /* Literal.Number.Integer */ -body .mo { color: #666666 } /* Literal.Number.Oct */ -body .sb { color: #219161 } /* Literal.String.Backtick */ -body .sc { color: #219161 } /* Literal.String.Char */ -body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ -body .s2 { color: #219161 } /* Literal.String.Double */ -body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -body .sh { color: #219161 } /* Literal.String.Heredoc */ -body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -body .sx { color: #954121 } /* Literal.String.Other */ -body .sr { color: #BB6688 } /* Literal.String.Regex */ -body .s1 { color: #219161 } /* Literal.String.Single */ -body .ss { color: #19469D } /* Literal.String.Symbol */ -body .bp { color: #954121 } /* Name.Builtin.Pseudo */ -body .vc { color: #19469D } /* Name.Variable.Class */ -body .vg { color: #19469D } /* Name.Variable.Global */ -body .vi { color: #19469D } /* Name.Variable.Instance */ -body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/node_modules/api-easy/examples/simple-example.js b/node_modules/api-easy/examples/simple-example.js deleted file mode 100644 index 25aad6f..0000000 --- a/node_modules/api-easy/examples/simple-example.js +++ /dev/null @@ -1,39 +0,0 @@ -var vows = require('vows'), - assert = require('assert'), - APIeasy = require('../lib/api-easy'), - helpers = require('../test/helpers'); - -var scopes = ['When using the Test API', 'the Test Resource']; - -helpers.startServer(8000); - -var suite = APIeasy.describe('api/test'); - -scopes.forEach(function (text) { - suite.discuss(text); -}); - -suite.use('localhost', 8000) - .setHeader('Content-Type', 'application/json') - .followRedirect(false) - .get('/tests') - .expect(200, { ok: true }) - .post('/tests', { dynamic: true }) - .expect(200, { dynamic: true }) - .post('/redirect', { dynamic: true }) - .expect(302, { dynamic: true }) - .get('/login') - .expect(200) - .expect('should respond with the authorize token', function (err, res, body) { - var result = JSON.parse(body); - assert.isNotNull(result.token); - - suite.before('setAuth', function (outgoing) { - outgoing.headers['x-test-authorized'] = result.token; - return outgoing; - }); - }) - .next() - .get('/restricted') - .expect(200, { authorized: true }) - .export(module); \ No newline at end of file diff --git a/node_modules/api-easy/lib/api-easy.js b/node_modules/api-easy/lib/api-easy.js deleted file mode 100644 index f61b1d8..0000000 --- a/node_modules/api-easy/lib/api-easy.js +++ /dev/null @@ -1,533 +0,0 @@ -/* - * api-easy.js: Top-level include for the api-easy module. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var assert = require('assert'), - fs = require('fs'), - path = require('path'), - qs = require('qs'), - request = require('request'), - vows = require('vows'); - -// -// ### Check for version info in `package.json` -// -require('pkginfo')(module, 'version'); - -// -// ## APIeasy.describe(text, vowsSuite) -// This is the main (and sole) entry point for APIeasy. -// It responds with an object literal that manages an -// underlying vows suite. Each call to `APIeasy.describe()` -// will create a vows suite, with the corresponding `text` -// passed to this method. -// -exports.describe = function (text) { - return { - // - // ### State / Context management: - // - // * `suite`: The underlying vows suite - // * `discussion`: Ordered list containing the set of text to use before each test - // * `outgoing`: Shared options to be passed to the `request` module on each test. - // * `befores`: Mapping of named functions to execute before each test to modify the - // outgoing request options. - // * `options`: Various configuration options for managing nuances of state / scope. - // * `paths`: The set of paths representing the location of the current resource / - // API method being tested by this object. - // * `batch`: The object literal representing the current batch of vows tests to - // eventually be pass to vows `.addBatch()`. - // * `batches`: The set of all batches that have been added to the vows `suite` - // associated with this object. - // - suite: vows.describe(text), - discussion: [], - outgoing: { - headers: {} - }, - befores: {}, - options: {}, - paths: [], - batch: {}, - batches: [], - - // - // ### Add and Remove BDD Discussion - // Simple pathing for adding contextual description to sets of tests. - // Each call to discuss will create an object in the nested vows - // structure which has that text as the key in the parent. **e.g.:** - // - // APIeasy.describe('your/awesome/api') - // .use('localhost', 8080) - // .discuss('When using your awesome API') - // .discuss('and an awesome resource') - // .path('/awesome-resource') - // .get().expect(200) - // .undiscuss().unpath() - // .discuss('and a super resource') - // .path('/super-resource') - // .get().expect(404); - // - discuss: function (text) { - this.discussion.push(text); - return this; - }, - undiscuss: function (length) { - length = length || 1; - this.discussion.splice(-1 * length, length); - return this; - }, - - // - // ### Setup Remote API Location / Options - // Configure the remote `host`, `port`, and miscellaneous - // `options` of the API that this suite is testing. - // - use: function (host /* [port, options] */) { - var args = Array.prototype.slice.call(arguments), - options = typeof args[args.length - 1] === 'object' ? args.pop() : {}, - port = args[1]; - - this.host = host || 'localhost'; - this.port = port || 80; - this.secure = options.secure || false; - - // - // **TODO _(indexzero)_:** Setup `this.options` here (i.e. options for the SUITE, not the REQUEST) - // _What are useful options to expose?_ - // - - return this; - }, - - // - // ### Configure Headers - // Manipulate the HTTP headers that are sent to your API using these methods. - // They are designed to mimic the node.js core HTTP APIs. - // - setHeaders: function (headers) { - this.outgoing.headers = headers; - return this; - }, - setHeader: function (key, value) { - this.outgoing.headers[key] = value; - return this; - }, - removeHeader: function (key, value) { - delete this.outgoing.headers[key]; - return this; - }, - - // - // ### Manipulate Base Path - // Control the base path used for a given test in this suite. Append a path - // by calling `.path()`. Remove the last `num` paths from the suite by calling - // `.unpath(num)`. Set the root path using `.root(path)` - // - path: function (uri) { - this.paths.push(uri.replace(/^\/|\/$/ig, '')); - return this; - }, - unpath: function (length) { - length = length || 1; - this.paths.splice(-1 * length, length); - return this; - }, - root: function (path) { - this.paths = [path]; - return this; - }, - - // - // ### Dynamically set Outgoing Request Options - // Often it is necessary to set some HTTP options conditionally or based on - // results of a dynamic and/or asynchronous operation. A call to `.before()` - // will enqueue a function that will modify the outgoing request options - // before the request is made for all tests on the suite. - // - before: function (name, fn) { - this.befores[name] = fn; - return this; - }, - unbefore: function (name) { - delete this.befores[name]; - return this; - }, - - // - // ### Add HTTP Request-based Tests - // The `.get()`, `.post()`, `.put()`, `.del()`, and `.head()` - // methods add a new context and topic to the vows structure maintained - // by this APIeasy suite. The nuts and bolts of this are in the "private" - // method `_request()`. - // - // Each method invocation returns the suite itself so that - //`.expect()` and other assertion method(s) can be called - // afterwards to add assertions to this context. - // - get: function (/* [uri, params] */) { - var args = Array.prototype.slice.call(arguments); - args.splice(1, -1, null); - return this._request.apply(this, ['get'].concat(args)); - }, - post: function (/* [uri, data, params] */) { - var args = Array.prototype.slice.call(arguments); - return this._request.apply(this, ['post'].concat(args)); - }, - put: function (/* [uri, data, params] */) { - var args = Array.prototype.slice.call(arguments); - return this._request.apply(this, ['put'].concat(args)); - }, - del: function (/* [uri, data, params] */) { - var args = Array.prototype.slice.call(arguments); - return this._request.apply(this, ['delete'].concat(args)); - }, - head: function (/* [uri, params] */) { - var args = Array.prototype.slice.call(arguments); - args.splice(1, -1, null); - return this._request.apply(this, ['head'].concat(args)); - }, - uploadFile: function (/* [uri, filepath, filePartName] */) { - var args = Array.prototype.slice.call(arguments), - filepath = args.splice(1, 1), - filePartName = args.splice(1, 1), - filename = path.basename(filepath); - - args.push(function (outgoing, callback) { - // - // TODO replace request/multipart with better implementation with - // low memory consumption - // - fs.readFile(filepath[0], function (err, fileData) { - outgoing.multipart = [{ - 'content-type': 'application/octet-stream', - 'Content-Transfer-Encoding': 'binary', - 'Content-Disposition': 'form-data; name="' + filePartName + '"; filename="' + filename + '"', - 'body': fileData - }]; - - request(outgoing, callback); - }); - }); - - return this._request.apply(this, ['post'].concat(args)); - }, - - // - // ### Add Test Assertions - // Add test assertions with `.expect()`. There are a couple of options here: - // - // 1. Assert a response code: `suite.expect(200)` - // 2. Assert a JSON result: `suite.expect({ some: 'value' })` - // 3. Use a custom assertion: `suite.expect('should be custom', function (err, res, body) { ... })` - // - expect: function (/* [text, code, result, assert] */) { - var args = Array.prototype.slice.call(arguments), - text, code, result, test, context; - - args.forEach(function (arg) { - switch (typeof(arg)) { - case 'number': code = arg; break; - case 'string': text = arg; break; - case 'object': result = arg; break; - case 'function': test = arg; break; - } - }); - - context = this._currentTest(this.current); - - // When using a custom test assertion function, both the assertion function - // and a description are required or else we have no key in the JSON structure to use. - if (text && !test || test && !text) { - throw new Error('Both description and a custom test are required.'); - } - - // Setup the custom test assertion if we have the appropriate arguments. - if (text && test) { - context[text] = function (err, res, body) { - assert.isNull(err); - test.apply(context, arguments); - }; - } - - // Setup the response code test assertion if we have the appropriate arguments. - if (code) { - context['should respond with ' + code] = function (err, res, body) { - assert.isNull(err); - assert.equal(res.statusCode, code); - }; - } - - // Setup the JSON response assertion if we have the appropriate arguments. - if (result) { - context['should respond with ' + JSON.stringify(result).substring(0, 50)] = function (err, res, body) { - // - // Pass any and all errors from parsing and asserting - // the JSON returned to the underlying `vows` suite. - // - assert.isNull(err); - var testResult = JSON.parse(body); - assert.deepEqual(testResult, result); - }; - } - - return this; - }, - - // - // Create some helper methods for setting important options - // that will be later passed to `request`. - // - followRedirect: function (follow) { - this.outgoing.followRedirect = follow; - return this; - }, - maxRedirects: function (max) { - this.outgoing.maxRedirects = max; - return this; - }, - - // - // ### Perform Sequential Tests Easily - // Since this object literal is designed to manage a single vows suite, - // we need a way to add multiple batches to that suite for performing - // sequential tests. This is precisely what `.next()` does. It will: - // - // 1. Add the current batch (or 'vows'), `this.batch`, to the vows suite - // 2. Add this same batch to the set of batches on `this.batches` - // 3. Create a new empty object literal to use for `this.batch`. - // 4. Reset the context for the `this.current` test. - // - next: function () { - this.suite.addBatch(this.batch); - this.batches.push(this.batch); - this.batch = {}; - this.current = ''; - return this; - }, - - // - // ### Run Your Tests - // Again, since we are managing a single vows suite in this object we - // should expose an easy way to export your tests to a given target without - // needing to call `apiEasySuite.suite.export(module)`. You should only - // call this method once in a given test file. - // - // The method exportTo(module) is provided as an alias to export(module) - // if you want to avoid using the reserved JavaScript `export` word - // - // You can also call `.run()` which will run the specified suite just - // as if you were using vows directly. - // - export: function (target) { - if (this.batch) { - this.next(); - } - - this.suite.export(target); - return this; - }, - exportTo: function (target) { - return this.export(target); - }, - run: function (options, callback) { - if (this.batch) { - this.next(); - } - - if (!callback) { - callback = options; - options = {}; - } - - this.suite.run(options, callback); - return this; - }, - - // ### Use Vows from APIeasy - addBatch : function () { - if (this.batch) { - this.next(); - } - - // - // injects `easy` methods into vows' suite to be able - // to switch back to APIEasy context - // - var self = this; - ['get', 'post', 'del', 'put', 'head', 'uploadFile'].forEach(function (methodName) { - if (typeof self.suite[methodName] === 'undefined') { - self.suite[methodName] = function () { - return self[methodName].apply(self, arguments); - } - } - }); - - this.suite.addBatch.apply(this.suite, arguments); - return this; - }, - - // - // ### Helpers and Utilities - // `_request()` exists for the sake of DRY and simplicity and is designed to handle - // a variety of interal usage(s) exposed indirectly through the `.get()`, - // `.post()`, `.put()`, `.del()` and `.head()`. Nothing to see here unless you're - // interested in improving APIeasy itself. - // - _request: function (/* method [uri, data, params] */) { - var self = this, - args = Array.prototype.slice.call(arguments), - method = args.shift(), - uri = typeof args[0] === 'string' && args.shift(), - data = typeof args[0] === 'object' && args.shift(), - params = typeof args[0] === 'object' && args.shift(), - - // custom request implementation function (outgoing, callaback), - // should invoke callback(err, response, body) once done - requestImpl = typeof args[0] === 'function' && args.shift(), - port = this.port && this.port !== 80 ? ':' + this.port : '', - outgoing = clone(this.outgoing), - fullUri, context; - - // - // Update the fullUri for this request with the passed uri - // and the query string parameters (if any). - // - fullUri = distillPath(uri ? this.paths.concat([uri]) : this.paths); - - // - // Append the query string parameters to the `fullUri`. It's worth mentioning - // here that if only a single object is provided to `_request()` it will assume - // that it is the request body, not the params hash. - // - if (params) { - fullUri += '?' + qs.stringify(params); - } - - // - // If the user has provided data, assume that it is JSON - // and set it to the `body` property of the options. - // - // **TODO _(indexzero)_**: Expose more properties available by the - // [request module](http://github.com/mikeal/request) - // - if (data) { - if (this.outgoing.headers['Content-Type'] == 'application/x-www-form-urlencoded') { - outgoing.body = qs.stringify(data); - } - else if (this.outgoing.headers['Content-Type'] == 'application/json') { - outgoing.body = JSON.stringify(data); - } - else { - outgoing.body = data; - } - } - - // - // Set the `uri` and `method` properties of the request options `outgoing` - // using the information provided to this instance and `_request()`. - // - outgoing.uri = this.secure ? 'https://' : 'http://'; - outgoing.uri += this.host + port + fullUri; - outgoing.method = method; - - // - // Create the description for this test. This is currently static. - // **Remark _(indexzero)_**: Do users care if these strings are configurable? - // - this.current = ['A', method.toUpperCase(), 'to', fullUri].join(' '); - context = this._currentTest(); - - // - // Add the topic for the specified request to the context of the current - // batch used by this suite. - // - context[this.current] = { - topic: function () { - // - // Before making the outgoing HTTP request for this topic, execute - // all known before funtions available to this suite. These functions - // are by definition synchronous add vows before a given test if - // this data is fetched asynchronously. - // - Object.keys(self.befores).forEach(function (name) { - outgoing = self.befores[name](outgoing); - }); - - if (requestImpl) - requestImpl(outgoing, this.callback); - else - request(outgoing, this.callback); - } - }; - - // - // Set the outgoing request options and set of before functions on the topic. - // This is used for test assertions, general consistency, and basically - // just knowing what every topic does explicitly. - // - context[this.current].topic.outgoing = outgoing; - context[this.current].topic.before = this.befores; - return this; - }, - - // - // The vows data structure is read as a sentence constructred by - // keys in a nested JSON structure. This helper method is designed to - // get the current test context (i.e. object) by nesting into the - // JSON structure using this convention. - // - _currentTest: function (text) { - var last = this.batch; - - // Nest into the batch JSON structure using the current `discussion` text. - this.discussion.forEach(function (text) { - if (typeof last[text] !== 'object') { - last[text] = {}; - } - - // Capture the nested object - last = last[text]; - }); - - return text ? last[text] : last; - } - }; -}; - -// -// A simple function that performs a deep clone on the specified `obj`. -// We use this in APIeasy to create multiple copies of the `options` -// passed to `request` because they are considered mutable by `request` -// and we strive to make each request idempotent. -// -function clone (obj) { - var copy = {}; - for (var i in obj) { - if (Array.isArray(obj[i])) { - copy[i] = obj[i].slice(0); - } - else { - copy[i] = obj[i] instanceof Object ? clone(obj[i]) : obj[i]; - } - } - - return copy; -} - -// -// Helper function used to join nested paths created by -// multiple calls to `.path()`. -// -// suite.path('/a-path') -// .path('/hey-another-path') -// .path(...) -// -function distillPath (paths) { - return '/' + paths.map(function (p) { - return p.replace(/^\/|\/$/ig, ''); - }).join('/'); -} diff --git a/node_modules/api-easy/node_modules/.bin/vows b/node_modules/api-easy/node_modules/.bin/vows deleted file mode 120000 index 0386e59..0000000 --- a/node_modules/api-easy/node_modules/.bin/vows +++ /dev/null @@ -1 +0,0 @@ -../vows/bin/vows \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/pkginfo/.npmignore b/node_modules/api-easy/node_modules/pkginfo/.npmignore deleted file mode 100644 index 9303c34..0000000 --- a/node_modules/api-easy/node_modules/pkginfo/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -npm-debug.log \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/pkginfo/README.md b/node_modules/api-easy/node_modules/pkginfo/README.md deleted file mode 100644 index 07ba942..0000000 --- a/node_modules/api-easy/node_modules/pkginfo/README.md +++ /dev/null @@ -1,85 +0,0 @@ -# node-pkginfo - -An easy way to expose properties on a module from a package.json - -## Installation - -### Installing npm (node package manager) -``` - curl http://npmjs.org/install.sh | sh -``` - -### Installing pkginfo -``` - [sudo] npm install pkginfo -``` - -## Motivation -How often when writing node.js modules have you written the following line(s) of code? - -* Hard code your version string into your code - -``` js - exports.version = '0.1.0'; -``` - -* Programmatically expose the version from the package.json - -``` js - exports.version = JSON.parse(fs.readFileSync('/path/to/package.json', 'utf8')).version; -``` - -In other words, how often have you wanted to expose basic information from your package.json onto your module programmatically? **WELL NOW YOU CAN!** - -## Usage - -Using `pkginfo` is idiot-proof, just require and invoke it. - -``` js - var pkginfo = require('pkginfo')(module); - - console.dir(module.exports); -``` - -By invoking the `pkginfo` module all of the properties in your `package.json` file will be automatically exposed on the callee module (i.e. the parent module of `pkginfo`). - -Here's a sample of the output: - -``` - { name: 'simple-app', - description: 'A test fixture for pkginfo', - version: '0.1.0', - author: 'Charlie Robbins ', - keywords: [ 'test', 'fixture' ], - main: './index.js', - scripts: { test: 'vows test/*-test.js --spec' }, - engines: { node: '>= 0.4.0' } } -``` - -### Expose specific properties -If you don't want to expose **all** properties on from your `package.json` on your module then simple pass those properties to the `pkginfo` function: - -``` js - var pkginfo = require('pkginfo')(module, 'version', 'author'); - - console.dir(module.exports); -``` - -``` - { version: '0.1.0', - author: 'Charlie Robbins ' } -``` - -If you're looking for further usage see the [examples][0] included in this repository. - -## Run Tests -Tests are written in [vows][1] and give complete coverage of all APIs. - -``` - vows test/*-test.js --spec -``` - -[0]: https://github.com/indexzero/node-pkginfo/tree/master/examples -[1]: http://vowsjs.org - -#### Author: [Charlie Robbins](http://nodejitsu.com) \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/pkginfo/docs/docco.css b/node_modules/api-easy/node_modules/pkginfo/docs/docco.css deleted file mode 100644 index bd54134..0000000 --- a/node_modules/api-easy/node_modules/pkginfo/docs/docco.css +++ /dev/null @@ -1,194 +0,0 @@ -/*--------------------- Layout and Typography ----------------------------*/ -body { - font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; - font-size: 15px; - line-height: 22px; - color: #252519; - margin: 0; padding: 0; -} -a { - color: #261a3b; -} - a:visited { - color: #261a3b; - } -p { - margin: 0 0 15px 0; -} -h4, h5, h6 { - color: #333; - margin: 6px 0 6px 0; - font-size: 13px; -} - h2, h3 { - margin-bottom: 0; - color: #000; - } - h1 { - margin-top: 40px; - margin-bottom: 15px; - color: #000; - } -#container { - position: relative; -} -#background { - position: fixed; - top: 0; left: 525px; right: 0; bottom: 0; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - z-index: -1; -} -#jump_to, #jump_page { - background: white; - -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; - -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; - font: 10px Arial; - text-transform: uppercase; - cursor: pointer; - text-align: right; -} -#jump_to, #jump_wrapper { - position: fixed; - right: 0; top: 0; - padding: 5px 10px; -} - #jump_wrapper { - padding: 0; - display: none; - } - #jump_to:hover #jump_wrapper { - display: block; - } - #jump_page { - padding: 5px 0 3px; - margin: 0 0 25px 25px; - } - #jump_page .source { - display: block; - padding: 5px 10px; - text-decoration: none; - border-top: 1px solid #eee; - } - #jump_page .source:hover { - background: #f5f5ff; - } - #jump_page .source:first-child { - } -table td { - border: 0; - outline: 0; -} - td.docs, th.docs { - max-width: 450px; - min-width: 450px; - min-height: 5px; - padding: 10px 25px 1px 50px; - overflow-x: hidden; - vertical-align: top; - text-align: left; - } - .docs pre { - margin: 15px 0 15px; - padding-left: 15px; - } - .docs p tt, .docs p code { - background: #f8f8ff; - border: 1px solid #dedede; - font-size: 12px; - padding: 0 0.2em; - } - .pilwrap { - position: relative; - } - .pilcrow { - font: 12px Arial; - text-decoration: none; - color: #454545; - position: absolute; - top: 3px; left: -20px; - padding: 1px 2px; - opacity: 0; - -webkit-transition: opacity 0.2s linear; - } - td.docs:hover .pilcrow { - opacity: 1; - } - td.code, th.code { - padding: 14px 15px 16px 25px; - width: 100%; - vertical-align: top; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - } - pre, tt, code { - font-size: 12px; line-height: 18px; - font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; - margin: 0; padding: 0; - } - - -/*---------------------- Syntax Highlighting -----------------------------*/ -td.linenos { background-color: #f0f0f0; padding-right: 10px; } -span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } -body .hll { background-color: #ffffcc } -body .c { color: #408080; font-style: italic } /* Comment */ -body .err { border: 1px solid #FF0000 } /* Error */ -body .k { color: #954121 } /* Keyword */ -body .o { color: #666666 } /* Operator */ -body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ -body .cp { color: #BC7A00 } /* Comment.Preproc */ -body .c1 { color: #408080; font-style: italic } /* Comment.Single */ -body .cs { color: #408080; font-style: italic } /* Comment.Special */ -body .gd { color: #A00000 } /* Generic.Deleted */ -body .ge { font-style: italic } /* Generic.Emph */ -body .gr { color: #FF0000 } /* Generic.Error */ -body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -body .gi { color: #00A000 } /* Generic.Inserted */ -body .go { color: #808080 } /* Generic.Output */ -body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -body .gs { font-weight: bold } /* Generic.Strong */ -body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -body .gt { color: #0040D0 } /* Generic.Traceback */ -body .kc { color: #954121 } /* Keyword.Constant */ -body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ -body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ -body .kp { color: #954121 } /* Keyword.Pseudo */ -body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ -body .kt { color: #B00040 } /* Keyword.Type */ -body .m { color: #666666 } /* Literal.Number */ -body .s { color: #219161 } /* Literal.String */ -body .na { color: #7D9029 } /* Name.Attribute */ -body .nb { color: #954121 } /* Name.Builtin */ -body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ -body .no { color: #880000 } /* Name.Constant */ -body .nd { color: #AA22FF } /* Name.Decorator */ -body .ni { color: #999999; font-weight: bold } /* Name.Entity */ -body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -body .nf { color: #0000FF } /* Name.Function */ -body .nl { color: #A0A000 } /* Name.Label */ -body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -body .nt { color: #954121; font-weight: bold } /* Name.Tag */ -body .nv { color: #19469D } /* Name.Variable */ -body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -body .w { color: #bbbbbb } /* Text.Whitespace */ -body .mf { color: #666666 } /* Literal.Number.Float */ -body .mh { color: #666666 } /* Literal.Number.Hex */ -body .mi { color: #666666 } /* Literal.Number.Integer */ -body .mo { color: #666666 } /* Literal.Number.Oct */ -body .sb { color: #219161 } /* Literal.String.Backtick */ -body .sc { color: #219161 } /* Literal.String.Char */ -body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ -body .s2 { color: #219161 } /* Literal.String.Double */ -body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -body .sh { color: #219161 } /* Literal.String.Heredoc */ -body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -body .sx { color: #954121 } /* Literal.String.Other */ -body .sr { color: #BB6688 } /* Literal.String.Regex */ -body .s1 { color: #219161 } /* Literal.String.Single */ -body .ss { color: #19469D } /* Literal.String.Symbol */ -body .bp { color: #954121 } /* Name.Builtin.Pseudo */ -body .vc { color: #19469D } /* Name.Variable.Class */ -body .vg { color: #19469D } /* Name.Variable.Global */ -body .vi { color: #19469D } /* Name.Variable.Instance */ -body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/pkginfo/docs/pkginfo.html b/node_modules/api-easy/node_modules/pkginfo/docs/pkginfo.html deleted file mode 100644 index bf615fa..0000000 --- a/node_modules/api-easy/node_modules/pkginfo/docs/pkginfo.html +++ /dev/null @@ -1,101 +0,0 @@ - pkginfo.js

pkginfo.js

/*
- * pkginfo.js: Top-level include for the pkginfo module
- *
- * (C) 2011, Charlie Robbins
- *
- */
- 
-var fs = require('fs'),
-    path = require('path');

function pkginfo ([options, 'property', 'property' ..])

- -

@pmodule {Module} Parent module to read from.

- -

@options {Object|Array|string} Optional Options used when exposing properties.

- -

@arguments {string...} Optional Specified properties to expose.

- -

Exposes properties from the package.json file for the parent module on -it's exports. Valid usage:

- -

require('pkginfo')()

- -

require('pkginfo')('version', 'author');

- -

require('pkginfo')(['version', 'author']);

- -

require('pkginfo')({ include: ['version', 'author'] });

var pkginfo = module.exports = function (pmodule, options) {
-  var args = [].slice.call(arguments, 2).filter(function (arg) {
-    return typeof arg === 'string';
-  });
-  

Parse variable arguments

  if (Array.isArray(options)) {

If the options passed in is an Array assume that -it is the Array of properties to expose from the -on the package.json file on the parent module.

    options = { include: options };
-  }
-  else if (typeof options === 'string') {

Otherwise if the first argument is a string, then -assume that it is the first property to expose from -the package.json file on the parent module.

    options = { include: [options] };
-  }
-  

Setup default options

  options = options || { include: [] };
-  
-  if (args.length > 0) {

If additional string arguments have been passed in -then add them to the properties to expose on the -parent module.

    options.include = options.include.concat(args);
-  }
-  
-  var pkg = pkginfo.read(pmodule, options.dir).package;
-  Object.keys(pkg).forEach(function (key) {
-    if (options.include.length > 0 && !~options.include.indexOf(key)) {
-      return;
-    }
-    
-    if (!pmodule.exports[key]) {
-      pmodule.exports[key] = pkg[key];
-    }
-  });
-  
-  return pkginfo;
-};

function find (dir)

- -

@pmodule {Module} Parent module to read from.

- -

@dir {string} Optional Directory to start search from.

- -

Searches up the directory tree from dir until it finds a directory -which contains a package.json file.

pkginfo.find = function (pmodule, dir) {
-  dir = dir || pmodule.filename;
-  dir = path.dirname(dir); 
-  
-  var files = fs.readdirSync(dir);
-  
-  if (~files.indexOf('package.json')) {
-    return path.join(dir, 'package.json');
-  }
-  
-  if (dir === '/') {
-    throw new Error('Could not find package.json up from: ' + dir);
-  }
-  
-  return pkginfo.find(dir);
-};

function read (pmodule, dir)

- -

@pmodule {Module} Parent module to read from.

- -

@dir {string} Optional Directory to start search from.

- -

Searches up the directory tree from dir until it finds a directory -which contains a package.json file and returns the package information.

pkginfo.read = function (pmodule, dir) { 
-  dir = pkginfo.find(pmodule, dir);
-  
-  var data = fs.readFileSync(dir).toString();
-      
-  return {
-    dir: dir, 
-    package: JSON.parse(data)
-  };
-};

Call pkginfo on this module and expose version.

pkginfo(module, {
-  dir: __dirname,
-  include: ['version'],
-  target: pkginfo
-});
-
-
\ No newline at end of file diff --git a/node_modules/api-easy/node_modules/pkginfo/examples/all-properties.js b/node_modules/api-easy/node_modules/pkginfo/examples/all-properties.js deleted file mode 100644 index fd1d831..0000000 --- a/node_modules/api-easy/node_modules/pkginfo/examples/all-properties.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * all-properties.js: Sample of including all properties from a package.json file - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/pkginfo/examples/array-argument.js b/node_modules/api-easy/node_modules/pkginfo/examples/array-argument.js deleted file mode 100644 index b1b6848..0000000 --- a/node_modules/api-easy/node_modules/pkginfo/examples/array-argument.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * array-argument.js: Sample of including specific properties from a package.json file - * using Array argument syntax. - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, ['version', 'author']); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/pkginfo/examples/multiple-properties.js b/node_modules/api-easy/node_modules/pkginfo/examples/multiple-properties.js deleted file mode 100644 index b4b5fd6..0000000 --- a/node_modules/api-easy/node_modules/pkginfo/examples/multiple-properties.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * multiple-properties.js: Sample of including multiple properties from a package.json file - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, 'version', 'author'); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/pkginfo/examples/object-argument.js b/node_modules/api-easy/node_modules/pkginfo/examples/object-argument.js deleted file mode 100644 index 28420c8..0000000 --- a/node_modules/api-easy/node_modules/pkginfo/examples/object-argument.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * object-argument.js: Sample of including specific properties from a package.json file - * using Object argument syntax. - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, { - include: ['version', 'author'] - }); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/pkginfo/examples/package.json b/node_modules/api-easy/node_modules/pkginfo/examples/package.json deleted file mode 100644 index 1f2f01c..0000000 --- a/node_modules/api-easy/node_modules/pkginfo/examples/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "simple-app", - "description": "A test fixture for pkginfo", - "version": "0.1.0", - "author": "Charlie Robbins ", - "keywords": ["test", "fixture"], - "main": "./index.js", - "scripts": { "test": "vows test/*-test.js --spec" }, - "engines": { "node": ">= 0.4.0" } -} diff --git a/node_modules/api-easy/node_modules/pkginfo/examples/single-property.js b/node_modules/api-easy/node_modules/pkginfo/examples/single-property.js deleted file mode 100644 index 4f44561..0000000 --- a/node_modules/api-easy/node_modules/pkginfo/examples/single-property.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * single-property.js: Sample of including a single specific properties from a package.json file - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, 'version'); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/pkginfo/lib/pkginfo.js b/node_modules/api-easy/node_modules/pkginfo/lib/pkginfo.js deleted file mode 100644 index a4a6227..0000000 --- a/node_modules/api-easy/node_modules/pkginfo/lib/pkginfo.js +++ /dev/null @@ -1,132 +0,0 @@ -/* - * pkginfo.js: Top-level include for the pkginfo module - * - * (C) 2011, Charlie Robbins - * - */ - -var fs = require('fs'), - path = require('path'); - -// -// ### function pkginfo ([options, 'property', 'property' ..]) -// #### @pmodule {Module} Parent module to read from. -// #### @options {Object|Array|string} **Optional** Options used when exposing properties. -// #### @arguments {string...} **Optional** Specified properties to expose. -// Exposes properties from the package.json file for the parent module on -// it's exports. Valid usage: -// -// `require('pkginfo')()` -// -// `require('pkginfo')('version', 'author');` -// -// `require('pkginfo')(['version', 'author']);` -// -// `require('pkginfo')({ include: ['version', 'author'] });` -// -var pkginfo = module.exports = function (pmodule, options) { - var args = [].slice.call(arguments, 2).filter(function (arg) { - return typeof arg === 'string'; - }); - - // - // **Parse variable arguments** - // - if (Array.isArray(options)) { - // - // If the options passed in is an Array assume that - // it is the Array of properties to expose from the - // on the package.json file on the parent module. - // - options = { include: options }; - } - else if (typeof options === 'string') { - // - // Otherwise if the first argument is a string, then - // assume that it is the first property to expose from - // the package.json file on the parent module. - // - options = { include: [options] }; - } - - // - // **Setup default options** - // - options = options || { include: [] }; - - if (args.length > 0) { - // - // If additional string arguments have been passed in - // then add them to the properties to expose on the - // parent module. - // - options.include = options.include.concat(args); - } - - var pkg = pkginfo.read(pmodule, options.dir).package; - Object.keys(pkg).forEach(function (key) { - if (options.include.length > 0 && !~options.include.indexOf(key)) { - return; - } - - if (!pmodule.exports[key]) { - pmodule.exports[key] = pkg[key]; - } - }); - - return pkginfo; -}; - -// -// ### function find (dir) -// #### @pmodule {Module} Parent module to read from. -// #### @dir {string} **Optional** Directory to start search from. -// Searches up the directory tree from `dir` until it finds a directory -// which contains a `package.json` file. -// -pkginfo.find = function (pmodule, dir) { - dir = dir || pmodule.filename; - dir = path.dirname(dir); - - var files = fs.readdirSync(dir); - - if (~files.indexOf('package.json')) { - return path.join(dir, 'package.json'); - } - - if (dir === '/') { - throw new Error('Could not find package.json up from: ' + dir); - } - else if (!dir || dir === '.') { - throw new Error('Cannot find package.json from unspecified directory'); - } - - return pkginfo.find(pmodule, dir); -}; - -// -// ### function read (pmodule, dir) -// #### @pmodule {Module} Parent module to read from. -// #### @dir {string} **Optional** Directory to start search from. -// Searches up the directory tree from `dir` until it finds a directory -// which contains a `package.json` file and returns the package information. -// -pkginfo.read = function (pmodule, dir) { - dir = pkginfo.find(pmodule, dir); - - var data = fs.readFileSync(dir).toString(); - - return { - dir: dir, - package: JSON.parse(data) - }; -}; - -// -// Call `pkginfo` on this module and expose version. -// -pkginfo(module, { - dir: __dirname, - include: ['version'], - target: pkginfo -}); \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/pkginfo/package.json b/node_modules/api-easy/node_modules/pkginfo/package.json deleted file mode 100644 index 8670f9a..0000000 --- a/node_modules/api-easy/node_modules/pkginfo/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "pkginfo", - "version": "0.2.3", - "description": "An easy way to expose properties on a module from a package.json", - "author": { - "name": "Charlie Robbins", - "email": "charlie.robbins@gmail.com" - }, - "repository": { - "type": "git", - "url": "git://github.com/indexzero/node-pkginfo.git" - }, - "keywords": [ - "info", - "tools", - "package.json" - ], - "devDependencies": { - "vows": "0.6.x" - }, - "main": "./lib/pkginfo", - "scripts": { - "test": "vows test/*-test.js --spec" - }, - "engines": { - "node": ">= 0.4.0" - }, - "_id": "pkginfo@0.2.3", - "dependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "pkginfo@0.2.x" -} diff --git a/node_modules/api-easy/node_modules/pkginfo/test/pkginfo-test.js b/node_modules/api-easy/node_modules/pkginfo/test/pkginfo-test.js deleted file mode 100644 index 3156c00..0000000 --- a/node_modules/api-easy/node_modules/pkginfo/test/pkginfo-test.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * pkginfo-test.js: Tests for the pkginfo module. - * - * (C) 2011, Charlie Robbins - * - */ - -var assert = require('assert'), - exec = require('child_process').exec, - fs = require('fs'), - path = require('path'), - vows = require('vows'), - pkginfo = require('../lib/pkginfo'); - -function assertProperties (source, target) { - assert.lengthOf(source, target.length + 1); - target.forEach(function (prop) { - assert.isTrue(!!~source.indexOf(prop)); - }); -} - -function testExposes (options) { - return { - topic: function () { - exec('node ' + path.join(__dirname, '..', 'examples', options.script), this.callback); - }, - "should expose that property correctly": function (err, stdout, stderr) { - assert.isNull(err); - - var exposed = stderr.match(/'(\w+)'/ig).map(function (p) { - return p.substring(1, p.length - 1); - }); - - return !options.assert - ? assertProperties(exposed, options.properties) - : options.assert(exposed); - } - } -} - -vows.describe('pkginfo').addBatch({ - "When using the pkginfo module": { - "and passed a single `string` argument": testExposes({ - script: 'single-property.js', - properties: ['version'] - }), - "and passed multiple `string` arguments": testExposes({ - script: 'multiple-properties.js', - properties: ['version', 'author'] - }), - "and passed an `object` argument": testExposes({ - script: 'object-argument.js', - properties: ['version', 'author'] - }), - "and passed an `array` argument": testExposes({ - script: 'array-argument.js', - properties: ['version', 'author'] - }), - "and passed no arguments": testExposes({ - script: 'all-properties.js', - assert: function (exposed) { - var pkg = fs.readFileSync(path.join(__dirname, '..', 'examples', 'package.json')).toString(), - keys = Object.keys(JSON.parse(pkg)); - - assertProperties(exposed, keys); - } - }) - } -}).export(module); diff --git a/node_modules/api-easy/node_modules/qs/.gitmodules b/node_modules/api-easy/node_modules/qs/.gitmodules deleted file mode 100644 index 49e31da..0000000 --- a/node_modules/api-easy/node_modules/qs/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "support/expresso"] - path = support/expresso - url = git://github.com/visionmedia/expresso.git -[submodule "support/should"] - path = support/should - url = git://github.com/visionmedia/should.js.git diff --git a/node_modules/api-easy/node_modules/qs/.npmignore b/node_modules/api-easy/node_modules/qs/.npmignore deleted file mode 100644 index 3c3629e..0000000 --- a/node_modules/api-easy/node_modules/qs/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/node_modules/api-easy/node_modules/qs/.travis.yml b/node_modules/api-easy/node_modules/qs/.travis.yml deleted file mode 100644 index 2c0a8f6..0000000 --- a/node_modules/api-easy/node_modules/qs/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.6 - - 0.4 \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/qs/History.md b/node_modules/api-easy/node_modules/qs/History.md deleted file mode 100644 index 3eaf7df..0000000 --- a/node_modules/api-easy/node_modules/qs/History.md +++ /dev/null @@ -1,73 +0,0 @@ - -0.4.2 / 2012-02-08 -================== - - * Fixed: ensure objects are created when appropriate not arrays [aheckmann] - -0.4.1 / 2012-01-26 -================== - - * Fixed stringify()ing numbers. Closes #23 - -0.4.0 / 2011-11-21 -================== - - * Allow parsing of an existing object (for `bodyParser()`) [jackyz] - * Replaced expresso with mocha - -0.3.2 / 2011-11-08 -================== - - * Fixed global variable leak - -0.3.1 / 2011-08-17 -================== - - * Added `try/catch` around malformed uri components - * Add test coverage for Array native method bleed-though - -0.3.0 / 2011-07-19 -================== - - * Allow `array[index]` and `object[property]` syntaxes [Aria Stewart] - -0.2.0 / 2011-06-29 -================== - - * Added `qs.stringify()` [Cory Forsyth] - -0.1.0 / 2011-04-13 -================== - - * Added jQuery-ish array support - -0.0.7 / 2011-03-13 -================== - - * Fixed; handle empty string and `== null` in `qs.parse()` [dmit] - allows for convenient `qs.parse(url.parse(str).query)` - -0.0.6 / 2011-02-14 -================== - - * Fixed; support for implicit arrays - -0.0.4 / 2011-02-09 -================== - - * Fixed `+` as a space - -0.0.3 / 2011-02-08 -================== - - * Fixed case when right-hand value contains "]" - -0.0.2 / 2011-02-07 -================== - - * Fixed "=" presence in key - -0.0.1 / 2011-02-07 -================== - - * Initial release \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/qs/Makefile b/node_modules/api-easy/node_modules/qs/Makefile deleted file mode 100644 index e4df837..0000000 --- a/node_modules/api-easy/node_modules/qs/Makefile +++ /dev/null @@ -1,5 +0,0 @@ - -test: - @./node_modules/.bin/mocha - -.PHONY: test \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/qs/Readme.md b/node_modules/api-easy/node_modules/qs/Readme.md deleted file mode 100644 index db0d145..0000000 --- a/node_modules/api-easy/node_modules/qs/Readme.md +++ /dev/null @@ -1,54 +0,0 @@ -# node-querystring - - query string parser for node supporting nesting, as it was removed from `0.3.x`, so this library provides the previous and commonly desired behaviour (and twice as fast). Used by [express](http://expressjs.com), [connect](http://senchalabs.github.com/connect) and others. - -## Installation - - $ npm install qs - -## Examples - -```js -var qs = require('qs'); - -qs.parse('user[name][first]=Tobi&user[email]=tobi@learnboost.com'); -// => { user: { name: { first: 'Tobi' }, email: 'tobi@learnboost.com' } } - -qs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }}) -// => user[name]=Tobi&user[email]=tobi%40learnboost.com -``` - -## Testing - -Install dev dependencies: - - $ npm install -d - -and execute: - - $ make test - -## License - -(The MIT License) - -Copyright (c) 2010 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/qs/benchmark.js b/node_modules/api-easy/node_modules/qs/benchmark.js deleted file mode 100644 index 97e2c93..0000000 --- a/node_modules/api-easy/node_modules/qs/benchmark.js +++ /dev/null @@ -1,17 +0,0 @@ - -var qs = require('./'); - -var times = 100000 - , start = new Date - , n = times; - -console.log('times: %d', times); - -while (n--) qs.parse('foo=bar'); -console.log('simple: %dms', new Date - start); - -var start = new Date - , n = times; - -while (n--) qs.parse('user[name][first]=tj&user[name][last]=holowaychuk'); -console.log('nested: %dms', new Date - start); \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/qs/examples.js b/node_modules/api-easy/node_modules/qs/examples.js deleted file mode 100644 index 27617b7..0000000 --- a/node_modules/api-easy/node_modules/qs/examples.js +++ /dev/null @@ -1,51 +0,0 @@ - -/** - * Module dependencies. - */ - -var qs = require('./'); - -var obj = qs.parse('foo'); -console.log(obj) - -var obj = qs.parse('foo=bar=baz'); -console.log(obj) - -var obj = qs.parse('users[]'); -console.log(obj) - -var obj = qs.parse('name=tj&email=tj@vision-media.ca'); -console.log(obj) - -var obj = qs.parse('users[]=tj&users[]=tobi&users[]=jane'); -console.log(obj) - -var obj = qs.parse('user[name][first]=tj&user[name][last]=holowaychuk'); -console.log(obj) - -var obj = qs.parse('users[][name][first]=tj&users[][name][last]=holowaychuk'); -console.log(obj) - -var obj = qs.parse('a=a&a=b&a=c'); -console.log(obj) - -var obj = qs.parse('user[tj]=tj&user[tj]=TJ'); -console.log(obj) - -var obj = qs.parse('user[names]=tj&user[names]=TJ&user[names]=Tyler'); -console.log(obj) - -var obj = qs.parse('user[name][first]=tj&user[name][first]=TJ'); -console.log(obj) - -var obj = qs.parse('user[0]=tj&user[1]=TJ'); -console.log(obj) - -var obj = qs.parse('user[0]=tj&user[]=TJ'); -console.log(obj) - -var obj = qs.parse('user[0]=tj&user[foo]=TJ'); -console.log(obj) - -var str = qs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }}); -console.log(str); \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/qs/index.js b/node_modules/api-easy/node_modules/qs/index.js deleted file mode 100644 index d177d20..0000000 --- a/node_modules/api-easy/node_modules/qs/index.js +++ /dev/null @@ -1,2 +0,0 @@ - -module.exports = require('./lib/querystring'); \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/qs/lib/querystring.js b/node_modules/api-easy/node_modules/qs/lib/querystring.js deleted file mode 100644 index 6c72712..0000000 --- a/node_modules/api-easy/node_modules/qs/lib/querystring.js +++ /dev/null @@ -1,264 +0,0 @@ - -/*! - * querystring - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Library version. - */ - -exports.version = '0.4.2'; - -/** - * Object#toString() ref for stringify(). - */ - -var toString = Object.prototype.toString; - -/** - * Cache non-integer test regexp. - */ - -var isint = /^[0-9]+$/; - -function promote(parent, key) { - if (parent[key].length == 0) return parent[key] = {}; - var t = {}; - for (var i in parent[key]) t[i] = parent[key][i]; - parent[key] = t; - return t; -} - -function parse(parts, parent, key, val) { - var part = parts.shift(); - // end - if (!part) { - if (Array.isArray(parent[key])) { - parent[key].push(val); - } else if ('object' == typeof parent[key]) { - parent[key] = val; - } else if ('undefined' == typeof parent[key]) { - parent[key] = val; - } else { - parent[key] = [parent[key], val]; - } - // array - } else { - var obj = parent[key] = parent[key] || []; - if (']' == part) { - if (Array.isArray(obj)) { - if ('' != val) obj.push(val); - } else if ('object' == typeof obj) { - obj[Object.keys(obj).length] = val; - } else { - obj = parent[key] = [parent[key], val]; - } - // prop - } else if (~part.indexOf(']')) { - part = part.substr(0, part.length - 1); - if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key); - parse(parts, obj, part, val); - // key - } else { - if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key); - parse(parts, obj, part, val); - } - } -} - -/** - * Merge parent key/val pair. - */ - -function merge(parent, key, val){ - if (~key.indexOf(']')) { - var parts = key.split('[') - , len = parts.length - , last = len - 1; - parse(parts, parent, 'base', val); - // optimize - } else { - if (!isint.test(key) && Array.isArray(parent.base)) { - var t = {}; - for (var k in parent.base) t[k] = parent.base[k]; - parent.base = t; - } - set(parent.base, key, val); - } - - return parent; -} - -/** - * Parse the given obj. - */ - -function parseObject(obj){ - var ret = { base: {} }; - Object.keys(obj).forEach(function(name){ - merge(ret, name, obj[name]); - }); - return ret.base; -} - -/** - * Parse the given str. - */ - -function parseString(str){ - return String(str) - .split('&') - .reduce(function(ret, pair){ - try{ - pair = decodeURIComponent(pair.replace(/\+/g, ' ')); - } catch(e) { - // ignore - } - - var eql = pair.indexOf('=') - , brace = lastBraceInKey(pair) - , key = pair.substr(0, brace || eql) - , val = pair.substr(brace || eql, pair.length) - , val = val.substr(val.indexOf('=') + 1, val.length); - - // ?foo - if ('' == key) key = pair, val = ''; - - return merge(ret, key, val); - }, { base: {} }).base; -} - -/** - * Parse the given query `str` or `obj`, returning an object. - * - * @param {String} str | {Object} obj - * @return {Object} - * @api public - */ - -exports.parse = function(str){ - if (null == str || '' == str) return {}; - return 'object' == typeof str - ? parseObject(str) - : parseString(str); -}; - -/** - * Turn the given `obj` into a query string - * - * @param {Object} obj - * @return {String} - * @api public - */ - -var stringify = exports.stringify = function(obj, prefix) { - if (Array.isArray(obj)) { - return stringifyArray(obj, prefix); - } else if ('[object Object]' == toString.call(obj)) { - return stringifyObject(obj, prefix); - } else if ('string' == typeof obj) { - return stringifyString(obj, prefix); - } else { - return prefix + '=' + obj; - } -}; - -/** - * Stringify the given `str`. - * - * @param {String} str - * @param {String} prefix - * @return {String} - * @api private - */ - -function stringifyString(str, prefix) { - if (!prefix) throw new TypeError('stringify expects an object'); - return prefix + '=' + encodeURIComponent(str); -} - -/** - * Stringify the given `arr`. - * - * @param {Array} arr - * @param {String} prefix - * @return {String} - * @api private - */ - -function stringifyArray(arr, prefix) { - var ret = []; - if (!prefix) throw new TypeError('stringify expects an object'); - for (var i = 0; i < arr.length; i++) { - ret.push(stringify(arr[i], prefix + '[]')); - } - return ret.join('&'); -} - -/** - * Stringify the given `obj`. - * - * @param {Object} obj - * @param {String} prefix - * @return {String} - * @api private - */ - -function stringifyObject(obj, prefix) { - var ret = [] - , keys = Object.keys(obj) - , key; - - for (var i = 0, len = keys.length; i < len; ++i) { - key = keys[i]; - ret.push(stringify(obj[key], prefix - ? prefix + '[' + encodeURIComponent(key) + ']' - : encodeURIComponent(key))); - } - - return ret.join('&'); -} - -/** - * Set `obj`'s `key` to `val` respecting - * the weird and wonderful syntax of a qs, - * where "foo=bar&foo=baz" becomes an array. - * - * @param {Object} obj - * @param {String} key - * @param {String} val - * @api private - */ - -function set(obj, key, val) { - var v = obj[key]; - if (undefined === v) { - obj[key] = val; - } else if (Array.isArray(v)) { - v.push(val); - } else { - obj[key] = [v, val]; - } -} - -/** - * Locate last brace in `str` within the key. - * - * @param {String} str - * @return {Number} - * @api private - */ - -function lastBraceInKey(str) { - var len = str.length - , brace - , c; - for (var i = 0; i < len; ++i) { - c = str[i]; - if (']' == c) brace = false; - if ('[' == c) brace = true; - if ('=' == c && !brace) return i; - } -} diff --git a/node_modules/api-easy/node_modules/qs/package.json b/node_modules/api-easy/node_modules/qs/package.json deleted file mode 100644 index 13e4f5b..0000000 --- a/node_modules/api-easy/node_modules/qs/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "qs", - "description": "querystring parser", - "version": "0.4.2", - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/node-querystring.git" - }, - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca", - "url": "http://tjholowaychuk.com" - }, - "main": "index", - "engines": { - "node": "*" - }, - "_id": "qs@0.4.2", - "dependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "qs@0.4.x" -} diff --git a/node_modules/api-easy/node_modules/qs/test/mocha.opts b/node_modules/api-easy/node_modules/qs/test/mocha.opts deleted file mode 100644 index 521cbb2..0000000 --- a/node_modules/api-easy/node_modules/qs/test/mocha.opts +++ /dev/null @@ -1,2 +0,0 @@ ---require should ---ui exports diff --git a/node_modules/api-easy/node_modules/qs/test/parse.js b/node_modules/api-easy/node_modules/qs/test/parse.js deleted file mode 100644 index f219e27..0000000 --- a/node_modules/api-easy/node_modules/qs/test/parse.js +++ /dev/null @@ -1,167 +0,0 @@ - -/** - * Module dependencies. - */ - -var qs = require('../'); - -module.exports = { - 'test basics': function(){ - qs.parse('0=foo').should.eql({ '0': 'foo' }); - - qs.parse('foo=c++') - .should.eql({ foo: 'c ' }); - - qs.parse('a[>=]=23') - .should.eql({ a: { '>=': '23' }}); - - qs.parse('a[<=>]==23') - .should.eql({ a: { '<=>': '=23' }}); - - qs.parse('a[==]=23') - .should.eql({ a: { '==': '23' }}); - - qs.parse('foo') - .should.eql({ foo: '' }); - - qs.parse('foo=bar') - .should.eql({ foo: 'bar' }); - - qs.parse('foo%3Dbar=baz') - .should.eql({ foo: 'bar=baz' }); - - qs.parse(' foo = bar = baz ') - .should.eql({ ' foo ': ' bar = baz ' }); - - qs.parse('foo=bar=baz') - .should.eql({ foo: 'bar=baz' }); - - qs.parse('foo=bar&bar=baz') - .should.eql({ foo: 'bar', bar: 'baz' }); - - qs.parse('foo=bar&baz') - .should.eql({ foo: 'bar', baz: '' }); - - qs.parse('cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World') - .should.eql({ - cht: 'p3' - , chd: 't:60,40' - , chs: '250x100' - , chl: 'Hello|World' - }); - }, - - 'test nesting': function(){ - qs.parse('ops[>=]=25') - .should.eql({ ops: { '>=': '25' }}); - - qs.parse('user[name]=tj') - .should.eql({ user: { name: 'tj' }}); - - qs.parse('user[name][first]=tj&user[name][last]=holowaychuk') - .should.eql({ user: { name: { first: 'tj', last: 'holowaychuk' }}}); - }, - - 'test escaping': function(){ - qs.parse('foo=foo%20bar') - .should.eql({ foo: 'foo bar' }); - }, - - 'test arrays': function(){ - qs.parse('images[]') - .should.eql({ images: [] }); - - qs.parse('user[]=tj') - .should.eql({ user: ['tj'] }); - - qs.parse('user[]=tj&user[]=tobi&user[]=jane') - .should.eql({ user: ['tj', 'tobi', 'jane'] }); - - qs.parse('user[names][]=tj&user[names][]=tyler') - .should.eql({ user: { names: ['tj', 'tyler'] }}); - - qs.parse('user[names][]=tj&user[names][]=tyler&user[email]=tj@vision-media.ca') - .should.eql({ user: { names: ['tj', 'tyler'], email: 'tj@vision-media.ca' }}); - - qs.parse('items=a&items=b') - .should.eql({ items: ['a', 'b'] }); - - qs.parse('user[names]=tj&user[names]=holowaychuk&user[names]=TJ') - .should.eql({ user: { names: ['tj', 'holowaychuk', 'TJ'] }}); - - qs.parse('user[name][first]=tj&user[name][first]=TJ') - .should.eql({ user: { name: { first: ['tj', 'TJ'] }}}); - - var o = qs.parse('existing[fcbaebfecc][name][last]=tj') - o.should.eql({ existing: { 'fcbaebfecc': { name: { last: 'tj' }}}}) - Array.isArray(o.existing).should.be.false; - }, - - 'test right-hand brackets': function(){ - qs.parse('pets=["tobi"]') - .should.eql({ pets: '["tobi"]' }); - - qs.parse('operators=[">=", "<="]') - .should.eql({ operators: '[">=", "<="]' }); - - qs.parse('op[>=]=[1,2,3]') - .should.eql({ op: { '>=': '[1,2,3]' }}); - - qs.parse('op[>=]=[1,2,3]&op[=]=[[[[1]]]]') - .should.eql({ op: { '>=': '[1,2,3]', '=': '[[[[1]]]]' }}); - }, - - 'test duplicates': function(){ - qs.parse('items=bar&items=baz&items=raz') - .should.eql({ items: ['bar', 'baz', 'raz'] }); - }, - - 'test empty': function(){ - qs.parse('').should.eql({}); - qs.parse(undefined).should.eql({}); - qs.parse(null).should.eql({}); - }, - - 'test arrays with indexes': function(){ - qs.parse('foo[0]=bar&foo[1]=baz').should.eql({ foo: ['bar', 'baz'] }); - qs.parse('foo[1]=bar&foo[0]=baz').should.eql({ foo: ['baz', 'bar'] }); - qs.parse('foo[base64]=RAWR').should.eql({ foo: { base64: 'RAWR' }}); - qs.parse('foo[64base]=RAWR').should.eql({ foo: { '64base': 'RAWR' }}); - }, - - 'test arrays becoming objects': function(){ - qs.parse('foo[0]=bar&foo[bad]=baz').should.eql({ foo: { 0: "bar", bad: "baz" }}); - qs.parse('foo[bad]=baz&foo[0]=bar').should.eql({ foo: { 0: "bar", bad: "baz" }}); - }, - - 'test bleed-through of Array native properties/methods': function(){ - Array.prototype.protoProperty = true; - Array.prototype.protoFunction = function () {}; - qs.parse('foo=bar').should.eql({ foo: 'bar' }); - }, - - 'test malformed uri': function(){ - qs.parse('{%:%}').should.eql({ '{%:%}': '' }); - qs.parse('foo=%:%}').should.eql({ 'foo': '%:%}' }); - }, - - 'test semi-parsed': function(){ - qs.parse({ 'user[name]': 'tobi' }) - .should.eql({ user: { name: 'tobi' }}); - - qs.parse({ 'user[name]': 'tobi', 'user[email][main]': 'tobi@lb.com' }) - .should.eql({ user: { name: 'tobi', email: { main: 'tobi@lb.com' } }}); - } - - // 'test complex': function(){ - // qs.parse('users[][name][first]=tj&users[foo]=bar') - // .should.eql({ - // users: [ { name: 'tj' }, { name: 'tobi' }, { foo: 'bar' }] - // }); - // - // qs.parse('users[][name][first]=tj&users[][name][first]=tobi') - // .should.eql({ - // users: [ { name: 'tj' }, { name: 'tobi' }] - // }); - // } -}; diff --git a/node_modules/api-easy/node_modules/qs/test/stringify.js b/node_modules/api-easy/node_modules/qs/test/stringify.js deleted file mode 100644 index c2195cb..0000000 --- a/node_modules/api-easy/node_modules/qs/test/stringify.js +++ /dev/null @@ -1,103 +0,0 @@ - -/** - * Module dependencies. - */ - -var qs = require('../') - , should = require('should') - , str_identities = { - 'basics': [ - { str: 'foo=bar', obj: {'foo' : 'bar'}}, - { str: 'foo=%22bar%22', obj: {'foo' : '\"bar\"'}}, - { str: 'foo=', obj: {'foo': ''}}, - { str: 'foo=1&bar=2', obj: {'foo' : '1', 'bar' : '2'}}, - { str: 'my%20weird%20field=q1!2%22\'w%245%267%2Fz8)%3F', obj: {'my weird field': "q1!2\"'w$5&7/z8)?"}}, - { str: 'foo%3Dbaz=bar', obj: {'foo=baz': 'bar'}}, - { str: 'foo=bar&bar=baz', obj: {foo: 'bar', bar: 'baz'}} - ], - 'escaping': [ - { str: 'foo=foo%20bar', obj: {foo: 'foo bar'}}, - { str: 'cht=p3&chd=t%3A60%2C40&chs=250x100&chl=Hello%7CWorld', obj: { - cht: 'p3' - , chd: 't:60,40' - , chs: '250x100' - , chl: 'Hello|World' - }} - ], - 'nested': [ - { str: 'foo[]=bar&foo[]=quux', obj: {'foo' : ['bar', 'quux']}}, - { str: 'foo[]=bar', obj: {foo: ['bar']}}, - { str: 'foo[]=1&foo[]=2', obj: {'foo' : ['1', '2']}}, - { str: 'foo=bar&baz[]=1&baz[]=2&baz[]=3', obj: {'foo' : 'bar', 'baz' : ['1', '2', '3']}}, - { str: 'foo[]=bar&baz[]=1&baz[]=2&baz[]=3', obj: {'foo' : ['bar'], 'baz' : ['1', '2', '3']}}, - { str: 'x[y][z]=1', obj: {'x' : {'y' : {'z' : '1'}}}}, - { str: 'x[y][z][]=1', obj: {'x' : {'y' : {'z' : ['1']}}}}, - { str: 'x[y][z]=2', obj: {'x' : {'y' : {'z' : '2'}}}}, - { str: 'x[y][z][]=1&x[y][z][]=2', obj: {'x' : {'y' : {'z' : ['1', '2']}}}}, - { str: 'x[y][][z]=1', obj: {'x' : {'y' : [{'z' : '1'}]}}}, - { str: 'x[y][][z][]=1', obj: {'x' : {'y' : [{'z' : ['1']}]}}}, - { str: 'x[y][][z]=1&x[y][][w]=2', obj: {'x' : {'y' : [{'z' : '1', 'w' : '2'}]}}}, - { str: 'x[y][][v][w]=1', obj: {'x' : {'y' : [{'v' : {'w' : '1'}}]}}}, - { str: 'x[y][][z]=1&x[y][][v][w]=2', obj: {'x' : {'y' : [{'z' : '1', 'v' : {'w' : '2'}}]}}}, - { str: 'x[y][][z]=1&x[y][][z]=2', obj: {'x' : {'y' : [{'z' : '1'}, {'z' : '2'}]}}}, - { str: 'x[y][][z]=1&x[y][][w]=a&x[y][][z]=2&x[y][][w]=3', obj: {'x' : {'y' : [{'z' : '1', 'w' : 'a'}, {'z' : '2', 'w' : '3'}]}}}, - { str: 'user[name][first]=tj&user[name][last]=holowaychuk', obj: { user: { name: { first: 'tj', last: 'holowaychuk' }}}} - ], - 'errors': [ - { obj: 'foo=bar', message: 'stringify expects an object' }, - { obj: ['foo', 'bar'], message: 'stringify expects an object' } - ], - 'numbers': [ - { str: 'limit[]=1&limit[]=2&limit[]=3', obj: { limit: [1, 2, '3'] }}, - { str: 'limit=1', obj: { limit: 1 }} - ] - }; - - -// Assert error -function err(fn, msg){ - var err; - try { - fn(); - } catch (e) { - should.equal(e.message, msg); - return; - } - throw new Error('no exception thrown, expected "' + msg + '"'); -} - -function test(type) { - var str, obj; - for (var i = 0; i < str_identities[type].length; i++) { - str = str_identities[type][i].str; - obj = str_identities[type][i].obj; - qs.stringify(obj).should.eql(str); - } -} - -module.exports = { - 'test basics': function() { - test('basics'); - }, - - 'test escaping': function() { - test('escaping'); - }, - - 'test nested': function() { - test('nested'); - }, - - 'test numbers': function(){ - test('numbers'); - }, - - 'test errors': function() { - var obj, message; - for (var i = 0; i < str_identities['errors'].length; i++) { - message = str_identities['errors'][i].message; - obj = str_identities['errors'][i].obj; - err(function(){ qs.stringify(obj) }, message); - } - } -}; \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/request/LICENSE b/node_modules/api-easy/node_modules/request/LICENSE deleted file mode 100644 index a4a9aee..0000000 --- a/node_modules/api-easy/node_modules/request/LICENSE +++ /dev/null @@ -1,55 +0,0 @@ -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of this License; and - -You must cause any modified files to carry prominent notices stating that You changed the files; and - -You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - -If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/request/README.md b/node_modules/api-easy/node_modules/request/README.md deleted file mode 100644 index e5839b5..0000000 --- a/node_modules/api-easy/node_modules/request/README.md +++ /dev/null @@ -1,288 +0,0 @@ -# Request -- Simplified HTTP request method - -## Install - -
-  npm install request
-
- -Or from source: - -
-  git clone git://github.com/mikeal/request.git 
-  cd request
-  npm link
-
- -## Super simple to use - -Request is designed to be the simplest way possible to make http calls. It support HTTPS and follows redirects by default. - -```javascript -var request = require('request'); -request('http://www.google.com', function (error, response, body) { - if (!error && response.statusCode == 200) { - console.log(body) // Print the google web page. - } -}) -``` - -## Streaming - -You can stream any response to a file stream. - -```javascript -request('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png')) -``` - -You can also stream a file to a PUT or POST request. This method will also check the file extension against a mapping of file extensions to content-types, in this case `application/json`, and use the proper content-type in the PUT request if one is not already provided in the headers. - -```javascript -fs.createReadStream('file.json').pipe(request.put('http://mysite.com/obj.json')) -``` - -Request can also pipe to itself. When doing so the content-type and content-length will be preserved in the PUT headers. - -```javascript -request.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img.png')) -``` - -Now let's get fancy. - -```javascript -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - if (req.method === 'PUT') { - req.pipe(request.put('http://mysite.com/doodle.png')) - } else if (req.method === 'GET' || req.method === 'HEAD') { - request.get('http://mysite.com/doodle.png').pipe(resp) - } - } -}) -``` - -You can also pipe() from a http.ServerRequest instance and to a http.ServerResponse instance. The HTTP method and headers will be sent as well as the entity-body data. Which means that, if you don't really care about security, you can do: - -```javascript -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - var x = request('http://mysite.com/doodle.png') - req.pipe(x) - x.pipe(resp) - } -}) -``` - -And since pipe() returns the destination stream in node 0.5.x you can do one line proxying :) - -```javascript -req.pipe(request('http://mysite.com/doodle.png')).pipe(resp) -``` - -Also, none of this new functionality conflicts with requests previous features, it just expands them. - -```javascript -var r = request.defaults({'proxy':'http://localproxy.com'}) - -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - r.get('http://google.com/doodle.png').pipe(resp) - } -}) -``` - -You can still use intermediate proxies, the requests will still follow HTTP forwards, etc. - -## OAuth Signing - -```javascript -// Twitter OAuth -var qs = require('querystring') - , oauth = - { callback: 'http://mysite.com/callback/' - , consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - } - , url = 'https://api.twitter.com/oauth/request_token' - ; -request.post({url:url, oauth:oauth}, function (e, r, body) { - // Assume by some stretch of magic you aquired the verifier - var access_token = qs.parse(body) - , oauth = - { consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - , token: access_token.oauth_token - , verifier: VERIFIER - , token_secret: access_token.oauth_token_secret - } - , url = 'https://api.twitter.com/oauth/access_token' - ; - request.post({url:url, oauth:oauth}, function (e, r, body) { - var perm_token = qs.parse(body) - , oauth = - { consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - , token: perm_token.oauth_token - , token_secret: perm_token.oauth_token_secret - } - , url = 'https://api.twitter.com/1/users/show.json?' - , params = - { screen_name: perm_token.screen_name - , user_id: perm_token.user_id - } - ; - url += qs.stringify(params) - request.get({url:url, oauth:oauth, json:true}, function (e, r, user) { - console.log(user) - }) - }) -}) -``` - - - -### request(options, callback) - -The first argument can be either a url or an options object. The only required option is uri, all others are optional. - -* `uri` || `url` - fully qualified uri or a parsed url object from url.parse() -* `qs` - object containing querystring values to be appended to the uri -* `method` - http method, defaults to GET -* `headers` - http headers, defaults to {} -* `body` - entity body for POST and PUT requests. Must be buffer or string. -* `form` - sets `body` but to querystring representation of value and adds `Content-type: application/x-www-form-urlencoded; charset=utf-8` header. -* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. -* `multipart` - (experimental) array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See example below. -* `followRedirect` - follow HTTP 3xx responses as redirects. defaults to true. -* `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects. defaults to false. -* `maxRedirects` - the maximum number of redirects to follow, defaults to 10. -* `onResponse` - If true the callback will be fired on the "response" event instead of "end". If a function it will be called on "response" and not effect the regular semantics of the main callback on "end". -* `encoding` - Encoding to be used on `setEncoding` of response data. If set to `null`, the body is returned as a Buffer. -* `pool` - A hash object containing the agents for these requests. If omitted this request will use the global pool which is set to node's default maxSockets. -* `pool.maxSockets` - Integer containing the maximum amount of sockets in the pool. -* `timeout` - Integer containing the number of milliseconds to wait for a request to respond before aborting the request -* `proxy` - An HTTP proxy to be used. Support proxy Auth with Basic Auth the same way it's supported with the `url` parameter by embedding the auth info in the uri. -* `oauth` - Options for OAuth HMAC-SHA1 signing, see documentation above. -* `strictSSL` - Set to `true` to require that SSL certificates be valid. Note: to use your own certificate authority, you need to specify an agent that was created with that ca as an option. -* `jar` - Set to `false` if you don't want cookies to be remembered for future use or define your custom cookie jar (see examples section) - - -The callback argument gets 3 arguments. The first is an error when applicable (usually from the http.Client option not the http.ClientRequest object). The second in an http.ClientResponse object. The third is the response body String or Buffer. - -## Convenience methods - -There are also shorthand methods for different HTTP METHODs and some other conveniences. - -### request.defaults(options) - -This method returns a wrapper around the normal request API that defaults to whatever options you pass in to it. - -### request.put - -Same as request() but defaults to `method: "PUT"`. - -```javascript -request.put(url) -``` - -### request.post - -Same as request() but defaults to `method: "POST"`. - -```javascript -request.post(url) -``` - -### request.head - -Same as request() but defaults to `method: "HEAD"`. - -```javascript -request.head(url) -``` - -### request.del - -Same as request() but defaults to `method: "DELETE"`. - -```javascript -request.del(url) -``` - -### request.get - -Alias to normal request method for uniformity. - -```javascript -request.get(url) -``` -### request.cookie - -Function that creates a new cookie. - -```javascript -request.cookie('cookie_string_here') -``` -### request.jar - -Function that creates a new cookie jar. - -```javascript -request.jar() -``` - - -## Examples: - -```javascript - var request = require('request') - , rand = Math.floor(Math.random()*100000000).toString() - ; - request( - { method: 'PUT' - , uri: 'http://mikeal.iriscouch.com/testjs/' + rand - , multipart: - [ { 'content-type': 'application/json' - , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) - } - , { body: 'I am an attachment' } - ] - } - , function (error, response, body) { - if(response.statusCode == 201){ - console.log('document saved as: http://mikeal.iriscouch.com/testjs/'+ rand) - } else { - console.log('error: '+ response.statusCode) - console.log(body) - } - } - ) -``` -Cookies are enabled by default (so they can be used in subsequent requests). To disable cookies set jar to false (either in defaults or in the options sent). - -```javascript -var request = request.defaults({jar: false}) -request('http://www.google.com', function () { - request('http://images.google.com') -}) -``` - -If you to use a custom cookie jar (instead of letting request use its own global cookie jar) you do so by setting the jar default or by specifying it as an option: - -```javascript -var j = request.jar() -var request = request.defaults({jar:j}) -request('http://www.google.com', function () { - request('http://images.google.com') -}) -``` -OR - -```javascript -var j = request.jar() -var cookie = request.cookie('your_cookie_here') -j.add(cookie) -request({url: 'http://www.google.com', jar: j}, function () { - request('http://images.google.com') -}) -``` diff --git a/node_modules/api-easy/node_modules/request/forever.js b/node_modules/api-easy/node_modules/request/forever.js deleted file mode 100644 index ac853c0..0000000 --- a/node_modules/api-easy/node_modules/request/forever.js +++ /dev/null @@ -1,103 +0,0 @@ -module.exports = ForeverAgent -ForeverAgent.SSL = ForeverAgentSSL - -var util = require('util') - , Agent = require('http').Agent - , net = require('net') - , tls = require('tls') - , AgentSSL = require('https').Agent - -function ForeverAgent(options) { - var self = this - self.options = options || {} - self.requests = {} - self.sockets = {} - self.freeSockets = {} - self.maxSockets = self.options.maxSockets || Agent.defaultMaxSockets - self.minSockets = self.options.minSockets || ForeverAgent.defaultMinSockets - self.on('free', function(socket, host, port) { - var name = host + ':' + port - if (self.requests[name] && self.requests[name].length) { - self.requests[name].shift().onSocket(socket) - } else if (self.sockets[name].length < self.minSockets) { - if (!self.freeSockets[name]) self.freeSockets[name] = [] - self.freeSockets[name].push(socket) - - // if an error happens while we don't use the socket anyway, meh, throw the socket away - function onIdleError() { - socket.destroy() - } - socket._onIdleError = onIdleError - socket.on('error', onIdleError) - } else { - // If there are no pending requests just destroy the - // socket and it will get removed from the pool. This - // gets us out of timeout issues and allows us to - // default to Connection:keep-alive. - socket.destroy(); - } - }) - -} -util.inherits(ForeverAgent, Agent) - -ForeverAgent.defaultMinSockets = 5 - - -ForeverAgent.prototype.createConnection = net.createConnection -ForeverAgent.prototype.addRequestNoreuse = Agent.prototype.addRequest -ForeverAgent.prototype.addRequest = function(req, host, port) { - var name = host + ':' + port - if (this.freeSockets[name] && this.freeSockets[name].length > 0 && !req.useChunkedEncodingByDefault) { - var idleSocket = this.freeSockets[name].pop() - idleSocket.removeListener('error', idleSocket._onIdleError) - delete idleSocket._onIdleError - req._reusedSocket = true - req.onSocket(idleSocket) - } else { - this.addRequestNoreuse(req, host, port) - } -} - -ForeverAgent.prototype.removeSocket = function(s, name, host, port) { - if (this.sockets[name]) { - var index = this.sockets[name].indexOf(s); - if (index !== -1) { - this.sockets[name].splice(index, 1); - } - } else if (this.sockets[name] && this.sockets[name].length === 0) { - // don't leak - delete this.sockets[name]; - delete this.requests[name]; - } - - if (this.freeSockets[name]) { - var index = this.freeSockets[name].indexOf(s) - if (index !== -1) { - this.freeSockets[name].splice(index, 1) - if (this.freeSockets[name].length === 0) { - delete this.freeSockets[name] - } - } - } - - if (this.requests[name] && this.requests[name].length) { - // If we have pending requests and a socket gets closed a new one - // needs to be created to take over in the pool for the one that closed. - this.createSocket(name, host, port).emit('free'); - } -} - -function ForeverAgentSSL (options) { - ForeverAgent.call(this, options) -} -util.inherits(ForeverAgentSSL, ForeverAgent) - -ForeverAgentSSL.prototype.createConnection = createConnectionSSL -ForeverAgentSSL.prototype.addRequestNoreuse = AgentSSL.prototype.addRequest - -function createConnectionSSL (port, host, options) { - options.port = port - options.host = host - return tls.connect(options) -} diff --git a/node_modules/api-easy/node_modules/request/main.js b/node_modules/api-easy/node_modules/request/main.js deleted file mode 100644 index f651202..0000000 --- a/node_modules/api-easy/node_modules/request/main.js +++ /dev/null @@ -1,874 +0,0 @@ -// Copyright 2010-2012 Mikeal Rogers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -var http = require('http') - , https = false - , tls = false - , url = require('url') - , util = require('util') - , stream = require('stream') - , qs = require('querystring') - , mimetypes = require('./mimetypes') - , oauth = require('./oauth') - , uuid = require('./uuid') - , ForeverAgent = require('./forever') - , Cookie = require('./vendor/cookie') - , CookieJar = require('./vendor/cookie/jar') - , cookieJar = new CookieJar - , tunnel = require('./tunnel') - ; - -if (process.logging) { - var log = process.logging('request') -} - -try { - https = require('https') -} catch (e) {} - -try { - tls = require('tls') -} catch (e) {} - -function toBase64 (str) { - return (new Buffer(str || "", "ascii")).toString("base64") -} - -// Hacky fix for pre-0.4.4 https -if (https && !https.Agent) { - https.Agent = function (options) { - http.Agent.call(this, options) - } - util.inherits(https.Agent, http.Agent) - https.Agent.prototype._getConnection = function(host, port, cb) { - var s = tls.connect(port, host, this.options, function() { - // do other checks here? - if (cb) cb() - }) - return s - } -} - -function isReadStream (rs) { - if (rs.readable && rs.path && rs.mode) { - return true - } -} - -function copy (obj) { - var o = {} - Object.keys(obj).forEach(function (i) { - o[i] = obj[i] - }) - return o -} - -var isUrl = /^https?:/ - -var globalPool = {} - -function Request (options) { - stream.Stream.call(this) - this.readable = true - this.writable = true - - if (typeof options === 'string') { - options = {uri:options} - } - - var reserved = Object.keys(Request.prototype) - for (var i in options) { - if (reserved.indexOf(i) === -1) { - this[i] = options[i] - } else { - if (typeof options[i] === 'function') { - delete options[i] - } - } - } - options = copy(options) - - this.init(options) -} -util.inherits(Request, stream.Stream) -Request.prototype.init = function (options) { - var self = this - - if (!options) options = {} - - if (!self.pool) self.pool = globalPool - self.dests = [] - self.__isRequestRequest = true - - // Protect against double callback - if (!self._callback && self.callback) { - self._callback = self.callback - self.callback = function () { - if (self._callbackCalled) return // Print a warning maybe? - self._callback.apply(self, arguments) - self._callbackCalled = true - } - } - - if (self.url) { - // People use this property instead all the time so why not just support it. - self.uri = self.url - delete self.url - } - - if (!self.uri) { - throw new Error("options.uri is a required argument") - } else { - if (typeof self.uri == "string") self.uri = url.parse(self.uri) - } - if (self.proxy) { - if (typeof self.proxy == 'string') self.proxy = url.parse(self.proxy) - - // do the HTTP CONNECT dance using koichik/node-tunnel - if (http.globalAgent && self.uri.protocol === "https:") { - self.tunnel = true - var tunnelFn = self.proxy.protocol === "http:" - ? tunnel.httpsOverHttp : tunnel.httpsOverHttps - - var tunnelOptions = { proxy: { host: self.proxy.hostname - , port: +self.proxy.port } - , ca: this.ca } - - self.agent = tunnelFn(tunnelOptions) - self.tunnel = true - } - } - - self._redirectsFollowed = self._redirectsFollowed || 0 - self.maxRedirects = (self.maxRedirects !== undefined) ? self.maxRedirects : 10 - self.followRedirect = (self.followRedirect !== undefined) ? self.followRedirect : true - self.followAllRedirects = (self.followAllRedirects !== undefined) ? self.followAllRedirects : false; - if (self.followRedirect || self.followAllRedirects) - self.redirects = self.redirects || [] - - self.headers = self.headers ? copy(self.headers) : {} - - self.setHost = false - if (!self.headers.host) { - self.headers.host = self.uri.hostname - if (self.uri.port) { - if ( !(self.uri.port === 80 && self.uri.protocol === 'http:') && - !(self.uri.port === 443 && self.uri.protocol === 'https:') ) - self.headers.host += (':'+self.uri.port) - } - self.setHost = true - } - - self.jar(options.jar) - - if (!self.uri.pathname) {self.uri.pathname = '/'} - if (!self.uri.port) { - if (self.uri.protocol == 'http:') {self.uri.port = 80} - else if (self.uri.protocol == 'https:') {self.uri.port = 443} - } - - if (self.proxy && !self.tunnel) { - self.port = self.proxy.port - self.host = self.proxy.hostname - } else { - self.port = self.uri.port - self.host = self.uri.hostname - } - - if (self.onResponse === true) { - self.onResponse = self.callback - delete self.callback - } - - self.clientErrorHandler = function (error) { - if (self._aborted) return - - if (self.setHost) delete self.headers.host - if (self.req._reusedSocket && error.code === 'ECONNRESET' - && self.agent.addRequestNoreuse) { - self.agent = { addRequest: self.agent.addRequestNoreuse.bind(self.agent) } - self.start() - self.req.end() - return - } - if (self.timeout && self.timeoutTimer) { - clearTimeout(self.timeoutTimer); - self.timeoutTimer = null; - } - self.emit('error', error) - } - if (self.onResponse) self.on('error', function (e) {self.onResponse(e)}) - if (self.callback) self.on('error', function (e) {self.callback(e)}) - - if (options.form) { - self.form(options.form) - } - - if (options.oauth) { - self.oauth(options.oauth) - } - - if (self.uri.auth && !self.headers.authorization) { - self.headers.authorization = "Basic " + toBase64(self.uri.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':')) - } - if (self.proxy && self.proxy.auth && !self.headers['proxy-authorization'] && !self.tunnel) { - self.headers['proxy-authorization'] = "Basic " + toBase64(self.proxy.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':')) - } - - if (options.qs) self.qs(options.qs) - - if (self.uri.path) { - self.path = self.uri.path - } else { - self.path = self.uri.pathname + (self.uri.search || "") - } - - if (self.path.length === 0) self.path = '/' - - if (self.proxy && !self.tunnel) self.path = (self.uri.protocol + '//' + self.uri.host + self.path) - - if (options.json) { - self.json(options.json) - } else if (options.multipart) { - self.multipart(options.multipart) - } - - if (self.body) { - var length = 0 - if (!Buffer.isBuffer(self.body)) { - if (Array.isArray(self.body)) { - for (var i = 0; i < self.body.length; i++) { - length += self.body[i].length - } - } else { - self.body = new Buffer(self.body) - length = self.body.length - } - } else { - length = self.body.length - } - if (length) { - self.headers['content-length'] = length - } else { - throw new Error('Argument error, options.body.') - } - } - - var protocol = self.proxy && !self.tunnel ? self.proxy.protocol : self.uri.protocol - , defaultModules = {'http:':http, 'https:':https} - , httpModules = self.httpModules || {} - ; - self.httpModule = httpModules[protocol] || defaultModules[protocol] - - if (!self.httpModule) throw new Error("Invalid protocol") - - if (options.ca) self.ca = options.ca - - if (!self.agent) { - if (options.agentOptions) self.agentOptions = options.agentOptions - - if (options.agentClass) { - self.agentClass = options.agentClass - } else if (options.forever) { - self.agentClass = protocol === 'http:' ? ForeverAgent : ForeverAgent.SSL - } else { - self.agentClass = self.httpModule.Agent - } - } - - if (self.pool === false) { - self.agent = false - } else { - self.agent = self.agent || self.getAgent() - if (self.maxSockets) { - // Don't use our pooling if node has the refactored client - self.agent.maxSockets = self.maxSockets - } - if (self.pool.maxSockets) { - // Don't use our pooling if node has the refactored client - self.agent.maxSockets = self.pool.maxSockets - } - } - - self.once('pipe', function (src) { - if (self.ntick) throw new Error("You cannot pipe to this stream after the first nextTick() after creation of the request stream.") - self.src = src - if (isReadStream(src)) { - if (!self.headers['content-type'] && !self.headers['Content-Type']) - self.headers['content-type'] = mimetypes.lookup(src.path.slice(src.path.lastIndexOf('.')+1)) - } else { - if (src.headers) { - for (var i in src.headers) { - if (!self.headers[i]) { - self.headers[i] = src.headers[i] - } - } - } - if (src.method && !self.method) { - self.method = src.method - } - } - - self.on('pipe', function () { - console.error("You have already piped to this stream. Pipeing twice is likely to break the request.") - }) - }) - - process.nextTick(function () { - if (self._aborted) return - - if (self.body) { - if (Array.isArray(self.body)) { - self.body.forEach(function(part) { - self.write(part) - }) - } else { - self.write(self.body) - } - self.end() - } else if (self.requestBodyStream) { - console.warn("options.requestBodyStream is deprecated, please pass the request object to stream.pipe.") - self.requestBodyStream.pipe(self) - } else if (!self.src) { - self.headers['content-length'] = 0 - self.end() - } - self.ntick = true - }) -} - -Request.prototype.getAgent = function () { - var Agent = this.agentClass - var options = {} - if (this.agentOptions) { - for (var i in this.agentOptions) { - options[i] = this.agentOptions[i] - } - } - if (this.ca) options.ca = this.ca - - var poolKey = '' - - // different types of agents are in different pools - if (Agent !== this.httpModule.Agent) { - poolKey += Agent.name - } - - if (!this.httpModule.globalAgent) { - // node 0.4.x - options.host = this.host - options.port = this.port - if (poolKey) poolKey += ':' - poolKey += this.host + ':' + this.port - } - - if (options.ca) { - if (poolKey) poolKey += ':' - poolKey += options.ca - } - - if (!poolKey && Agent === this.httpModule.Agent && this.httpModule.globalAgent) { - // not doing anything special. Use the globalAgent - return this.httpModule.globalAgent - } - - // already generated an agent for this setting - if (this.pool[poolKey]) return this.pool[poolKey] - - return this.pool[poolKey] = new Agent(options) -} - -Request.prototype.start = function () { - var self = this - - if (self._aborted) return - - self._started = true - self.method = self.method || 'GET' - self.href = self.uri.href - if (log) log('%method %href', self) - self.req = self.httpModule.request(self, function (response) { - if (self._aborted) return - if (self._paused) response.pause() - - self.response = response - response.request = self - - if (self.httpModule === https && - self.strictSSL && - !response.client.authorized) { - var sslErr = response.client.authorizationError - self.emit('error', new Error('SSL Error: '+ sslErr)) - return - } - - if (self.setHost) delete self.headers.host - if (self.timeout && self.timeoutTimer) { - clearTimeout(self.timeoutTimer); - self.timeoutTimer = null; - } - - if (response.headers['set-cookie'] && (!self._disableCookies)) { - response.headers['set-cookie'].forEach(function(cookie) { - if (self._jar) self._jar.add(new Cookie(cookie)) - else cookieJar.add(new Cookie(cookie)) - }) - } - - if (response.statusCode >= 300 && response.statusCode < 400 && - (self.followAllRedirects || - (self.followRedirect && (self.method !== 'PUT' && self.method !== 'POST' && self.method !== 'DELETE'))) && - response.headers.location) { - if (self._redirectsFollowed >= self.maxRedirects) { - self.emit('error', new Error("Exceeded maxRedirects. Probably stuck in a redirect loop.")) - return - } - self._redirectsFollowed += 1 - - if (!isUrl.test(response.headers.location)) { - response.headers.location = url.resolve(self.uri.href, response.headers.location) - } - self.uri = response.headers.location - self.redirects.push( - { statusCode : response.statusCode - , redirectUri: response.headers.location - } - ) - self.method = 'GET'; // Force all redirects to use GET - delete self.req - delete self.agent - delete self._started - if (self.headers) { - delete self.headers.host - } - if (log) log('Redirect to %uri', self) - self.init() - return // Ignore the rest of the response - } else { - self._redirectsFollowed = self._redirectsFollowed || 0 - // Be a good stream and emit end when the response is finished. - // Hack to emit end on close because of a core bug that never fires end - response.on('close', function () { - if (!self._ended) self.response.emit('end') - }) - - if (self.encoding) { - if (self.dests.length !== 0) { - console.error("Ingoring encoding parameter as this stream is being piped to another stream which makes the encoding option invalid.") - } else { - response.setEncoding(self.encoding) - } - } - - self.dests.forEach(function (dest) { - self.pipeDest(dest) - }) - - response.on("data", function (chunk) { - self._destdata = true - self.emit("data", chunk) - }) - response.on("end", function (chunk) { - self._ended = true - self.emit("end", chunk) - }) - response.on("close", function () {self.emit("close")}) - - self.emit('response', response) - - if (self.onResponse) { - self.onResponse(null, response) - } - if (self.callback) { - var buffer = [] - var bodyLen = 0 - self.on("data", function (chunk) { - buffer.push(chunk) - bodyLen += chunk.length - }) - self.on("end", function () { - if (self._aborted) return - - if (buffer.length && Buffer.isBuffer(buffer[0])) { - var body = new Buffer(bodyLen) - var i = 0 - buffer.forEach(function (chunk) { - chunk.copy(body, i, 0, chunk.length) - i += chunk.length - }) - if (self.encoding === null) { - response.body = body - } else { - response.body = body.toString() - } - } else if (buffer.length) { - response.body = buffer.join('') - } - - if (self._json) { - try { - response.body = JSON.parse(response.body) - } catch (e) {} - } - - self.callback(null, response, response.body) - }) - } - } - }) - - if (self.timeout && !self.timeoutTimer) { - self.timeoutTimer = setTimeout(function() { - self.req.abort() - var e = new Error("ETIMEDOUT") - e.code = "ETIMEDOUT" - self.emit("error", e) - }, self.timeout) - - // Set additional timeout on socket - in case if remote - // server freeze after sending headers - if (self.req.setTimeout) { // only works on node 0.6+ - self.req.setTimeout(self.timeout, function(){ - if (self.req) { - self.req.abort() - var e = new Error("ESOCKETTIMEDOUT") - e.code = "ESOCKETTIMEDOUT" - self.emit("error", e) - } - }) - } - } - - self.req.on('error', self.clientErrorHandler) - - self.emit('request', self.req) -} - -Request.prototype.abort = function() { - this._aborted = true; - - if (this.req) { - this.req.abort() - } - else if (this.response) { - this.response.abort() - } - - this.emit("abort") -} - -Request.prototype.pipeDest = function (dest) { - var response = this.response - // Called after the response is received - if (dest.headers) { - dest.headers['content-type'] = response.headers['content-type'] - if (response.headers['content-length']) { - dest.headers['content-length'] = response.headers['content-length'] - } - } - if (dest.setHeader) { - for (var i in response.headers) { - dest.setHeader(i, response.headers[i]) - } - dest.statusCode = response.statusCode - } - if (this.pipefilter) this.pipefilter(response, dest) -} - -// Composable API -Request.prototype.setHeader = function (name, value, clobber) { - if (clobber === undefined) clobber = true - if (clobber || !this.headers.hasOwnProperty(name)) this.headers[name] = value - else this.headers[name] += ',' + value - return this -} -Request.prototype.setHeaders = function (headers) { - for (i in headers) {this.setHeader(i, headers[i])} - return this -} -Request.prototype.qs = function (q, clobber) { - var uri = { - protocol: this.uri.protocol, - host: this.uri.host, - pathname: this.uri.pathname, - query: clobber ? q : qs.parse(this.uri.query), - hash: this.uri.hash - }; - if (!clobber) for (var i in q) uri.query[i] = q[i] - - this.uri= url.parse(url.format(uri)) - - return this -} -Request.prototype.form = function (form) { - this.headers['content-type'] = 'application/x-www-form-urlencoded; charset=utf-8' - this.body = qs.stringify(form).toString('utf8') - return this -} -Request.prototype.multipart = function (multipart) { - var self = this - self.body = [] - - if (!self.headers['content-type']) { - self.headers['content-type'] = 'multipart/related;boundary="frontier"'; - } else { - self.headers['content-type'] = self.headers['content-type'].split(';')[0] + ';boundary="frontier"'; - } - - if (!multipart.forEach) throw new Error('Argument error, options.multipart.') - - multipart.forEach(function (part) { - var body = part.body - if(!body) throw Error('Body attribute missing in multipart.') - delete part.body - var preamble = '--frontier\r\n' - Object.keys(part).forEach(function(key){ - preamble += key + ': ' + part[key] + '\r\n' - }) - preamble += '\r\n' - self.body.push(new Buffer(preamble)) - self.body.push(new Buffer(body)) - self.body.push(new Buffer('\r\n')) - }) - self.body.push(new Buffer('--frontier--')) - return self -} -Request.prototype.json = function (val) { - this.setHeader('content-type', 'application/json') - this.setHeader('accept', 'application/json') - this._json = true - if (typeof val === 'boolean') { - if (typeof this.body === 'object') this.body = JSON.stringify(this.body) - } else { - this.body = JSON.stringify(val) - } - return this -} -Request.prototype.oauth = function (_oauth) { - var form - if (this.headers['content-type'] && - this.headers['content-type'].slice(0, 'application/x-www-form-urlencoded'.length) === - 'application/x-www-form-urlencoded' - ) { - form = qs.parse(this.body) - } - if (this.uri.query) { - form = qs.parse(this.uri.query) - } - if (!form) form = {} - var oa = {} - for (var i in form) oa[i] = form[i] - for (var i in _oauth) oa['oauth_'+i] = _oauth[i] - if (!oa.oauth_version) oa.oauth_version = '1.0' - if (!oa.oauth_timestamp) oa.oauth_timestamp = Math.floor( (new Date()).getTime() / 1000 ).toString() - if (!oa.oauth_nonce) oa.oauth_nonce = uuid().replace(/-/g, '') - - oa.oauth_signature_method = 'HMAC-SHA1' - - var consumer_secret = oa.oauth_consumer_secret - delete oa.oauth_consumer_secret - var token_secret = oa.oauth_token_secret - delete oa.oauth_token_secret - - var baseurl = this.uri.protocol + '//' + this.uri.host + this.uri.pathname - var signature = oauth.hmacsign(this.method, baseurl, oa, consumer_secret, token_secret) - - // oa.oauth_signature = signature - for (var i in form) { - if ( i.slice(0, 'oauth_') in _oauth) { - // skip - } else { - delete oa['oauth_'+i] - } - } - this.headers.authorization = - 'OAuth '+Object.keys(oa).sort().map(function (i) {return i+'="'+oauth.rfc3986(oa[i])+'"'}).join(',') - this.headers.authorization += ',oauth_signature="'+oauth.rfc3986(signature)+'"' - return this -} -Request.prototype.jar = function (jar) { - var cookies - - if (this._redirectsFollowed === 0) { - this.originalCookieHeader = this.headers.cookie - } - - if (jar === false) { - // disable cookies - cookies = false; - this._disableCookies = true; - } else if (jar) { - // fetch cookie from the user defined cookie jar - cookies = jar.get({ url: this.uri.href }) - } else { - // fetch cookie from the global cookie jar - cookies = cookieJar.get({ url: this.uri.href }) - } - - if (cookies && cookies.length) { - var cookieString = cookies.map(function (c) { - return c.name + "=" + c.value - }).join("; ") - - if (this.originalCookieHeader) { - // Don't overwrite existing Cookie header - this.headers.cookie = this.originalCookieHeader + '; ' + cookieString - } else { - this.headers.cookie = cookieString - } - } - this._jar = jar - return this -} - - -// Stream API -Request.prototype.pipe = function (dest, opts) { - if (this.response) { - if (this._destdata) { - throw new Error("You cannot pipe after data has been emitted from the response.") - } else if (this._ended) { - throw new Error("You cannot pipe after the response has been ended.") - } else { - stream.Stream.prototype.pipe.call(this, dest, opts) - this.pipeDest(dest) - return dest - } - } else { - this.dests.push(dest) - stream.Stream.prototype.pipe.call(this, dest, opts) - return dest - } -} -Request.prototype.write = function () { - if (!this._started) this.start() - this.req.write.apply(this.req, arguments) -} -Request.prototype.end = function (chunk) { - if (chunk) this.write(chunk) - if (!this._started) this.start() - this.req.end() -} -Request.prototype.pause = function () { - if (!this.response) this._paused = true - else this.response.pause.apply(this.response, arguments) -} -Request.prototype.resume = function () { - if (!this.response) this._paused = false - else this.response.resume.apply(this.response, arguments) -} -Request.prototype.destroy = function () { - if (!this._ended) this.end() -} - -// organize params for post, put, head, del -function initParams(uri, options, callback) { - if ((typeof options === 'function') && !callback) callback = options; - if (typeof options === 'object') { - options.uri = uri; - } else if (typeof uri === 'string') { - options = {uri:uri}; - } else { - options = uri; - uri = options.uri; - } - return { uri: uri, options: options, callback: callback }; -} - -function request (uri, options, callback) { - if ((typeof options === 'function') && !callback) callback = options; - if (typeof options === 'object') { - options.uri = uri; - } else if (typeof uri === 'string') { - options = {uri:uri}; - } else { - options = uri; - } - - if (callback) options.callback = callback; - var r = new Request(options) - return r -} - -module.exports = request - -request.defaults = function (options) { - var def = function (method) { - var d = function (uri, opts, callback) { - var params = initParams(uri, opts, callback); - for (var i in options) { - if (params.options[i] === undefined) params.options[i] = options[i] - } - return method(params.uri, params.options, params.callback) - } - return d - } - var de = def(request) - de.get = def(request.get) - de.post = def(request.post) - de.put = def(request.put) - de.head = def(request.head) - de.del = def(request.del) - de.cookie = def(request.cookie) - de.jar = def(request.jar) - return de -} - -request.forever = function (agentOptions, optionsArg) { - var options = {} - if (optionsArg) { - for (option in optionsArg) { - options[option] = optionsArg[option] - } - } - if (agentOptions) options.agentOptions = agentOptions - options.forever = true - return request.defaults(options) -} - -request.get = request -request.post = function (uri, options, callback) { - var params = initParams(uri, options, callback); - params.options.method = 'POST'; - return request(params.uri, params.options, params.callback) -} -request.put = function (uri, options, callback) { - var params = initParams(uri, options, callback); - params.options.method = 'PUT' - return request(params.uri, params.options, params.callback) -} -request.head = function (uri, options, callback) { - var params = initParams(uri, options, callback); - params.options.method = 'HEAD' - if (params.options.body || - params.options.requestBodyStream || - (params.options.json && typeof params.options.json !== 'boolean') || - params.options.multipart) { - throw new Error("HTTP HEAD requests MUST NOT include a request body.") - } - return request(params.uri, params.options, params.callback) -} -request.del = function (uri, options, callback) { - var params = initParams(uri, options, callback); - params.options.method = 'DELETE' - return request(params.uri, params.options, params.callback) -} -request.jar = function () { - return new CookieJar -} -request.cookie = function (str) { - if (str && str.uri) str = str.uri - if (typeof str !== 'string') throw new Error("The cookie function only accepts STRING as param") - return new Cookie(str) -} diff --git a/node_modules/api-easy/node_modules/request/mimetypes.js b/node_modules/api-easy/node_modules/request/mimetypes.js deleted file mode 100644 index 59b21b4..0000000 --- a/node_modules/api-easy/node_modules/request/mimetypes.js +++ /dev/null @@ -1,152 +0,0 @@ -// from http://github.com/felixge/node-paperboy -exports.types = { - "3gp":"video/3gpp", - "aiff":"audio/x-aiff", - "arj":"application/x-arj-compressed", - "asf":"video/x-ms-asf", - "asx":"video/x-ms-asx", - "au":"audio/ulaw", - "avi":"video/x-msvideo", - "bcpio":"application/x-bcpio", - "ccad":"application/clariscad", - "cod":"application/vnd.rim.cod", - "com":"application/x-msdos-program", - "cpio":"application/x-cpio", - "cpt":"application/mac-compactpro", - "csh":"application/x-csh", - "css":"text/css", - "deb":"application/x-debian-package", - "dl":"video/dl", - "doc":"application/msword", - "drw":"application/drafting", - "dvi":"application/x-dvi", - "dwg":"application/acad", - "dxf":"application/dxf", - "dxr":"application/x-director", - "etx":"text/x-setext", - "ez":"application/andrew-inset", - "fli":"video/x-fli", - "flv":"video/x-flv", - "gif":"image/gif", - "gl":"video/gl", - "gtar":"application/x-gtar", - "gz":"application/x-gzip", - "hdf":"application/x-hdf", - "hqx":"application/mac-binhex40", - "html":"text/html", - "ice":"x-conference/x-cooltalk", - "ico":"image/x-icon", - "ief":"image/ief", - "igs":"model/iges", - "ips":"application/x-ipscript", - "ipx":"application/x-ipix", - "jad":"text/vnd.sun.j2me.app-descriptor", - "jar":"application/java-archive", - "jpeg":"image/jpeg", - "jpg":"image/jpeg", - "js":"text/javascript", - "json":"application/json", - "latex":"application/x-latex", - "lsp":"application/x-lisp", - "lzh":"application/octet-stream", - "m":"text/plain", - "m3u":"audio/x-mpegurl", - "m4v":"video/mp4", - "man":"application/x-troff-man", - "me":"application/x-troff-me", - "midi":"audio/midi", - "mif":"application/x-mif", - "mime":"www/mime", - "mkv":" video/x-matrosk", - "movie":"video/x-sgi-movie", - "mp4":"video/mp4", - "mp41":"video/mp4", - "mp42":"video/mp4", - "mpg":"video/mpeg", - "mpga":"audio/mpeg", - "ms":"application/x-troff-ms", - "mustache":"text/plain", - "nc":"application/x-netcdf", - "oda":"application/oda", - "ogm":"application/ogg", - "pbm":"image/x-portable-bitmap", - "pdf":"application/pdf", - "pgm":"image/x-portable-graymap", - "pgn":"application/x-chess-pgn", - "pgp":"application/pgp", - "pm":"application/x-perl", - "png":"image/png", - "pnm":"image/x-portable-anymap", - "ppm":"image/x-portable-pixmap", - "ppz":"application/vnd.ms-powerpoint", - "pre":"application/x-freelance", - "prt":"application/pro_eng", - "ps":"application/postscript", - "qt":"video/quicktime", - "ra":"audio/x-realaudio", - "rar":"application/x-rar-compressed", - "ras":"image/x-cmu-raster", - "rgb":"image/x-rgb", - "rm":"audio/x-pn-realaudio", - "rpm":"audio/x-pn-realaudio-plugin", - "rtf":"text/rtf", - "rtx":"text/richtext", - "scm":"application/x-lotusscreencam", - "set":"application/set", - "sgml":"text/sgml", - "sh":"application/x-sh", - "shar":"application/x-shar", - "silo":"model/mesh", - "sit":"application/x-stuffit", - "skt":"application/x-koan", - "smil":"application/smil", - "snd":"audio/basic", - "sol":"application/solids", - "spl":"application/x-futuresplash", - "src":"application/x-wais-source", - "stl":"application/SLA", - "stp":"application/STEP", - "sv4cpio":"application/x-sv4cpio", - "sv4crc":"application/x-sv4crc", - "svg":"image/svg+xml", - "swf":"application/x-shockwave-flash", - "tar":"application/x-tar", - "tcl":"application/x-tcl", - "tex":"application/x-tex", - "texinfo":"application/x-texinfo", - "tgz":"application/x-tar-gz", - "tiff":"image/tiff", - "tr":"application/x-troff", - "tsi":"audio/TSP-audio", - "tsp":"application/dsptype", - "tsv":"text/tab-separated-values", - "unv":"application/i-deas", - "ustar":"application/x-ustar", - "vcd":"application/x-cdlink", - "vda":"application/vda", - "vivo":"video/vnd.vivo", - "vrm":"x-world/x-vrml", - "wav":"audio/x-wav", - "wax":"audio/x-ms-wax", - "webm":"video/webm", - "wma":"audio/x-ms-wma", - "wmv":"video/x-ms-wmv", - "wmx":"video/x-ms-wmx", - "wrl":"model/vrml", - "wvx":"video/x-ms-wvx", - "xbm":"image/x-xbitmap", - "xlw":"application/vnd.ms-excel", - "xml":"text/xml", - "xpm":"image/x-xpixmap", - "xwd":"image/x-xwindowdump", - "xyz":"chemical/x-pdb", - "zip":"application/zip" -}; - -exports.lookup = function(ext, defaultType) { - defaultType = defaultType || 'application/octet-stream'; - - return (ext in exports.types) - ? exports.types[ext] - : defaultType; -}; \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/request/oauth.js b/node_modules/api-easy/node_modules/request/oauth.js deleted file mode 100644 index 31b9dc6..0000000 --- a/node_modules/api-easy/node_modules/request/oauth.js +++ /dev/null @@ -1,34 +0,0 @@ -var crypto = require('crypto') - , qs = require('querystring') - ; - -function sha1 (key, body) { - return crypto.createHmac('sha1', key).update(body).digest('base64') -} - -function rfc3986 (str) { - return encodeURIComponent(str) - .replace('!','%21') - .replace('*','%2A') - .replace('(','%28') - .replace(')','%29') - .replace("'",'%27') - ; -} - -function hmacsign (httpMethod, base_uri, params, consumer_secret, token_secret, body) { - // adapted from https://dev.twitter.com/docs/auth/oauth - var base = - (httpMethod || 'GET') + "&" + - encodeURIComponent( base_uri ) + "&" + - Object.keys(params).sort().map(function (i) { - // big WTF here with the escape + encoding but it's what twitter wants - return escape(rfc3986(i)) + "%3D" + escape(rfc3986(params[i])) - }).join("%26") - var key = consumer_secret + '&' - if (token_secret) key += token_secret - return sha1(key, base) -} - -exports.hmacsign = hmacsign -exports.rfc3986 = rfc3986 \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/request/package.json b/node_modules/api-easy/node_modules/request/package.json deleted file mode 100644 index 55cf32c..0000000 --- a/node_modules/api-easy/node_modules/request/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "request", - "description": "Simplified HTTP request client.", - "tags": [ - "http", - "simple", - "util", - "utility" - ], - "version": "2.9.153", - "author": { - "name": "Mikeal Rogers", - "email": "mikeal.rogers@gmail.com" - }, - "repository": { - "type": "git", - "url": "git://github.com/mikeal/request.git" - }, - "bugs": { - "url": "http://github.com/mikeal/request/issues" - }, - "engines": [ - "node >= 0.3.6" - ], - "main": "./main", - "scripts": { - "test": "node tests/run.js" - }, - "_id": "request@2.9.153", - "dependencies": {}, - "devDependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "request@2.x.x" -} diff --git a/node_modules/api-easy/node_modules/request/tests/googledoodle.png b/node_modules/api-easy/node_modules/request/tests/googledoodle.png deleted file mode 100644 index f80c9c5..0000000 Binary files a/node_modules/api-easy/node_modules/request/tests/googledoodle.png and /dev/null differ diff --git a/node_modules/api-easy/node_modules/request/tests/run.js b/node_modules/api-easy/node_modules/request/tests/run.js deleted file mode 100644 index 6011846..0000000 --- a/node_modules/api-easy/node_modules/request/tests/run.js +++ /dev/null @@ -1,37 +0,0 @@ -var spawn = require('child_process').spawn - , exitCode = 0 - ; - -var tests = [ - 'test-body.js' - , 'test-cookie.js' - , 'test-cookiejar.js' - , 'test-defaults.js' - , 'test-errors.js' - , 'test-headers.js' - , 'test-httpModule.js' - , 'test-https.js' - , 'test-https-strict.js' - , 'test-oauth.js' - , 'test-pipes.js' - , 'test-proxy.js' - , 'test-qs.js' - , 'test-redirect.js' - , 'test-timeout.js' - , 'test-tunnel.js' -] - -var next = function () { - if (tests.length === 0) process.exit(exitCode); - - var file = tests.shift() - console.log(file) - var proc = spawn('node', [ 'tests/' + file ]) - proc.stdout.pipe(process.stdout) - proc.stderr.pipe(process.stderr) - proc.on('exit', function (code) { - exitCode += code || 0 - next() - }) -} -next() diff --git a/node_modules/api-easy/node_modules/request/tests/server.js b/node_modules/api-easy/node_modules/request/tests/server.js deleted file mode 100644 index 921f512..0000000 --- a/node_modules/api-easy/node_modules/request/tests/server.js +++ /dev/null @@ -1,82 +0,0 @@ -var fs = require('fs') - , http = require('http') - , path = require('path') - , https = require('https') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - ; - -exports.createServer = function (port) { - port = port || 6767 - var s = http.createServer(function (req, resp) { - s.emit(req.url, req, resp); - }) - s.port = port - s.url = 'http://localhost:'+port - return s; -} - -exports.createSSLServer = function(port, opts) { - port = port || 16767 - - var options = { 'key' : path.join(__dirname, 'ssl', 'test.key') - , 'cert': path.join(__dirname, 'ssl', 'test.crt') - } - if (opts) { - for (var i in opts) options[i] = opts[i] - } - - for (var i in options) { - options[i] = fs.readFileSync(options[i]) - } - - var s = https.createServer(options, function (req, resp) { - s.emit(req.url, req, resp); - }) - s.port = port - s.url = 'https://localhost:'+port - return s; -} - -exports.createPostStream = function (text) { - var postStream = new stream.Stream(); - postStream.writeable = true; - postStream.readable = true; - setTimeout(function () {postStream.emit('data', new Buffer(text)); postStream.emit('end')}, 0); - return postStream; -} -exports.createPostValidator = function (text) { - var l = function (req, resp) { - var r = ''; - req.on('data', function (chunk) {r += chunk}) - req.on('end', function () { - if (r !== text) console.log(r, text); - assert.equal(r, text) - resp.writeHead(200, {'content-type':'text/plain'}) - resp.write('OK') - resp.end() - }) - } - return l; -} -exports.createGetResponse = function (text, contentType) { - var l = function (req, resp) { - contentType = contentType || 'text/plain' - resp.writeHead(200, {'content-type':contentType}) - resp.write(text) - resp.end() - } - return l; -} -exports.createChunkResponse = function (chunks, contentType) { - var l = function (req, resp) { - contentType = contentType || 'text/plain' - resp.writeHead(200, {'content-type':contentType}) - chunks.forEach(function (chunk) { - resp.write(chunk) - }) - resp.end() - } - return l; -} diff --git a/node_modules/api-easy/node_modules/request/tests/squid.conf b/node_modules/api-easy/node_modules/request/tests/squid.conf deleted file mode 100644 index 0d4a3b6..0000000 --- a/node_modules/api-easy/node_modules/request/tests/squid.conf +++ /dev/null @@ -1,77 +0,0 @@ -# -# Recommended minimum configuration: -# -acl manager proto cache_object -acl localhost src 127.0.0.1/32 ::1 -acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1 - -# Example rule allowing access from your local networks. -# Adapt to list your (internal) IP networks from where browsing -# should be allowed -acl localnet src 10.0.0.0/8 # RFC1918 possible internal network -acl localnet src 172.16.0.0/12 # RFC1918 possible internal network -acl localnet src 192.168.0.0/16 # RFC1918 possible internal network -acl localnet src fc00::/7 # RFC 4193 local private network range -acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines - -acl SSL_ports port 443 -acl Safe_ports port 80 # http -acl Safe_ports port 21 # ftp -acl Safe_ports port 443 # https -acl Safe_ports port 70 # gopher -acl Safe_ports port 210 # wais -acl Safe_ports port 1025-65535 # unregistered ports -acl Safe_ports port 280 # http-mgmt -acl Safe_ports port 488 # gss-http -acl Safe_ports port 591 # filemaker -acl Safe_ports port 777 # multiling http -acl CONNECT method CONNECT - -# -# Recommended minimum Access Permission configuration: -# -# Only allow cachemgr access from localhost -http_access allow manager localhost -http_access deny manager - -# Deny requests to certain unsafe ports -http_access deny !Safe_ports - -# Deny CONNECT to other than secure SSL ports -#http_access deny CONNECT !SSL_ports - -# We strongly recommend the following be uncommented to protect innocent -# web applications running on the proxy server who think the only -# one who can access services on "localhost" is a local user -#http_access deny to_localhost - -# -# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS -# - -# Example rule allowing access from your local networks. -# Adapt localnet in the ACL section to list your (internal) IP networks -# from where browsing should be allowed -http_access allow localnet -http_access allow localhost - -# And finally deny all other access to this proxy -http_access deny all - -# Squid normally listens to port 3128 -http_port 3128 - -# We recommend you to use at least the following line. -hierarchy_stoplist cgi-bin ? - -# Uncomment and adjust the following to add a disk cache directory. -#cache_dir ufs /usr/local/var/cache 100 16 256 - -# Leave coredumps in the first cache dir -coredump_dir /usr/local/var/cache - -# Add any of your own refresh_pattern entries above these. -refresh_pattern ^ftp: 1440 20% 10080 -refresh_pattern ^gopher: 1440 0% 1440 -refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 -refresh_pattern . 0 20% 4320 diff --git a/node_modules/api-easy/node_modules/request/tests/ssl/ca/ca.cnf b/node_modules/api-easy/node_modules/request/tests/ssl/ca/ca.cnf deleted file mode 100644 index 425a889..0000000 --- a/node_modules/api-easy/node_modules/request/tests/ssl/ca/ca.cnf +++ /dev/null @@ -1,20 +0,0 @@ -[ req ] -default_bits = 1024 -days = 3650 -distinguished_name = req_distinguished_name -attributes = req_attributes -prompt = no -output_password = password - -[ req_distinguished_name ] -C = US -ST = CA -L = Oakland -O = request -OU = request Certificate Authority -CN = requestCA -emailAddress = mikeal@mikealrogers.com - -[ req_attributes ] -challengePassword = password challenge - diff --git a/node_modules/api-easy/node_modules/request/tests/ssl/ca/ca.crl b/node_modules/api-easy/node_modules/request/tests/ssl/ca/ca.crl deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/api-easy/node_modules/request/tests/ssl/ca/ca.crt b/node_modules/api-easy/node_modules/request/tests/ssl/ca/ca.crt deleted file mode 100644 index b4524e4..0000000 --- a/node_modules/api-easy/node_modules/request/tests/ssl/ca/ca.crt +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICvTCCAiYCCQDn+P/MSbDsWjANBgkqhkiG9w0BAQUFADCBojELMAkGA1UEBhMC -VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMRAwDgYDVQQKEwdyZXF1 -ZXN0MSYwJAYDVQQLEx1yZXF1ZXN0IENlcnRpZmljYXRlIEF1dGhvcml0eTESMBAG -A1UEAxMJcmVxdWVzdENBMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlrZWFscm9n -ZXJzLmNvbTAeFw0xMjAzMDEyMjUwNTZaFw0yMjAyMjcyMjUwNTZaMIGiMQswCQYD -VQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNVBAcTB09ha2xhbmQxEDAOBgNVBAoT -B3JlcXVlc3QxJjAkBgNVBAsTHXJlcXVlc3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5 -MRIwEAYDVQQDEwlyZXF1ZXN0Q0ExJjAkBgkqhkiG9w0BCQEWF21pa2VhbEBtaWtl -YWxyb2dlcnMuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC7t9pQUAK4 -5XJYTI6NrF0n3G2HZsfN+rPYSVzzL8SuVyb1tHXos+vbPm3NKI4E8X1yVAXU8CjJ -5SqXnp4DAypAhaseho81cbhk7LXUhFz78OvAa+OD+xTAEAnNQ8tGUr4VGyplEjfD -xsBVuqV2j8GPNTftr+drOCFlqfAgMrBn4wIDAQABMA0GCSqGSIb3DQEBBQUAA4GB -ADVdTlVAL45R+PACNS7Gs4o81CwSclukBu4FJbxrkd4xGQmurgfRrYYKjtqiopQm -D7ysRamS3HMN9/VKq2T7r3z1PMHPAy7zM4uoXbbaTKwlnX4j/8pGPn8Ca3qHXYlo -88L/OOPc6Di7i7qckS3HFbXQCTiULtxWmy97oEuTwrAj ------END CERTIFICATE----- diff --git a/node_modules/api-easy/node_modules/request/tests/ssl/ca/ca.csr b/node_modules/api-easy/node_modules/request/tests/ssl/ca/ca.csr deleted file mode 100644 index e48c56e..0000000 --- a/node_modules/api-easy/node_modules/request/tests/ssl/ca/ca.csr +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIICBjCCAW8CAQAwgaIxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEQMA4GA1UE -BxMHT2FrbGFuZDEQMA4GA1UEChMHcmVxdWVzdDEmMCQGA1UECxMdcmVxdWVzdCBD -ZXJ0aWZpY2F0ZSBBdXRob3JpdHkxEjAQBgNVBAMTCXJlcXVlc3RDQTEmMCQGCSqG -SIb3DQEJARYXbWlrZWFsQG1pa2VhbHJvZ2Vycy5jb20wgZ8wDQYJKoZIhvcNAQEB -BQADgY0AMIGJAoGBALu32lBQArjlclhMjo2sXSfcbYdmx836s9hJXPMvxK5XJvW0 -deiz69s+bc0ojgTxfXJUBdTwKMnlKpeengMDKkCFqx6GjzVxuGTstdSEXPvw68Br -44P7FMAQCc1Dy0ZSvhUbKmUSN8PGwFW6pXaPwY81N+2v52s4IWWp8CAysGfjAgMB -AAGgIzAhBgkqhkiG9w0BCQcxFBMScGFzc3dvcmQgY2hhbGxlbmdlMA0GCSqGSIb3 -DQEBBQUAA4GBAGJO7grHeVHXetjHEK8urIxdnvfB2qeZeObz4GPKIkqUurjr0rfj -bA3EK1kDMR5aeQWR8RunixdM16Q6Ry0lEdLVWkdSwRN9dmirIHT9cypqnD/FYOia -SdezZ0lUzXgmJIwRYRwB1KSMMocIf52ll/xC2bEGg7/ZAEuAyAgcZV3X ------END CERTIFICATE REQUEST----- diff --git a/node_modules/api-easy/node_modules/request/tests/ssl/ca/ca.key b/node_modules/api-easy/node_modules/request/tests/ssl/ca/ca.key deleted file mode 100644 index a53e7f7..0000000 --- a/node_modules/api-easy/node_modules/request/tests/ssl/ca/ca.key +++ /dev/null @@ -1,18 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,C8B5887048377F02 - -nyD5ZH0Wup2uWsDvurq5mKDaDrf8lvNn9w0SH/ZkVnfR1/bkwqrFriqJWvZNUG+q -nS0iBYczsWLJnbub9a1zLOTENWUKVD5uqbC3aGHhnoUTNSa27DONgP8gHOn6JgR+ -GAKo01HCSTiVT4LjkwN337QKHnMP2fTzg+IoC/CigvMcq09hRLwU1/guq0GJKGwH -gTxYNuYmQC4Tjh8vdS4liF+Ve/P3qPR2CehZrIOkDT8PHJBGQJRo4xGUIB7Tpk38 -VCk+UZ0JCS2coY8VkY/9tqFJp/ZnnQQVmaNbdRqg7ECKL+bXnNo7yjzmazPZmPe3 -/ShbE0+CTt7LrjCaQAxWbeDzqfo1lQfgN1LulTm8MCXpQaJpv7v1VhIhQ7afjMYb -4thW/ypHPiYS2YJCAkAVlua9Oxzzh1qJoh8Df19iHtpd79Q77X/qf+1JvITlMu0U -gi7yEatmQcmYNws1mtTC1q2DXrO90c+NZ0LK/Alse6NRL/xiUdjug2iHeTf/idOR -Gg/5dSZbnnlj1E5zjSMDkzg6EHAFmHV4jYGSAFLEQgp4V3ZhMVoWZrvvSHgKV/Qh -FqrAK4INr1G2+/QTd09AIRzfy3/j6yD4A9iNaOsEf9Ua7Qh6RcALRCAZTWR5QtEf -dX+iSNJ4E85qXs0PqwkMDkoaxIJ+tmIRJY7y8oeylV8cfGAi8Soubt/i3SlR8IHC -uDMas/2OnwafK3N7ODeE1i7r7wkzQkSHaEz0TrF8XRnP25jAICCSLiMdAAjKfxVb -EvzsFSuAy3Jt6bU3hSLY9o4YVYKE+68ITMv9yNjvTsEiW+T+IbN34w== ------END RSA PRIVATE KEY----- diff --git a/node_modules/api-easy/node_modules/request/tests/ssl/ca/ca.srl b/node_modules/api-easy/node_modules/request/tests/ssl/ca/ca.srl deleted file mode 100644 index 17128db..0000000 --- a/node_modules/api-easy/node_modules/request/tests/ssl/ca/ca.srl +++ /dev/null @@ -1 +0,0 @@ -ADF62016AA40C9C3 diff --git a/node_modules/api-easy/node_modules/request/tests/ssl/ca/server.cnf b/node_modules/api-easy/node_modules/request/tests/ssl/ca/server.cnf deleted file mode 100644 index cd1fd1e..0000000 --- a/node_modules/api-easy/node_modules/request/tests/ssl/ca/server.cnf +++ /dev/null @@ -1,19 +0,0 @@ -[ req ] -default_bits = 1024 -days = 3650 -distinguished_name = req_distinguished_name -attributes = req_attributes -prompt = no - -[ req_distinguished_name ] -C = US -ST = CA -L = Oakland -O = request -OU = testing -CN = testing.request.mikealrogers.com -emailAddress = mikeal@mikealrogers.com - -[ req_attributes ] -challengePassword = password challenge - diff --git a/node_modules/api-easy/node_modules/request/tests/ssl/ca/server.crt b/node_modules/api-easy/node_modules/request/tests/ssl/ca/server.crt deleted file mode 100644 index efe96ce..0000000 --- a/node_modules/api-easy/node_modules/request/tests/ssl/ca/server.crt +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICejCCAeMCCQCt9iAWqkDJwzANBgkqhkiG9w0BAQUFADCBojELMAkGA1UEBhMC -VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMRAwDgYDVQQKEwdyZXF1 -ZXN0MSYwJAYDVQQLEx1yZXF1ZXN0IENlcnRpZmljYXRlIEF1dGhvcml0eTESMBAG -A1UEAxMJcmVxdWVzdENBMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlrZWFscm9n -ZXJzLmNvbTAeFw0xMjAzMDEyMjUwNTZaFw0yMjAyMjcyMjUwNTZaMIGjMQswCQYD -VQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNVBAcTB09ha2xhbmQxEDAOBgNVBAoT -B3JlcXVlc3QxEDAOBgNVBAsTB3Rlc3RpbmcxKTAnBgNVBAMTIHRlc3RpbmcucmVx -dWVzdC5taWtlYWxyb2dlcnMuY29tMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlr -ZWFscm9nZXJzLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDgVl0jMumvOpmM -20W5v9yhGgZj8hPhEQF/N7yCBVBn/rWGYm70IHC8T/pR5c0LkWc5gdnCJEvKWQjh -DBKxZD8FAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEABShRkNgFbgs4vUWW9R9deNJj -7HJoiTmvkmoOC7QzcYkjdgHbOxsSq3rBnwxsVjY9PAtPwBn0GRspOeG7KzKRgySB -kb22LyrCFKbEOfKO/+CJc80ioK9zEPVjGsFMyAB+ftYRqM+s/4cQlTg/m89l01wC -yapjN3RxZbInGhWR+jA= ------END CERTIFICATE----- diff --git a/node_modules/api-easy/node_modules/request/tests/ssl/ca/server.csr b/node_modules/api-easy/node_modules/request/tests/ssl/ca/server.csr deleted file mode 100644 index a8e7595..0000000 --- a/node_modules/api-easy/node_modules/request/tests/ssl/ca/server.csr +++ /dev/null @@ -1,11 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIBgjCCASwCAQAwgaMxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEQMA4GA1UE -BxMHT2FrbGFuZDEQMA4GA1UEChMHcmVxdWVzdDEQMA4GA1UECxMHdGVzdGluZzEp -MCcGA1UEAxMgdGVzdGluZy5yZXF1ZXN0Lm1pa2VhbHJvZ2Vycy5jb20xJjAkBgkq -hkiG9w0BCQEWF21pa2VhbEBtaWtlYWxyb2dlcnMuY29tMFwwDQYJKoZIhvcNAQEB -BQADSwAwSAJBAOBWXSMy6a86mYzbRbm/3KEaBmPyE+ERAX83vIIFUGf+tYZibvQg -cLxP+lHlzQuRZzmB2cIkS8pZCOEMErFkPwUCAwEAAaAjMCEGCSqGSIb3DQEJBzEU -ExJwYXNzd29yZCBjaGFsbGVuZ2UwDQYJKoZIhvcNAQEFBQADQQBD3E5WekQzCEJw -7yOcqvtPYIxGaX8gRKkYfLPoj3pm3GF5SGqtJKhylKfi89szHXgktnQgzff9FN+A -HidVJ/3u ------END CERTIFICATE REQUEST----- diff --git a/node_modules/api-easy/node_modules/request/tests/ssl/ca/server.js b/node_modules/api-easy/node_modules/request/tests/ssl/ca/server.js deleted file mode 100644 index 05e21c1..0000000 --- a/node_modules/api-easy/node_modules/request/tests/ssl/ca/server.js +++ /dev/null @@ -1,28 +0,0 @@ -var fs = require("fs") -var https = require("https") -var options = { key: fs.readFileSync("./server.key") - , cert: fs.readFileSync("./server.crt") } - -var server = https.createServer(options, function (req, res) { - res.writeHead(200) - res.end() - server.close() -}) -server.listen(1337) - -var ca = fs.readFileSync("./ca.crt") -var agent = new https.Agent({ host: "localhost", port: 1337, ca: ca }) - -https.request({ host: "localhost" - , method: "HEAD" - , port: 1337 - , headers: { host: "testing.request.mikealrogers.com" } - , agent: agent - , ca: [ ca ] - , path: "/" }, function (res) { - if (res.client.authorized) { - console.log("node test: OK") - } else { - throw new Error(res.client.authorizationError) - } -}).end() diff --git a/node_modules/api-easy/node_modules/request/tests/ssl/ca/server.key b/node_modules/api-easy/node_modules/request/tests/ssl/ca/server.key deleted file mode 100644 index 72d8698..0000000 --- a/node_modules/api-easy/node_modules/request/tests/ssl/ca/server.key +++ /dev/null @@ -1,9 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIBOwIBAAJBAOBWXSMy6a86mYzbRbm/3KEaBmPyE+ERAX83vIIFUGf+tYZibvQg -cLxP+lHlzQuRZzmB2cIkS8pZCOEMErFkPwUCAwEAAQJAK+r8ZM2sze8s7FRo/ApB -iRBtO9fCaIdJwbwJnXKo4RKwZDt1l2mm+fzZ+/QaQNjY1oTROkIIXmnwRvZWfYlW -gQIhAPKYsG+YSBN9o8Sdp1DMyZ/rUifKX3OE6q9tINkgajDVAiEA7Ltqh01+cnt0 -JEnud/8HHcuehUBLMofeg0G+gCnSbXECIQCqDvkXsWNNLnS/3lgsnvH0Baz4sbeJ -rjIpuVEeg8eM5QIgbu0+9JmOV6ybdmmiMV4yAncoF35R/iKGVHDZCAsQzDECIQDZ -0jGz22tlo5YMcYSqrdD3U4sds1pwiAaWFRbCunoUJw== ------END RSA PRIVATE KEY----- diff --git a/node_modules/api-easy/node_modules/request/tests/ssl/npm-ca.crt b/node_modules/api-easy/node_modules/request/tests/ssl/npm-ca.crt deleted file mode 100644 index fde2fe9..0000000 --- a/node_modules/api-easy/node_modules/request/tests/ssl/npm-ca.crt +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIChzCCAfACCQDauvz/KHp8ejANBgkqhkiG9w0BAQUFADCBhzELMAkGA1UEBhMC -VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMQwwCgYDVQQKEwNucG0x -IjAgBgNVBAsTGW5wbSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxDjAMBgNVBAMTBW5w -bUNBMRcwFQYJKoZIhvcNAQkBFghpQGl6cy5tZTAeFw0xMTA5MDUwMTQ3MTdaFw0y -MTA5MDIwMTQ3MTdaMIGHMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNV -BAcTB09ha2xhbmQxDDAKBgNVBAoTA25wbTEiMCAGA1UECxMZbnBtIENlcnRpZmlj -YXRlIEF1dGhvcml0eTEOMAwGA1UEAxMFbnBtQ0ExFzAVBgkqhkiG9w0BCQEWCGlA -aXpzLm1lMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLI4tIqPpRW+ACw9GE -OgBlJZwK5f8nnKCLK629Pv5yJpQKs3DENExAyOgDcyaF0HD0zk8zTp+ZsLaNdKOz -Gn2U181KGprGKAXP6DU6ByOJDWmTlY6+Ad1laYT0m64fERSpHw/hjD3D+iX4aMOl -y0HdbT5m1ZGh6SJz3ZqxavhHLQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAC4ySDbC -l7W1WpLmtLGEQ/yuMLUf6Jy/vr+CRp4h+UzL+IQpCv8FfxsYE7dhf/bmWTEupBkv -yNL18lipt2jSvR3v6oAHAReotvdjqhxddpe5Holns6EQd1/xEZ7sB1YhQKJtvUrl -ZNufy1Jf1r0ldEGeA+0ISck7s+xSh9rQD2Op ------END CERTIFICATE----- diff --git a/node_modules/api-easy/node_modules/request/tests/ssl/test.crt b/node_modules/api-easy/node_modules/request/tests/ssl/test.crt deleted file mode 100644 index b357f86..0000000 --- a/node_modules/api-easy/node_modules/request/tests/ssl/test.crt +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICQzCCAawCCQCO/XWtRFck1jANBgkqhkiG9w0BAQUFADBmMQswCQYDVQQGEwJU -SDEQMA4GA1UECBMHQmFuZ2tvazEOMAwGA1UEBxMFU2lsb20xGzAZBgNVBAoTElRo -ZSBSZXF1ZXN0IE1vZHVsZTEYMBYGA1UEAxMPcmVxdWVzdC5leGFtcGxlMB4XDTEx -MTIwMzAyMjkyM1oXDTIxMTEzMDAyMjkyM1owZjELMAkGA1UEBhMCVEgxEDAOBgNV -BAgTB0Jhbmdrb2sxDjAMBgNVBAcTBVNpbG9tMRswGQYDVQQKExJUaGUgUmVxdWVz -dCBNb2R1bGUxGDAWBgNVBAMTD3JlcXVlc3QuZXhhbXBsZTCBnzANBgkqhkiG9w0B -AQEFAAOBjQAwgYkCgYEAwmctddZqlA48+NXs0yOy92DijcQV1jf87zMiYAIlNUto -wghVbTWgJU5r0pdKrD16AptnWJTzKanhItEX8XCCPgsNkq1afgTtJP7rNkwu3xcj -eIMkhJg/ay4ZnkbnhYdsii5VTU5prix6AqWRAhbkBgoA+iVyHyof8wvZyKBoFTMC -AwEAATANBgkqhkiG9w0BAQUFAAOBgQB6BybMJbpeiABgihDfEVBcAjDoQ8gUMgwV -l4NulugfKTDmArqnR9aPd4ET5jX5dkMP4bwCHYsvrcYDeWEQy7x5WWuylOdKhua4 -L4cEi2uDCjqEErIG3cc1MCOk6Cl6Ld6tkIzQSf953qfdEACRytOeUqLNQcrXrqeE -c7U8F6MWLQ== ------END CERTIFICATE----- diff --git a/node_modules/api-easy/node_modules/request/tests/ssl/test.key b/node_modules/api-easy/node_modules/request/tests/ssl/test.key deleted file mode 100644 index b85810d..0000000 --- a/node_modules/api-easy/node_modules/request/tests/ssl/test.key +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXgIBAAKBgQDCZy111mqUDjz41ezTI7L3YOKNxBXWN/zvMyJgAiU1S2jCCFVt -NaAlTmvSl0qsPXoCm2dYlPMpqeEi0RfxcII+Cw2SrVp+BO0k/us2TC7fFyN4gySE -mD9rLhmeRueFh2yKLlVNTmmuLHoCpZECFuQGCgD6JXIfKh/zC9nIoGgVMwIDAQAB -AoGBALXFwfUf8vHTSmGlrdZS2AGFPvEtuvldyoxi9K5u8xmdFCvxnOcLsF2RsTHt -Mu5QYWhUpNJoG+IGLTPf7RJdj/kNtEs7xXqWy4jR36kt5z5MJzqiK+QIgiO9UFWZ -fjUb6oeDnTIJA9YFBdYi97MDuL89iU/UK3LkJN3hd4rciSbpAkEA+MCkowF5kSFb -rkOTBYBXZfiAG78itDXN6DXmqb9XYY+YBh3BiQM28oxCeQYyFy6pk/nstnd4TXk6 -V/ryA2g5NwJBAMgRKTY9KvxJWbESeMEFe2iBIV0c26/72Amgi7ZKUCLukLfD4tLF -+WSZdmTbbqI1079YtwaiOVfiLm45Q/3B0eUCQAaQ/0eWSGE+Yi8tdXoVszjr4GXb -G81qBi91DMu6U1It+jNfIba+MPsiHLcZJMVb4/oWBNukN7bD1nhwFWdlnu0CQQCf -Is9WHkdvz2RxbZDxb8verz/7kXXJQJhx5+rZf7jIYFxqX3yvTNv3wf2jcctJaWlZ -fVZwB193YSivcgt778xlAkEAprYUz3jczjF5r2hrgbizPzPDR94tM5BTO3ki2v3w -kbf+j2g7FNAx6kZiVN8XwfLc8xEeUGiPKwtq3ddPDFh17w== ------END RSA PRIVATE KEY----- diff --git a/node_modules/api-easy/node_modules/request/tests/test-body.js b/node_modules/api-easy/node_modules/request/tests/test-body.js deleted file mode 100644 index 9d2e188..0000000 --- a/node_modules/api-easy/node_modules/request/tests/test-body.js +++ /dev/null @@ -1,95 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetBuffer : - { resp : server.createGetResponse(new Buffer("TESTING!")) - , encoding: null - , expectBody: new Buffer("TESTING!") - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--frontier\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--frontier\r\n\r\n' + - 'Oh hi.' + - '\r\n--frontier--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - test.uri = s.url + '/' + i - request(test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) - diff --git a/node_modules/api-easy/node_modules/request/tests/test-cookie.js b/node_modules/api-easy/node_modules/request/tests/test-cookie.js deleted file mode 100644 index f17cfb3..0000000 --- a/node_modules/api-easy/node_modules/request/tests/test-cookie.js +++ /dev/null @@ -1,29 +0,0 @@ -var Cookie = require('../vendor/cookie') - , assert = require('assert'); - -var str = 'sid="s543qactge.wKE61E01Bs%2BKhzmxrwrnug="; path=/; httpOnly; expires=Sat, 04 Dec 2010 23:27:28 GMT'; -var cookie = new Cookie(str); - -// test .toString() -assert.equal(cookie.toString(), str); - -// test .path -assert.equal(cookie.path, '/'); - -// test .httpOnly -assert.equal(cookie.httpOnly, true); - -// test .name -assert.equal(cookie.name, 'sid'); - -// test .value -assert.equal(cookie.value, '"s543qactge.wKE61E01Bs%2BKhzmxrwrnug="'); - -// test .expires -assert.equal(cookie.expires instanceof Date, true); - -// test .path default -var cookie = new Cookie('foo=bar', { url: 'http://foo.com/bar' }); -assert.equal(cookie.path, '/bar'); - -console.log('All tests passed'); diff --git a/node_modules/api-easy/node_modules/request/tests/test-cookiejar.js b/node_modules/api-easy/node_modules/request/tests/test-cookiejar.js deleted file mode 100644 index 76fcd71..0000000 --- a/node_modules/api-easy/node_modules/request/tests/test-cookiejar.js +++ /dev/null @@ -1,90 +0,0 @@ -var Cookie = require('../vendor/cookie') - , Jar = require('../vendor/cookie/jar') - , assert = require('assert'); - -function expires(ms) { - return new Date(Date.now() + ms).toUTCString(); -} - -// test .get() expiration -(function() { - var jar = new Jar; - var cookie = new Cookie('sid=1234; path=/; expires=' + expires(1000)); - jar.add(cookie); - setTimeout(function(){ - var cookies = jar.get({ url: 'http://foo.com/foo' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], cookie); - setTimeout(function(){ - var cookies = jar.get({ url: 'http://foo.com/foo' }); - assert.equal(cookies.length, 0); - }, 1000); - }, 5); -})(); - -// test .get() path support -(function() { - var jar = new Jar; - var a = new Cookie('sid=1234; path=/'); - var b = new Cookie('sid=1111; path=/foo/bar'); - var c = new Cookie('sid=2222; path=/'); - jar.add(a); - jar.add(b); - jar.add(c); - - // should remove the duplicates - assert.equal(jar.cookies.length, 2); - - // same name, same path, latter prevails - var cookies = jar.get({ url: 'http://foo.com/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], c); - - // same name, diff path, path specifity prevails, latter prevails - var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], b); - - var jar = new Jar; - var a = new Cookie('sid=1111; path=/foo/bar'); - var b = new Cookie('sid=1234; path=/'); - jar.add(a); - jar.add(b); - - var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], a); - - var cookies = jar.get({ url: 'http://foo.com/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], b); - - var jar = new Jar; - var a = new Cookie('sid=1111; path=/foo/bar'); - var b = new Cookie('sid=3333; path=/foo/bar'); - var c = new Cookie('pid=3333; path=/foo/bar'); - var d = new Cookie('sid=2222; path=/foo/'); - var e = new Cookie('sid=1234; path=/'); - jar.add(a); - jar.add(b); - jar.add(c); - jar.add(d); - jar.add(e); - - var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); - assert.equal(cookies.length, 2); - assert.equal(cookies[0], b); - assert.equal(cookies[1], c); - - var cookies = jar.get({ url: 'http://foo.com/foo/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], d); - - var cookies = jar.get({ url: 'http://foo.com/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], e); -})(); - -setTimeout(function() { - console.log('All tests passed'); -}, 1200); diff --git a/node_modules/api-easy/node_modules/request/tests/test-defaults.js b/node_modules/api-easy/node_modules/request/tests/test-defaults.js deleted file mode 100644 index 6c8b58f..0000000 --- a/node_modules/api-easy/node_modules/request/tests/test-defaults.js +++ /dev/null @@ -1,68 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); - -s.listen(s.port, function () { - var counter = 0; - s.on('/get', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.method, 'GET') - resp.writeHead(200, {'Content-Type': 'text/plain'}); - resp.end('TESTING!'); - }); - - // test get(string, function) - request.defaults({headers:{foo:"bar"}})(s.url + '/get', function (e, r, b){ - if (e) throw e; - assert.deepEqual("TESTING!", b); - counter += 1; - }); - - s.on('/post', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.headers['content-type'], 'application/json'); - assert.equal(req.method, 'POST') - resp.writeHead(200, {'Content-Type': 'application/json'}); - resp.end(JSON.stringify({foo:'bar'})); - }); - - // test post(string, object, function) - request.defaults({headers:{foo:"bar"}}).post(s.url + '/post', {json: true}, function (e, r, b){ - if (e) throw e; - assert.deepEqual('bar', b.foo); - counter += 1; - }); - - s.on('/del', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.method, 'DELETE') - resp.writeHead(200, {'Content-Type': 'application/json'}); - resp.end(JSON.stringify({foo:'bar'})); - }); - - // test .del(string, function) - request.defaults({headers:{foo:"bar"}, json:true}).del(s.url + '/del', function (e, r, b){ - if (e) throw e; - assert.deepEqual('bar', b.foo); - counter += 1; - }); - - s.on('/head', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.method, 'HEAD') - resp.writeHead(200, {'Content-Type': 'text/plain'}); - resp.end(); - }); - - // test head.(object, function) - request.defaults({headers:{foo:"bar"}}).head({uri: s.url + '/head'}, function (e, r, b){ - if (e) throw e; - counter += 1; - console.log(counter.toString() + " tests passed.") - s.close() - }); - -}) diff --git a/node_modules/api-easy/node_modules/request/tests/test-errors.js b/node_modules/api-easy/node_modules/request/tests/test-errors.js deleted file mode 100644 index 1986a59..0000000 --- a/node_modules/api-easy/node_modules/request/tests/test-errors.js +++ /dev/null @@ -1,37 +0,0 @@ -var server = require('./server') - , events = require('events') - , assert = require('assert') - , request = require('../main.js') - ; - -var local = 'http://localhost:8888/asdf' - -try { - request({uri:local, body:{}}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Argument error, options.body.') -} - -try { - request({uri:local, multipart: 'foo'}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Argument error, options.multipart.') -} - -try { - request({uri:local, multipart: [{}]}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Body attribute missing in multipart.') -} - -try { - request(local, {multipart: [{}]}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Body attribute missing in multipart.') -} - -console.log("All tests passed.") diff --git a/node_modules/api-easy/node_modules/request/tests/test-headers.js b/node_modules/api-easy/node_modules/request/tests/test-headers.js deleted file mode 100644 index 31fe3f4..0000000 --- a/node_modules/api-easy/node_modules/request/tests/test-headers.js +++ /dev/null @@ -1,52 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , Cookie = require('../vendor/cookie') - , Jar = require('../vendor/cookie/jar') - , s = server.createServer() - -s.listen(s.port, function () { - var serverUri = 'http://localhost:' + s.port - , numTests = 0 - , numOutstandingTests = 0 - - function createTest(requestObj, serverAssertFn) { - var testNumber = numTests; - numTests += 1; - numOutstandingTests += 1; - s.on('/' + testNumber, function (req, res) { - serverAssertFn(req, res); - res.writeHead(200); - res.end(); - }); - requestObj.url = serverUri + '/' + testNumber - request(requestObj, function (err, res, body) { - assert.ok(!err) - assert.equal(res.statusCode, 200) - numOutstandingTests -= 1 - if (numOutstandingTests === 0) { - console.log(numTests + ' tests passed.') - s.close() - } - }) - } - - // Issue #125: headers.cookie shouldn't be replaced when a cookie jar isn't specified - createTest({headers: {cookie: 'foo=bar'}}, function (req, res) { - assert.ok(req.headers.cookie) - assert.equal(req.headers.cookie, 'foo=bar') - }) - - // Issue #125: headers.cookie + cookie jar - var jar = new Jar() - jar.add(new Cookie('quux=baz')); - createTest({jar: jar, headers: {cookie: 'foo=bar'}}, function (req, res) { - assert.ok(req.headers.cookie) - assert.equal(req.headers.cookie, 'foo=bar; quux=baz') - }) - - // There should be no cookie header when neither headers.cookie nor a cookie jar is specified - createTest({}, function (req, res) { - assert.ok(!req.headers.cookie) - }) -}) diff --git a/node_modules/api-easy/node_modules/request/tests/test-httpModule.js b/node_modules/api-easy/node_modules/request/tests/test-httpModule.js deleted file mode 100644 index 1866de2..0000000 --- a/node_modules/api-easy/node_modules/request/tests/test-httpModule.js +++ /dev/null @@ -1,94 +0,0 @@ -var http = require('http') - , https = require('https') - , server = require('./server') - , assert = require('assert') - , request = require('../main.js') - - -var faux_requests_made = {'http':0, 'https':0} -function wrap_request(name, module) { - // Just like the http or https module, but note when a request is made. - var wrapped = {} - Object.keys(module).forEach(function(key) { - var value = module[key]; - - if(key != 'request') - wrapped[key] = value; - else - wrapped[key] = function(options, callback) { - faux_requests_made[name] += 1 - return value.apply(this, arguments) - } - }) - - return wrapped; -} - - -var faux_http = wrap_request('http', http) - , faux_https = wrap_request('https', https) - , plain_server = server.createServer() - , https_server = server.createSSLServer() - - -plain_server.listen(plain_server.port, function() { - plain_server.on('/plain', function (req, res) { - res.writeHead(200) - res.end('plain') - }) - plain_server.on('/to_https', function (req, res) { - res.writeHead(301, {'location':'https://localhost:'+https_server.port + '/https'}) - res.end() - }) - - https_server.listen(https_server.port, function() { - https_server.on('/https', function (req, res) { - res.writeHead(200) - res.end('https') - }) - https_server.on('/to_plain', function (req, res) { - res.writeHead(302, {'location':'http://localhost:'+plain_server.port + '/plain'}) - res.end() - }) - - run_tests() - run_tests({}) - run_tests({'http:':faux_http}) - run_tests({'https:':faux_https}) - run_tests({'http:':faux_http, 'https:':faux_https}) - }) -}) - -function run_tests(httpModules) { - var to_https = 'http://localhost:'+plain_server.port+'/to_https' - var to_plain = 'https://localhost:'+https_server.port+'/to_plain' - - request(to_https, {'httpModules':httpModules}, function (er, res, body) { - assert.ok(!er, 'Bounce to SSL worked') - assert.equal(body, 'https', 'Received HTTPS server body') - done() - }) - - request(to_plain, {'httpModules':httpModules}, function (er, res, body) { - assert.ok(!er, 'Bounce to plaintext server worked') - assert.equal(body, 'plain', 'Received HTTPS server body') - done() - }) -} - - -var passed = 0; -function done() { - passed += 1 - var expected = 10 - - if(passed == expected) { - plain_server.close() - https_server.close() - - assert.equal(faux_requests_made.http, 4, 'Wrapped http module called appropriately') - assert.equal(faux_requests_made.https, 4, 'Wrapped https module called appropriately') - - console.log((expected+2) + ' tests passed.') - } -} diff --git a/node_modules/api-easy/node_modules/request/tests/test-https-strict.js b/node_modules/api-easy/node_modules/request/tests/test-https-strict.js deleted file mode 100644 index f53fc14..0000000 --- a/node_modules/api-easy/node_modules/request/tests/test-https-strict.js +++ /dev/null @@ -1,97 +0,0 @@ -// a test where we validate the siguature of the keys -// otherwise exactly the same as the ssl test - -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , fs = require('fs') - , path = require('path') - , opts = { key: path.resolve(__dirname, 'ssl/ca/server.key') - , cert: path.resolve(__dirname, 'ssl/ca/server.crt') } - , s = server.createSSLServer(null, opts) - , caFile = path.resolve(__dirname, 'ssl/ca/ca.crt') - , ca = fs.readFileSync(caFile) - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--frontier\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--frontier\r\n\r\n' + - 'Oh hi.' + - '\r\n--frontier--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - test.uri = s.url + '/' + i - test.strictSSL = true - test.ca = ca - test.headers = { host: 'testing.request.mikealrogers.com' } - request(test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) diff --git a/node_modules/api-easy/node_modules/request/tests/test-https.js b/node_modules/api-easy/node_modules/request/tests/test-https.js deleted file mode 100644 index df7330b..0000000 --- a/node_modules/api-easy/node_modules/request/tests/test-https.js +++ /dev/null @@ -1,86 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - -var s = server.createSSLServer(); - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--frontier\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--frontier\r\n\r\n' + - 'Oh hi.' + - '\r\n--frontier--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - test.uri = s.url + '/' + i - request(test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) diff --git a/node_modules/api-easy/node_modules/request/tests/test-oauth.js b/node_modules/api-easy/node_modules/request/tests/test-oauth.js deleted file mode 100644 index e9d3290..0000000 --- a/node_modules/api-easy/node_modules/request/tests/test-oauth.js +++ /dev/null @@ -1,117 +0,0 @@ -var hmacsign = require('../oauth').hmacsign - , assert = require('assert') - , qs = require('querystring') - , request = require('../main') - ; - -function getsignature (r) { - var sign - r.headers.authorization.slice('OAuth '.length).replace(/,\ /g, ',').split(',').forEach(function (v) { - if (v.slice(0, 'oauth_signature="'.length) === 'oauth_signature="') sign = v.slice('oauth_signature="'.length, -1) - }) - return decodeURIComponent(sign) -} - -// Tests from Twitter documentation https://dev.twitter.com/docs/auth/oauth - -var reqsign = hmacsign('POST', 'https://api.twitter.com/oauth/request_token', - { oauth_callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11' - , oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g' - , oauth_nonce: 'QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk' - , oauth_signature_method: 'HMAC-SHA1' - , oauth_timestamp: '1272323042' - , oauth_version: '1.0' - }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98") - -console.log(reqsign) -console.log('8wUi7m5HFQy76nowoCThusfgB+Q=') -assert.equal(reqsign, '8wUi7m5HFQy76nowoCThusfgB+Q=') - -var accsign = hmacsign('POST', 'https://api.twitter.com/oauth/access_token', - { oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g' - , oauth_nonce: '9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8' - , oauth_signature_method: 'HMAC-SHA1' - , oauth_token: '8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc' - , oauth_timestamp: '1272323047' - , oauth_verifier: 'pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY' - , oauth_version: '1.0' - }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "x6qpRnlEmW9JbQn4PQVVeVG8ZLPEx6A0TOebgwcuA") - -console.log(accsign) -console.log('PUw/dHA4fnlJYM6RhXk5IU/0fCc=') -assert.equal(accsign, 'PUw/dHA4fnlJYM6RhXk5IU/0fCc=') - -var upsign = hmacsign('POST', 'http://api.twitter.com/1/statuses/update.json', - { oauth_consumer_key: "GDdmIQH6jhtmLUypg82g" - , oauth_nonce: "oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y" - , oauth_signature_method: "HMAC-SHA1" - , oauth_token: "819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw" - , oauth_timestamp: "1272325550" - , oauth_version: "1.0" - , status: 'setting up my twitter 私のさえずりを設定する' - }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA") - -console.log(upsign) -console.log('yOahq5m0YjDDjfjxHaXEsW9D+X0=') -assert.equal(upsign, 'yOahq5m0YjDDjfjxHaXEsW9D+X0=') - - -var rsign = request.post( - { url: 'https://api.twitter.com/oauth/request_token' - , oauth: - { callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11' - , consumer_key: 'GDdmIQH6jhtmLUypg82g' - , nonce: 'QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk' - , timestamp: '1272323042' - , version: '1.0' - , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" - } - }) - -setTimeout(function () { - console.log(getsignature(rsign)) - assert.equal(reqsign, getsignature(rsign)) -}) - -var raccsign = request.post( - { url: 'https://api.twitter.com/oauth/access_token' - , oauth: - { consumer_key: 'GDdmIQH6jhtmLUypg82g' - , nonce: '9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8' - , signature_method: 'HMAC-SHA1' - , token: '8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc' - , timestamp: '1272323047' - , verifier: 'pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY' - , version: '1.0' - , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" - , token_secret: "x6qpRnlEmW9JbQn4PQVVeVG8ZLPEx6A0TOebgwcuA" - } - }) - -setTimeout(function () { - console.log(getsignature(raccsign)) - assert.equal(accsign, getsignature(raccsign)) -}, 1) - -var rupsign = request.post( - { url: 'http://api.twitter.com/1/statuses/update.json' - , oauth: - { consumer_key: "GDdmIQH6jhtmLUypg82g" - , nonce: "oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y" - , signature_method: "HMAC-SHA1" - , token: "819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw" - , timestamp: "1272325550" - , version: "1.0" - , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" - , token_secret: "J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA" - } - , form: {status: 'setting up my twitter 私のさえずりを設定する'} - }) -setTimeout(function () { - console.log(getsignature(rupsign)) - assert.equal(upsign, getsignature(rupsign)) -}, 1) - - - - diff --git a/node_modules/api-easy/node_modules/request/tests/test-params.js b/node_modules/api-easy/node_modules/request/tests/test-params.js deleted file mode 100644 index 8354f6d..0000000 --- a/node_modules/api-easy/node_modules/request/tests/test-params.js +++ /dev/null @@ -1,92 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetBuffer : - { resp : server.createGetResponse(new Buffer("TESTING!")) - , encoding: null - , expectBody: new Buffer("TESTING!") - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--frontier\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--frontier\r\n\r\n' + - 'Oh hi.' + - '\r\n--frontier--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - //test.uri = s.url + '/' + i - request(s.url + '/' + i, test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) diff --git a/node_modules/api-easy/node_modules/request/tests/test-pipes.js b/node_modules/api-easy/node_modules/request/tests/test-pipes.js deleted file mode 100644 index 1869874..0000000 --- a/node_modules/api-easy/node_modules/request/tests/test-pipes.js +++ /dev/null @@ -1,202 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , fs = require('fs') - , request = require('../main.js') - , path = require('path') - , util = require('util') - ; - -var s = server.createServer(3453); - -function ValidationStream(str) { - this.str = str - this.buf = '' - this.on('data', function (data) { - this.buf += data - }) - this.on('end', function () { - assert.equal(this.str, this.buf) - }) - this.writable = true -} -util.inherits(ValidationStream, stream.Stream) -ValidationStream.prototype.write = function (chunk) { - this.emit('data', chunk) -} -ValidationStream.prototype.end = function (chunk) { - if (chunk) emit('data', chunk) - this.emit('end') -} - -s.listen(s.port, function () { - counter = 0; - - var check = function () { - counter = counter - 1 - if (counter === 0) { - console.log('All tests passed.') - setTimeout(function () { - process.exit(); - }, 500) - } - } - - // Test pipeing to a request object - s.once('/push', server.createPostValidator("mydata")); - - var mydata = new stream.Stream(); - mydata.readable = true - - counter++ - var r1 = request.put({url:'http://localhost:3453/push'}, function () { - check(); - }) - mydata.pipe(r1) - - mydata.emit('data', 'mydata'); - mydata.emit('end'); - - - // Test pipeing from a request object. - s.once('/pull', server.createGetResponse("mypulldata")); - - var mypulldata = new stream.Stream(); - mypulldata.writable = true - - counter++ - request({url:'http://localhost:3453/pull'}).pipe(mypulldata) - - var d = ''; - - mypulldata.write = function (chunk) { - d += chunk; - } - mypulldata.end = function () { - assert.equal(d, 'mypulldata'); - check(); - }; - - - s.on('/cat', function (req, resp) { - if (req.method === "GET") { - resp.writeHead(200, {'content-type':'text/plain-test', 'content-length':4}); - resp.end('asdf') - } else if (req.method === "PUT") { - assert.equal(req.headers['content-type'], 'text/plain-test'); - assert.equal(req.headers['content-length'], 4) - var validate = ''; - - req.on('data', function (chunk) {validate += chunk}) - req.on('end', function () { - resp.writeHead(201); - resp.end(); - assert.equal(validate, 'asdf'); - check(); - }) - } - }) - s.on('/pushjs', function (req, resp) { - if (req.method === "PUT") { - assert.equal(req.headers['content-type'], 'text/javascript'); - check(); - } - }) - s.on('/catresp', function (req, resp) { - request.get('http://localhost:3453/cat').pipe(resp) - }) - s.on('/doodle', function (req, resp) { - if (req.headers['x-oneline-proxy']) { - resp.setHeader('x-oneline-proxy', 'yup') - } - resp.writeHead('200', {'content-type':'image/png'}) - fs.createReadStream(path.join(__dirname, 'googledoodle.png')).pipe(resp) - }) - s.on('/onelineproxy', function (req, resp) { - var x = request('http://localhost:3453/doodle') - req.pipe(x) - x.pipe(resp) - }) - - counter++ - fs.createReadStream(__filename).pipe(request.put('http://localhost:3453/pushjs')) - - counter++ - request.get('http://localhost:3453/cat').pipe(request.put('http://localhost:3453/cat')) - - counter++ - request.get('http://localhost:3453/catresp', function (e, resp, body) { - assert.equal(resp.headers['content-type'], 'text/plain-test'); - assert.equal(resp.headers['content-length'], 4) - check(); - }) - - var doodleWrite = fs.createWriteStream(path.join(__dirname, 'test.png')) - - counter++ - request.get('http://localhost:3453/doodle').pipe(doodleWrite) - - doodleWrite.on('close', function () { - assert.deepEqual(fs.readFileSync(path.join(__dirname, 'googledoodle.png')), fs.readFileSync(path.join(__dirname, 'test.png'))) - check() - }) - - process.on('exit', function () { - fs.unlinkSync(path.join(__dirname, 'test.png')) - }) - - counter++ - request.get({uri:'http://localhost:3453/onelineproxy', headers:{'x-oneline-proxy':'nope'}}, function (err, resp, body) { - assert.equal(resp.headers['x-oneline-proxy'], 'yup') - check() - }) - - s.on('/afterresponse', function (req, resp) { - resp.write('d') - resp.end() - }) - - counter++ - var afterresp = request.post('http://localhost:3453/afterresponse').on('response', function () { - var v = new ValidationStream('d') - afterresp.pipe(v) - v.on('end', check) - }) - - s.on('/forward1', function (req, resp) { - resp.writeHead(302, {location:'/forward2'}) - resp.end() - }) - s.on('/forward2', function (req, resp) { - resp.writeHead('200', {'content-type':'image/png'}) - resp.write('d') - resp.end() - }) - - counter++ - var validateForward = new ValidationStream('d') - validateForward.on('end', check) - request.get('http://localhost:3453/forward1').pipe(validateForward) - - // Test pipe options - s.once('/opts', server.createGetResponse('opts response')); - - var optsStream = new stream.Stream(); - optsStream.writable = true - - var optsData = ''; - optsStream.write = function (buf) { - optsData += buf; - if (optsData === 'opts response') { - setTimeout(check, 10); - } - } - - optsStream.end = function () { - assert.fail('end called') - }; - - counter++ - request({url:'http://localhost:3453/opts'}).pipe(optsStream, { end : false }) -}) diff --git a/node_modules/api-easy/node_modules/request/tests/test-proxy.js b/node_modules/api-easy/node_modules/request/tests/test-proxy.js deleted file mode 100644 index 647157c..0000000 --- a/node_modules/api-easy/node_modules/request/tests/test-proxy.js +++ /dev/null @@ -1,39 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , fs = require('fs') - , request = require('../main.js') - , path = require('path') - , util = require('util') - ; - -var port = 6768 - , called = false - , proxiedHost = 'google.com' - ; - -var s = server.createServer(port) -s.listen(port, function () { - s.on('http://google.com/', function (req, res) { - called = true - assert.equal(req.headers.host, proxiedHost) - res.writeHeader(200) - res.end() - }) - request ({ - url: 'http://'+proxiedHost, - proxy: 'http://localhost:'+port - /* - //should behave as if these arguments where passed: - url: 'http://localhost:'+port, - headers: {host: proxiedHost} - //*/ - }, function (err, res, body) { - s.close() - }) -}) - -process.on('exit', function () { - assert.ok(called, 'the request must be made to the proxy server') -}) diff --git a/node_modules/api-easy/node_modules/request/tests/test-qs.js b/node_modules/api-easy/node_modules/request/tests/test-qs.js deleted file mode 100644 index 1aac22b..0000000 --- a/node_modules/api-easy/node_modules/request/tests/test-qs.js +++ /dev/null @@ -1,28 +0,0 @@ -var request = request = require('../main.js') - , assert = require('assert') - ; - - -// Test adding a querystring -var req1 = request.get({ uri: 'http://www.google.com', qs: { q : 'search' }}) -setTimeout(function() { - assert.equal('/?q=search', req1.path) -}, 1) - -// Test replacing a querystring value -var req2 = request.get({ uri: 'http://www.google.com?q=abc', qs: { q : 'search' }}) -setTimeout(function() { - assert.equal('/?q=search', req2.path) -}, 1) - -// Test appending a querystring value to the ones present in the uri -var req3 = request.get({ uri: 'http://www.google.com?x=y', qs: { q : 'search' }}) -setTimeout(function() { - assert.equal('/?x=y&q=search', req3.path) -}, 1) - -// Test leaving a querystring alone -var req4 = request.get({ uri: 'http://www.google.com?x=y'}) -setTimeout(function() { - assert.equal('/?x=y', req4.path) -}, 1) diff --git a/node_modules/api-easy/node_modules/request/tests/test-redirect.js b/node_modules/api-easy/node_modules/request/tests/test-redirect.js deleted file mode 100644 index 54fc19b..0000000 --- a/node_modules/api-easy/node_modules/request/tests/test-redirect.js +++ /dev/null @@ -1,159 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , Cookie = require('../vendor/cookie') - , Jar = require('../vendor/cookie/jar') - -var s = server.createServer() - -s.listen(s.port, function () { - var server = 'http://localhost:' + s.port; - var hits = {} - var passed = 0; - - bouncer(301, 'temp') - bouncer(302, 'perm') - bouncer(302, 'nope') - - function bouncer(code, label) { - var landing = label+'_landing'; - - s.on('/'+label, function (req, res) { - hits[label] = true; - res.writeHead(code, {'location':server + '/'+landing}) - res.end() - }) - - s.on('/'+landing, function (req, res) { - if (req.method !== 'GET') { // We should only accept GET redirects - console.error("Got a non-GET request to the redirect destination URL"); - resp.writeHead(400); - resp.end(); - return; - } - // Make sure the cookie doesn't get included twice, see #139: - assert.equal(req.headers.cookie, 'foo=bar; quux=baz'); - hits[landing] = true; - res.writeHead(200) - res.end(landing) - }) - } - - // Permanent bounce - var jar = new Jar() - jar.add(new Cookie('quux=baz')) - request({uri: server+'/perm', jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.perm, 'Original request is to /perm') - assert.ok(hits.perm_landing, 'Forward to permanent landing URL') - assert.equal(body, 'perm_landing', 'Got permanent landing content') - passed += 1 - } finally { - done() - } - }) - - // Temporary bounce - request({uri: server+'/temp', jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(hits.temp_landing, 'Forward to temporary landing URL') - assert.equal(body, 'temp_landing', 'Got temporary landing content') - passed += 1 - } finally { - done() - } - }) - - // Prevent bouncing. - request({uri:server+'/nope', jar: jar, headers: {cookie: 'foo=bar'}, followRedirect:false}, function (er, res, body) { - try { - assert.ok(hits.nope, 'Original request to /nope') - assert.ok(!hits.nope_landing, 'No chasing the redirect') - assert.equal(res.statusCode, 302, 'Response is the bounce itself') - passed += 1 - } finally { - done() - } - }) - - // Should not follow post redirects by default - request.post(server+'/temp', { jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect when post') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - } finally { - done() - } - }) - - // Should follow post redirects when followAllRedirects true - request.post({uri:server+'/temp', followAllRedirects:true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(hits.temp_landing, 'Forward to temporary landing URL') - assert.equal(body, 'temp_landing', 'Got temporary landing content') - passed += 1 - } finally { - done() - } - }) - - request.post({uri:server+'/temp', followAllRedirects:false, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - } finally { - done() - } - }) - - // Should not follow delete redirects by default - request.del(server+'/temp', { jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect when delete') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - } finally { - done() - } - }) - - // Should not follow delete redirects even if followRedirect is set to true - request.del(server+'/temp', { followRedirect: true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect when delete') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - } finally { - done() - } - }) - - // Should follow delete redirects when followAllRedirects true - request.del(server+'/temp', {followAllRedirects:true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(hits.temp_landing, 'Forward to temporary landing URL') - assert.equal(body, 'temp_landing', 'Got temporary landing content') - passed += 1 - } finally { - done() - } - }) - - var reqs_done = 0; - function done() { - reqs_done += 1; - if(reqs_done == 9) { - console.log(passed + ' tests passed.') - s.close() - } - } -}) diff --git a/node_modules/api-easy/node_modules/request/tests/test-timeout.js b/node_modules/api-easy/node_modules/request/tests/test-timeout.js deleted file mode 100644 index 673f8ad..0000000 --- a/node_modules/api-easy/node_modules/request/tests/test-timeout.js +++ /dev/null @@ -1,87 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); -var expectedBody = "waited"; -var remainingTests = 5; - -s.listen(s.port, function () { - // Request that waits for 200ms - s.on('/timeout', function (req, resp) { - setTimeout(function(){ - resp.writeHead(200, {'content-type':'text/plain'}) - resp.write(expectedBody) - resp.end() - }, 200); - }); - - // Scenario that should timeout - var shouldTimeout = { - url: s.url + "/timeout", - timeout:100 - } - - - request(shouldTimeout, function (err, resp, body) { - assert.equal(err.code, "ETIMEDOUT"); - checkDone(); - }) - - - // Scenario that shouldn't timeout - var shouldntTimeout = { - url: s.url + "/timeout", - timeout:300 - } - - request(shouldntTimeout, function (err, resp, body) { - assert.equal(err, null); - assert.equal(expectedBody, body) - checkDone(); - }) - - // Scenario with no timeout set, so shouldn't timeout - var noTimeout = { - url: s.url + "/timeout" - } - - request(noTimeout, function (err, resp, body) { - assert.equal(err); - assert.equal(expectedBody, body) - checkDone(); - }) - - // Scenario with a negative timeout value, should be treated a zero or the minimum delay - var negativeTimeout = { - url: s.url + "/timeout", - timeout:-1000 - } - - request(negativeTimeout, function (err, resp, body) { - assert.equal(err.code, "ETIMEDOUT"); - checkDone(); - }) - - // Scenario with a float timeout value, should be rounded by setTimeout anyway - var floatTimeout = { - url: s.url + "/timeout", - timeout: 100.76 - } - - request(floatTimeout, function (err, resp, body) { - assert.equal(err.code, "ETIMEDOUT"); - checkDone(); - }) - - function checkDone() { - if(--remainingTests == 0) { - s.close(); - console.log("All tests passed."); - } - } -}) - diff --git a/node_modules/api-easy/node_modules/request/tests/test-tunnel.js b/node_modules/api-easy/node_modules/request/tests/test-tunnel.js deleted file mode 100644 index 58131b9..0000000 --- a/node_modules/api-easy/node_modules/request/tests/test-tunnel.js +++ /dev/null @@ -1,61 +0,0 @@ -// test that we can tunnel a https request over an http proxy -// keeping all the CA and whatnot intact. -// -// Note: this requires that squid is installed. -// If the proxy fails to start, we'll just log a warning and assume success. - -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , fs = require('fs') - , path = require('path') - , caFile = path.resolve(__dirname, 'ssl/npm-ca.crt') - , ca = fs.readFileSync(caFile) - , child_process = require('child_process') - , sqConf = path.resolve(__dirname, 'squid.conf') - , sqArgs = ['-f', sqConf, '-N', '-d', '5'] - , proxy = 'http://localhost:3128' - , hadError = null - -var squid = child_process.spawn('squid', sqArgs); -var ready = false - -squid.stderr.on('data', function (c) { - console.error('SQUIDERR ' + c.toString().trim().split('\n') - .join('\nSQUIDERR ')) - ready = c.toString().match(/ready to serve requests/i) -}) - -squid.stdout.on('data', function (c) { - console.error('SQUIDOUT ' + c.toString().trim().split('\n') - .join('\nSQUIDOUT ')) -}) - -squid.on('exit', function (c) { - console.error('exit '+c) - if (c && !ready) { - console.error('squid must be installed to run this test.') - c = null - hadError = null - process.exit(0) - return - } - - if (c) { - hadError = hadError || new Error('Squid exited with '+c) - } - if (hadError) throw hadError -}) - -setTimeout(function F () { - if (!ready) return setTimeout(F, 100) - request({ uri: 'https://registry.npmjs.org/request/' - , proxy: 'http://localhost:3128' - , ca: ca - , json: true }, function (er, body) { - hadError = er - console.log(er || typeof body) - if (!er) console.log("ok") - squid.kill('SIGKILL') - }) -}, 100) diff --git a/node_modules/api-easy/node_modules/request/tunnel.js b/node_modules/api-easy/node_modules/request/tunnel.js deleted file mode 100644 index 453786c..0000000 --- a/node_modules/api-easy/node_modules/request/tunnel.js +++ /dev/null @@ -1,229 +0,0 @@ -'use strict'; - -var net = require('net'); -var tls = require('tls'); -var http = require('http'); -var https = require('https'); -var events = require('events'); -var assert = require('assert'); -var util = require('util'); - - -exports.httpOverHttp = httpOverHttp; -exports.httpsOverHttp = httpsOverHttp; -exports.httpOverHttps = httpOverHttps; -exports.httpsOverHttps = httpsOverHttps; - - -function httpOverHttp(options) { - var agent = new TunnelingAgent(options); - agent.request = http.request; - return agent; -} - -function httpsOverHttp(options) { - var agent = new TunnelingAgent(options); - agent.request = http.request; - agent.createSocket = createSecureSocket; - return agent; -} - -function httpOverHttps(options) { - var agent = new TunnelingAgent(options); - agent.request = https.request; - return agent; -} - -function httpsOverHttps(options) { - var agent = new TunnelingAgent(options); - agent.request = https.request; - agent.createSocket = createSecureSocket; - return agent; -} - - -function TunnelingAgent(options) { - var self = this; - self.options = options || {}; - self.proxyOptions = self.options.proxy || {}; - self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; - self.requests = []; - self.sockets = []; - - self.on('free', function onFree(socket, host, port) { - for (var i = 0, len = self.requests.length; i < len; ++i) { - var pending = self.requests[i]; - if (pending.host === host && pending.port === port) { - // Detect the request to connect same origin server, - // reuse the connection. - self.requests.splice(i, 1); - pending.request.onSocket(socket); - return; - } - } - socket.destroy(); - self.removeSocket(socket); - }); -} -util.inherits(TunnelingAgent, events.EventEmitter); - -TunnelingAgent.prototype.addRequest = function addRequest(req, host, port) { - var self = this; - - if (self.sockets.length >= this.maxSockets) { - // We are over limit so we'll add it to the queue. - self.requests.push({host: host, port: port, request: req}); - return; - } - - // If we are under maxSockets create a new one. - self.createSocket({host: host, port: port, request: req}, function(socket) { - socket.on('free', onFree); - socket.on('close', onCloseOrRemove); - socket.on('agentRemove', onCloseOrRemove); - req.onSocket(socket); - - function onFree() { - self.emit('free', socket, host, port); - } - - function onCloseOrRemove(err) { - self.removeSocket(); - socket.removeListener('free', onFree); - socket.removeListener('close', onCloseOrRemove); - socket.removeListener('agentRemove', onCloseOrRemove); - } - }); -}; - -TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { - var self = this; - var placeholder = {}; - self.sockets.push(placeholder); - - var connectOptions = mergeOptions({}, self.proxyOptions, { - method: 'CONNECT', - path: options.host + ':' + options.port, - agent: false - }); - if (connectOptions.proxyAuth) { - connectOptions.headers = connectOptions.headers || {}; - connectOptions.headers['Proxy-Authorization'] = 'Basic ' + - new Buffer(connectOptions.proxyAuth).toString('base64'); - } - - debug('making CONNECT request'); - var connectReq = self.request(connectOptions); - connectReq.useChunkedEncodingByDefault = false; // for v0.6 - connectReq.once('response', onResponse); // for v0.6 - connectReq.once('upgrade', onUpgrade); // for v0.6 - connectReq.once('connect', onConnect); // for v0.7 or later - connectReq.once('error', onError); - connectReq.end(); - - function onResponse(res) { - // Very hacky. This is necessary to avoid http-parser leaks. - res.upgrade = true; - } - - function onUpgrade(res, socket, head) { - // Hacky. - process.nextTick(function() { - onConnect(res, socket, head); - }); - } - - function onConnect(res, socket, head) { - connectReq.removeAllListeners(); - socket.removeAllListeners(); - - if (res.statusCode === 200) { - assert.equal(head.length, 0); - debug('tunneling connection has established'); - self.sockets[self.sockets.indexOf(placeholder)] = socket; - cb(socket); - } else { - debug('tunneling socket could not be established, statusCode=%d', - res.statusCode); - var error = new Error('tunneling socket could not be established, ' + - 'sutatusCode=' + res.statusCode); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - } - } - - function onError(cause) { - connectReq.removeAllListeners(); - - debug('tunneling socket could not be established, cause=%s\n', - cause.message, cause.stack); - var error = new Error('tunneling socket could not be established, ' + - 'cause=' + cause.message); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - } -}; - -TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { - var pos = this.sockets.indexOf(socket) - if (pos === -1) { - return; - } - this.sockets.splice(pos, 1); - - var pending = this.requests.shift(); - if (pending) { - // If we have pending requests and a socket gets closed a new one - // needs to be created to take over in the pool for the one that closed. - this.createSocket(pending, function(socket) { - pending.request.onSocket(socket); - }); - } -}; - -function createSecureSocket(options, cb) { - var self = this; - TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { - // 0 is dummy port for v0.6 - var secureSocket = tls.connect(0, mergeOptions({}, self.options, { - socket: socket - })); - cb(secureSocket); - }); -} - - -function mergeOptions(target) { - for (var i = 1, len = arguments.length; i < len; ++i) { - var overrides = arguments[i]; - if (typeof overrides === 'object') { - var keys = Object.keys(overrides); - for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { - var k = keys[j]; - if (overrides[k] !== undefined) { - target[k] = overrides[k]; - } - } - } - } - return target; -} - - -var debug; -if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { - debug = function() { - var args = Array.prototype.slice.call(arguments); - if (typeof args[0] === 'string') { - args[0] = 'TUNNEL: ' + args[0]; - } else { - args.unshift('TUNNEL:'); - } - console.error.apply(console, args); - } -} else { - debug = function() {}; -} -exports.debug = debug; // for test diff --git a/node_modules/api-easy/node_modules/request/uuid.js b/node_modules/api-easy/node_modules/request/uuid.js deleted file mode 100644 index 1d83bd5..0000000 --- a/node_modules/api-easy/node_modules/request/uuid.js +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = function () { - var s = [], itoh = '0123456789ABCDEF'; - - // Make array of random hex digits. The UUID only has 32 digits in it, but we - // allocate an extra items to make room for the '-'s we'll be inserting. - for (var i = 0; i <36; i++) s[i] = Math.floor(Math.random()*0x10); - - // Conform to RFC-4122, section 4.4 - s[14] = 4; // Set 4 high bits of time_high field to version - s[19] = (s[19] & 0x3) | 0x8; // Specify 2 high bits of clock sequence - - // Convert to hex chars - for (var i = 0; i <36; i++) s[i] = itoh[s[i]]; - - // Insert '-'s - s[8] = s[13] = s[18] = s[23] = '-'; - - return s.join(''); -} diff --git a/node_modules/api-easy/node_modules/request/vendor/cookie/index.js b/node_modules/api-easy/node_modules/request/vendor/cookie/index.js deleted file mode 100644 index 1eb2eaa..0000000 --- a/node_modules/api-easy/node_modules/request/vendor/cookie/index.js +++ /dev/null @@ -1,60 +0,0 @@ -/*! - * Tobi - Cookie - * Copyright(c) 2010 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var url = require('url'); - -/** - * Initialize a new `Cookie` with the given cookie `str` and `req`. - * - * @param {String} str - * @param {IncomingRequest} req - * @api private - */ - -var Cookie = exports = module.exports = function Cookie(str, req) { - this.str = str; - - // First key is the name - this.name = str.substr(0, str.indexOf('=')).trim(); - - // Map the key/val pairs - str.split(/ *; */).reduce(function(obj, pair){ - var p = pair.indexOf('='); - if(p > 0) - obj[pair.substring(0, p).trim()] = pair.substring(p + 1).trim(); - else - obj[pair.trim()] = true; - return obj; - }, this); - - // Assign value - this.value = this[this.name]; - - // Expires - this.expires = this.expires - ? new Date(this.expires) - : Infinity; - - // Default or trim path - this.path = this.path - ? this.path.trim(): req - ? url.parse(req.url).pathname: '/'; -}; - -/** - * Return the original cookie string. - * - * @return {String} - * @api public - */ - -Cookie.prototype.toString = function(){ - return this.str; -}; diff --git a/node_modules/api-easy/node_modules/request/vendor/cookie/jar.js b/node_modules/api-easy/node_modules/request/vendor/cookie/jar.js deleted file mode 100644 index 34920e0..0000000 --- a/node_modules/api-easy/node_modules/request/vendor/cookie/jar.js +++ /dev/null @@ -1,72 +0,0 @@ -/*! -* Tobi - CookieJar -* Copyright(c) 2010 LearnBoost -* MIT Licensed -*/ - -/** -* Module dependencies. -*/ - -var url = require('url'); - -/** -* Initialize a new `CookieJar`. -* -* @api private -*/ - -var CookieJar = exports = module.exports = function CookieJar() { - this.cookies = []; -}; - -/** -* Add the given `cookie` to the jar. -* -* @param {Cookie} cookie -* @api private -*/ - -CookieJar.prototype.add = function(cookie){ - this.cookies = this.cookies.filter(function(c){ - // Avoid duplication (same path, same name) - return !(c.name == cookie.name && c.path == cookie.path); - }); - this.cookies.push(cookie); -}; - -/** -* Get cookies for the given `req`. -* -* @param {IncomingRequest} req -* @return {Array} -* @api private -*/ - -CookieJar.prototype.get = function(req){ - var path = url.parse(req.url).pathname - , now = new Date - , specificity = {}; - return this.cookies.filter(function(cookie){ - if (0 == path.indexOf(cookie.path) && now < cookie.expires - && cookie.path.length > (specificity[cookie.name] || 0)) - return specificity[cookie.name] = cookie.path.length; - }); -}; - -/** -* Return Cookie string for the given `req`. -* -* @param {IncomingRequest} req -* @return {String} -* @api private -*/ - -CookieJar.prototype.cookieString = function(req){ - var cookies = this.get(req); - if (cookies.length) { - return cookies.map(function(cookie){ - return cookie.name + '=' + cookie.value; - }).join('; '); - } -}; diff --git a/node_modules/api-easy/node_modules/vows/.npmignore b/node_modules/api-easy/node_modules/vows/.npmignore deleted file mode 100644 index 3c3629e..0000000 --- a/node_modules/api-easy/node_modules/vows/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/node_modules/api-easy/node_modules/vows/.travis.yml b/node_modules/api-easy/node_modules/vows/.travis.yml deleted file mode 100644 index aa1dc39..0000000 --- a/node_modules/api-easy/node_modules/vows/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: node_js - -node_js: - - 0.4 - - 0.6 - diff --git a/node_modules/api-easy/node_modules/vows/LICENSE b/node_modules/api-easy/node_modules/vows/LICENSE deleted file mode 100644 index a1edd93..0000000 --- a/node_modules/api-easy/node_modules/vows/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2009 cloudhead - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/api-easy/node_modules/vows/Makefile b/node_modules/api-easy/node_modules/vows/Makefile deleted file mode 100644 index 6bf8991..0000000 --- a/node_modules/api-easy/node_modules/vows/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# -# Run all tests -# -test: - @@bin/vows test/* - -.PHONY: test install diff --git a/node_modules/api-easy/node_modules/vows/README.md b/node_modules/api-easy/node_modules/vows/README.md deleted file mode 100644 index bfa410e..0000000 --- a/node_modules/api-easy/node_modules/vows/README.md +++ /dev/null @@ -1,65 +0,0 @@ -Vows -==== - -> Asynchronous BDD & continuous integration for node.js - -#### # - -introduction ------------- -There are two reasons why we might want asynchronous testing. The first, and obvious reason is that node.js is asynchronous, and therefore our tests need to be. The second reason is to make test suites which target I/O libraries run much faster. - -_Vows_ is an experiment in making this possible, while adding a minimum of overhead. - -synopsis --------- - - var vows = require('vows'), - assert = require('assert'); - - vows.describe('Deep Thought').addBatch({ - 'An instance of DeepThought': { - topic: new DeepThought, - - 'should know the answer to the ultimate question of life': function (deepThought) { - assert.equal (deepThought.question('what is the answer to the universe?'), 42); - } - } - }); - -coverage reporting ------------------- -Code coverage reporting is available if _instrumented_ code is detected. Currently only _instrumentation_ via [node-jscoverage](https://github.com/visionmedia/node-jscoverage) is supported. When _instrumented_ code is detected and coverage reporting is enabled using any of the `--cover-plain`, `--cover-html`, or `--cover-json` options a code coverage map is generated. - -### downloading and installing [node-jscoverage](https://github.com/visionmedia/node-jscoverage) -[node-jscoverage](https://github.com/visionmedia/node-jscoverage) is a binary package that needs to be compiled from source: - - $ git clone https://github.com/visionmedia/node-jscoverage.git - $ cd node-jscoverage/ - $ ./configure - checking for a BSD-compatible install... /usr/bin/install -c - checking whether build environment is sane... yes - [...] - $ make && sudo make install - -### instrumenting with jscoverage - - $ jscoverage myfile.js myfile-instrumented.js - -installation ------------- - - $ npm install vows - -documentation -------------- - -Head over to - -authors -------- - -Alexis Sellier <>, Charlie Robbins, - -*...and many others* - diff --git a/node_modules/api-easy/node_modules/vows/bin/vows b/node_modules/api-easy/node_modules/vows/bin/vows deleted file mode 100755 index 0a0bcd1..0000000 --- a/node_modules/api-easy/node_modules/vows/bin/vows +++ /dev/null @@ -1,560 +0,0 @@ -#!/usr/bin/env node - -var path = require('path'), - fs = require('fs'), - util = require('util'), - events = require('events'); - -// -// Attempt to load Coffee-Script. If it's not available, continue on our -// merry way, if it is available, set it up so we can include `*.coffee` -// scripts and start searching for them. -// -var fileExt, specFileExt; - -try { - var coffee = require('coffee-script'); - if (require.extensions) { - require.extensions['.coffee'] = function (module, filename) { - var content = coffee.compile(fs.readFileSync(filename, 'utf8')); - return module._compile(content, filename); - }; - } else { - require.registerExtension('.coffee', function (content) { return coffee.compile(content) }); - } - fileExt = /\.(js|coffee)$/; - specFileExt = /[.(-|_)](test|spec)\.(js|coffee)$/; -} catch (_) { - fileExt = /\.js$/; - specFileExt = /[.(-|_)](test|spec)\.js$/; -} - -var inspect = require('eyes').inspector({ - stream: null, - styles: { string: 'grey', regexp: 'grey' } -}); - -var vows = require('../lib/vows'); -var cutils = require('../lib/vows/console'); -var stylize = require('../lib/vows/console').stylize; -var _reporter = require('../lib/vows/reporters/dot-matrix'), reporter = { - name: _reporter.name -}; -var _coverage; - -var help = [ - "usage: vows [FILE, ...] [options]", - "", - "options:", - " -v, --verbose Enable verbose output", - " -w, --watch Watch mode", - " -s, --silent Don't report", - " -i, --isolate Run each test in it's own vows process", - " -m PATTERN Only run tests matching the PATTERN string", - " -r PATTERN Only run tests matching the PATTERN regexp", - " --json Use JSON reporter", - " --spec Use Spec reporter", - " --dot-matrix Use Dot-Matrix reporter", - " --xunit Use xUnit reporter", - " --cover-plain Print plain coverage map if detected", - " --cover-html Write coverage map to \"coverage.html\"", - " --cover-json Write unified coverage map to \"coverage.json\"", - " --cover-xml Write coverage map to \"coverage.xml\" in Emma xml", - " --no-color Don't use terminal colors", - " --version Show version", - " -h, --help You're staring at it" -].join('\n'); - -var options = { - reporter: reporter, - matcher: /.*/, - watch: false, - coverage: false, - isolate: false, - nocolor: !process.stdout.isTTY -}; - -var files = []; - -// Get rid of process runner -// ('node' in most cases) -var arg, args = [], argv = process.argv.slice(2); - -// Current directory index, -// and path of test folder. -var root, testFolder; - -// -// Parse command-line parameters -// -while (arg = argv.shift()) { - if (arg === __filename) { continue } - - if (arg[0] !== '-') { - args.push(arg); - } else { - arg = arg.match(/^--?(.+)/)[1]; - - if (arg[0] === 'r') { - options.matcher = new(RegExp)(argv.shift()); - } else if (arg[0] === 'm') { - options.matcher = (function (str) { // Create an escaped RegExp - var specials = '. * + ? | ( ) [ ] { } \\ ^ ? ! = : $'.split(' ').join('|\\'), - regex = new(RegExp)('(\\' + specials + ')', 'g'); - return new(RegExp)(str.replace(regex, '\\$1')); - })(argv.shift()); - } else if (arg in options) { - options[arg] = true; - } else { - switch (arg) { - case 'json': - _reporter = require('../lib/vows/reporters/json'); - break; - case 'spec': - _reporter = require('../lib/vows/reporters/spec'); - break; - case 'dot-matrix': - _reporter = require('../lib/vows/reporters/dot-matrix'); - break; - case 'silent': - case 's': - _reporter = require('../lib/vows/reporters/silent'); - break; - case 'xunit': - _reporter = require('../lib/vows/reporters/xunit'); - break; - case 'cover-plain': - options.coverage = true; - _coverage = require('../lib/vows/coverage/report-plain'); - break; - case 'cover-html': - options.coverage = true; - _coverage = require('../lib/vows/coverage/report-html'); - break; - case 'cover-json': - options.coverage = true; - _coverage = require('../lib/vows/coverage/report-json'); - break; - case 'cover-xml': - options.coverage = true; - _coverage = require('../lib/vows/coverage/report-xml'); - break; - case 'verbose': - case 'v': - options.verbose = true; - break; - case 'watch': - case 'w': - options.watch = true; - break; - case 'supress-stdout': - options.supressStdout = true; - break; - case 'isolate': - case 'i': - options.isolate = true; - break; - case 'no-color': - options.nocolor = true; - break; - case 'color': - options.nocolor = false; - break; - case 'no-error': - options.error = false; - break; - case 'version': - console.log('vows ' + vows.version); - process.exit(0); - case 'help': - case 'h': - console.log(help); - process.exit(0); - break; - } - } - } -} - -if (options.nocolor) { - cutils.nocolor = true; - inspect = require('eyes').inspector({ stream: null, styles: false }); -} - -if (options.supressStdout) { - _reporter.setStream && _reporter.setStream(process.stdout); - var devNullStream = fs.createWriteStream('/dev/null'); - process.__defineGetter__('stdout', function () { - return devNullStream; - }); -} - -if (options.watch) { - options.reporter = reporter = require('../lib/vows/reporters/watch'); -} - -msg('bin', 'argv', args); -msg('bin', 'options', { reporter: options.reporter.name, matcher: options.matcher }); - -if (args.length === 0 || options.watch) { - msg('bin', 'discovering', 'folder structure'); - root = fs.readdirSync('.'); - - if (root.indexOf('test') !== -1) { - testFolder = 'test'; - } else if (root.indexOf('spec') !== -1) { - testFolder = 'spec'; - } else { - abort("runner", "couldn't find test folder"); - } - msg('bin', 'discovered', "./" + testFolder); - if (args.length === 0) { - args = paths(testFolder).filter(function (f) { - return specFileExt.test(f); - }); - - if (options.watch) { - args = args.concat(paths('lib'), paths('src')); - } - } -} - -if (! options.watch) { - reporter.report = function (data, filename) { - switch (data[0]) { - case 'subject': - case 'vow': - case 'context': - case 'error': - _reporter.report(data, filename); - break; - case 'end': - (options.verbose || _reporter.name === 'json') && - _reporter.report(data); - break; - case 'finish': - options.verbose ? - _reporter.print('\n') - : - _reporter.print(' '); - break; - } - }; - reporter.reset = function () { _reporter.reset && _reporter.reset() }; - reporter.print = _reporter.print; - - files = args.map(function (a) { - return (!a.match(/^\//)) - ? path.join(process.cwd(), a.replace(fileExt, '')) - : a.replace(fileExt, ''); - }); - - runSuites(importSuites(files), function (results) { - var status = results.errored ? 2 : (results.broken ? 1 : 0); - - !options.verbose && _reporter.print('\n'); - msg('runner', 'finish'); - _reporter.report(['finish', results], { - write: function (str) { - util.print(str.replace(/^\n\n/, '\n')); - } - }); - try { - if (options.coverage === true && _$jscoverage !== undefined) { - _coverage.report(_$jscoverage); - } - } catch (err) { - // ignore the undefined jscoverage - } - if (process.stdout.write('')) { // Check if stdout is drained - process.exit(status); - } else { - process.stdout.on('drain', function () { - process.exit(status); - }); - } - }); -} else { - // - // Watch mode - // - (function () { - var pendulum = [ - '. ', '.. ', '... ', ' ...', - ' ..', ' .', ' .', ' ..', - '... ', '.. ', '. ' - ]; - var strobe = ['.', ' ']; - var status, - cue, - current = 0, - running = 0, - lastRun, - colors = ['32m', '33m', '31m'], - timer = setInterval(tick, 100); - process.on('uncaughtException', exception); - process.on('exit', cleanup); - process.on('SIGINT', function () { - process.exit(0); - }); - process.on('SIGQUIT', function () { - changed(); - }); - - cursorHide(); - - // Run every 100ms - function tick() { - if (running && (cue !== strobe)) { - cue = strobe, current = 0; - } else if (!running && (cue !== pendulum)) { - cue = pendulum, current = 0; - } - - eraseLine(); - lastRun && !running && esc(colors[status.errored ? 2 : (status.broken ? 1 : 0)]); - print(cue[current]); - - if (current == cue.length - 1) { current = -1 } - - current ++; - esc('39m'); - cursorRestore(); - } - - // - // Utility functions - // - function print(str) { util.print(str) } - function esc(str) { print("\x1b[" + str) } - function eraseLine() { esc("0K") } - function cursorRestore() { esc("0G") } - function cursorHide() { esc("?25l") } - function cursorShow() { esc("?25h") } - function cleanup() { eraseLine(), cursorShow(), clearInterval(timer), print('\n') } - function exception(err) { print(err.stack || err.message || JSON.stringify(err)), running = 0} - - // - // Get a matching test for a given file - // - function getMatchingTest(file, join) { - join || (join = '-'); - var testFile; - if (specFileExt.test(file)) { - testFile = path.join(testFolder, file); - } - else { - var root, extension; - _s = file.split('.'), root = _s[0], extension = _s[1]; - testFile = path.join(testFolder, root + join + testFolder + "." + extension); - } - - try { - fs.statSync(testFile); - } catch (e) { - if (join == '-') { - return getMatchingTest(file, '_'); - } - else { - msg('watcher', 'no equivalence found, running all tests.'); - testFile = null; - } - } - return testFile; - } - - // - // Called when a file has been modified. - // Run the matching tests and change the status. - // - function changed(file) { - status = { honored: 0, broken: 0, errored: 0, pending: 0 }; - - msg('watcher', 'detected change in', file); - - file = getMatchingTest(file); - - var files = (specFileExt.test(file) ? [file] : paths(testFolder)).map(function (p) { - return path.join(process.cwd(), p); - }).filter(function (p) { - return specFileExt.test(p); - }).map(function (p) { - var cache = require.main.moduleCache || require.cache; - if (cache[p]) { delete(cache[p]) } - return p; - }).map(function (p) { - return p.replace(fileExt, ''); - }); - - running ++; - - runSuites(importSuites(files), function (results) { - delete(results.time); - print(cutils.result(results).join('') + '\n\n'); - lastRun = new(Date); - status = results; - running --; - }); - } - - msg('watcher', 'watching', args); - - // - // Watch all relevant files, - // and call `changed()` on change. - // - args.forEach(function (p) { - fs.watchFile(p, function (current, previous) { - if (new(Date)(current.mtime).valueOf() === - new(Date)(previous.mtime).valueOf()) { return } - else { - changed(p); - } - }); - }); - })(); -} - -function runSuites(suites, callback) { - var results = { - honored: 0, - broken: 0, - errored: 0, - pending: 0, - total: 0, - time: 0 - }; - reporter.reset(); - - (function run(suites, callback) { - var suite = suites.shift(); - if (suite) { - msg('runner', "running", suite.subject + ' ', options.watch ? false : true); - suite.run(options, function (result) { - Object.keys(result).forEach(function (k) { - results[k] += result[k]; - }); - run(suites, callback); - }); - } else { - callback(results); - } - })(suites, callback); -} - -function importSuites(files) { - msg(options.watcher ? 'watcher' : 'runner', 'loading', files); - - var spawn = require('child_process').spawn; - - function cwdname(f) { - return f.replace(process.cwd() + '/', '') + '.js'; - } - - function wrapSpawn(f) { - f = cwdname(f); - return function (options, callback) { - var args = [process.argv[1], '--json', '--supress-stdout', f], - p = spawn(process.execPath, args), - result; - - p.on('exit', function (code) { - callback( - !result ? - {errored: 1, total: 1} - : - result - ); - }); - - var buffer = []; - p.stdout.on('data', function (data) { - data = data.toString().split(/\n/g); - if (data.length == 1) { - buffer.push(data[0]); - } else { - data[0] = buffer.concat(data[0]).join(''); - buffer = [data.pop()]; - - data.forEach(function (data) { - if (data) { - data = JSON.parse(data); - if (data && data[0] === 'finish') { - result = data[1]; - } else { - reporter.report(data); - } - } - }); - } - }); - - p.stderr.pipe(process.stderr); - } - } - - return files.reduce(options.isolate ? function (suites, f) { - return suites.concat({ - run: wrapSpawn(f) - }); - } : function (suites, f) { - var obj = require(f); - return suites.concat(Object.keys(obj).map(function (s) { - obj[s]._filename = cwdname(f); - return obj[s]; - })); - }, []) -} - -// -// Recursively traverse a hierarchy, returning -// a list of all relevant .js files. -// -function paths(dir) { - var paths = []; - - try { fs.statSync(dir) } - catch (e) { return [] } - - (function traverse(dir, stack) { - stack.push(dir); - fs.readdirSync(stack.join('/')).forEach(function (file) { - // - // Skip dotfiles and `vendor` directory before `fs.stat()`ing them. - // Not doing so causes race conditions with Emacs buffer files - // (`.#filename.js`). - // - if (file[0] == '.' || file === 'vendor') { - return; - } - - var path = stack.concat([file]).join('/'), - stat = fs.statSync(path); - - if (stat.isFile() && fileExt.test(file)) { - paths.push(path); - } else if (stat.isDirectory()) { - traverse(file, stack); - } - }); - stack.pop(); - })(dir || '.', []); - - return paths; -} - -function msg(cmd, subject, str, p) { - if (options.verbose) { - util[p ? 'print' : 'puts']( stylize('vows ', 'green') - + stylize(cmd, 'bold') - + ' ' + subject + ' ' - + (str ? (typeof(str) === 'string' ? str : inspect(str)) : '') - ); - } -} - -function abort(cmd, str) { - console.log(stylize('vows ', 'red') + stylize(cmd, 'bold') + ' ' + str); - console.log(stylize('vows ', 'red') + stylize(cmd, 'bold') + ' exiting'); - process.exit(-1); -} diff --git a/node_modules/api-easy/node_modules/vows/lib/assert/error.js b/node_modules/api-easy/node_modules/vows/lib/assert/error.js deleted file mode 100644 index 3f52271..0000000 --- a/node_modules/api-easy/node_modules/vows/lib/assert/error.js +++ /dev/null @@ -1,42 +0,0 @@ -var stylize = require('../vows/console').stylize; -var inspect = require('../vows/console').inspect; - -require('assert').AssertionError.prototype.toString = function () { - var that = this, - source; - - if (this.stack) { - source = this.stack.match(/([a-zA-Z0-9._-]+\.(?:js|coffee))(:\d+):\d+/); - } - - function parse(str) { - var actual = inspect(that.actual, {showHidden: that.actual instanceof Error}), - expected; - - if (that.expected instanceof Function) { - expected = that.expected.name; - } - else { - expected = inspect(that.expected, {showHidden: that.actual instanceof Error}); - } - - return str.replace(/{actual}/g, actual). - replace(/{operator}/g, stylize(that.operator, 'bold')). - replace(/{expected}/g, expected); - } - - if (this.message) { - var msg = stylize(parse(this.message), 'yellow'); - if (source) { - msg += stylize(' // ' + source[1] + source[2], 'grey'); - } - return msg; - } else { - return stylize([ - this.expected, - this.operator, - this.actual - ].join(' '), 'yellow'); - } -}; - diff --git a/node_modules/api-easy/node_modules/vows/lib/assert/macros.js b/node_modules/api-easy/node_modules/vows/lib/assert/macros.js deleted file mode 100644 index 154aa14..0000000 --- a/node_modules/api-easy/node_modules/vows/lib/assert/macros.js +++ /dev/null @@ -1,215 +0,0 @@ -var assert = require('assert'), - utils = require('./utils'); - -var messages = { - 'equal' : "expected {expected},\n\tgot\t {actual} ({operator})", - 'notEqual' : "didn't expect {actual} ({operator})" -}; -messages['strictEqual'] = messages['deepEqual'] = messages['equal']; -messages['notStrictEqual'] = messages['notDeepEqual'] = messages['notEqual']; - -for (var key in messages) { - assert[key] = (function (key, callback) { - return function (actual, expected, message) { - callback(actual, expected, message || messages[key]); - }; - })(key, assert[key]); -} - -assert.ok = (function (callback) { - return function (actual, message) { - callback(actual, message || "expected expression to evaluate to {expected}, but was {actual}"); - }; -})(assert.ok); - -assert.match = function (actual, expected, message) { - if (! expected.test(actual)) { - assert.fail(actual, expected, message || "expected {actual} to match {expected}", "match", assert.match); - } -}; -assert.matches = assert.match; - -assert.isTrue = function (actual, message) { - if (actual !== true) { - assert.fail(actual, true, message || "expected {expected}, got {actual}", "===", assert.isTrue); - } -}; -assert.isFalse = function (actual, message) { - if (actual !== false) { - assert.fail(actual, false, message || "expected {expected}, got {actual}", "===", assert.isFalse); - } -}; -assert.isZero = function (actual, message) { - if (actual !== 0) { - assert.fail(actual, 0, message || "expected {expected}, got {actual}", "===", assert.isZero); - } -}; -assert.isNotZero = function (actual, message) { - if (actual === 0) { - assert.fail(actual, 0, message || "expected non-zero value, got {actual}", "===", assert.isNotZero); - } -}; - -assert.greater = function (actual, expected, message) { - if (actual <= expected) { - assert.fail(actual, expected, message || "expected {actual} to be greater than {expected}", ">", assert.greater); - } -}; -assert.lesser = function (actual, expected, message) { - if (actual >= expected) { - assert.fail(actual, expected, message || "expected {actual} to be lesser than {expected}", "<", assert.lesser); - } -}; - -assert.inDelta = function (actual, expected, delta, message) { - var lower = expected - delta; - var upper = expected + delta; - if (actual < lower || actual > upper) { - assert.fail(actual, expected, message || "expected {actual} to be in within *" + delta.toString() + "* of {expected}", null, assert.inDelta); - } -}; - -// -// Inclusion -// -assert.include = function (actual, expected, message) { - if ((function (obj) { - if (isArray(obj) || isString(obj)) { - return obj.indexOf(expected) === -1; - } else if (isObject(actual)) { - return ! obj.hasOwnProperty(expected); - } - return true; - })(actual)) { - assert.fail(actual, expected, message || "expected {actual} to include {expected}", "include", assert.include); - } -}; -assert.includes = assert.include; - -assert.deepInclude = function (actual, expected, message) { - if (!isArray(actual)) { - return assert.include(actual, expected, message); - } - if (!actual.some(function (item) { return utils.deepEqual(item, expected) })) { - assert.fail(actual, expected, message || "expected {actual} to include {expected}", "include", assert.deepInclude); - } -}; -assert.deepIncludes = assert.deepInclude; - -// -// Length -// -assert.isEmpty = function (actual, message) { - if ((isObject(actual) && Object.keys(actual).length > 0) || actual.length > 0) { - assert.fail(actual, 0, message || "expected {actual} to be empty", "length", assert.isEmpty); - } -}; -assert.isNotEmpty = function (actual, message) { - if ((isObject(actual) && Object.keys(actual).length === 0) || actual.length === 0) { - assert.fail(actual, 0, message || "expected {actual} to be not empty", "length", assert.isNotEmpty); - } -}; - -assert.lengthOf = function (actual, expected, message) { - if (actual.length !== expected) { - assert.fail(actual, expected, message || "expected {actual} to have {expected} element(s)", "length", assert.length); - } -}; - -// -// Type -// -assert.isArray = function (actual, message) { - assertTypeOf(actual, 'array', message || "expected {actual} to be an Array", assert.isArray); -}; -assert.isObject = function (actual, message) { - assertTypeOf(actual, 'object', message || "expected {actual} to be an Object", assert.isObject); -}; -assert.isNumber = function (actual, message) { - if (isNaN(actual)) { - assert.fail(actual, 'number', message || "expected {actual} to be of type {expected}", "isNaN", assert.isNumber); - } else { - assertTypeOf(actual, 'number', message || "expected {actual} to be a Number", assert.isNumber); - } -}; -assert.isBoolean = function (actual, message) { - if (actual !== true && actual !== false) { - assert.fail(actual, 'boolean', message || "expected {actual} to be a Boolean", "===", assert.isBoolean); - } -}; -assert.isNaN = function (actual, message) { - if (actual === actual) { - assert.fail(actual, 'NaN', message || "expected {actual} to be NaN", "===", assert.isNaN); - } -}; -assert.isNull = function (actual, message) { - if (actual !== null) { - assert.fail(actual, null, message || "expected {expected}, got {actual}", "===", assert.isNull); - } -}; -assert.isNotNull = function (actual, message) { - if (actual === null) { - assert.fail(actual, null, message || "expected non-null value, got {actual}", "===", assert.isNotNull); - } -}; -assert.isUndefined = function (actual, message) { - if (actual !== undefined) { - assert.fail(actual, undefined, message || "expected {actual} to be {expected}", "===", assert.isUndefined); - } -}; -assert.isDefined = function (actual, message) { - if(actual === undefined) { - assert.fail(actual, 0, message || "expected {actual} to be defined", "===", assert.isDefined); - } -}; -assert.isString = function (actual, message) { - assertTypeOf(actual, 'string', message || "expected {actual} to be a String", assert.isString); -}; -assert.isFunction = function (actual, message) { - assertTypeOf(actual, 'function', message || "expected {actual} to be a Function", assert.isFunction); -}; -assert.typeOf = function (actual, expected, message) { - assertTypeOf(actual, expected, message, assert.typeOf); -}; -assert.instanceOf = function (actual, expected, message) { - if (! (actual instanceof expected)) { - assert.fail(actual, expected, message || "expected {actual} to be an instance of {expected}", "instanceof", assert.instanceOf); - } -}; - -// -// Utility functions -// - -function assertTypeOf(actual, expected, message, caller) { - if (typeOf(actual) !== expected) { - assert.fail(actual, expected, message || "expected {actual} to be of type {expected}", "typeOf", caller); - } -}; - -function isArray (obj) { - return Array.isArray(obj); -} - -function isString (obj) { - return typeof(obj) === 'string' || obj instanceof String; -} - -function isObject (obj) { - return typeof(obj) === 'object' && obj && !isArray(obj); -} - -// A better `typeof` -function typeOf(value) { - var s = typeof(value), - types = [Object, Array, String, RegExp, Number, Function, Boolean, Date]; - - if (s === 'object' || s === 'function') { - if (value) { - types.forEach(function (t) { - if (value instanceof t) { s = t.name.toLowerCase() } - }); - } else { s = 'null' } - } - return s; -} diff --git a/node_modules/api-easy/node_modules/vows/lib/assert/utils.js b/node_modules/api-easy/node_modules/vows/lib/assert/utils.js deleted file mode 100644 index dccd0f6..0000000 --- a/node_modules/api-easy/node_modules/vows/lib/assert/utils.js +++ /dev/null @@ -1,77 +0,0 @@ - -// Taken from node/lib/assert.js -exports.deepEqual = function (actual, expected) { - if (actual === expected) { - return true; - - } else if (Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) { - if (actual.length != expected.length) return false; - - for (var i = 0; i < actual.length; i++) { - if (actual[i] !== expected[i]) return false; - } - return true; - - } else if (actual instanceof Date && expected instanceof Date) { - return actual.getTime() === expected.getTime(); - - } else if (typeof actual != 'object' && typeof expected != 'object') { - return actual == expected; - - } else { - return objEquiv(actual, expected); - } -} - -// Taken from node/lib/assert.js -exports.notDeepEqual = function (actual, expected, message) { - if (exports.deepEqual(actual, expected)) { - fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); - } -} - -// Taken from node/lib/assert.js -function isUndefinedOrNull(value) { - return value === null || value === undefined; -} - -// Taken from node/lib/assert.js -function isArguments(object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; -} - -// Taken from node/lib/assert.js -function objEquiv(a, b) { - if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) - return false; - if (a.prototype !== b.prototype) return false; - if (isArguments(a)) { - if (!isArguments(b)) { - return false; - } - a = pSlice.call(a); - b = pSlice.call(b); - return exports.deepEqual(a, b); - } - try { - var ka = Object.keys(a), - kb = Object.keys(b), - key, i; - } catch (e) { - return false; - } - if (ka.length != kb.length) - return false; - ka.sort(); - kb.sort(); - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) - return false; - } - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!exports.deepEqual(a[key], b[key])) return false; - } - return true; -} - diff --git a/node_modules/api-easy/node_modules/vows/lib/vows.js b/node_modules/api-easy/node_modules/vows/lib/vows.js deleted file mode 100644 index 363f96f..0000000 --- a/node_modules/api-easy/node_modules/vows/lib/vows.js +++ /dev/null @@ -1,255 +0,0 @@ -// -// Vows.js - asynchronous event-based BDD for node.js -// -// usage: -// -// var vows = require('vows'); -// -// vows.describe('Deep Thought').addBatch({ -// "An instance of DeepThought": { -// topic: new DeepThought, -// -// "should know the answer to the ultimate question of life": function (deepThought) { -// assert.equal (deepThought.question('what is the answer to the universe?'), 42); -// } -// } -// }).run(); -// -var util = require('util'), - path = require('path'), - events = require('events'), - vows = exports; - -// Options -vows.options = { - Emitter: events.EventEmitter, - reporter: require('./vows/reporters/dot-matrix'), - matcher: /.*/, - error: true // Handle "error" event -}; - -vows.__defineGetter__('reporter', function () { - return vows.options.reporter; -}); - -var stylize = require('./vows/console').stylize; -var console = vows.console = require('./vows/console'); - -vows.inspect = require('./vows/console').inspect; -vows.prepare = require('./vows/extras').prepare; -vows.tryEnd = require('./vows/suite').tryEnd; - -// -// Assertion Macros & Extensions -// -require('./assert/error'); -require('./assert/macros'); - -// -// Suite constructor -// -var Suite = require('./vows/suite').Suite; - -// -// This function gets added to events.EventEmitter.prototype, by default. -// It's essentially a wrapper around `on`, which adds all the specification -// goodness. -// -function addVow(vow) { - var batch = vow.batch, - event = vow.binding.context.event || 'success', - self = this; - - batch.total ++; - batch.vows.push(vow); - - // always set a listener on the event - this.on(event, function () { - var args = Array.prototype.slice.call(arguments); - // If the vow is a sub-event then we know it is an - // emitted event. So I don't muck with the arguments - // However the legacy behavior: - // If the callback is expecting two or more arguments, - // pass the error as the first (null) and the result after. - if (!(this.ctx && this.ctx.isEvent) && - vow.callback.length >= 2 && batch.suite.options.error) { - args.unshift(null); - } - runTest(args, this.ctx); - vows.tryEnd(batch); - }); - - if (event !== 'error') { - this.on("error", function (err) { - if (vow.callback.length >= 2 || !batch.suite.options.error) { - runTest(arguments, this.ctx); - } else { - output('errored', { type: 'promise', error: err.stack || - err.message || JSON.stringify(err) }); - } - vows.tryEnd(batch); - }); - } - - // in case an event fired before we could listen - if (this._vowsEmitedEvents && - this._vowsEmitedEvents.hasOwnProperty(event)) { - // make sure no one is messing with me - if (Array.isArray(this._vowsEmitedEvents[event])) { - // I don't think I need to optimize for one event, - // I think it is more important to make sure I check the vow n times - self._vowsEmitedEvents[event].forEach(function(args) { - runTest(args, self.ctx); - }); - } else { - // initial conditions problem - throw new Error('_vowsEmitedEvents[' + event + '] is not an Array') - } - vows.tryEnd(batch); - } - - return this; - - function runTest(args, ctx) { - if (vow.callback instanceof String) { - return output('pending'); - } - - if (vow.binding.context.isEvent && vow.binding.context.after) { - var after = vow.binding.context.after; - // only need to check order. I won't get here if the after event - // has never been emitted - if (self._vowsEmitedEventsOrder.indexOf(after) > - self._vowsEmitedEventsOrder.indexOf(event)) { - output('broken', event + ' emitted before ' + after); - return; - } - } - - // Run the test, and try to catch `AssertionError`s and other exceptions; - // increment counters accordingly. - try { - vow.callback.apply(ctx === global || !ctx ? vow.binding : ctx, args); - output('honored'); - } catch (e) { - if (e.name && e.name.match(/AssertionError/)) { - output('broken', e.toString().replace(/\`/g, '`')); - } else { - output('errored', e.stack || e.message || e); - } - } - } - - function output(status, exception) { - batch[status] ++; - vow.status = status; - - if (vow.context && batch.lastContext !== vow.context) { - batch.lastContext = vow.context; - batch.suite.report(['context', vow.context]); - } - batch.suite.report(['vow', { - title: vow.description, - context: vow.context, - status: status, - exception: exception || null - }]); - } -}; - -// -// On exit, check that all promises have been fired. -// If not, report an error message. -// -process.on('exit', function () { - var results = { honored: 0, broken: 0, errored: 0, pending: 0, total: 0 }, - failure; - - vows.suites.forEach(function (s) { - if ((s.results.total > 0) && (s.results.time === null)) { - s.reporter.print('\n\n'); - s.reporter.report(['error', { error: "Asynchronous Error", suite: s }]); - } - s.batches.forEach(function (b) { - var unFired = []; - - b.vows.forEach(function (vow) { - if (! vow.status) { - if (unFired.indexOf(vow.context) === -1) { - unFired.push(vow.context); - } - } - }); - - if (unFired.length > 0) { util.print('\n') } - - unFired.forEach(function (title) { - s.reporter.report(['error', { - error: "callback not fired", - context: title, - batch: b, - suite: s - }]); - }); - - if (b.status === 'begin') { - failure = true; - results.errored ++; - results.total ++; - } - Object.keys(results).forEach(function (k) { results[k] += b[k] }); - }); - }); - if (failure) { - util.puts(console.result(results)); - } -}); - -vows.suites = []; - -// We need the old emit function so we can hook it -// and do magic to deal with events that have fired -var oldEmit = vows.options.Emitter.prototype.emit; - -// -// Create a new test suite -// -vows.describe = function (subject) { - var suite = new(Suite)(subject); - - this.options.Emitter.prototype.addVow = addVow; - // just in case someone emit's before I get to it - this.options.Emitter.prototype.emit = function (event) { - this._vowsEmitedEvents = this._vowsEmitedEvents || {}; - this._vowsEmitedEventsOrder = this._vowsEmitedEventsOrder || []; - // slice off the event - var args = Array.prototype.slice.call(arguments, 1); - // if multiple events are fired, add or push - if (this._vowsEmitedEvents.hasOwnProperty(event)) { - this._vowsEmitedEvents[event].push(args); - } else { - this._vowsEmitedEvents[event] = [args]; - } - - // push the event onto a stack so I have an order - this._vowsEmitedEventsOrder.push(event); - return oldEmit.apply(this, arguments); - } - this.suites.push(suite); - - // - // Add any additional arguments as batches if they're present - // - if (arguments.length > 1) { - for (var i = 1, l = arguments.length; i < l; ++i) { - suite.addBatch(arguments[i]); - } - } - - return suite; -}; - - -vows.version = JSON.parse(require('fs') - .readFileSync(path.join(__dirname, '..', 'package.json'))) - .version diff --git a/node_modules/api-easy/node_modules/vows/lib/vows/console.js b/node_modules/api-easy/node_modules/vows/lib/vows/console.js deleted file mode 100644 index 900cef9..0000000 --- a/node_modules/api-easy/node_modules/vows/lib/vows/console.js +++ /dev/null @@ -1,140 +0,0 @@ -var eyes = require('eyes').inspector({ stream: null, styles: false }); - -// Stylize a string -this.stylize = function stylize(str, style) { - if (module.exports.nocolor) { - return str; - } - - var styles = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'cyan' : [96, 39], - 'yellow' : [33, 39], - 'green' : [32, 39], - 'red' : [31, 39], - 'grey' : [90, 39], - 'green-hi' : [92, 32], - }; - return '\033[' + styles[style][0] + 'm' + str + - '\033[' + styles[style][1] + 'm'; -}; - -var $ = this.$ = function (str) { - str = new(String)(str); - - ['bold', 'grey', 'yellow', 'red', 'green', 'white', 'cyan', 'italic'].forEach(function (style) { - Object.defineProperty(str, style, { - get: function () { - return exports.$(exports.stylize(this, style)); - } - }); - }); - return str; -}; - -this.puts = function (options) { - var stylize = exports.stylize; - options.stream || (options.stream = process.stdout); - options.tail = options.tail || ''; - - return function (args) { - args = Array.prototype.slice.call(arguments); - if (!options.raw) { - args = args.map(function (a) { - return a.replace(/`([^`]+)`/g, function (_, capture) { return stylize(capture, 'italic') }) - .replace(/\*([^*]+)\*/g, function (_, capture) { return stylize(capture, 'bold') }) - .replace(/\n/g, function (_, capture) { return ' \n ' } ); - }); - } - return options.stream.write(args.join('\n') + options.tail); - }; -}; - -this.result = function (event) { - var result = [], buffer = [], time = '', header; - var complete = event.honored + event.pending + event.errored + event.broken; - var status = (event.errored && 'errored') || (event.broken && 'broken') || - (event.honored && 'honored') || (event.pending && 'pending'); - - if (event.total === 0) { - return [$("Could not find any tests to run.").bold.red]; - } - - event.honored && result.push($(event.honored).bold + " honored"); - event.broken && result.push($(event.broken).bold + " broken"); - event.errored && result.push($(event.errored).bold + " errored"); - event.pending && result.push($(event.pending).bold + " pending"); - - if (complete < event.total) { - result.push($(event.total - complete).bold + " dropped"); - } - - result = result.join(' ∙ '); - - header = { - honored: '✓ ' + $('OK').bold.green, - broken: '✗ ' + $('Broken').bold.yellow, - errored: '✗ ' + $('Errored').bold.red, - pending: '- ' + $('Pending').bold.cyan - }[status] + ' » '; - - if (typeof(event.time) === 'number') { - time = ' (' + event.time.toFixed(3) + 's)'; - time = this.stylize(time, 'grey'); - } - buffer.push(header + result + time + '\n'); - - return buffer; -}; - -this.inspect = function inspect(val) { - if (module.exports.nocolor) { - return eyes(val); - } - - return '\033[1m' + eyes(val) + '\033[22m'; -}; - -this.error = function (obj) { - var string = '✗ ' + $('Errored ').red + '» '; - string += $(obj.error).red.bold + '\n'; - string += (obj.context ? ' in ' + $(obj.context).red + '\n': ''); - string += ' in ' + $(obj.suite.subject).red + '\n'; - string += ' in ' + $(obj.suite._filename).red; - - return string; -}; - -this.contextText = function (event) { - return ' ' + event; -}; - -this.vowText = function (event) { - var buffer = []; - - buffer.push(' ' + { - honored: ' ✓ ', - broken: ' ✗ ', - errored: ' ✗ ', - pending: ' - ' - }[event.status] + this.stylize(event.title, ({ - honored: 'green', - broken: 'yellow', - errored: 'red', - pending: 'cyan' - })[event.status])); - - if (event.status === 'broken') { - buffer.push(' » ' + event.exception); - } else if (event.status === 'errored') { - if (event.exception.type === 'promise') { - buffer.push(' » ' + this.stylize("An unexpected error was caught: " + - this.stylize(event.exception.error, 'bold'), 'red')); - } else { - buffer.push(' ' + this.stylize(event.exception, 'red')); - } - } - return buffer.join('\n'); -}; diff --git a/node_modules/api-easy/node_modules/vows/lib/vows/context.js b/node_modules/api-easy/node_modules/vows/lib/vows/context.js deleted file mode 100644 index b11d676..0000000 --- a/node_modules/api-easy/node_modules/vows/lib/vows/context.js +++ /dev/null @@ -1,76 +0,0 @@ - -this.Context = function (vow, ctx, env) { - var that = this; - - this.tests = vow.callback; - this.topics = (ctx.topics || []).slice(0); - this.emitter = null; - this.env = env || {}; - this.env.context = this; - - this.env.callback = function (/* arguments */) { - var ctx = this; - var args = Array.prototype.slice.call(arguments); - - var emit = (function (args) { - // - // Convert callback-style results into events. - // - if (vow.batch.suite.options.error) { - return function () { - var e = args.shift(); - that.emitter.ctx = ctx; - // We handle a special case, where the first argument is a - // boolean, in which case we treat it as a result, and not - // an error. This is useful for `path.exists` and other - // functions like it, which only pass a single boolean - // parameter instead of the more common (error, result) pair. - if (typeof(e) === 'boolean' && args.length === 0) { - that.emitter.emit.call(that.emitter, 'success', e); - } else { - if (e) { that.emitter.emit.apply(that.emitter, ['error', e].concat(args)) } - else { that.emitter.emit.apply(that.emitter, ['success'].concat(args)) } - } - }; - } else { - return function () { - that.emitter.ctx = ctx; - that.emitter.emit.apply(that.emitter, ['success'].concat(args)); - }; - } - })(args.slice(0)); - // If `this.callback` is called synchronously, - // the emitter will not have been set yet, - // so we defer the emition, that way it'll behave - // asynchronously. - if (that.emitter) { emit() } - else { process.nextTick(emit) } - }; - this.name = vow.description; - // events is an alias for on - if (this.name === 'events') { - this.name = vow.description = 'on'; - } - - // if this is a sub-event context AND it's context was an event, - // then I must enforce event order. - // this will not do a good job of handling pin-pong events - if (this.name === 'on' && ctx.isEvent) { - this.after = ctx.name; - } - - if (ctx.name === 'on') { - this.isEvent = true; - this.event = this.name; - this.after = ctx.after; - } else { - this.isEvent = false; - this.event = 'success'; - } - - this.title = [ - ctx.title || '', - vow.description || '' - ].join(/^[#.:]/.test(vow.description) ? '' : ' ').trim(); -}; - diff --git a/node_modules/api-easy/node_modules/vows/lib/vows/coverage/file.js b/node_modules/api-easy/node_modules/vows/lib/vows/coverage/file.js deleted file mode 100644 index 5bdef90..0000000 --- a/node_modules/api-easy/node_modules/vows/lib/vows/coverage/file.js +++ /dev/null @@ -1,29 +0,0 @@ - -exports.coverage = function (filename, data) { - var ret = { - filename: filename, - coverage: 0, - hits: 0, - misses: 0, - sloc : 0 - }; - - var source = data.source; - ret.source = source.map(function (line, num) { - num++; - - if (data[num] === 0) { - ret.misses++; - ret.sloc++; - } else if (data[num] !== undefined) { - ret.hits++; - ret.sloc++; - } - - return { line: line, coverage: (data[num] === undefined ? '' : data[num]) }; - }); - - ret.coverage = (ret.hits / ret.sloc) * 100; - - return ret; -}; \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/vows/lib/vows/coverage/fragments/coverage-foot.html b/node_modules/api-easy/node_modules/vows/lib/vows/coverage/fragments/coverage-foot.html deleted file mode 100644 index 691287b..0000000 --- a/node_modules/api-easy/node_modules/vows/lib/vows/coverage/fragments/coverage-foot.html +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/vows/lib/vows/coverage/fragments/coverage-head.html b/node_modules/api-easy/node_modules/vows/lib/vows/coverage/fragments/coverage-head.html deleted file mode 100644 index aa2f107..0000000 --- a/node_modules/api-easy/node_modules/vows/lib/vows/coverage/fragments/coverage-head.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - diff --git a/node_modules/api-easy/node_modules/vows/lib/vows/coverage/report-html.js b/node_modules/api-easy/node_modules/vows/lib/vows/coverage/report-html.js deleted file mode 100644 index f7e5b72..0000000 --- a/node_modules/api-easy/node_modules/vows/lib/vows/coverage/report-html.js +++ /dev/null @@ -1,54 +0,0 @@ -var util = require('util'), - fs = require('fs'), - file = require('./file'); - -this.name = 'coverage-report-html'; - -function getCoverageClass( data ) { - var fullCoverage= (data.coverage == 100); - var okCoverage= (!fullCoverage && data.coverage >=60); - var coverageClass= ''; - if( fullCoverage ) coverageClass= 'fullCoverage'; - else if( okCoverage) coverageClass= 'okCoverage'; - else coverageClass= 'poorCoverage'; - return coverageClass; -} -this.report = function (coverageMap) { - var out, head, foot; - - try { - out = fs.openSync("coverage.html", "w"); - head = fs.readFileSync(__dirname + "/fragments/coverage-head.html", "utf8"); - foot = fs.readFileSync(__dirname + "/fragments/coverage-foot.html", "utf8"); - } catch (error) { - util.print("Error: Unable to write to file coverage.html\n"); - return; - } - - fs.writeSync(out, head); - - for (var filename in coverageMap) { - if (coverageMap.hasOwnProperty(filename)) { - var data = file.coverage(filename, coverageMap[filename]); - var coverageClass= getCoverageClass( data ); - fs.writeSync(out, "

" + filename + "

\n"); - fs.writeSync(out, '' + "[ hits: " + data.hits); - fs.writeSync(out, ", misses: " + data.misses + ", sloc: " + data.sloc); - fs.writeSync(out, ", coverage: " + data.coverage.toFixed(2) + "% ]" + "
[+]\n"); - fs.writeSync(out, "\n"); - fs.writeSync(out, "
\n"); - } - } - - fs.writeSync(out, foot); - fs.close(out); -}; diff --git a/node_modules/api-easy/node_modules/vows/lib/vows/coverage/report-json.js b/node_modules/api-easy/node_modules/vows/lib/vows/coverage/report-json.js deleted file mode 100644 index bcbab25..0000000 --- a/node_modules/api-easy/node_modules/vows/lib/vows/coverage/report-json.js +++ /dev/null @@ -1,54 +0,0 @@ -var util = require('util'), - fs = require('fs'), - file = require('./file'); - -this.name = 'coverage-report-json'; - -this.report = function (coverageMap) { - var output = { - meta: { - "generator": "vowsjs", - "generated": new Date().toString(), - "instrumentation": "node-jscoverage", - "file-version": "1.0" - }, - files: [ ], - coverage: [ ] - }; - - - for (var filename in coverageMap) { - if (coverageMap.hasOwnProperty(filename)) { - var data = file.coverage(filename, coverageMap[filename]); - - var coverage = { - file: filename, - coverage: data.coverage.toFixed(2), - hits: data.hits, - misses: data.misses, - sloc: data.sloc, - source: { } - }; - - for (var i = 0; i < data.source.length; i++) { - coverage.source[i + 1] = { - line: data.source[i].line, - coverage: data.source[i].coverage - }; - } - - output.coverage.push(coverage); - - output.files.push(filename); - } - } - - try { - out = fs.openSync("coverage.json", "w"); - fs.writeSync(out, JSON.stringify(output)); - fs.close(out); - } catch (error) { - util.print("Error: Unable to write to file coverage.json\n"); - return; - } -}; diff --git a/node_modules/api-easy/node_modules/vows/lib/vows/coverage/report-plain.js b/node_modules/api-easy/node_modules/vows/lib/vows/coverage/report-plain.js deleted file mode 100644 index 9de7005..0000000 --- a/node_modules/api-easy/node_modules/vows/lib/vows/coverage/report-plain.js +++ /dev/null @@ -1,38 +0,0 @@ -var util = require('util'), - file = require('./file'); - -this.name = 'coverage-report-plain'; - -function lpad(str, width) { - str = String(str); - var n = width - str.length; - - if (n < 1) { - return str; - } - - while (n--) { - str = ' ' + str; - } - - return str; -} - - -this.report = function (coverageMap) { - for (var filename in coverageMap) { - if (coverageMap.hasOwnProperty(filename)) { - var data = file.coverage(filename, coverageMap[filename]); - - util.print(filename + ":\n"); - util.print("[ hits: " + data.hits + ", misses: " + data.misses); - util.print(", sloc: " + data.sloc + ", coverage: " + data.coverage.toFixed(2) + "% ]\n"); - - for (var i = 0; i < data.source.length; i++) { - util.print(lpad(data.source[i].coverage, 5) + " | " + data.source[i].line + "\n"); - } - - util.print("\n"); - } - } -}; diff --git a/node_modules/api-easy/node_modules/vows/lib/vows/coverage/report-xml.js b/node_modules/api-easy/node_modules/vows/lib/vows/coverage/report-xml.js deleted file mode 100644 index b9ff95b..0000000 --- a/node_modules/api-easy/node_modules/vows/lib/vows/coverage/report-xml.js +++ /dev/null @@ -1,81 +0,0 @@ -var fs = require('fs'), - file = require('./file'); - -this.name = 'coverage-report-xml'; - -this.report = function (coverageMap) { - var all = { - xml: '', - packages: 0, - files: 0, - lines: 0, - hits: 0 - }, - data = {}; - - // group data by path - for (var filename in coverageMap) { - if (coverageMap.hasOwnProperty(filename)) { - var pkg = (filename.indexOf('/') > 0) - ? filename.substr(0, filename.lastIndexOf('/')) - : filename; - if (!data[pkg]) { - data[pkg] = {}; - } - data[pkg][ (filename.indexOf('/')) - ? filename.substr(filename.lastIndexOf('/') + 1, filename.length) - : filename ] - = file.coverage(filename, coverageMap[filename]); - } - } - - // generate groups xml-fragment - for (var pkg in data) { - if (data.hasOwnProperty(pkg)) { - var pkgStat = { - xml: '', - files: 0, - lines: 0, - hits: 0 - }; - - all.xml += '\t\n'; - - for (var filename in data[pkg]) { - if (data[pkg].hasOwnProperty(filename)) { - pkgStat.files += 1; - pkgStat.lines += data[pkg][filename].sloc; - pkgStat.hits += data[pkg][filename].hits; - - pkgStat.xml += '\t\t\n' - + '\t\t\t\n' - + '\t\t\n'; - } - } - - all.packages += 1; - all.files += pkgStat.files; - all.lines += pkgStat.lines; - all.hits += pkgStat.hits; - - all.xml += '\t\t\n' - + pkgStat.xml - + '\t\n'; - } - } - - all.xml = '\n' - + '\n\n' - + '\t\n' - + '\t\n' - + '\t\n' - + '\t\n' - + '\t\n' - + '\n\n' - + '\n' - + '\t\n' - + all.xml - + '\n\n\n'; - - fs.writeFileSync('coverage.xml', all.xml); -}; diff --git a/node_modules/api-easy/node_modules/vows/lib/vows/extras.js b/node_modules/api-easy/node_modules/vows/lib/vows/extras.js deleted file mode 100644 index a90d7a5..0000000 --- a/node_modules/api-easy/node_modules/vows/lib/vows/extras.js +++ /dev/null @@ -1,28 +0,0 @@ -var events = require('events'); -// -// Wrap a Node.js style async function into an EventEmmitter -// -this.prepare = function (obj, targets) { - targets.forEach(function (target) { - if (target in obj) { - obj[target] = (function (fun) { - return function () { - var args = Array.prototype.slice.call(arguments); - var ee = new(events.EventEmitter); - - args.push(function (err /* [, data] */) { - var args = Array.prototype.slice.call(arguments, 1); - - if (err) { ee.emit.apply(ee, ['error', err].concat(args)) } - else { ee.emit.apply(ee, ['success'].concat(args)) } - }); - fun.apply(obj, args); - - return ee; - }; - })(obj[target]); - } - }); - return obj; -}; - diff --git a/node_modules/api-easy/node_modules/vows/lib/vows/reporters/dot-matrix.js b/node_modules/api-easy/node_modules/vows/lib/vows/reporters/dot-matrix.js deleted file mode 100644 index 0ecf590..0000000 --- a/node_modules/api-easy/node_modules/vows/lib/vows/reporters/dot-matrix.js +++ /dev/null @@ -1,67 +0,0 @@ -var options = { tail: '' }, - console = require('../../vows/console'), - stylize = console.stylize, - puts = console.puts(options); -// -// Console reporter -// -var messages = [], lastContext; - -this.name = 'dot-matrix'; -this.setStream = function (s) { - options.stream = s; -}; - -this.reset = function () { - messages = []; - lastContext = null; -}; -this.report = function (data) { - var event = data[1]; - - switch (data[0]) { - case 'subject': - // messages.push(stylize(event, 'underline') + '\n'); - break; - case 'context': - break; - case 'vow': - if (event.status === 'honored') { - puts(stylize('·', 'green')); - } else if (event.status === 'pending') { - puts(stylize('-', 'cyan')); - } else { - if (lastContext !== event.context) { - lastContext = event.context; - messages.push(' ' + event.context); - } - if (event.status === 'broken') { - puts(stylize('✗', 'yellow')); - messages.push(console.vowText(event)); - } else if (event.status === 'errored') { - puts(stylize('✗', 'red')); - messages.push(console.vowText(event)); - } - messages.push(''); - } - break; - case 'end': - puts(' '); - break; - case 'finish': - if (messages.length) { - puts('\n\n' + messages.join('\n')); - } else { - puts(''); - } - puts(console.result(event).join('\n')); - break; - case 'error': - puts(console.error(event)); - break; - } -}; - -this.print = function (str) { - puts(str); -}; diff --git a/node_modules/api-easy/node_modules/vows/lib/vows/reporters/json.js b/node_modules/api-easy/node_modules/vows/lib/vows/reporters/json.js deleted file mode 100644 index 20c1366..0000000 --- a/node_modules/api-easy/node_modules/vows/lib/vows/reporters/json.js +++ /dev/null @@ -1,33 +0,0 @@ -var options = { tail: '\n', raw: true }; -var console = require('../../vows/console'); -var puts = console.puts(options); - -// -// Console JSON reporter -// -this.name = 'json'; -this.setStream = function (s) { - options.stream = s; -}; - -function removeCircularSuite(obj, suite) { - var result = {}; - - if (typeof obj !== 'object' || obj === null) return obj; - - Object.keys(obj).forEach(function(key) { - if (obj[key] === suite) { - result[key] = {}; - } else { - result[key] = removeCircularSuite(obj[key], suite || obj.suite); - } - }); - - return result; -}; - -this.report = function (obj) { - puts(JSON.stringify(removeCircularSuite(obj))); -}; - -this.print = function (str) {}; diff --git a/node_modules/api-easy/node_modules/vows/lib/vows/reporters/silent.js b/node_modules/api-easy/node_modules/vows/lib/vows/reporters/silent.js deleted file mode 100644 index fe90a33..0000000 --- a/node_modules/api-easy/node_modules/vows/lib/vows/reporters/silent.js +++ /dev/null @@ -1,8 +0,0 @@ -// -// Silent reporter - "Shhh" -// -this.name = 'silent'; -this.reset = function () {}; -this.report = function () {}; -this.print = function () {}; - diff --git a/node_modules/api-easy/node_modules/vows/lib/vows/reporters/spec.js b/node_modules/api-easy/node_modules/vows/lib/vows/reporters/spec.js deleted file mode 100644 index d1c6dd8..0000000 --- a/node_modules/api-easy/node_modules/vows/lib/vows/reporters/spec.js +++ /dev/null @@ -1,42 +0,0 @@ -var util = require('util'); - -var options = { tail: '\n' }; -var console = require('../../vows/console'); -var stylize = console.stylize, - puts = console.puts(options); -// -// Console reporter -// - -this.name = 'spec'; -this.setStream = function (s) { - options.stream = s; -}; -this.report = function (data) { - var event = data[1]; - - switch (data[0]) { - case 'subject': - puts('\n♢ ' + stylize(event, 'bold') + '\n'); - break; - case 'context': - puts(console.contextText(event)); - break; - case 'vow': - puts(console.vowText(event)); - break; - case 'end': - util.print('\n'); - break; - case 'finish': - puts(console.result(event).join('\n')); - break; - case 'error': - puts(console.error(event)); - break; - } -}; - -this.print = function (str) { - util.print(str); -}; diff --git a/node_modules/api-easy/node_modules/vows/lib/vows/reporters/watch.js b/node_modules/api-easy/node_modules/vows/lib/vows/reporters/watch.js deleted file mode 100644 index 58f6e3c..0000000 --- a/node_modules/api-easy/node_modules/vows/lib/vows/reporters/watch.js +++ /dev/null @@ -1,37 +0,0 @@ -var options = {}; -var console = require('../../vows/console'); -var spec = require('../../vows/reporters/spec'); -var stylize = console.stylize, - puts = console.puts(options); -// -// Console reporter -// -var lastContext; - -this.name = 'watch'; -this.setStream = function (s) { - options.stream = s; -}; -this.reset = function () { - lastContext = null; -}; -this.report = function (data) { - var event = data[1]; - - switch (data[0]) { - case 'vow': - if (['honored', 'pending'].indexOf(event.status) === -1) { - if (lastContext !== event.context) { - lastContext = event.context; - puts(console.contextText(event.context)); - } - puts(console.vowText(event)); - puts(''); - } - break; - case 'error': - puts(console.error(event)); - break; - } -}; -this.print = function (str) {}; diff --git a/node_modules/api-easy/node_modules/vows/lib/vows/reporters/xunit.js b/node_modules/api-easy/node_modules/vows/lib/vows/reporters/xunit.js deleted file mode 100644 index 411a948..0000000 --- a/node_modules/api-easy/node_modules/vows/lib/vows/reporters/xunit.js +++ /dev/null @@ -1,90 +0,0 @@ -// xunit outoput for vows, so we can run things under hudson -// -// The translation to xunit is simple. Most likely more tags/attributes can be -// added, see: http://ant.1045680.n5.nabble.com/schema-for-junit-xml-output-td1375274.html -// - -var puts = require('util').puts; - -var buffer = [], - curSubject = null; - -function xmlEnc(value) { - return !value ? value : String(value).replace(/&/g, "&") - .replace(/>/g, ">") - .replace(/'; -} - -function cdata(data) { - return ''; -} - -this.name = 'xunit'; -this.report = function (data) { - var event = data[1]; - - switch (data[0]) { - case 'subject': - curSubject = event; - break; - case 'context': - break; - case 'vow': - switch (event.status) { - case 'honored': - buffer.push(tag('testcase', {classname: curSubject, name: event.context + ': ' + event.title}, true)); - break; - case 'broken': - var err = tag('error', {type: 'vows.event.broken', message: 'Broken test'}, false, cdata(event.exception)); - buffer.push(tag('testcase', {classname: curSubject, name: event.context + ': ' + event.title}, false, err)); - break; - case 'errored': - var skip = tag('skipped', {type: 'vows.event.errored', message: 'Errored test'}, false, cdata(event.exception)); - buffer.push(tag('testcase', {classname: curSubject, name: event.context + ': ' + event.title}, false, skip)); - break; - case 'pending': - // nop - break; - } - break; - case 'end': - buffer.push(end('testcase')); - break; - case 'finish': - buffer.unshift(tag('testsuite', {name: 'Vows test', tests: event.total, timestamp: (new Date()).toUTCString(), errors: event.errored, failures: event.broken, skip: event.pending, time: event.time})); - buffer.push(end('testsuite')); - puts(buffer.join('\n')); - break; - case 'error': - break; - } -}; - -this.print = function (str) { }; diff --git a/node_modules/api-easy/node_modules/vows/lib/vows/suite.js b/node_modules/api-easy/node_modules/vows/lib/vows/suite.js deleted file mode 100644 index 737b295..0000000 --- a/node_modules/api-easy/node_modules/vows/lib/vows/suite.js +++ /dev/null @@ -1,380 +0,0 @@ -var events = require('events'), - path = require('path'); - -var vows = require('../vows'); -var Context = require('../vows/context').Context; - -this.Suite = function (subject) { - this.subject = subject; - this.matcher = /.*/; - this.reporter = require('./reporters/dot-matrix'); - this.batches = []; - this.options = { error: true }; - this.reset(); -}; - -this.Suite.prototype = new(function () { - this.reset = function () { - this.results = { - honored: 0, - broken: 0, - errored: 0, - pending: 0, - total: 0, - time: null - }; - this.batches.forEach(function (b) { - b.lastContext = null; - b.remaining = b._remaining; - b.honored = b.broken = b.errored = b.total = b.pending = 0; - b.vows.forEach(function (vow) { vow.status = null }); - b.teardowns = []; - }); - }; - - this.addBatch = function (tests) { - this.batches.push({ - tests: tests, - suite: this, - vows: [], - remaining: 0, - _remaining: 0, - honored: 0, - broken: 0, - errored: 0, - pending: 0, - total: 0, - teardowns: [] - }); - return this; - }; - this.addVows = this.addBatch; - - this.parseBatch = function (batch, matcher) { - var tests = batch.tests; - - if ('topic' in tests) { - throw new(Error)("missing top-level context."); - } - // Count the number of vows/promises expected to fire, - // so we know when the tests are over. - // We match the keys against `matcher`, to decide - // whether or not they should be included in the test. - // Any key, including assertion function keys can be matched. - // If a child matches, then the n parent topics must not be skipped. - (function count(tests, _match) { - var match = false; - - var keys = Object.keys(tests).filter(function (k) { - return k !== 'topic' && k !== 'teardown'; - }); - - for (var i = 0, key; i < keys.length; i++) { - key = keys[i]; - - // If the parent node, or this one matches. - match = _match || matcher.test(key); - - if (typeof(tests[key]) === 'object') { - match = count(tests[key], match); - } else { - if (typeof(tests[key]) === 'string') { - tests[key] = new(String)(tests[key]); - } - if (! match) { - tests[key]._skip = true; - } - } - } - - // If any of the children matched, - // don't skip this node. - for (var i = 0; i < keys.length; i++) { - if (! tests[keys[i]]._skip) { match = true } - } - - if (match) { batch.remaining ++ } - else { tests._skip = true } - - return match; - })(tests, false); - - batch._remaining = batch.remaining; - }; - - this.runBatch = function (batch) { - var topic, - tests = batch.tests, - promise = batch.promise = new(events.EventEmitter); - - var that = this; - - batch.status = 'begin'; - - // The test runner, it calls itself recursively, passing the - // previous context to the inner contexts. This is so the `topic` - // functions have access to all the previous context topics in their - // arguments list. - // It is defined and invoked at the same time. - // If it encounters a `topic` function, it waits for the returned - // promise to emit (the topic), at which point it runs the functions under it, - // passing the topic as an argument. - (function run(ctx, lastTopic) { - var old = false; - topic = ctx.tests.topic; - - if (typeof(topic) === 'function') { - if (ctx.isEvent || ctx.name === 'on') { - throw new Error('Event context cannot contain a topic'); - } - - // Run the topic, passing the previous context topics - // If topic `throw`s an exception, pass it down as a value - try { - topic = topic.apply(ctx.env, ctx.topics); - } - catch (ex) { - topic = ex; - } - - if (typeof(topic) === 'undefined') { ctx._callback = true } - } - - // If this context has a topic, store it in `lastTopic`, - // if not, use the last topic, passed down by a parent - // context. - if (typeof(topic) !== 'undefined' || ctx._callback) { - lastTopic = topic; - } else { - old = true; - topic = lastTopic; - } - - // If the topic doesn't return an event emitter (such as a promise), - // we create it ourselves, and emit the value on the next tick. - if (! (topic && - topic.constructor === events.EventEmitter)) { - // If the context is a traditional vow, then a topic can ONLY - // be an EventEmitter. However if the context is a sub-event - // then the topic may be an instanceof EventEmitter - if (!ctx.isEvent || - (ctx.isEvent && !(topic instanceof events.EventEmitter))) { - - ctx.emitter = new(events.EventEmitter); - - if (! ctx._callback) { - process.nextTick(function (val) { - return function () { - ctx.emitter.emit("success", val) - }; - }(topic)); - } - // if I have a callback, push the new topic back up to - // lastTopic - if (ctx._callback) { - lastTopic = topic = ctx.emitter; - } else { - topic = ctx.emitter; - } - } - } - - topic.on(ctx.event, function (val) { - // Once the topic fires, add the return value - // to the beginning of the topics list, so it - // becomes the first argument for the next topic. - // If we're using the parent topic, no need to - // prepend it to the topics list, or we'll get - // duplicates. - if (!old || ctx.isEvent) { - Array.prototype.unshift.apply(ctx.topics, arguments) - }; - }); - if (topic.setMaxListeners) { topic.setMaxListeners(Infinity) } - // Now run the tests, or sub-contexts - Object.keys(ctx.tests).filter(function (k) { - return ctx.tests[k] && k !== 'topic' && - k !== 'teardown' && !ctx.tests[k]._skip; - }).forEach(function (item) { - // Create a new evaluation context, - // inheriting from the parent one. - var env = Object.create(ctx.env); - env.suite = that; - - // Holds the current test or context - var vow = Object.create({ - callback: ctx.tests[item], - context: ctx.title, - description: item, - binding: ctx.env, - status: null, - batch: batch - }); - - // If we encounter a function, add it to the callbacks - // of the `topic` function, so it'll get called once the - // topic fires. - // If we encounter an object literal, we recurse, sending it - // our current context. - if ((typeof(vow.callback) === 'function') || - (vow.callback instanceof String)) { - topic.addVow(vow); - } else if (typeof(vow.callback) === 'object') { - // If there's a setup stage, we have to wait for it to fire, - // before calling the inner context. - // If the event has already fired, the context is 'on' or - // there is no setup stage, just run the inner context - // synchronously. - if (topic && - ctx.name !== 'on' && - !topic._vowsEmitedEvents.hasOwnProperty(ctx.event)) { - topic.on(ctx.event, function (ctx) { - return function (val) { - return run(new(Context)(vow, ctx, env), lastTopic); - }; - }(ctx)); - } else { - run(new(Context)(vow, ctx, env), lastTopic); - } - } - }); - // Teardown - if (ctx.tests.teardown) { - batch.teardowns.push(ctx); - } - if (! ctx.tests._skip) { - batch.remaining --; - } - // Check if we're done running the tests - exports.tryEnd(batch); - // This is our initial, empty context - })(new(Context)({ callback: tests, context: null, description: null }, {})); - return promise; - }; - - this.report = function () { - return this.reporter.report.apply(this.reporter, arguments); - }; - - this.run = function (options, callback) { - var that = this, start; - - options = options || {}; - - for (var k in options) { this.options[k] = options[k] } - - this.matcher = this.options.matcher || this.matcher; - this.reporter = this.options.reporter || this.reporter; - - this.batches.forEach(function (batch) { - that.parseBatch(batch, that.matcher); - }); - - this.reset(); - - start = new(Date); - - if (this.batches.filter(function (b) { return b.remaining > 0 }).length) { - this.report(['subject', this.subject]); - } - - return (function run(batches) { - var batch = batches.shift(); - - if (batch) { - // If the batch has no vows to run, - // go to the next one. - if (batch.remaining === 0) { - run(batches); - } else { - that.runBatch(batch).on('end', function () { - run(batches); - }); - } - } else { - that.results.time = (new(Date) - start) / 1000; - that.report(['finish', that.results]); - - if (callback) { callback(that.results) } - - if (that.results.honored + that.results.pending === that.results.total) { - return 0; - } else { - return 1; - } - } - })(this.batches.slice(0)); - }; - - this.runParallel = function () {}; - - this.export = function (module, options) { - for (var k in (options || {})) { this.options[k] = options[k] } - - if (require.main === module) { - return this.run(); - } else { - return module.exports[this.subject] = this; - } - }; - this.exportTo = function (module, options) { // Alias, for JSLint - return this.export(module, options); - }; -}); - -// -// Checks if all the tests in the batch have been run, -// and triggers the next batch (if any), by emitting the 'end' event. -// -this.tryEnd = function (batch) { - var result, style, time; - - if (batch.honored + batch.broken + batch.errored + batch.pending === batch.total && - batch.remaining === 0) { - - Object.keys(batch).forEach(function (k) { - (k in batch.suite.results) && (batch.suite.results[k] += batch[k]); - }); - - if (batch.teardowns) { - for (var i = batch.teardowns.length - 1, ctx; i >= 0; i--) { - runTeardown(batch.teardowns[i]); - } - - maybeFinish(); - } - - function runTeardown(teardown) { - var env = Object.create(teardown.env); - - Object.defineProperty(env, "callback", { - get: function () { - teardown.awaitingCallback = true; - - return function () { - teardown.awaitingCallback = false; - maybeFinish(); - }; - } - }); - - teardown.tests.teardown.apply(env, teardown.topics); - } - - function maybeFinish() { - var pending = batch.teardowns.filter(function (teardown) { - return teardown.awaitingCallback; - }); - - if (pending.length === 0) { - finish(); - } - } - - function finish() { - batch.status = 'end'; - batch.suite.report(['end']); - batch.promise.emit('end', batch.honored, batch.broken, batch.errored, batch.pending); - } - } -}; diff --git a/node_modules/api-easy/node_modules/vows/node_modules/eyes/LICENSE b/node_modules/api-easy/node_modules/vows/node_modules/eyes/LICENSE deleted file mode 100644 index a1edd93..0000000 --- a/node_modules/api-easy/node_modules/vows/node_modules/eyes/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2009 cloudhead - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/api-easy/node_modules/vows/node_modules/eyes/Makefile b/node_modules/api-easy/node_modules/vows/node_modules/eyes/Makefile deleted file mode 100644 index a121dea..0000000 --- a/node_modules/api-easy/node_modules/vows/node_modules/eyes/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -test: - @@node test/eyes-test.js - -.PHONY: test diff --git a/node_modules/api-easy/node_modules/vows/node_modules/eyes/README.md b/node_modules/api-easy/node_modules/vows/node_modules/eyes/README.md deleted file mode 100644 index 7a92158..0000000 --- a/node_modules/api-easy/node_modules/vows/node_modules/eyes/README.md +++ /dev/null @@ -1,72 +0,0 @@ -eyes -==== - -a customizable value inspector for Node.js - -synopsis --------- - -I was tired of looking at cluttered output in the console -- something needed to be done, -`sys.inspect()` didn't display regexps correctly, and was too verbose, and I had an hour or two to spare. -So I decided to have some fun. _eyes_ were born. - -![eyes-ss](http://dl.dropbox.com/u/251849/eyes-js-ss.gif) - -_example of the output of a user-customized eyes.js inspector_ - -*eyes* also deals with circular objects in an intelligent way, and can pretty-print object literals. - -usage ------ - - var inspect = require('eyes').inspector({styles: {all: 'magenta'}}); - - inspect(something); // inspect with the settings passed to `inspector` - -or - - var eyes = require('eyes'); - - eyes.inspect(something); // inspect with the default settings - -you can pass a _label_ to `inspect()`, to keep track of your inspections: - - eyes.inspect(something, "a random value"); - -If you want to return the output of eyes without printing it, you can set it up this way: - - var inspect = require('eyes').inspector({ stream: null }); - - sys.puts(inspect({ something: 42 })); - -customization -------------- - -These are the default styles and settings used by _eyes_. - styles: { // Styles applied to stdout - all: 'cyan', // Overall style applied to everything - label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]` - other: 'inverted', // Objects which don't have a literal representation, such as functions - key: 'bold', // The keys in object literals, like 'a' in `{a: 1}` - - special: 'grey', // null, undefined... - string: 'green', - number: 'magenta', - bool: 'blue', // true false - regexp: 'green', // /\d+/ - }, - pretty: true, // Indent object literals - hideFunctions: false, // Don't output functions at all - stream: process.stdout, // Stream to write to, or null - maxLength: 2048 // Truncate output if longer - -You can overwrite them with your own, by passing a similar object to `inspector()` or `inspect()`. - - var inspect = require('eyes').inspector({ - styles: { - all: 'magenta', - special: 'bold' - }, - maxLength: 512 - }); - diff --git a/node_modules/api-easy/node_modules/vows/node_modules/eyes/lib/eyes.js b/node_modules/api-easy/node_modules/vows/node_modules/eyes/lib/eyes.js deleted file mode 100644 index 10d964b..0000000 --- a/node_modules/api-easy/node_modules/vows/node_modules/eyes/lib/eyes.js +++ /dev/null @@ -1,236 +0,0 @@ -// -// Eyes.js - a customizable value inspector for Node.js -// -// usage: -// -// var inspect = require('eyes').inspector({styles: {all: 'magenta'}}); -// inspect(something); // inspect with the settings passed to `inspector` -// -// or -// -// var eyes = require('eyes'); -// eyes.inspect(something); // inspect with the default settings -// -var eyes = exports, - stack = []; - -eyes.defaults = { - styles: { // Styles applied to stdout - all: 'cyan', // Overall style applied to everything - label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]` - other: 'inverted', // Objects which don't have a literal representation, such as functions - key: 'bold', // The keys in object literals, like 'a' in `{a: 1}` - special: 'grey', // null, undefined... - string: 'green', - number: 'magenta', - bool: 'blue', // true false - regexp: 'green', // /\d+/ - }, - pretty: true, // Indent object literals - hideFunctions: false, - showHidden: false, - stream: process.stdout, - maxLength: 2048 // Truncate output if longer -}; - -// Return a curried inspect() function, with the `options` argument filled in. -eyes.inspector = function (options) { - var that = this; - return function (obj, label, opts) { - return that.inspect.call(that, obj, label, - merge(options || {}, opts || {})); - }; -}; - -// If we have a `stream` defined, use it to print a styled string, -// if not, we just return the stringified object. -eyes.inspect = function (obj, label, options) { - options = merge(this.defaults, options || {}); - - if (options.stream) { - return this.print(stringify(obj, options), label, options); - } else { - return stringify(obj, options) + (options.styles ? '\033[39m' : ''); - } -}; - -// Output using the 'stream', and an optional label -// Loop through `str`, and truncate it after `options.maxLength` has been reached. -// Because escape sequences are, at this point embeded within -// the output string, we can't measure the length of the string -// in a useful way, without separating what is an escape sequence, -// versus a printable character (`c`). So we resort to counting the -// length manually. -eyes.print = function (str, label, options) { - for (var c = 0, i = 0; i < str.length; i++) { - if (str.charAt(i) === '\033') { i += 4 } // `4` because '\033[25m'.length + 1 == 5 - else if (c === options.maxLength) { - str = str.slice(0, i - 1) + '…'; - break; - } else { c++ } - } - return options.stream.write.call(options.stream, (label ? - this.stylize(label, options.styles.label, options.styles) + ': ' : '') + - this.stylize(str, options.styles.all, options.styles) + '\033[0m' + "\n"); -}; - -// Apply a style to a string, eventually, -// I'd like this to support passing multiple -// styles. -eyes.stylize = function (str, style, styles) { - var codes = { - 'bold' : [1, 22], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'cyan' : [36, 39], - 'magenta' : [35, 39], - 'blue' : [34, 39], - 'yellow' : [33, 39], - 'green' : [32, 39], - 'red' : [31, 39], - 'grey' : [90, 39] - }, endCode; - - if (style && codes[style]) { - endCode = (codes[style][1] === 39 && styles.all) ? codes[styles.all][0] - : codes[style][1]; - return '\033[' + codes[style][0] + 'm' + str + - '\033[' + endCode + 'm'; - } else { return str } -}; - -// Convert any object to a string, ready for output. -// When an 'array' or an 'object' are encountered, they are -// passed to specialized functions, which can then recursively call -// stringify(). -function stringify(obj, options) { - var that = this, stylize = function (str, style) { - return eyes.stylize(str, options.styles[style], options.styles) - }, index, result; - - if ((index = stack.indexOf(obj)) !== -1) { - return stylize(new(Array)(stack.length - index + 1).join('.'), 'special'); - } - stack.push(obj); - - result = (function (obj) { - switch (typeOf(obj)) { - case "string" : obj = stringifyString(obj.indexOf("'") === -1 ? "'" + obj + "'" - : '"' + obj + '"'); - return stylize(obj, 'string'); - case "regexp" : return stylize('/' + obj.source + '/', 'regexp'); - case "number" : return stylize(obj + '', 'number'); - case "function" : return options.stream ? stylize("Function", 'other') : '[Function]'; - case "null" : return stylize("null", 'special'); - case "undefined": return stylize("undefined", 'special'); - case "boolean" : return stylize(obj + '', 'bool'); - case "date" : return stylize(obj.toUTCString()); - case "array" : return stringifyArray(obj, options, stack.length); - case "object" : return stringifyObject(obj, options, stack.length); - } - })(obj); - - stack.pop(); - return result; -}; - -// Escape invisible characters in a string -function stringifyString (str, options) { - return str.replace(/\\/g, '\\\\') - .replace(/\n/g, '\\n') - .replace(/[\u0001-\u001F]/g, function (match) { - return '\\0' + match[0].charCodeAt(0).toString(8); - }); -} - -// Convert an array to a string, such as [1, 2, 3]. -// This function calls stringify() for each of the elements -// in the array. -function stringifyArray(ary, options, level) { - var out = []; - var pretty = options.pretty && (ary.length > 4 || ary.some(function (o) { - return (o !== null && typeof(o) === 'object' && Object.keys(o).length > 0) || - (Array.isArray(o) && o.length > 0); - })); - var ws = pretty ? '\n' + new(Array)(level * 4 + 1).join(' ') : ' '; - - for (var i = 0; i < ary.length; i++) { - out.push(stringify(ary[i], options)); - } - - if (out.length === 0) { - return '[]'; - } else { - return '[' + ws - + out.join(',' + (pretty ? ws : ' ')) - + (pretty ? ws.slice(0, -4) : ws) + - ']'; - } -}; - -// Convert an object to a string, such as {a: 1}. -// This function calls stringify() for each of its values, -// and does not output functions or prototype values. -function stringifyObject(obj, options, level) { - var out = []; - var pretty = options.pretty && (Object.keys(obj).length > 2 || - Object.keys(obj).some(function (k) { return typeof(obj[k]) === 'object' })); - var ws = pretty ? '\n' + new(Array)(level * 4 + 1).join(' ') : ' '; - - var keys = options.showHidden ? Object.keys(obj) : Object.getOwnPropertyNames(obj); - keys.forEach(function (k) { - if (Object.prototype.hasOwnProperty.call(obj, k) - && !(obj[k] instanceof Function && options.hideFunctions)) { - out.push(eyes.stylize(k, options.styles.key, options.styles) + ': ' + - stringify(obj[k], options)); - } - }); - - if (out.length === 0) { - return '{}'; - } else { - return "{" + ws - + out.join(',' + (pretty ? ws : ' ')) - + (pretty ? ws.slice(0, -4) : ws) + - "}"; - } -}; - -// A better `typeof` -function typeOf(value) { - var s = typeof(value), - types = [Object, Array, String, RegExp, Number, Function, Boolean, Date]; - - if (s === 'object' || s === 'function') { - if (value) { - types.forEach(function (t) { - if (value instanceof t) { s = t.name.toLowerCase() } - }); - } else { s = 'null' } - } - return s; -} - -function merge(/* variable args */) { - var objs = Array.prototype.slice.call(arguments); - var target = {}; - - objs.forEach(function (o) { - Object.keys(o).forEach(function (k) { - if (k === 'styles') { - if (! o.styles) { - target.styles = false; - } else { - target.styles = {} - for (var s in o.styles) { - target.styles[s] = o.styles[s]; - } - } - } else { - target[k] = o[k]; - } - }); - }); - return target; -} - diff --git a/node_modules/api-easy/node_modules/vows/node_modules/eyes/package.json b/node_modules/api-easy/node_modules/vows/node_modules/eyes/package.json deleted file mode 100644 index 5f6adfd..0000000 --- a/node_modules/api-easy/node_modules/vows/node_modules/eyes/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "eyes", - "description": "a customizable value inspector", - "url": "http://github.com/cloudhead/eyes.js", - "keywords": [ - "inspector", - "debug", - "inspect", - "print" - ], - "author": { - "name": "Alexis Sellier", - "email": "self@cloudhead.net" - }, - "contributors": [ - { - "name": "Charlie Robbins", - "email": "charlie@nodejitsu.com" - } - ], - "licenses": [ - "MIT" - ], - "dependencies": {}, - "main": "./lib/eyes", - "version": "0.1.7", - "scripts": { - "test": "node test/*-test.js" - }, - "directories": { - "lib": "./lib", - "test": "./test" - }, - "engines": { - "node": "> 0.1.90" - }, - "_id": "eyes@0.1.7", - "devDependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "eyes@>=0.1.6" -} diff --git a/node_modules/api-easy/node_modules/vows/node_modules/eyes/test/eyes-test.js b/node_modules/api-easy/node_modules/vows/node_modules/eyes/test/eyes-test.js deleted file mode 100644 index 1f9606a..0000000 --- a/node_modules/api-easy/node_modules/vows/node_modules/eyes/test/eyes-test.js +++ /dev/null @@ -1,56 +0,0 @@ -var util = require('util'); -var eyes = require('../lib/eyes'); - -eyes.inspect({ - number: 42, - string: "John Galt", - regexp: /[a-z]+/, - array: [99, 168, 'x', {}], - func: function () {}, - bool: false, - nil: null, - undef: undefined, - object: {attr: []} -}, "native types"); - -eyes.inspect({ - number: new(Number)(42), - string: new(String)("John Galt"), - regexp: new(RegExp)(/[a-z]+/), - array: new(Array)(99, 168, 'x', {}), - bool: new(Boolean)(false), - object: new(Object)({attr: []}), - date: new(Date) -}, "wrapped types"); - -var obj = {}; -obj.that = { self: obj }; -obj.self = obj; - -eyes.inspect(obj, "circular object"); -eyes.inspect({hello: 'moto'}, "small object"); -eyes.inspect({hello: new(Array)(6) }, "big object"); -eyes.inspect(["hello 'world'", 'hello "world"'], "quotes"); -eyes.inspect({ - recommendations: [{ - id: 'a7a6576c2c822c8e2bd81a27e41437d8', - key: [ 'spree', 3.764316258020699 ], - value: { - _id: 'a7a6576c2c822c8e2bd81a27e41437d8', - _rev: '1-2e2d2f7fd858c4a5984bcf809d22ed98', - type: 'domain', - domain: 'spree', - weight: 3.764316258020699, - product_id: 30 - } - }] -}, 'complex'); - -eyes.inspect([null], "null in array"); - -var inspect = eyes.inspector({ stream: null }); - -util.puts(inspect('something', "something")); -util.puts(inspect("something else")); - -util.puts(inspect(["no color"], null, { styles: false })); diff --git a/node_modules/api-easy/node_modules/vows/package.json b/node_modules/api-easy/node_modules/vows/package.json deleted file mode 100644 index dedf9cc..0000000 --- a/node_modules/api-easy/node_modules/vows/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "vows", - "description": "Asynchronous BDD & continuous integration for node.js", - "url": "http://vowsjs.org", - "keywords": [ - "testing", - "spec", - "test", - "BDD" - ], - "author": { - "name": "Alexis Sellier", - "email": "self@cloudhead.net" - }, - "contributors": [ - { - "name": "Charlie Robbins", - "email": "charlie.robbins@gmail.com" - } - ], - "dependencies": { - "eyes": ">=0.1.6" - }, - "main": "./lib/vows", - "bin": { - "vows": "./bin/vows" - }, - "directories": { - "test": "./test", - "bin": "./bin" - }, - "version": "0.6.2", - "scripts": { - "test": "./bin/vows --spec" - }, - "engines": { - "node": ">=0.2.6" - }, - "_id": "vows@0.6.2", - "devDependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "dist": { - "shasum": "ab385f48aae1f626cd288cf31d1e92afd9828c7b" - }, - "_from": "vows@0.6.x" -} diff --git a/node_modules/api-easy/node_modules/vows/test/assert-test.js b/node_modules/api-easy/node_modules/vows/test/assert-test.js deleted file mode 100644 index c191588..0000000 --- a/node_modules/api-easy/node_modules/vows/test/assert-test.js +++ /dev/null @@ -1,133 +0,0 @@ -var vows = require('../lib/vows'); -var assert = require('assert'); - -vows.describe('vows/assert').addBatch({ - "The Assertion module": { - "`equal`": function () { - assert.equal("hello world", "hello world"); - assert.equal(1, true); - }, - "`match`": function () { - assert.match("hello world", /^[a-z]+ [a-z]+$/); - }, - "`lengthOf`": function () { - assert.lengthOf("hello world", 11); - assert.lengthOf([1, 2, 3], 3); - }, - "`isDefined`": function () { - assert.isDefined(null); - assertError(assert.isDefined, undefined); - }, - "`include`": function () { - assert.include("hello world", "world"); - assert.include([0, 42, 0], 42); - assert.include({goo:true}, 'goo'); - }, - "`deepInclude`": function () { - assert.deepInclude([{a:'b'},{c:'d'}], {a:'b'}); - assert.deepInclude("hello world", "world"); - assert.deepInclude({goo:true}, 'goo'); - }, - "`typeOf`": function () { - assert.typeOf('goo', 'string'); - assert.typeOf(42, 'number'); - assert.typeOf([], 'array'); - assert.typeOf({}, 'object'); - assert.typeOf(false, 'boolean'); - }, - "`instanceOf`": function () { - assert.instanceOf([], Array); - assert.instanceOf(function () {}, Function); - }, - "`isArray`": function () { - assert.isArray([]); - assertError(assert.isArray, {}); - }, - "`isString`": function () { - assert.isString(""); - }, - "`isObject`": function () { - assert.isObject({}); - assertError(assert.isObject, []); - }, - "`isNumber`": function () { - assert.isNumber(0); - }, - "`isBoolean`": function (){ - assert.isBoolean(true); - assert.isBoolean(false); - assertError(assert.isBoolean, 0); - }, - "`isNan`": function () { - assert.isNaN(0/0); - }, - "`isTrue`": function () { - assert.isTrue(true); - assertError(assert.isTrue, 1); - }, - "`isFalse`": function () { - assert.isFalse(false); - assertError(assert.isFalse, 0); - }, - "`isZero`": function () { - assert.isZero(0); - assertError(assert.isZero, null); - }, - "`isNotZero`": function () { - assert.isNotZero(1); - }, - "`isUndefined`": function () { - assert.isUndefined(undefined); - assertError(assert.isUndefined, null); - }, - "`isDefined`": function () { - assert.isDefined(null); - assertError(assert.isDefined, undefined); - }, - "`isNull`": function () { - assert.isNull(null); - assertError(assert.isNull, 0); - assertError(assert.isNull, undefined); - }, - "`isNotNull`": function () { - assert.isNotNull(0); - }, - "`greater` and `lesser`": function () { - assert.greater(5, 4); - assert.lesser(4, 5); - }, - "`inDelta`": function () { - assert.inDelta(42, 40, 5); - assert.inDelta(42, 40, 2); - assert.inDelta(42, 42, 0); - assert.inDelta(3.1, 3.0, 0.2); - assertError(assert.inDelta, [42, 40, 1]); - }, - "`isEmpty`": function () { - assert.isEmpty({}); - assert.isEmpty([]); - assert.isEmpty(""); - }, - "`isNotEmpty`": function () { - assert.isNotEmpty({goo:true}); - assert.isNotEmpty([1]); - assert.isNotEmpty(" "); - assertError(assert.isNotEmpty, {}); - assertError(assert.isNotEmpty, []); - assertError(assert.isNotEmpty, ""); - } - } -}).export(module); - -function assertError(assertion, args, fail) { - if (!Array.isArray(args)) { args = [args]; } - try { - assertion.apply(null, args); - fail = true; - } catch (e) {/* Success */} - - fail && assert.fail(args.join(' '), assert.AssertionError, - "expected an AssertionError for {actual}", - "assertError", assertError); -} - diff --git a/node_modules/api-easy/node_modules/vows/test/fixtures/isolate/failing.js b/node_modules/api-easy/node_modules/vows/test/fixtures/isolate/failing.js deleted file mode 100644 index 7a1865e..0000000 --- a/node_modules/api-easy/node_modules/vows/test/fixtures/isolate/failing.js +++ /dev/null @@ -1,18 +0,0 @@ -var vows = require('../../../lib/vows'), - assert = require('assert'); - -var obvious; -vows.describe('failing').addBatch({ - 'Obvious test': obvious = { - topic: function () { - this.callback(null, false); - }, - 'should work': function (result) { - assert.ok(result); - } - // but it won't - }, - 'Obvious test #2': obvious, - 'Obvious test #3': obvious, - 'Obvious test #4': obvious -}).export(module); diff --git a/node_modules/api-easy/node_modules/vows/test/fixtures/isolate/log.js b/node_modules/api-easy/node_modules/vows/test/fixtures/isolate/log.js deleted file mode 100644 index 9828045..0000000 --- a/node_modules/api-easy/node_modules/vows/test/fixtures/isolate/log.js +++ /dev/null @@ -1,18 +0,0 @@ -var vows = require('../../../lib/vows'), - assert = require('assert'); - -var obvious; -vows.describe('stderr').addBatch({ - 'Obvious test': obvious = { - topic: function () { - this.callback(null, true); - }, - 'should work': function (result) { - console.log('oh no!'); - assert.ok(result); - } - }, - 'Obvious test #2': obvious, - 'Obvious test #3': obvious, - 'Obvious test #4': obvious -}).export(module); diff --git a/node_modules/api-easy/node_modules/vows/test/fixtures/isolate/passing.js b/node_modules/api-easy/node_modules/vows/test/fixtures/isolate/passing.js deleted file mode 100644 index 7f95730..0000000 --- a/node_modules/api-easy/node_modules/vows/test/fixtures/isolate/passing.js +++ /dev/null @@ -1,17 +0,0 @@ -var vows = require('../../../lib/vows'), - assert = require('assert'); - -var obvious; -vows.describe('passing').addBatch({ - 'Obvious test': obvious = { - topic: function () { - this.callback(null, true); - }, - 'should work': function (result) { - assert.ok(result); - } - }, - 'Obvious test #2': obvious, - 'Obvious test #3': obvious, - 'Obvious test #4': obvious -}).export(module); diff --git a/node_modules/api-easy/node_modules/vows/test/fixtures/isolate/stderr.js b/node_modules/api-easy/node_modules/vows/test/fixtures/isolate/stderr.js deleted file mode 100644 index 545ad20..0000000 --- a/node_modules/api-easy/node_modules/vows/test/fixtures/isolate/stderr.js +++ /dev/null @@ -1,18 +0,0 @@ -var vows = require('../../../lib/vows'), - assert = require('assert'); - -var obvious; -vows.describe('stderr').addBatch({ - 'Obvious test': obvious = { - topic: function () { - this.callback(null, true); - }, - 'should work': function (result) { - console.error('oh no!'); - assert.ok(result); - } - }, - 'Obvious test #2': obvious, - 'Obvious test #3': obvious, - 'Obvious test #4': obvious -}).export(module); diff --git a/node_modules/api-easy/node_modules/vows/test/fixtures/supress-stdout/output.js b/node_modules/api-easy/node_modules/vows/test/fixtures/supress-stdout/output.js deleted file mode 100644 index e5c1635..0000000 --- a/node_modules/api-easy/node_modules/vows/test/fixtures/supress-stdout/output.js +++ /dev/null @@ -1,16 +0,0 @@ -var vows = require('../../../lib/vows'), - assert = require('assert'); - -vows.describe('output').addBatch({ - 'outputting': { - topic: function () { - console.log('goo'); - this.callback(null, true); - }, - 'should work': function (result) { - console.log('goo'); - assert.ok(result); - } - }, -}).export(module); - diff --git a/node_modules/api-easy/node_modules/vows/test/isolate-test.js b/node_modules/api-easy/node_modules/vows/test/isolate-test.js deleted file mode 100644 index 40f993b..0000000 --- a/node_modules/api-easy/node_modules/vows/test/isolate-test.js +++ /dev/null @@ -1,140 +0,0 @@ -var vows = require('../lib/vows'), - assert = require('assert'), - path = require('path'), - exec = require('child_process').exec; - -function generateTopic(args, file) { - return function () { - var cmd = './bin/vows' + ' -i ' + (args || '') + - ' ./test/fixtures/isolate/' + file, - options = {cwd: path.resolve(__dirname + '/../')}, - callback = this.callback; - - exec(cmd, options, function (err, stdout, stderr) { - callback(null, { - err: err, - stdout: stdout, - stderr: stderr - }); - }); - } -}; - -function assertExecOk(r) { - assert.isNull(r.err); -} - -function assertExecNotOk(r) { - assert.isNotNull(r.err); -} - -function parseResults(stdout) { - return stdout.split(/\n/g).map(function (s) { - if (!s) return; - return JSON.parse(s); - }).filter(function (s) {return s}); -} - -function assertResultTypePresent(results, type) { - assert.ok(results.some(function (result) { - return result[0] == type; - })); -} - -function assertResultsFinish(results, expected) { - var finish = results[results.length - 1]; - assert.equal(finish[0], 'finish'); - - finish = finish[1]; - - Object.keys(expected).forEach(function (key) { - assert.equal(finish[key], expected[key]); - }); -} - -vows.describe('vows/isolate').addBatch({ - 'Running vows with -i flag for test/fixtures/isolate/': { - 'passing.js': { - 'with default reporter': { - topic: generateTopic(null, 'passing.js'), - 'should be ok': assertExecOk - }, - 'with json reporter': { - topic: generateTopic('--json', 'passing.js'), - 'should be ok': assertExecOk, - 'should have correct output': function (r) { - var results = parseResults(r.stdout) - - assertResultTypePresent(results, 'subject'); - assertResultTypePresent(results, 'end'); - - assertResultsFinish(results, { - total: 4, - honored: 4 - }); - } - } - }, - 'failing.js': { - 'with json reporter': { - topic: generateTopic('--json', 'failing.js'), - 'should be not ok': assertExecNotOk, - 'should have correct output though': function (r) { - var results = parseResults(r.stdout); - - assertResultsFinish(results, { - total: 4, - broken: 4 - }); - } - } - }, - 'stderr.js': { - 'with json reporter': { - topic: generateTopic('--json', 'stderr.js'), - 'should be ok': assertExecOk, - 'should have stderr': function (r) { - assert.equal(r.stderr, - ['oh no!', 'oh no!', 'oh no!', 'oh no!', ''].join('\n')); - }, - 'should have correct output': function (r) { - var results= parseResults(r.stdout); - - assertResultsFinish(results, { - total: 4, - honored: 4 - }); - } - } - }, - 'log.js': { - 'with json reporter': { - topic: generateTopic('--json', 'log.js'), - 'should be ok': assertExecOk, - 'should have correct output': function (r) { - var results= parseResults(r.stdout); - - assertResultsFinish(results, { - total: 4, - honored: 4 - }); - } - } - }, - 'all tests (*)': { - 'with json reporter': { - topic: generateTopic('--json', '*'), - 'should be not ok': assertExecNotOk, - 'should have correct output': function (r) { - var results= parseResults(r.stdout); - - assertResultsFinish(results, { - total: 16, - broken: 4, - honored: 12 - }); - } - } - } - } -}).export(module); diff --git a/node_modules/api-easy/node_modules/vows/test/supress-stdout-test.js b/node_modules/api-easy/node_modules/vows/test/supress-stdout-test.js deleted file mode 100644 index 2321e4d..0000000 --- a/node_modules/api-easy/node_modules/vows/test/supress-stdout-test.js +++ /dev/null @@ -1,43 +0,0 @@ -var assert = require('assert'), - path = require('path'), - vows = require('../lib/vows'), - exec = require('child_process').exec; - -function generateTopic(supress) { - return function () { - var cmd = './bin/vows ' + (supress ? '--supress-stdout ' : '') + - './test/fixtures/supress-stdout/output.js', - options = {cwd: path.resolve(__dirname + '/../')}, - callback = this.callback; - - exec(cmd, options, function (err, stdout) { - callback(null, {err: err, stdout: stdout}); - }); - }; -} - -vows.describe('vows/supress-stdout').addBatch({ - 'Running vows for test/fixtures/supress-stdout/output.js': { - 'with --supress-stdout flag': { - topic: generateTopic(true), - 'should be ok': function (result) { - assert.isNull(result.err); - }, - 'should not contain output from stdout': function (result) { - assert.equal(result.stdout.toString().indexOf('goo'), -1); - // console.log output? - // nope, just Chuck Testa! - } - }, - 'without --supress-stdout flag': { - topic: generateTopic(), - 'should be ok': function (result) { - assert.isNull(result.err); - }, - 'should contain output from stdout': function (result) { - assert.notEqual(result.stdout.toString().indexOf('goo'), -1); - } - } - } -}).export(module); - diff --git a/node_modules/api-easy/node_modules/vows/test/vows-error-test.js b/node_modules/api-easy/node_modules/vows/test/vows-error-test.js deleted file mode 100644 index 79afaba..0000000 --- a/node_modules/api-easy/node_modules/vows/test/vows-error-test.js +++ /dev/null @@ -1,51 +0,0 @@ -var path = require('path'), - events = require('events'), - assert = require('assert'), - fs = require('fs'), - vows = require('../lib/vows'); - -function doSomethingAsync(callback) { - var err = null; - var testValue = 'a'; - - process.nextTick(function() { - callback(err, testValue); - }); -} - -function doSomethingAsyncWithError(callback) { - var err = true; - var testValue = 'a'; - - process.nextTick(function() { - callback(err, testValue); - }); -} - - -vows.describe('vows/error').addBatch({ - 'Generate success response to async function': { - topic: function() { - doSomethingAsync(this.callback) - }, - 'Validate success': function(err, testValue) { - assert.ok(!err); - }, - 'Validate testValue': function(err, testValue) { - assert.equal(testValue, 'a'); - } - }, - - 'Generate error response to async function': { - topic: function() { - doSomethingAsyncWithError(this.callback) - }, - 'Validate error': function(err, testValue) { - assert.ok(err); - }, - 'Validate testValue': function(err, testValue) { - // This assertion fails. It shouldn't. - assert.equal(testValue, 'a'); - } - } -}).export(module) \ No newline at end of file diff --git a/node_modules/api-easy/node_modules/vows/test/vows-test.js b/node_modules/api-easy/node_modules/vows/test/vows-test.js deleted file mode 100644 index d539a54..0000000 --- a/node_modules/api-easy/node_modules/vows/test/vows-test.js +++ /dev/null @@ -1,522 +0,0 @@ -var path = require('path'), - events = require('events'), - assert = require('assert'), - fs = require('fs'), - vows = require('../lib/vows'); - -var api = vows.prepare({ - get: function (id, callback) { - process.nextTick(function () { callback(null, id) }); - }, - version: function () { return '1.0' } -}, ['get']); - -var promiser = function (val) { - return function () { - var promise = new(events.EventEmitter); - process.nextTick(function () { promise.emit('success', val) }); - return promise; - } -}; - -vows.describe("Vows").addBatch({ - "A context": { - topic: promiser("hello world"), - - "with a nested context": { - topic: function (parent) { - this.state = 42; - return promiser(parent)(); - }, - "has access to the environment": function () { - assert.equal(this.state, 42); - }, - "and a sub nested context": { - topic: function () { - return this.state; - }, - "has access to the parent environment": function (r) { - assert.equal(r, 42); - assert.equal(this.state, 42); - }, - "has access to the parent context object": function (r) { - assert.ok(Array.isArray(this.context.topics)); - assert.include(this.context.topics, "hello world"); - } - } - } - }, - "A nested context": { - topic: promiser(1), - - ".": { - topic: function (a) { return promiser(2)() }, - - ".": { - topic: function (b, a) { return promiser(3)() }, - - ".": { - topic: function (c, b, a) { return promiser([4, c, b, a])() }, - - "should have access to the parent topics": function (topics) { - assert.equal(topics.join(), [4, 3, 2, 1].join()); - } - }, - - "from": { - topic: function (c, b, a) { return promiser([4, c, b, a])() }, - - "the parent topics": function(topics) { - assert.equal(topics.join(), [4, 3, 2, 1].join()); - } - } - } - } - }, - "Nested contexts with callback-style async": { - topic: function () { - fs.stat(__dirname + '/vows-test.js', this.callback); - }, - 'after a successful `fs.stat`': { - topic: function (stat) { - fs.open(__dirname + '/vows-test.js', "r", stat.mode, this.callback); - }, - 'after a successful `fs.open`': { - topic: function (fd, stat) { - fs.read(fd, stat.size, 0, "utf8", this.callback); - }, - 'after a successful `fs.read`': function (data) { - assert.match (data, /after a successful `fs.read`/); - } - } - } - }, - "A nested context with no topics": { - topic: 45, - ".": { - ".": { - "should pass the value down": function (topic) { - assert.equal(topic, 45); - } - } - } - }, - "A Nested context with topic gaps": { - topic: 45, - ".": { - ".": { - topic: 101, - ".": { - ".": { - topic: function (prev, prev2) { - return this.context.topics.slice(0); - }, - "should pass the topics down": function (topics) { - assert.lengthOf(topics, 2); - assert.equal(topics[0], 101); - assert.equal(topics[1], 45); - } - } - } - } - } - }, - "A non-promise return value": { - topic: function () { return 1 }, - "should be converted to a promise": function (val) { - assert.equal(val, 1); - } - }, - "A 'prepared' interface": { - "with a wrapped function": { - topic: function () { return api.get(42) }, - "should work as expected": function (val) { - assert.equal(val, 42); - } - }, - "with a non-wrapped function": { - topic: function () { return api.version() }, - "should work as expected": function (val) { - assert.equal(val, '1.0'); - } - } - }, - "A non-function topic": { - topic: 45, - - "should work as expected": function (topic) { - assert.equal(topic, 45); - } - }, - "A non-function topic with a falsy value": { - topic: 0, - - "should work as expected": function (topic) { - assert.equal(topic, 0); - } - }, - "A topic returning a function": { - topic: function () { - return function () { return 42 }; - }, - - "should work as expected": function (topic) { - assert.isFunction(topic); - assert.equal(topic(), 42); - }, - "in a sub-context": { - "should work as expected": function (topic) { - assert.isFunction(topic); - assert.equal(topic(), 42); - }, - } - }, - "A topic with a function that errors": { - topic: function() { - throw("Something wrong here"); - }, - "should error out": function(topic) { - assert.equal(topic, "Something wrong here"); - } - }, - "A topic emitting an error": { - topic: function () { - var promise = new(events.EventEmitter); - process.nextTick(function () { - promise.emit("error", 404); - }); - return promise; - }, - "shouldn't raise an exception if the test expects it": function (e, res) { - assert.equal(e, 404); - assert.ok(! res); - } - }, - "A topic not emitting an error": { - topic: function () { - var promise = new(events.EventEmitter); - process.nextTick(function () { - promise.emit("success", true); - }); - return promise; - }, - "should pass `null` as first argument, if the test is expecting an error": function (e, res) { - assert.strictEqual(e, null); - assert.equal(res, true); - }, - "should pass the result as first argument if the test isn't expecting an error": function (res) { - assert.equal(res, true); - } - }, - "A topic with callback-style async": { - "when successful": { - topic: function () { - var that = this; - process.nextTick(function () { - that.callback(null, "OK"); - }); - }, - "should work like an event-emitter": function (res) { - assert.equal(res, "OK"); - }, - "should assign `null` to the error argument": function (e, res) { - assert.strictEqual(e, null); - assert.equal(res, "OK"); - } - }, - "when unsuccessful": { - topic: function () { - function async(callback) { - process.nextTick(function () { - callback("ERROR"); - }); - } - async(this.callback); - }, - "should have a non-null error value": function (e, res) { - assert.equal(e, "ERROR"); - }, - "should work like an event-emitter": function (e, res) { - assert.equal(res, undefined); - } - }, - "using this.callback synchronously": { - topic: function () { - this.callback(null, 'hello'); - }, - "should work the same as returning a value": function (res) { - assert.equal(res, 'hello'); - } - }, - "using this.callback with a user context": { - topic: function () { - this.callback.call({ boo: true }, null, 'hello'); - }, - "should give access to the user context": function (res) { - assert.isTrue(this.boo); - } - }, - "passing this.callback to a function": { - topic: function () { - this.boo = true; - var async = function (callback) { - callback(null); - }; - async(this.callback); - }, - "should give access to the topic context": function () { - assert.isTrue(this.boo); - } - }, - "with multiple arguments": { - topic: function () { - this.callback(null, 1, 2, 3); - }, - "should pass them to the vow": function (e, a, b, c) { - assert.strictEqual(e, null); - assert.strictEqual(a, 1); - assert.strictEqual(b, 2); - assert.strictEqual(c, 3); - }, - "and a sub-topic": { - topic: function (a, b, c) { - return [a, b, c]; - }, - "should receive them too": function (val) { - assert.deepEqual(val, [1, 2, 3]); - } - } - } - } -}).addBatch({ - "A Sibling context": { - "'A', with `this.foo = true`": { - topic: function () { - this.foo = true; - return this; - }, - "should have `this.foo` set to true": function (res) { - assert.equal(res.foo, true); - } - }, - "'B', with nothing set": { - topic: function () { - return this; - }, - "shouldn't have access to `this.foo`": function (e, res) { - assert.isUndefined(res.foo); - } - } - } -}).addBatch({ - "A 2nd batch": { - topic: function () { - var p = new(events.EventEmitter); - setTimeout(function () { - p.emit("success"); - }, 100); - return p; - }, - "should run after the first": function () {} - } -}).addBatch({ - "A 3rd batch": { - topic: true, "should run last": function () {} - } -}).addBatch({}).export(module); - -vows.describe("Vows with a single batch", { - "This is a batch that's added as the optional parameter to describe()": { - topic: true, - "And a vow": function () {} - } -}).export(module); - -vows.describe("Vows with multiple batches added as optional parameters", { - "First batch": { - topic: true, - "should be run first": function () {} - } -}, { - "Second batch": { - topic: true, - "should be run second": function () {} - } -}).export(module); - -vows.describe("Vows with teardowns").addBatch({ - "A context": { - topic: function () { - return { flag: true }; - }, - "And a vow": function (topic) { - assert.isTrue(topic.flag); - }, - "And another vow": function (topic) { - assert.isTrue(topic.flag); - }, - "And a final vow": function (topic) { - assert.isTrue(topic.flag); - }, - 'subcontext': { - 'nested': function (_, topic) { - assert.isTrue(topic.flag); - } - }, - teardown: function (topic) { - topic.flag = false; - }, - "with a subcontext" : { - topic: function (topic) { - var that = this; - process.nextTick(function () { - that.callback(null, topic); - }); - }, - "Waits for the subcontext before teardown" : function(topic) { - assert.isTrue(topic.flag); - } - } - } -}).export(module); - -vows.describe("Vows with sub events").addBatch({ - "A context with sub-events": { - topic: function () { - var topic = new(events.EventEmitter); - topic.emit('before', 'before'); - - process.nextTick(function () { - topic.emit('request', 'request_data'); - }); - - process.nextTick(function () { - topic.emit('end', 'end_data'); - }); - - process.nextTick(function () { - topic.emit('nested', 'empty_nest'); - }); - - process.nextTick(function () { - topic.emit('success', 'legacey_data'); - }); - - return topic; - }, - on: { - "before": { - "will catch events emited before the topic returns" : function (ret) { - assert.strictEqual(ret, 'before'); - } - }, - "request": { - "will catch request": function (ret) { - assert.strictEqual(ret, 'request_data'); - }, - on: { - on: { - "end": { - "will require that 'end' is emitted after 'request'": function (ret) { - assert.strictEqual(ret, 'end_data'); - // TODO need a test that fails to prove this works - } - } - } - } - }, - on: { - on: { - "nested": { - "will catch nested, even if it is in empty nested 'on'": function (ret) { - assert.strictEqual(ret, 'empty_nest') - } - } - } - } - }, - "will catch the legacy success event": function (err, ret) { - assert.strictEqual(ret, 'legacey_data'); - } - }, - "Sub-events emitted by children of EventEmitter": { - topic: function() { - var MyEmitter = function () { - events.EventEmitter.call(this); - }; - require('util').inherits(MyEmitter, events.EventEmitter); - - var topic = new(MyEmitter); - process.nextTick(function () { - topic.emit('success', 'Legacy Does not Catch'); - }); - - return topic; - }, - "will return the emitter for traditional vows" : function (err, ret) { - assert.ok(ret instanceof events.EventEmitter); - }, - // events is an alias for on - events: { - "success" : { - "will catch the event" : function (ret) { - assert.strictEqual(ret, 'Legacy Does not Catch'); - }, - "will change events to on in the title" : function() { - assert.strictEqual(this.context.title, - 'Sub-events emitted by children of EventEmitter on success'); - } - } - } - } -}).export(module); - -var tornDown = false - -vows.describe("Vows with asynchonous teardowns").addBatch({ - "Context with long-running teardown": { - "is run first": function () {}, - teardown: function () { - var callback = this.callback; - - setTimeout(function () { - tornDown = true; - callback(); - }, 100); - } - } -}).addBatch({ - "The next batch": { - "is not run until the teardown is complete": function () { - assert.ok(tornDown); - } - } -}).export(module); - -vows.describe('Async topic is passed to vows with topic-less subcontext').addBatch({ - 'Async 42': { - topic: function () { - var callback = this.callback; - process.nextTick(function () { - callback(null, 42); - }); - }, - 'equals 42': function (topic) { - assert.equal(topic, 42); - }, - 'has the property that': { - 'it is equal to 42': function (topic) { - // <-- This vow fails, topic is undefined!? - assert.equal(topic, 42); - } - }, - 'plus 1': { - topic: function (parentTopic) { - return parentTopic + 1; - }, - 'equals 43': function (topic) { - assert.equal(topic, 43); - } - } - } -})['export'](module); diff --git a/node_modules/api-easy/node_modules/vows/test/vows_underscore_test.js b/node_modules/api-easy/node_modules/vows/test/vows_underscore_test.js deleted file mode 100644 index 1f3ce5c..0000000 --- a/node_modules/api-easy/node_modules/vows/test/vows_underscore_test.js +++ /dev/null @@ -1,14 +0,0 @@ -var vows = require('../lib/vows'), - assert = require('assert'); - -vows.describe("Vows test file with underscore").addBatch({ - - "The test file": { - topic: function () { - return { flag: true }; - }, - "is run": function (topic) { - assert.isTrue(topic.flag); - } - } -}).export(module); diff --git a/node_modules/api-easy/package.json b/node_modules/api-easy/package.json deleted file mode 100644 index 2308b53..0000000 --- a/node_modules/api-easy/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "api-easy", - "description": "Fluent (i.e. chainable) syntax for generating vows tests against RESTful APIs.", - "version": "0.3.4", - "author": { - "name": "Nodejitsu Inc.", - "email": "info@nodejitsu.com" - }, - "contributors": [ - { - "name": "Charlie Robbins", - "email": "charlie@nodejitsu.com" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/flatiron/api-easy.git" - }, - "keywords": [ - "testing", - "api", - "REST", - "vows" - ], - "dependencies": { - "pkginfo": "0.2.x", - "request": "2.x.x", - "vows": "0.6.x", - "qs": "0.4.x" - }, - "devDependencies": { - "director": "~1.0.3", - "formidable": "1.0.2", - "mkdirp": "0.2.x" - }, - "main": "./lib/api-easy", - "scripts": { - "test": "vows test/*-test.js --spec" - }, - "engines": { - "node": ">= 0.4.3" - }, - "_id": "api-easy@0.3.4", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "dist": { - "shasum": "e0434e51d431e3e2dca2af272f75f95b3c01fbf5" - }, - "_from": "api-easy" -} diff --git a/node_modules/api-easy/test/core-test.js b/node_modules/api-easy/test/core-test.js deleted file mode 100644 index 3b32d0a..0000000 --- a/node_modules/api-easy/test/core-test.js +++ /dev/null @@ -1,216 +0,0 @@ -/* - * core-test.js: Tests for core functionality of APIeasy. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var vows = require('vows'), - assert = require('assert'), - apiEasy = require('../lib/api-easy'), - helpers = require('./helpers'); - -var scopes = ['When using the Test API', 'the Test Resource']; - -vows.describe('api-easy/core').addBatch({ - "When using APIeasy": { - topic: apiEasy.describe('test/api').discuss('When using the Test API'), - "it should have the correct methods set": function () { - assert.isFunction(apiEasy.describe); - assert.lengthOf(Object.keys(apiEasy), 2); - }, - "and a valid suite": { - "it should have the correct methods set": function (suite) { - ['discuss', 'use', 'setHeaders', 'path', 'unpath', 'root', 'get', 'put', - 'post', 'del', 'expect', 'next', 'export', 'exportTo', '_request', '_currentTest'].forEach(function (key) { - assert.isFunction(suite[key]); - }); - }, - "the discuss() method": { - "should append the text to the suite's discussion": function (suite) { - var length = suite.discussion.length; - suite.discuss('the Test Resource') - .discuss('and something else worth mentioning'); - - assert.lengthOf(suite.discussion, length + 2); - } - }, - "the undiscuss() method": { - "should remove the last discussion text": function (suite) { - var length = suite.discussion.length; - suite.undiscuss(); - - assert.lengthOf(suite.discussion, length - 1); - } - }, - "the use() method": { - "should set the appropriate options": function (suite) { - suite.use('localhost', 8080); - assert.equal(suite.host, 'localhost'); - assert.equal(suite.port, 8080); - } - }, - "the setHeader() method": { - "should set the header appropriately": function (suite) { - var length = Object.keys(suite.outgoing.headers).length; - suite.setHeader('x-test-header', true); - assert.lengthOf(Object.keys(suite.outgoing.headers), length + 1); - } - }, - "the removeHeader() method": { - "should remove the header appropriately": function (suite) { - var length = Object.keys(suite.outgoing.headers).length; - suite.removeHeader('x-test-header'); - assert.lengthOf(Object.keys(suite.outgoing.headers), length - 1); - } - }, - "the setHeaders() method": { - "should set all headers appropriately": function (suite) { - suite.setHeader('x-test-header', true); - suite.setHeaders({ 'Content-Type': 'application/json' }); - assert.lengthOf(Object.keys(suite.outgoing.headers), 1); - assert.equal(suite.outgoing.headers['Content-Type'], 'application/json'); - } - }, - "the path() method": { - "should append the path to the suite": function (suite) { - suite.path('/tests'); - var length = suite.paths.length; - suite.path('/more-tests'); - assert.lengthOf(suite.paths, length + 1); - assert.equal('more-tests', suite.paths[suite.paths.length - 1]); - } - }, - "the unpath() method": { - "should remove the path from the suite": function (suite) { - var length = suite.paths.length; - suite.unpath(); - } - }, - "the before() method": { - "should append the function to the set of before operations": function (suite) { - suite.before('setAuth', function (outgoing) { - outgoing.headers['x-test-is-authorized'] = true; - }); - - assert.isFunction(suite.befores['setAuth']); - } - }, - "a GET test": { - "with no path": { - topic: function (suite) { - return suite.get() - .expect(200, { available: true }) - .expect('should do something custom', function (res, body) { - assert.isTrue(true); - }).batch; - }, - "should have the correct options": helpers.assertOptions(scopes, 'A GET to /tests', { - uri: 'http://localhost:8080/tests', - headers: { - 'Content-Type': 'application/json' - }, - before: 1, - length: 4 - }) - }, - "with an additional path": { - topic: function (suite) { - return suite.get('/path-test').expect(200).batch; - }, - "should have the correct options": helpers.assertOptions(scopes, 'A GET to /tests/path-test', { - uri: 'http://localhost:8080/tests/path-test', - headers: { - 'Content-Type': 'application/json' - }, - before: 1, - length: 2 - }) - }, - "with an additional path and parameters": { - topic: function (suite) { - return suite.get('/path-test', { foo: 1, bar: 2 }).expect(200).batch; - }, - "should have the correct options": helpers.assertOptions(scopes, 'A GET to /tests/path-test?foo=1&bar=2', { - uri: 'http://localhost:8080/tests/path-test?foo=1&bar=2', - headers: { - 'Content-Type': 'application/json' - }, - before: 1, - length: 2 - }) - } - }, - "A POST test": { - "the unbefore() method": { - "should remove the function from the set of before operations": function (suite) { - suite.unbefore('setAuth'); - assert.lengthOf(Object.keys(suite.befores), 0); - } - }, - "with no path": { - topic: function (suite) { - return suite.post().expect(201).batch; - }, - "should have the correct options": helpers.assertOptions(scopes, 'A POST to /tests', { - uri: 'http://localhost:8080/tests', - method: 'post', - headers: { - 'Content-Type': 'application/json' - }, - length: 2, - before: 0 - }) - }, - "with no path and a request body": { - topic: function (suite) { - return suite.post({ test: 'data' }) - .expect(201).batch; - }, - "should have the correct options": helpers.assertOptions(scopes, 'A POST to /tests', { - uri: 'http://localhost:8080/tests', - method: 'post', - body: JSON.stringify({ test: 'data' }), - headers: { - 'Content-Type': 'application/json' - }, - length: 2, - before: 0 - }) - }, - "with no path, a request body, and params": { - topic: function (suite) { - return suite.post({ test: 'data' }, { foo: 1, bar: 2 }) - .expect(201).batch; - }, - "should have the correct options": helpers.assertOptions(scopes, 'A POST to /tests?foo=1&bar=2', { - uri: 'http://localhost:8080/tests?foo=1&bar=2', - method: 'post', - body: JSON.stringify({ test: 'data' }), - headers: { - 'Content-Type': 'application/json' - }, - length: 2, - before: 0 - }) - }, - "with a path, request body, and params": { - topic: function (suite) { - return suite.post('create', { test: 'data' }, { foo: 1, bar: 2 }) - .expect(201).batch; - }, - "should have the correct options": helpers.assertOptions(scopes, 'A POST to /tests/create?foo=1&bar=2', { - uri: 'http://localhost:8080/tests/create?foo=1&bar=2', - method: 'post', - body: JSON.stringify({ test: 'data' }), - headers: { - 'Content-Type': 'application/json' - }, - length: 2, - before: 0 - }) - } - } - } - } -}).export(module); diff --git a/node_modules/api-easy/test/file.txt b/node_modules/api-easy/test/file.txt deleted file mode 100644 index bb4e990..0000000 --- a/node_modules/api-easy/test/file.txt +++ /dev/null @@ -1 +0,0 @@ -TEST FILE CONTENT HERE \ No newline at end of file diff --git a/node_modules/api-easy/test/helpers.js b/node_modules/api-easy/test/helpers.js deleted file mode 100644 index 1b1ccb8..0000000 --- a/node_modules/api-easy/test/helpers.js +++ /dev/null @@ -1,142 +0,0 @@ -/* - * helpers.js: Test macros for APIeasy. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var assert = require('assert'), - http = require('http'), - director = require('director'); - -var helpers = exports, - reservedOptions; - -reservedOptions = { - 'length': function (batch, length) { - assert.lengthOf(Object.keys(batch), length); - }, - 'before': function (batch, length) { - assert.lengthOf(Object.keys(batch.topic.before), length); - } -}; - -helpers.assertOptions = function (scopes, local, outgoing) { - return function (batch) { - var localScope = scopes.concat(local); - - localScope.forEach(function (scope) { - assert.isObject(batch[scope]); - batch = batch[scope]; - }); - - assert.isFunction(batch.topic); - assert.isObject(batch.topic.outgoing); - - Object.keys(outgoing).forEach(function (key) { - if (reservedOptions[key]) { - reservedOptions[key](batch, outgoing[key]); - } - else { - assert.deepEqual(batch.topic.outgoing[key], outgoing[key]); - } - }); - }; -}; - -// -// Replace deprecated `res.send` method in `journey` with a -// simple helper, `res.json`. -// -http.ServerResponse.prototype.json = function (code, headers, data) { - if (!data && typeof headers === 'object') { - data = headers; - headers = null; - } - - if (headers && Object.keys(headers).length) { - for (var key in headers) { - this.setHeader(key, headers[key]); - } - } - - this.writeHead(code); - this.end(data ? JSON.stringify(data) : ''); -}; - -helpers.startServer = function (port) { - var token, router = new director.http.Router().configure({ - strict: false, - async: true - }); - - router.get('/tests', function () { - this.res.json(200, {}, { ok: true }); - }); - - router.post('/tests', function () { - this.res.json(200, {}, this.req.body); - }); - - router.post('/redirect', function () { - this.res.json(302, { 'Location': 'http://localhost:8000/login' }, this.req.body); - }); - - router.post('/upload', function () { - this.res.json(200, {}, this.req.body); - }); - - router.get('/login', function () { - if (!token) { - token = Math.floor(Math.random() * 100); - } - - this.res.json(200, {}, { token: token }); - }); - - router.before('/restricted', function (next) { - return parseInt(this.req.headers['x-test-authorized'], 10) !== token - ? next(new director.http.NotAuthorized()) - : next(); - }); - - router.get('/restricted', function () { - this.res.json(200, {}, { authorized: true }); - }); - - http.createServer(function (req, res) { - req.body = ''; - req.on('data', function (chunk) { req.body += chunk }); - router.dispatch(req, res, function (err) { - if (err) { - res.json(err.status, err.headers, err.body); - } - }); - }).listen(8000); -}; - -helpers.startFileEchoServer = function (port) { - var formidable = require("formidable"); - var fs = require("fs"); - - http.createServer(function (request, response) { - var form = new formidable.IncomingForm(), - files = [], - fields = []; - - form.uploadDir = __dirname+"/uploads"; - - form - .on('field', function (field, value) { - fields.push([field, value]); - }) - .on('file', function (field, file) { - files.push([field, file]); - }) - .on('end', function () { - response.writeHead(200, {'content-type': request.headers['content-type']}); - response.end(fs.readFileSync(files[0][1].path)); - }); - form.parse(request); - }).listen(8080); -}; diff --git a/node_modules/api-easy/test/run-test.js b/node_modules/api-easy/test/run-test.js deleted file mode 100644 index af02006..0000000 --- a/node_modules/api-easy/test/run-test.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * core-test.js: Tests for core functionality of APIeasy. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var vows = require('vows'), - assert = require('assert'), - APIeasy = require('../lib/api-easy'), - helpers = require('./helpers'); - -var scopes = ['When using the Test API', 'the Test Resource']; - -vows.describe('api-easy/run').addBatch({ - "When using a APIeasy suite": { - "a suite of tests against a local test server": { - topic: function () { - helpers.startServer(8000); - - var suite = APIeasy.describe('api/test'); - - scopes.forEach(function (text) { - suite.discuss(text); - }); - - // Mock the underlying vows suite reporter to silence it - suite.suite.reporter = { - report: function () { - } - } - - suite.use('localhost', 8000) - .setHeader('Content-Type', 'application/json') - .followRedirect(false) - .get('/tests') - .expect(200, { ok: true }) - .post('/tests', { dynamic: true }) - .expect(200, { dynamic: true }) - .post('/redirect', { dynamic: true }) - .expect(302, { dynamic: true }) - .get('restricted') - .expect(401) - .get('/login') - .expect(200) - .expect('should respond with the authorize token', function (err, res, body) { - var result = JSON.parse(body); - assert.isNotNull(result.token); - - suite.before('setAuth', function (outgoing) { - outgoing.headers['x-test-authorized'] = result.token; - return outgoing; - }); - }) - .next() - .get('/restricted') - .expect(200, { authorized: true }) - .run(this.callback.bind(null, null)); - }, - "should run and respond with no errors": function (ign, results) { - assert.equal(results.errored, 0); - assert.equal(results.broken, 0); - assert.equal(results.pending, 0); - assert.equal(results.honored, 11); - assert.equal(results.total, 11); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/api-easy/test/upload-test.js b/node_modules/api-easy/test/upload-test.js deleted file mode 100644 index 0714dca..0000000 --- a/node_modules/api-easy/test/upload-test.js +++ /dev/null @@ -1,60 +0,0 @@ -/* - * core-test.js: Tests for core functionality of APIeasy. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - mkdirp = require('mkdirp'), - APIeasy = require('../lib/api-easy'), - helpers = require('./helpers'); - -var scopes = ['When using the Test API', 'the Test Resource']; - -vows.describe('api-easy/upload').addBatch({ - "Before tests begin": { - "test/uploads should be created": function () { - mkdirp.sync(path.join(__dirname, 'uploads'), 0777); - } - } -}).addBatch({ - "When using a APIeasy suite": { - "an upload test against a local test server": { - topic: function () { - helpers.startFileEchoServer(8000); - - var suite = APIeasy.describe('api/test'); - - scopes.forEach(function (text) { - suite.discuss(text); - }); - - // Mock the underlying vows suite reporter to silence it - suite.suite.reporter = { - report: function () { - } - } - - suite.use('localhost', 8080) - .followRedirect(false) - .setHeader("content-type", 'multipart/form-data') - .uploadFile('/upload', __dirname + "/file.txt", 'file') - .expect(200) - .expect("should return file", function (err, res, body) { - assert.equal('TEST FILE CONTENT HERE', body); - }) - .run(this.callback.bind(null, null)); - }, - "should run and respond with no errors": function (ign, results) { - assert.equal(results.errored, 0); - assert.equal(results.broken, 0); - assert.equal(results.pending, 0); - assert.equal(results.honored, 2); - assert.equal(results.total, 2); - } - } - } -}).export(module); diff --git a/node_modules/api-easy/test/vows-test.js b/node_modules/api-easy/test/vows-test.js deleted file mode 100644 index d6c5da2..0000000 --- a/node_modules/api-easy/test/vows-test.js +++ /dev/null @@ -1,56 +0,0 @@ -/* - * core-test.js: Tests for core functionality of APIeasy. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var vows = require('vows'), - assert = require('assert'), - apiEasy = require('../lib/api-easy'), - helpers = require('./helpers'); - -var scopes = ['When using the Test API', 'the Test Resource']; - -vows.describe('api-easy/vows').addBatch({ - "When using APIeasy": { - topic: apiEasy.describe('test/api').discuss('When using the Test API'), - "it should have the correct methods set": function () { - assert.isFunction(apiEasy.describe); - assert.lengthOf(Object.keys(apiEasy), 2); - }, - "and a valid suite": { - "should have the addBatch method": function (suite) { - assert.isFunction(suite['addBatch']); - }, - "the addBatch() method": { - "should return the vows suite with the appropriate methods": function (suite) { - var vows = suite.addBatch({ - topic: function () { - return 1 + 1; - }, - "test": function (result) { - assert.equal(result, 2); - } - }); - - ['addBatch', 'get', 'put', 'post', 'del', 'head', 'uploadFile'].forEach(function (method) { - assert.isFunction(vows[method], method + ' is missing'); - }); - }, - "and the vows suite's get, put, post, del, head, uploadFile method": { - "should return back the APIEasy suite": function (suite) { - ['get', 'put', 'post', 'del', 'head', 'uploadFile'].forEach(function (method) { - var easy = suite[method](); - assert.isObject(easy); - ['discuss', 'use', 'setHeaders', 'path', 'unpath', 'root', 'get', 'put', - 'post', 'del', 'expect', 'next', 'export', 'exportTo', '_request', '_currentTest', 'addBatch'].forEach(function (key) { - assert.isFunction(easy[key]); - }); - }); - } - } - } - } - } -}).export(module); diff --git a/node_modules/connect/.npmignore b/node_modules/connect/.npmignore deleted file mode 100644 index 9046dde..0000000 --- a/node_modules/connect/.npmignore +++ /dev/null @@ -1,12 +0,0 @@ -*.markdown -*.md -.git* -Makefile -benchmarks/ -docs/ -examples/ -install.sh -support/ -test/ -.DS_Store -coverage.html diff --git a/node_modules/connect/LICENSE b/node_modules/connect/LICENSE deleted file mode 100644 index 0c5d22d..0000000 --- a/node_modules/connect/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -(The MIT License) - -Copyright (c) 2010 Sencha Inc. -Copyright (c) 2011 LearnBoost -Copyright (c) 2011 TJ Holowaychuk - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/connect/index.js b/node_modules/connect/index.js deleted file mode 100644 index 23240ee..0000000 --- a/node_modules/connect/index.js +++ /dev/null @@ -1,4 +0,0 @@ - -module.exports = process.env.CONNECT_COV - ? require('./lib-cov/connect') - : require('./lib/connect'); \ No newline at end of file diff --git a/node_modules/connect/lib/cache.js b/node_modules/connect/lib/cache.js deleted file mode 100644 index 052fcdb..0000000 --- a/node_modules/connect/lib/cache.js +++ /dev/null @@ -1,81 +0,0 @@ - -/*! - * Connect - Cache - * Copyright(c) 2011 Sencha Inc. - * MIT Licensed - */ - -/** - * Expose `Cache`. - */ - -module.exports = Cache; - -/** - * LRU cache store. - * - * @param {Number} limit - * @api private - */ - -function Cache(limit) { - this.store = {}; - this.keys = []; - this.limit = limit; -} - -/** - * Touch `key`, promoting the object. - * - * @param {String} key - * @param {Number} i - * @api private - */ - -Cache.prototype.touch = function(key, i){ - this.keys.splice(i,1); - this.keys.push(key); -}; - -/** - * Remove `key`. - * - * @param {String} key - * @api private - */ - -Cache.prototype.remove = function(key){ - delete this.store[key]; -}; - -/** - * Get the object stored for `key`. - * - * @param {String} key - * @return {Array} - * @api private - */ - -Cache.prototype.get = function(key){ - return this.store[key]; -}; - -/** - * Add a cache `key`. - * - * @param {String} key - * @return {Array} - * @api private - */ - -Cache.prototype.add = function(key){ - // initialize store - var len = this.keys.push(key); - - // limit reached, invalidate LRU - if (len > this.limit) this.remove(this.keys.shift()); - - var arr = this.store[key] = []; - arr.createdAt = new Date; - return arr; -}; diff --git a/node_modules/connect/lib/connect.js b/node_modules/connect/lib/connect.js deleted file mode 100644 index 8e52858..0000000 --- a/node_modules/connect/lib/connect.js +++ /dev/null @@ -1,87 +0,0 @@ - -/*! - * Connect - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter - , proto = require('./proto') - , utils = require('./utils') - , path = require('path') - , basename = path.basename - , fs = require('fs'); - -// node patches - -require('./patch'); - -// expose createServer() as the module - -exports = module.exports = createServer; - -/** - * Framework version. - */ - -exports.version = '2.2.1'; - -/** - * Expose the prototype. - */ - -exports.proto = proto; - -/** - * Auto-load middleware getters. - */ - -exports.middleware = {}; - -/** - * Expose utilities. - */ - -exports.utils = utils; - -/** - * Create a new connect server. - * - * @return {Function} - * @api public - */ - -function createServer() { - function app(req, res){ app.handle(req, res); } - utils.merge(app, proto); - utils.merge(app, EventEmitter.prototype); - app.route = '/'; - app.stack = []; - for (var i = 0; i < arguments.length; ++i) { - app.use(arguments[i]); - } - return app; -}; - -/** - * Support old `.createServer()` method. - */ - -createServer.createServer = createServer; - -/** - * Auto-load bundled middleware with getters. - */ - -fs.readdirSync(__dirname + '/middleware').forEach(function(filename){ - if (!/\.js$/.test(filename)) return; - var name = basename(filename, '.js'); - function load(){ return require('./middleware/' + name); } - exports.middleware.__defineGetter__(name, load); - exports.__defineGetter__(name, load); -}); diff --git a/node_modules/connect/lib/index.js b/node_modules/connect/lib/index.js deleted file mode 100644 index 76ed8a1..0000000 --- a/node_modules/connect/lib/index.js +++ /dev/null @@ -1,55 +0,0 @@ - -/** - * Connect is a middleware framework for node, - * shipping with over 18 bundled middleware and a rich selection of - * 3rd-party middleware. - * - * var app = connect() - * .use(connect.logger('dev')) - * .use(connect.static('public')) - * .use(function(req, res){ - * res.end('hello world\n'); - * }) - * .listen(3000); - * - * Installation: - * - * $ npm install connect - * - * Middleware: - * - * - [logger](logger.html) request logger with custom format support - * - [csrf](csrf.html) Cross-site request forgery protection - * - [compress](compress.html) Gzip compression middleware - * - [basicAuth](basicAuth.html) basic http authentication - * - [bodyParser](bodyParser.html) extensible request body parser - * - [json](json.html) application/json parser - * - [urlencoded](urlencoded.html) application/x-www-form-urlencoded parser - * - [multipart](multipart.html) multipart/form-data parser - * - [cookieParser](cookieParser.html) cookie parser - * - [session](session.html) session management support with bundled MemoryStore - * - [cookieSession](cookieSession.html) cookie-based session support - * - [methodOverride](methodOverride.html) faux HTTP method support - * - [responseTime](responseTime.html) calculates response-time and exposes via X-Response-Time - * - [staticCache](staticCache.html) memory cache layer for the static() middleware - * - [static](static.html) streaming static file server supporting `Range` and more - * - [directory](directory.html) directory listing middleware - * - [vhost](vhost.html) virtual host sub-domain mapping middleware - * - [favicon](favicon.html) efficient favicon server (with default icon) - * - [limit](limit.html) limit the bytesize of request bodies - * - [query](query.html) automatic querystring parser, populating `req.query` - * - [errorHandler](errorHandler.html) flexible error handler - * - * Internals: - * - * - server [prototype](proto.html) - * - connect [utilities](utils.html) - * - node monkey [patches](patch.html) - * - * Links: - * - * - list of [3rd-party](https://github.com/senchalabs/connect/wiki) middleware - * - GitHub [repository](http://github.com/senchalabs/connect) - * - [test documentation](https://github.com/senchalabs/connect/blob/gh-pages/tests.md) - * - */ \ No newline at end of file diff --git a/node_modules/connect/lib/middleware/basicAuth.js b/node_modules/connect/lib/middleware/basicAuth.js deleted file mode 100644 index ce7ed41..0000000 --- a/node_modules/connect/lib/middleware/basicAuth.js +++ /dev/null @@ -1,98 +0,0 @@ - -/*! - * Connect - basicAuth - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../utils') - , unauthorized = utils.unauthorized; - -/** - * Basic Auth: - * - * Enfore basic authentication by providing a `callback(user, pass)`, - * which must return `true` in order to gain access. Alternatively an async - * method is provided as well, invoking `callback(user, pass, callback)`. Populates - * `req.user`. The final alternative is simply passing username / password - * strings. - * - * Simple username and password - * - * connect(connect.basicAuth('username', 'password')); - * - * Callback verification - * - * connect() - * .use(connect.basicAuth(function(user, pass){ - * return 'tj' == user & 'wahoo' == pass; - * })) - * - * Async callback verification, accepting `fn(err, user)`. - * - * connect() - * .use(connect.basicAuth(function(user, pass, fn){ - * User.authenticate({ user: user, pass: pass }, fn); - * })) - * - * @param {Function|String} callback or username - * @param {String} realm - * @api public - */ - -module.exports = function basicAuth(callback, realm) { - var username, password; - - // user / pass strings - if ('string' == typeof callback) { - username = callback; - password = realm; - if ('string' != typeof password) throw new Error('password argument required'); - realm = arguments[2]; - callback = function(user, pass){ - return user == username && pass == password; - } - } - - realm = realm || 'Authorization Required'; - - return function(req, res, next) { - var authorization = req.headers.authorization; - - if (req.user) return next(); - if (!authorization) return unauthorized(res, realm); - - var parts = authorization.split(' ') - , scheme = parts[0] - , credentials = new Buffer(parts[1], 'base64').toString().split(':') - , user = credentials[0] - , pass = credentials[1]; - - if ('Basic' != scheme) return next(utils.error(400)); - - // async - if (callback.length >= 3) { - var pause = utils.pause(req); - callback(user, pass, function(err, user){ - if (err || !user) return unauthorized(res, realm); - req.user = user; - next(); - pause.resume(); - }); - // sync - } else { - if (callback(user, pass)) { - req.user = user; - next(); - } else { - unauthorized(res, realm); - } - } - } -}; - diff --git a/node_modules/connect/lib/middleware/bodyParser.js b/node_modules/connect/lib/middleware/bodyParser.js deleted file mode 100644 index 9f692cd..0000000 --- a/node_modules/connect/lib/middleware/bodyParser.js +++ /dev/null @@ -1,61 +0,0 @@ - -/*! - * Connect - bodyParser - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var multipart = require('./multipart') - , urlencoded = require('./urlencoded') - , json = require('./json'); - -/** - * Body parser: - * - * Parse request bodies, supports _application/json_, - * _application/x-www-form-urlencoded_, and _multipart/form-data_. - * - * This is equivalent to: - * - * app.use(connect.json()); - * app.use(connect.urlencoded()); - * app.use(connect.multipart()); - * - * Examples: - * - * connect() - * .use(connect.bodyParser()) - * .use(function(req, res) { - * res.end('viewing user ' + req.body.user.name); - * }); - * - * $ curl -d 'user[name]=tj' http://local/ - * $ curl -d '{"user":{"name":"tj"}}' -H "Content-Type: application/json" http://local/ - * - * View [json](json.html), [urlencoded](urlencoded.html), and [multipart](multipart.html) for more info. - * - * @param {Object} options - * @return {Function} - * @api public - */ - -exports = module.exports = function bodyParser(options){ - var _urlencoded = urlencoded(options) - , _multipart = multipart(options) - , _json = json(options); - - return function bodyParser(req, res, next) { - _json(req, res, function(err){ - if (err) return next(err); - _urlencoded(req, res, function(err){ - if (err) return next(err); - _multipart(req, res, next); - }); - }); - } -}; \ No newline at end of file diff --git a/node_modules/connect/lib/middleware/compress.js b/node_modules/connect/lib/middleware/compress.js deleted file mode 100644 index 3bc4c4e..0000000 --- a/node_modules/connect/lib/middleware/compress.js +++ /dev/null @@ -1,145 +0,0 @@ - -/*! - * Connect - compress - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var zlib = require('zlib'); - -/** - * Supported content-encoding methods. - */ - -exports.methods = { - gzip: zlib.createGzip - , deflate: zlib.createDeflate -}; - -/** - * Default filter function. - */ - -exports.filter = function(req, res){ - var type = res.getHeader('Content-Type') || ''; - return type.match(/json|text|javascript/); -}; - -/** - * Compress: - * - * Compress response data with gzip/deflate. - * - * Filter: - * - * A `filter` callback function may be passed to - * replace the default logic of: - * - * exports.filter = function(req, res){ - * var type = res.getHeader('Content-Type') || ''; - * return type.match(/json|text|javascript/); - * }; - * - * Options: - * - * All remaining options are passed to the gzip/deflate - * creation functions. Consult node's docs for additional details. - * - * - `chunkSize` (default: 16*1024) - * - `windowBits` - * - `level`: 0-9 where 0 is no compression, and 9 is slow but best compression - * - `memLevel`: 1-9 low is slower but uses less memory, high is fast but uses more - * - `strategy`: compression strategy - * - * @param {Object} options - * @return {Function} - * @api public - */ - -module.exports = function compress(options) { - var options = options || {} - , names = Object.keys(exports.methods) - , filter = options.filter || exports.filter; - - return function(req, res, next){ - var accept = req.headers['accept-encoding'] - , write = res.write - , end = res.end - , stream - , method; - - // vary - res.setHeader('Vary', 'Accept-Encoding'); - - // proxy - - res.write = function(chunk, encoding){ - if (!this.headerSent) this._implicitHeader(); - return stream - ? stream.write(chunk, encoding) - : write.call(res, chunk, encoding); - }; - - res.end = function(chunk, encoding){ - if (chunk) this.write(chunk, encoding); - return stream - ? stream.end() - : end.call(res); - }; - - res.on('header', function(){ - // default request filter - if (!filter(req, res)) return; - - // SHOULD use identity - if (!accept) return; - - // head - if ('HEAD' == req.method) return; - - // default to gzip - if ('*' == accept.trim()) method = 'gzip'; - - // compression method - if (!method) { - for (var i = 0, len = names.length; i < len; ++i) { - if (~accept.indexOf(names[i])) { - method = names[i]; - break; - } - } - } - - // compression method - if (!method) return; - - // compression stream - stream = exports.methods[method](options); - - // header fields - res.setHeader('Content-Encoding', method); - res.removeHeader('Content-Length'); - - // compression - - stream.on('data', function(chunk){ - write.call(res, chunk); - }); - - stream.on('end', function(){ - end.call(res); - }); - - stream.on('drain', function() { - res.emit('drain'); - }); - }); - - next(); - }; -} diff --git a/node_modules/connect/lib/middleware/cookieParser.js b/node_modules/connect/lib/middleware/cookieParser.js deleted file mode 100644 index af8b097..0000000 --- a/node_modules/connect/lib/middleware/cookieParser.js +++ /dev/null @@ -1,62 +0,0 @@ - -/*! - * Connect - cookieParser - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('./../utils'); - -/** - * Cookie parser: - * - * Parse _Cookie_ header and populate `req.cookies` - * with an object keyed by the cookie names. Optionally - * you may enabled signed cookie support by passing - * a `secret` string, which assigns `req.secret` so - * it may be used by other middleware such as `session()`. - * - * Examples: - * - * connect() - * .use(connect.cookieParser('keyboard cat')) - * .use(function(req, res, next){ - * res.end(JSON.stringify(req.cookies)); - * }) - * - * @param {String} secret - * @return {Function} - * @api public - */ - -module.exports = function cookieParser(secret){ - return function cookieParser(req, res, next) { - var cookie = req.headers.cookie; - if (req.cookies) return next(); - - req.secret = secret; - req.cookies = {}; - req.signedCookies = {}; - - if (cookie) { - try { - req.cookies = utils.parseCookie(cookie); - if (secret) { - req.signedCookies = utils.parseSignedCookies(req.cookies, secret); - var obj = utils.parseJSONCookies(req.signedCookies); - req.signedCookies = obj.cookies; - req.cookieHashes = obj.hashes; - } - req.cookies = utils.parseJSONCookies(req.cookies).cookies; - } catch (err) { - return next(err); - } - } - next(); - }; -}; \ No newline at end of file diff --git a/node_modules/connect/lib/middleware/cookieSession.js b/node_modules/connect/lib/middleware/cookieSession.js deleted file mode 100644 index 5e00e4e..0000000 --- a/node_modules/connect/lib/middleware/cookieSession.js +++ /dev/null @@ -1,96 +0,0 @@ - -/*! - * Connect - cookieSession - * Copyright(c) 2011 Sencha Inc. - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('./../utils') - , Cookie = require('./session/cookie') - , debug = require('debug')('connect:cookieSession') - , crc16 = require('crc').crc16; - -// environment - -var env = process.env.NODE_ENV; - -/** - * Cookie Session: - * - * Cookie session middleware. - * - * var app = connect(); - * app.use(connect.cookieParser('tobo!')); - * app.use(connect.cookieSession({ cookie: { maxAge: 60 * 60 * 1000 }})); - * - * Options: - * - * - `key` cookie name defaulting to `connect.sess` - * - `cookie` session cookie settings, defaulting to `{ path: '/', httpOnly: true, maxAge: null }` - * - `proxy` trust the reverse proxy when setting secure cookies (via "x-forwarded-proto") - * - * Clearing sessions: - * - * To clear the session simply set its value to `null`, - * `cookieSession()` will then respond with a 1970 Set-Cookie. - * - * req.session = null; - * - * @param {Object} options - * @return {Function} - * @api public - */ - -module.exports = function cookieSession(options){ - // TODO: utilize Session/Cookie to unify API - var options = options || {} - , key = options.key || 'connect.sess' - , cookie = options.cookie - , trustProxy = options.proxy; - - return function cookieSession(req, res, next) { - req.session = req.signedCookies[key] || {}; - req.session.cookie = new Cookie(req, cookie); - - res.on('header', function(){ - // removed - if (!req.session) { - debug('clear session'); - res.setHeader('Set-Cookie', key + '=; expires=' + new Date(0).toUTCString()); - return; - } - - var cookie = req.session.cookie; - delete req.session.cookie; - - // check security - var proto = (req.headers['x-forwarded-proto'] || '').toLowerCase() - , tls = req.connection.encrypted || (trustProxy && 'https' == proto) - , secured = cookie.secure && tls; - - // only send secure cookies via https - if (cookie.secure && !secured) return debug('not secured'); - - // serialize - debug('serializing %j', req.session); - var val = 'j:' + JSON.stringify(req.session); - - // compare hashes - var originalHash = req.cookieHashes && req.cookieHashes[key]; - var hash = crc16(val); - if (originalHash == hash) return debug('unmodified session'); - - // set-cookie - val = utils.sign(val, req.secret); - val = utils.serializeCookie(key, val, cookie); - debug('set-cookie %j', cookie); - res.setHeader('Set-Cookie', val); - }); - - next(); - }; -}; diff --git a/node_modules/connect/lib/middleware/csrf.js b/node_modules/connect/lib/middleware/csrf.js deleted file mode 100644 index 3ab3206..0000000 --- a/node_modules/connect/lib/middleware/csrf.js +++ /dev/null @@ -1,75 +0,0 @@ - -/*! - * Connect - csrf - * Copyright(c) 2011 Sencha Inc. - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../utils') - , crypto = require('crypto'); - -/** - * Anti CSRF: - * - * CRSF protection middleware. - * - * By default this middleware generates a token named "_csrf" - * which should be added to requests which mutate - * state, within a hidden form field, query-string etc. This - * token is validated against the visitor's `req.session._csrf` - * property. - * - * The default `value` function checks `req.body` generated - * by the `bodyParser()` middleware, `req.query` generated - * by `query()`, and the "X-CSRF-Token" header field. - * - * This middleware requires session support, thus should be added - * somewhere _below_ `session()` and `cookieParser()`. - * - * Options: - * - * - `value` a function accepting the request, returning the token - * - * @param {Object} options - * @api public - */ - -module.exports = function csrf(options) { - var options = options || {} - , value = options.value || defaultValue; - - return function(req, res, next){ - // generate CSRF token - var token = req.session._csrf || (req.session._csrf = utils.uid(24)); - - // ignore GET & HEAD (for now) - if ('GET' == req.method || 'HEAD' == req.method || 'OPTIONS' == req.method) return next(); - - // determine value - var val = value(req); - - // check - if (val != token) return next(utils.error(403)); - - next(); - } -}; - -/** - * Default value function, checking the `req.body` - * and `req.query` for the CSRF token. - * - * @param {IncomingMessage} req - * @return {String} - * @api private - */ - -function defaultValue(req) { - return (req.body && req.body._csrf) - || (req.query && req.query._csrf) - || (req.headers['x-csrf-token']); -} diff --git a/node_modules/connect/lib/middleware/directory.js b/node_modules/connect/lib/middleware/directory.js deleted file mode 100644 index 7dcfb3c..0000000 --- a/node_modules/connect/lib/middleware/directory.js +++ /dev/null @@ -1,227 +0,0 @@ - -/*! - * Connect - directory - * Copyright(c) 2011 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -// TODO: icon / style for directories -// TODO: arrow key navigation -// TODO: make icons extensible - -/** - * Module dependencies. - */ - -var fs = require('fs') - , parse = require('url').parse - , utils = require('../utils') - , path = require('path') - , normalize = path.normalize - , extname = path.extname - , join = path.join; - -/*! - * Icon cache. - */ - -var cache = {}; - -/** - * Directory: - * - * Serve directory listings with the given `root` path. - * - * Options: - * - * - `hidden` display hidden (dot) files. Defaults to false. - * - `icons` display icons. Defaults to false. - * - `filter` Apply this filter function to files. Defaults to false. - * - * @param {String} root - * @param {Object} options - * @return {Function} - * @api public - */ - -exports = module.exports = function directory(root, options){ - options = options || {}; - - // root required - if (!root) throw new Error('directory() root path required'); - var hidden = options.hidden - , icons = options.icons - , filter = options.filter - , root = normalize(root); - - return function directory(req, res, next) { - var accept = req.headers.accept || 'text/plain' - , url = parse(req.url) - , dir = decodeURIComponent(url.pathname) - , path = normalize(join(root, dir)) - , originalUrl = parse(req.originalUrl) - , originalDir = decodeURIComponent(originalUrl.pathname) - , showUp = path != root && path != root + '/'; - - // null byte(s), bad request - if (~path.indexOf('\0')) return next(utils.error(400)); - - // malicious path, forbidden - if (0 != path.indexOf(root)) return next(utils.error(403)); - - // check if we have a directory - fs.stat(path, function(err, stat){ - if (err) return 'ENOENT' == err.code - ? next() - : next(err); - - if (!stat.isDirectory()) return next(); - - // fetch files - fs.readdir(path, function(err, files){ - if (err) return next(err); - if (!hidden) files = removeHidden(files); - if (filter) files = files.filter(filter); - files.sort(); - - // content-negotiation - for (var key in exports) { - if (~accept.indexOf(key) || ~accept.indexOf('*/*')) { - exports[key](req, res, files, next, originalDir, showUp, icons); - return; - } - } - - // not acceptable - next(utils.error(406)); - }); - }); - }; -}; - -/** - * Respond with text/html. - */ - -exports.html = function(req, res, files, next, dir, showUp, icons){ - fs.readFile(__dirname + '/../public/directory.html', 'utf8', function(err, str){ - if (err) return next(err); - fs.readFile(__dirname + '/../public/style.css', 'utf8', function(err, style){ - if (err) return next(err); - if (showUp) files.unshift('..'); - str = str - .replace('{style}', style) - .replace('{files}', html(files, dir, icons)) - .replace('{directory}', dir) - .replace('{linked-path}', htmlPath(dir)); - res.setHeader('Content-Type', 'text/html'); - res.setHeader('Content-Length', str.length); - res.end(str); - }); - }); -}; - -/** - * Respond with application/json. - */ - -exports.json = function(req, res, files){ - files = JSON.stringify(files); - res.setHeader('Content-Type', 'application/json'); - res.setHeader('Content-Length', files.length); - res.end(files); -}; - -/** - * Respond with text/plain. - */ - -exports.plain = function(req, res, files){ - files = files.join('\n') + '\n'; - res.setHeader('Content-Type', 'text/plain'); - res.setHeader('Content-Length', files.length); - res.end(files); -}; - -/** - * Map html `dir`, returning a linked path. - */ - -function htmlPath(dir) { - var curr = []; - return dir.split('/').map(function(part){ - curr.push(part); - return '' + part + ''; - }).join(' / '); -} - -/** - * Map html `files`, returning an html unordered list. - */ - -function html(files, dir, useIcons) { - return ''; -} - -/** - * Load and cache the given `icon`. - * - * @param {String} icon - * @return {String} - * @api private - */ - -function load(icon) { - if (cache[icon]) return cache[icon]; - return cache[icon] = fs.readFileSync(__dirname + '/../public/icons/' + icon, 'base64'); -} - -/** - * Filter "hidden" `files`, aka files - * beginning with a `.`. - * - * @param {Array} files - * @return {Array} - * @api private - */ - -function removeHidden(files) { - return files.filter(function(file){ - return '.' != file[0]; - }); -} - -/** - * Icon map. - */ - -var icons = { - '.js': 'page_white_code_red.png' - , '.c': 'page_white_c.png' - , '.h': 'page_white_h.png' - , '.cc': 'page_white_cplusplus.png' - , '.php': 'page_white_php.png' - , '.rb': 'page_white_ruby.png' - , '.cpp': 'page_white_cplusplus.png' - , '.swf': 'page_white_flash.png' - , '.pdf': 'page_white_acrobat.png' - , 'default': 'page_white.png' -}; diff --git a/node_modules/connect/lib/middleware/errorHandler.js b/node_modules/connect/lib/middleware/errorHandler.js deleted file mode 100644 index b62aab7..0000000 --- a/node_modules/connect/lib/middleware/errorHandler.js +++ /dev/null @@ -1,87 +0,0 @@ -/*! - * Connect - errorHandler - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../utils') - , url = require('url') - , fs = require('fs'); - -// environment - -var env = process.env.NODE_ENV || 'development'; - -/** - * Error handler: - * - * Development error handler, providing stack traces - * and error message responses for requests accepting text, html, - * or json. - * - * Text: - * - * By default, and when _text/plain_ is accepted a simple stack trace - * or error message will be returned. - * - * JSON: - * - * When _application/json_ is accepted, connect will respond with - * an object in the form of `{ "error": error }`. - * - * HTML: - * - * When accepted connect will output a nice html stack trace. - * - * @return {Function} - * @api public - */ - -exports = module.exports = function errorHandler(){ - return function errorHandler(err, req, res, next){ - if (err.status) res.statusCode = err.status; - if (res.statusCode < 400) res.statusCode = 500; - if ('test' != env) console.error(err.stack); - var accept = req.headers.accept || ''; - // html - if (~accept.indexOf('html')) { - fs.readFile(__dirname + '/../public/style.css', 'utf8', function(e, style){ - fs.readFile(__dirname + '/../public/error.html', 'utf8', function(e, html){ - var stack = (err.stack || '') - .split('\n').slice(1) - .map(function(v){ return '
  • ' + v + '
  • '; }).join(''); - html = html - .replace('{style}', style) - .replace('{stack}', stack) - .replace('{title}', exports.title) - .replace('{statusCode}', res.statusCode) - .replace(/\{error\}/g, utils.escape(err.toString())); - res.setHeader('Content-Type', 'text/html; charset=utf-8'); - res.end(html); - }); - }); - // json - } else if (~accept.indexOf('json')) { - var error = { message: err.message, stack: err.stack }; - for (var prop in err) error[prop] = err[prop]; - var json = JSON.stringify({ error: error }); - res.setHeader('Content-Type', 'application/json'); - res.end(json); - // plain text - } else { - res.writeHead(res.statusCode, { 'Content-Type': 'text/plain' }); - res.end(err.stack); - } - }; -}; - -/** - * Template title, framework authors may override this value. - */ - -exports.title = 'Connect'; diff --git a/node_modules/connect/lib/middleware/favicon.js b/node_modules/connect/lib/middleware/favicon.js deleted file mode 100644 index b344218..0000000 --- a/node_modules/connect/lib/middleware/favicon.js +++ /dev/null @@ -1,86 +0,0 @@ - -/*! - * Connect - favicon - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var fs = require('fs') - , utils = require('../utils'); - -/*! - * Favicon cache. - */ - -var icon; - -/** - * Favicon: - * - * By default serves the connect favicon, or the favicon - * located by the given `path`. - * - * Options: - * - * - `maxAge` cache-control max-age directive, defaulting to 1 day - * - * Examples: - * - * Serve default favicon: - * - * connect() - * .use(connect.favicon()) - * - * Serve favicon before logging for brevity: - * - * connect() - * .use(connect.favicon()) - * .use(connect.logger('dev')) - * - * Serve custom favicon: - * - * connect() - * .use(connect.favicon('public/favicon.ico)) - * - * @param {String} path - * @param {Object} options - * @return {Function} - * @api public - */ - -module.exports = function favicon(path, options){ - var options = options || {} - , path = path || __dirname + '/../public/favicon.ico' - , maxAge = options.maxAge || 86400000; - - return function favicon(req, res, next){ - if ('/favicon.ico' == req.url) { - if (icon) { - res.writeHead(200, icon.headers); - res.end(icon.body); - } else { - fs.readFile(path, function(err, buf){ - if (err) return next(err); - icon = { - headers: { - 'Content-Type': 'image/x-icon' - , 'Content-Length': buf.length - , 'ETag': '"' + utils.md5(buf) + '"' - , 'Cache-Control': 'public, max-age=' + (maxAge / 1000) - }, - body: buf - }; - res.writeHead(200, icon.headers); - res.end(icon.body); - }); - } - } else { - next(); - } - }; -}; \ No newline at end of file diff --git a/node_modules/connect/lib/middleware/json.js b/node_modules/connect/lib/middleware/json.js deleted file mode 100644 index dd14d8b..0000000 --- a/node_modules/connect/lib/middleware/json.js +++ /dev/null @@ -1,61 +0,0 @@ -/*! - * Connect - json - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../utils'); - -/** - * JSON: - * - * Parse JSON request bodies, providing the - * parsed object as `req.body`. - * - * Options: - * - * - `strict` when `false` anything `JSON.parse()` accepts will be parsed - * - `reviver` used as the second "reviver" argument for JSON.parse - * - * @param {Object} options - * @return {Function} - * @api public - */ - -exports = module.exports = function(options){ - var options = options || {} - , strict = options.strict === false - ? false - : true; - - return function json(req, res, next) { - if (req._body) return next(); - req.body = req.body || {}; - - // check Content-Type - if ('application/json' != utils.mime(req)) return next(); - - // flag as parsed - req._body = true; - - // parse - var buf = ''; - req.setEncoding('utf8'); - req.on('data', function(chunk){ buf += chunk }); - req.on('end', function(){ - if (strict && '{' != buf[0] && '[' != buf[0]) return next(utils.error(400)); - try { - req.body = JSON.parse(buf, options.reviver); - next(); - } catch (err){ - err.status = 400; - next(err); - } - }); - } -}; \ No newline at end of file diff --git a/node_modules/connect/lib/middleware/limit.js b/node_modules/connect/lib/middleware/limit.js deleted file mode 100644 index d0b9d9b..0000000 --- a/node_modules/connect/lib/middleware/limit.js +++ /dev/null @@ -1,77 +0,0 @@ - -/*! - * Connect - limit - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../utils'); - -/** - * Limit: - * - * Limit request bodies to the given size in `bytes`. - * - * A string representation of the bytesize may also be passed, - * for example "5mb", "200kb", "1gb", etc. - * - * connect() - * .use(connect.limit('5.5mb')) - * .use(handleImageUpload) - * - * @param {Number|String} bytes - * @return {Function} - * @api public - */ - -module.exports = function limit(bytes){ - if ('string' == typeof bytes) bytes = parse(bytes); - if ('number' != typeof bytes) throw new Error('limit() bytes required'); - return function limit(req, res, next){ - var received = 0 - , len = req.headers['content-length'] - ? parseInt(req.headers['content-length'], 10) - : null; - - // self-awareness - if (req._limit) return next(); - req._limit = true; - - // limit by content-length - if (len && len > bytes) return next(utils.error(413)); - - // limit - req.on('data', function(chunk){ - received += chunk.length; - if (received > bytes) req.destroy(); - }); - - next(); - }; -}; - -/** - * Parse byte `size` string. - * - * @param {String} size - * @return {Number} - * @api private - */ - -function parse(size) { - var parts = size.match(/^(\d+(?:\.\d+)?) *(kb|mb|gb)$/) - , n = parseFloat(parts[1]) - , type = parts[2]; - - var map = { - kb: 1024 - , mb: 1024 * 1024 - , gb: 1024 * 1024 * 1024 - }; - - return map[type] * n; -} \ No newline at end of file diff --git a/node_modules/connect/lib/middleware/logger.js b/node_modules/connect/lib/middleware/logger.js deleted file mode 100644 index 816f637..0000000 --- a/node_modules/connect/lib/middleware/logger.js +++ /dev/null @@ -1,331 +0,0 @@ - -/*! - * Connect - logger - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/*! - * Log buffer. - */ - -var buf = []; - -/*! - * Default log buffer duration. - */ - -var defaultBufferDuration = 1000; - -/** - * Logger: - * - * Log requests with the given `options` or a `format` string. - * - * Options: - * - * - `format` Format string, see below for tokens - * - `stream` Output stream, defaults to _stdout_ - * - `buffer` Buffer duration, defaults to 1000ms when _true_ - * - `immediate` Write log line on request instead of response (for response times) - * - * Tokens: - * - * - `:req[header]` ex: `:req[Accept]` - * - `:res[header]` ex: `:res[Content-Length]` - * - `:http-version` - * - `:response-time` - * - `:remote-addr` - * - `:date` - * - `:method` - * - `:url` - * - `:referrer` - * - `:user-agent` - * - `:status` - * - * Formats: - * - * Pre-defined formats that ship with connect: - * - * - `default` ':remote-addr - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"' - * - `short` ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms' - * - `tiny` ':method :url :status :res[content-length] - :response-time ms' - * - `dev` concise output colored by response status for development use - * - * Examples: - * - * connect.logger() // default - * connect.logger('short') - * connect.logger('tiny') - * connect.logger({ immediate: true, format: 'dev' }) - * connect.logger(':method :url - :referrer') - * connect.logger(':req[content-type] -> :res[content-type]') - * connect.logger(function(req, res){ return 'some format string' }) - * - * Defining Tokens: - * - * To define a token, simply invoke `connect.logger.token()` with the - * name and a callback function. The value returned is then available - * as ":type" in this case. - * - * connect.logger.token('type', function(req, res){ return req.headers['content-type']; }) - * - * Defining Formats: - * - * All default formats are defined this way, however it's public API as well: - * - * connect.logger.format('name', 'string or function') - * - * @param {String|Function|Object} format or options - * @return {Function} - * @api public - */ - -exports = module.exports = function logger(options) { - if ('object' == typeof options) { - options = options || {}; - } else if (options) { - options = { format: options }; - } else { - options = {}; - } - - // output on request instead of response - var immediate = options.immediate; - - // format name - var fmt = exports[options.format] || options.format || exports.default; - - // compile format - if ('function' != typeof fmt) fmt = compile(fmt); - - // options - var stream = options.stream || process.stdout - , buffer = options.buffer; - - // buffering support - if (buffer) { - var realStream = stream - , interval = 'number' == typeof buffer - ? buffer - : defaultBufferDuration; - - // flush interval - setInterval(function(){ - if (buf.length) { - realStream.write(buf.join(''), 'ascii'); - buf.length = 0; - } - }, interval); - - // swap the stream - stream = { - write: function(str){ - buf.push(str); - } - }; - } - - return function logger(req, res, next) { - req._startTime = new Date; - - // mount safety - if (req._logging) return next(); - - // flag as logging - req._logging = true; - - // immediate - if (immediate) { - var line = fmt(exports, req, res); - if (null == line) return; - stream.write(line + '\n', 'ascii'); - // proxy end to output logging - } else { - var end = res.end; - res.end = function(chunk, encoding){ - res.end = end; - res.end(chunk, encoding); - var line = fmt(exports, req, res); - if (null == line) return; - stream.write(line + '\n', 'ascii'); - }; - } - - - next(); - }; -}; - -/** - * Compile `fmt` into a function. - * - * @param {String} fmt - * @return {Function} - * @api private - */ - -function compile(fmt) { - fmt = fmt.replace(/"/g, '\\"'); - var js = ' return "' + fmt.replace(/:([-\w]{2,})(?:\[([^\]]+)\])?/g, function(_, name, arg){ - return '"\n + (tokens["' + name + '"](req, res, "' + arg + '") || "-") + "'; - }) + '";' - return new Function('tokens, req, res', js); -}; - -/** - * Define a token function with the given `name`, - * and callback `fn(req, res)`. - * - * @param {String} name - * @param {Function} fn - * @return {Object} exports for chaining - * @api public - */ - -exports.token = function(name, fn) { - exports[name] = fn; - return this; -}; - -/** - * Define a `fmt` with the given `name`. - * - * @param {String} name - * @param {String|Function} fmt - * @return {Object} exports for chaining - * @api public - */ - -exports.format = function(name, str){ - exports[name] = str; - return this; -}; - -/** - * Default format. - */ - -exports.format('default', ':remote-addr - - [:date] ":method :url HTTP/:http-version" :status :res[content-length] ":referrer" ":user-agent"'); - -/** - * Short format. - */ - -exports.format('short', ':remote-addr - :method :url HTTP/:http-version :status :res[content-length] - :response-time ms'); - -/** - * Tiny format. - */ - -exports.format('tiny', ':method :url :status :res[content-length] - :response-time ms'); - -/** - * dev (colored) - */ - -exports.format('dev', function(tokens, req, res){ - var status = res.statusCode - , color = 32; - - if (status >= 500) color = 31 - else if (status >= 400) color = 33 - else if (status >= 300) color = 36; - - return '\033[90m' + req.method - + ' ' + req.originalUrl + ' ' - + '\033[' + color + 'm' + res.statusCode - + ' \033[90m' - + (new Date - req._startTime) - + 'ms\033[0m'; -}); - -/** - * request url - */ - -exports.token('url', function(req){ - return req.originalUrl; -}); - -/** - * request method - */ - -exports.token('method', function(req){ - return req.method; -}); - -/** - * response time in milliseconds - */ - -exports.token('response-time', function(req){ - return new Date - req._startTime; -}); - -/** - * UTC date - */ - -exports.token('date', function(){ - return new Date().toUTCString(); -}); - -/** - * response status code - */ - -exports.token('status', function(req, res){ - return res.statusCode; -}); - -/** - * normalized referrer - */ - -exports.token('referrer', function(req){ - return req.headers['referer'] || req.headers['referrer']; -}); - -/** - * remote address - */ - -exports.token('remote-addr', function(req){ - return req.socket && (req.socket.remoteAddress || (req.socket.socket && req.socket.socket.remoteAddress)); -}); - -/** - * HTTP version - */ - -exports.token('http-version', function(req){ - return req.httpVersionMajor + '.' + req.httpVersionMinor; -}); - -/** - * UA string - */ - -exports.token('user-agent', function(req){ - return req.headers['user-agent']; -}); - -/** - * request header - */ - -exports.token('req', function(req, res, field){ - return req.headers[field.toLowerCase()]; -}); - -/** - * response header - */ - -exports.token('res', function(req, res, field){ - return (res._headers || {})[field.toLowerCase()]; -}); - diff --git a/node_modules/connect/lib/middleware/methodOverride.js b/node_modules/connect/lib/middleware/methodOverride.js deleted file mode 100644 index aaf4014..0000000 --- a/node_modules/connect/lib/middleware/methodOverride.js +++ /dev/null @@ -1,40 +0,0 @@ - -/*! - * Connect - methodOverride - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Method Override: - * - * Provides faux HTTP method support. - * - * Pass an optional `key` to use when checking for - * a method override, othewise defaults to _\_method_. - * The original method is available via `req.originalMethod`. - * - * @param {String} key - * @return {Function} - * @api public - */ - -module.exports = function methodOverride(key){ - key = key || "_method"; - return function methodOverride(req, res, next) { - req.originalMethod = req.originalMethod || req.method; - - // req.body - if (req.body && key in req.body) { - req.method = req.body[key].toUpperCase(); - delete req.body[key]; - // check X-HTTP-Method-Override - } else if (req.headers['x-http-method-override']) { - req.method = req.headers['x-http-method-override'].toUpperCase(); - } - - next(); - }; -}; - diff --git a/node_modules/connect/lib/middleware/multipart.js b/node_modules/connect/lib/middleware/multipart.js deleted file mode 100644 index f48e4da..0000000 --- a/node_modules/connect/lib/middleware/multipart.js +++ /dev/null @@ -1,99 +0,0 @@ - -/*! - * Connect - multipart - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var formidable = require('formidable') - , utils = require('../utils') - , qs = require('qs'); - -/** - * Multipart: - * - * Parse multipart/form-data request bodies, - * providing the parsed object as `req.body` - * and `req.files`. - * - * Configuration: - * - * The options passed are merged with [formidable](https://github.com/felixge/node-formidable)'s - * `IncomingForm` object, allowing you to configure the upload directory, - * size limits, etc. For example if you wish to change the upload dir do the following. - * - * app.use(connect.multipart({ uploadDir: path })); - * - * @param {Object} options - * @return {Function} - * @api public - */ - -exports = module.exports = function(options){ - options = options || {}; - return function multipart(req, res, next) { - if (req._body) return next(); - req.body = req.body || {}; - req.files = req.files || {}; - - // ignore GET - if ('GET' == req.method || 'HEAD' == req.method) return next(); - - // check Content-Type - if ('multipart/form-data' != utils.mime(req)) return next(); - - // flag as parsed - req._body = true; - - // parse - var form = new formidable.IncomingForm - , data = {} - , files = {} - , done; - - Object.keys(options).forEach(function(key){ - form[key] = options[key]; - }); - - function ondata(name, val, data){ - if (Array.isArray(data[name])) { - data[name].push(val); - } else if (data[name]) { - data[name] = [data[name], val]; - } else { - data[name] = val; - } - } - - form.on('field', function(name, val){ - ondata(name, val, data); - }); - - form.on('file', function(name, val){ - ondata(name, val, files); - }); - - form.on('error', function(err){ - next(err); - done = true; - }); - - form.on('end', function(){ - if (done) return; - try { - req.body = qs.parse(data); - req.files = qs.parse(files); - next(); - } catch (err) { - next(err); - } - }); - - form.parse(req); - } -}; diff --git a/node_modules/connect/lib/middleware/query.js b/node_modules/connect/lib/middleware/query.js deleted file mode 100644 index 93fc5d3..0000000 --- a/node_modules/connect/lib/middleware/query.js +++ /dev/null @@ -1,46 +0,0 @@ -/*! - * Connect - query - * Copyright(c) 2011 TJ Holowaychuk - * Copyright(c) 2011 Sencha Inc. - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var qs = require('qs') - , parse = require('../utils').parseUrl; - -/** - * Query: - * - * Automatically parse the query-string when available, - * populating the `req.query` object. - * - * Examples: - * - * connect() - * .use(connect.query()) - * .use(function(req, res){ - * res.end(JSON.stringify(req.query)); - * }); - * - * The `options` passed are provided to qs.parse function. - * - * @param {Object} options - * @return {Function} - * @api public - */ - -module.exports = function query(options){ - return function query(req, res, next){ - if (!req.query) { - req.query = ~req.url.indexOf('?') - ? qs.parse(parse(req).query, options) - : {}; - } - - next(); - }; -}; diff --git a/node_modules/connect/lib/middleware/responseTime.js b/node_modules/connect/lib/middleware/responseTime.js deleted file mode 100644 index 57858f6..0000000 --- a/node_modules/connect/lib/middleware/responseTime.js +++ /dev/null @@ -1,32 +0,0 @@ - -/*! - * Connect - responseTime - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Reponse time: - * - * Adds the `X-Response-Time` header displaying the response - * duration in milliseconds. - * - * @return {Function} - * @api public - */ - -module.exports = function responseTime(){ - return function(req, res, next){ - var start = new Date; - - if (res._responseTime) return next(); - res._responseTime = true; - - res.on('header', function(header){ - var duration = new Date - start; - res.setHeader('X-Response-time', duration + 'ms'); - }); - - next(); - }; -}; diff --git a/node_modules/connect/lib/middleware/session.js b/node_modules/connect/lib/middleware/session.js deleted file mode 100644 index 1585fe9..0000000 --- a/node_modules/connect/lib/middleware/session.js +++ /dev/null @@ -1,325 +0,0 @@ - -/*! - * Connect - session - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Session = require('./session/session') - , debug = require('debug')('connect:session') - , MemoryStore = require('./session/memory') - , Cookie = require('./session/cookie') - , Store = require('./session/store') - , utils = require('./../utils') - , parse = utils.parseUrl - , crc16 = require('crc').crc16 - , crypto = require('crypto'); - -// environment - -var env = process.env.NODE_ENV; - -/** - * Expose the middleware. - */ - -exports = module.exports = session; - -/** - * Expose constructors. - */ - -exports.Store = Store; -exports.Cookie = Cookie; -exports.Session = Session; -exports.MemoryStore = MemoryStore; - -/** - * Warning message for `MemoryStore` usage in production. - */ - -var warning = 'Warning: connection.session() MemoryStore is not\n' - + 'designed for a production environment, as it will leak\n' - + 'memory, and will not scale past a single process.'; - -/** - * Session: - * - * Setup session store with the given `options`. - * - * Session data is _not_ saved in the cookie itself, however - * cookies are used, so we must use the [cookieParser()](cookieParser.html) - * middleware _before_ `session()`. - * - * Examples: - * - * connect() - * .use(connect.cookieParser('keyboard cat')) - * .use(connect.session({ key: 'sid', cookie: { secure: true }})) - * - * Options: - * - * - `key` cookie name defaulting to `connect.sid` - * - `store` session store instance - * - `cookie` session cookie settings, defaulting to `{ path: '/', httpOnly: true, maxAge: null }` - * - `proxy` trust the reverse proxy when setting secure cookies (via "x-forwarded-proto") - * - * Cookie option: - * - * By default `cookie.maxAge` is `null`, meaning no "expires" parameter is set - * so the cookie becomes a browser-session cookie. When the user closes the - * browser the cookie (and session) will be removed. - * - * ## req.session - * - * To store or access session data, simply use the request property `req.session`, - * which is (generally) serialized as JSON by the store, so nested objects - * are typically fine. For example below is a user-specific view counter: - * - * connect() - * .use(connect.favicon()) - * .use(connect.cookieParser('keyboard cat')) - * .use(connect.session({ cookie: { maxAge: 60000 }})) - * .use(function(req, res, next){ - * var sess = req.session; - * if (sess.views) { - * res.setHeader('Content-Type', 'text/html'); - * res.write('

    views: ' + sess.views + '

    '); - * res.write('

    expires in: ' + (sess.cookie.maxAge / 1000) + 's

    '); - * res.end(); - * sess.views++; - * } else { - * sess.views = 1; - * res.end('welcome to the session demo. refresh!'); - * } - * } - * )).listen(3000); - * - * ## Session#regenerate() - * - * To regenerate the session simply invoke the method, once complete - * a new SID and `Session` instance will be initialized at `req.session`. - * - * req.session.regenerate(function(err){ - * // will have a new session here - * }); - * - * ## Session#destroy() - * - * Destroys the session, removing `req.session`, will be re-generated next request. - * - * req.session.destroy(function(err){ - * // cannot access session here - * }); - * - * ## Session#reload() - * - * Reloads the session data. - * - * req.session.reload(function(err){ - * // session updated - * }); - * - * ## Session#save() - * - * Save the session. - * - * req.session.save(function(err){ - * // session saved - * }); - * - * ## Session#touch() - * - * Updates the `.maxAge` property. Typically this is - * not necessary to call, as the session middleware does this for you. - * - * ## Session#cookie - * - * Each session has a unique cookie object accompany it. This allows - * you to alter the session cookie per visitor. For example we can - * set `req.session.cookie.expires` to `false` to enable the cookie - * to remain for only the duration of the user-agent. - * - * ## Session#maxAge - * - * Alternatively `req.session.cookie.maxAge` will return the time - * remaining in milliseconds, which we may also re-assign a new value - * to adjust the `.expires` property appropriately. The following - * are essentially equivalent - * - * var hour = 3600000; - * req.session.cookie.expires = new Date(Date.now() + hour); - * req.session.cookie.maxAge = hour; - * - * For example when `maxAge` is set to `60000` (one minute), and 30 seconds - * has elapsed it will return `30000` until the current request has completed, - * at which time `req.session.touch()` is called to reset `req.session.maxAge` - * to its original value. - * - * req.session.cookie.maxAge; - * // => 30000 - * - * Session Store Implementation: - * - * Every session store _must_ implement the following methods - * - * - `.get(sid, callback)` - * - `.set(sid, session, callback)` - * - `.destroy(sid, callback)` - * - * Recommended methods include, but are not limited to: - * - * - `.length(callback)` - * - `.clear(callback)` - * - * For an example implementation view the [connect-redis](http://github.com/visionmedia/connect-redis) repo. - * - * @param {Object} options - * @return {Function} - * @api public - */ - -function session(options){ - var options = options || {} - , key = options.key || 'connect.sid' - , store = options.store || new MemoryStore - , cookie = options.cookie - , trustProxy = options.proxy; - - // notify user that this store is not - // meant for a production environment - if ('production' == env && store instanceof MemoryStore) { - console.warn(warning); - } - - // generates the new session - store.generate = function(req){ - req.sessionID = utils.uid(24); - req.session = new Session(req); - req.session.cookie = new Cookie(req, cookie); - }; - - return function session(req, res, next) { - // self-awareness - if (req.session) return next(); - - // ensure secret is available or bail - if (!req.secret) throw new Error('connect.cookieParser("secret") required for security when using sessions'); - - // parse url - var url = parse(req) - , path = url.pathname - , originalHash; - - // expose store - req.sessionStore = store; - - // set-cookie - res.on('header', function(){ - if (!req.session) return; - var cookie = req.session.cookie - , proto = (req.headers['x-forwarded-proto'] || '').toLowerCase() - , tls = req.connection.encrypted || (trustProxy && 'https' == proto) - , secured = cookie.secure && tls - , isNew = req.signedCookies[key] != req.sessionID; - - // only send secure cookies via https - if (cookie.secure && !secured) return debug('not secured'); - - // browser-session length cookie - if (null == cookie.expires) { - if (!isNew) return debug('already set browser-session cookie'); - // compare hashes - } else if (originalHash == hash(req.session)) { - return debug('unmodified session'); - } - - var val = cookie.serialize(key, req.sessionID); - debug('set-cookie %s', val); - res.setHeader('Set-Cookie', val); - }); - - // proxy end() to commit the session - var end = res.end; - res.end = function(data, encoding){ - res.end = end; - if (!req.session) return res.end(data, encoding); - debug('saving'); - req.session.resetMaxAge(); - req.session.save(function(){ - debug('saved'); - res.end(data, encoding); - }); - }; - - // generate the session - function generate() { - store.generate(req); - } - - // get the sessionID from the cookie - req.sessionID = req.signedCookies[key]; - - // generate a session if the browser doesn't send a sessionID - if (!req.sessionID) { - debug('no SID sent, generating session'); - generate(); - next(); - return; - } - - // generate the session object - var pause = utils.pause(req); - debug('fetching %s', req.sessionID); - store.get(req.sessionID, function(err, sess){ - // proxy to resume() events - var _next = next; - next = function(err){ - _next(err); - pause.resume(); - } - - // error handling - if (err) { - debug('error'); - if ('ENOENT' == err.code) { - generate(); - next(); - } else { - next(err); - } - // no session - } else if (!sess) { - debug('no session found'); - generate(); - next(); - // populate req.session - } else { - debug('session found'); - store.createSession(req, sess); - originalHash = hash(sess); - next(); - } - }); - }; -}; - -/** - * Hash the given `sess` object omitting changes - * to `.cookie`. - * - * @param {Object} sess - * @return {String} - * @api private - */ - -function hash(sess) { - return crc16(JSON.stringify(sess, function(key, val){ - if ('cookie' != key) return val; - })); -} diff --git a/node_modules/connect/lib/middleware/session/cookie.js b/node_modules/connect/lib/middleware/session/cookie.js deleted file mode 100644 index 5e7f4c3..0000000 --- a/node_modules/connect/lib/middleware/session/cookie.js +++ /dev/null @@ -1,129 +0,0 @@ - -/*! - * Connect - session - Cookie - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../../utils'); - -/** - * Initialize a new `Cookie` with the given `options`. - * - * @param {IncomingMessage} req - * @param {Object} options - * @api private - */ - -var Cookie = module.exports = function Cookie(req, options) { - this.path = '/'; - this.maxAge = null; - this.httpOnly = true; - if (options) utils.merge(this, options); - Object.defineProperty(this, 'req', { value: req }); - this.originalMaxAge = undefined == this.originalMaxAge - ? this.maxAge - : this.originalMaxAge; -}; - -/*! - * Prototype. - */ - -Cookie.prototype = { - - /** - * Set expires `date`. - * - * @param {Date} date - * @api public - */ - - set expires(date) { - this._expires = date; - this.originalMaxAge = this.maxAge; - }, - - /** - * Get expires `date`. - * - * @return {Date} - * @api public - */ - - get expires() { - return this._expires; - }, - - /** - * Set expires via max-age in `ms`. - * - * @param {Number} ms - * @api public - */ - - set maxAge(ms) { - this.expires = 'number' == typeof ms - ? new Date(Date.now() + ms) - : ms; - }, - - /** - * Get expires max-age in `ms`. - * - * @return {Number} - * @api public - */ - - get maxAge() { - return this.expires instanceof Date - ? this.expires.valueOf() - Date.now() - : this.expires; - }, - - /** - * Return cookie data object. - * - * @return {Object} - * @api private - */ - - get data() { - return { - originalMaxAge: this.originalMaxAge - , expires: this._expires - , secure: this.secure - , httpOnly: this.httpOnly - , domain: this.domain - , path: this.path - } - }, - - /** - * Return a serialized cookie string. - * - * @return {String} - * @api public - */ - - serialize: function(name, val){ - val = utils.sign(val, this.req.secret); - return utils.serializeCookie(name, val, this.data); - }, - - /** - * Return JSON representation of this cookie. - * - * @return {Object} - * @api private - */ - - toJSON: function(){ - return this.data; - } -}; diff --git a/node_modules/connect/lib/middleware/session/memory.js b/node_modules/connect/lib/middleware/session/memory.js deleted file mode 100644 index ec569f5..0000000 --- a/node_modules/connect/lib/middleware/session/memory.js +++ /dev/null @@ -1,131 +0,0 @@ - -/*! - * Connect - session - MemoryStore - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var Store = require('./store') - , utils = require('../../utils') - , Session = require('./session'); - -/** - * Initialize a new `MemoryStore`. - * - * @api public - */ - -var MemoryStore = module.exports = function MemoryStore() { - this.sessions = {}; -}; - -/** - * Inherit from `Store.prototype`. - */ - -MemoryStore.prototype.__proto__ = Store.prototype; - -/** - * Attempt to fetch session by the given `sid`. - * - * @param {String} sid - * @param {Function} fn - * @api public - */ - -MemoryStore.prototype.get = function(sid, fn){ - var self = this; - process.nextTick(function(){ - var expires - , sess = self.sessions[sid]; - if (sess) { - sess = JSON.parse(sess); - expires = 'string' == typeof sess.cookie.expires - ? new Date(sess.cookie.expires) - : sess.cookie.expires; - if (!expires || new Date < expires) { - fn(null, sess); - } else { - self.destroy(sid, fn); - } - } else { - fn(); - } - }); -}; - -/** - * Commit the given `sess` object associated with the given `sid`. - * - * @param {String} sid - * @param {Session} sess - * @param {Function} fn - * @api public - */ - -MemoryStore.prototype.set = function(sid, sess, fn){ - var self = this; - process.nextTick(function(){ - self.sessions[sid] = JSON.stringify(sess); - fn && fn(); - }); -}; - -/** - * Destroy the session associated with the given `sid`. - * - * @param {String} sid - * @api public - */ - -MemoryStore.prototype.destroy = function(sid, fn){ - var self = this; - process.nextTick(function(){ - delete self.sessions[sid]; - fn && fn(); - }); -}; - -/** - * Invoke the given callback `fn` with all active sessions. - * - * @param {Function} fn - * @api public - */ - -MemoryStore.prototype.all = function(fn){ - var arr = [] - , keys = Object.keys(this.sessions); - for (var i = 0, len = keys.length; i < len; ++i) { - arr.push(this.sessions[keys[i]]); - } - fn(null, arr); -}; - -/** - * Clear all sessions. - * - * @param {Function} fn - * @api public - */ - -MemoryStore.prototype.clear = function(fn){ - this.sessions = {}; - fn && fn(); -}; - -/** - * Fetch number of sessions. - * - * @param {Function} fn - * @api public - */ - -MemoryStore.prototype.length = function(fn){ - fn(null, Object.keys(this.sessions).length); -}; diff --git a/node_modules/connect/lib/middleware/session/session.js b/node_modules/connect/lib/middleware/session/session.js deleted file mode 100644 index eba8fcf..0000000 --- a/node_modules/connect/lib/middleware/session/session.js +++ /dev/null @@ -1,117 +0,0 @@ - -/*! - * Connect - session - Session - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../../utils') - , Cookie = require('./cookie'); - -/** - * Create a new `Session` with the given request and `data`. - * - * @param {IncomingRequest} req - * @param {Object} data - * @api private - */ - -var Session = module.exports = function Session(req, data) { - Object.defineProperty(this, 'req', { value: req }); - Object.defineProperty(this, 'id', { value: req.sessionID }); - if ('object' == typeof data) utils.merge(this, data); -}; - -/** - * Update reset `.cookie.maxAge` to prevent - * the cookie from expiring when the - * session is still active. - * - * @return {Session} for chaining - * @api public - */ - -Session.prototype.touch = function(){ - return this.resetMaxAge(); -}; - -/** - * Reset `.maxAge` to `.originalMaxAge`. - * - * @return {Session} for chaining - * @api public - */ - -Session.prototype.resetMaxAge = function(){ - this.cookie.maxAge = this.cookie.originalMaxAge; - return this; -}; - -/** - * Save the session data with optional callback `fn(err)`. - * - * @param {Function} fn - * @return {Session} for chaining - * @api public - */ - -Session.prototype.save = function(fn){ - this.req.sessionStore.set(this.id, this, fn || function(){}); - return this; -}; - -/** - * Re-loads the session data _without_ altering - * the maxAge properties. Invokes the callback `fn(err)`, - * after which time if no exception has occurred the - * `req.session` property will be a new `Session` object, - * although representing the same session. - * - * @param {Function} fn - * @return {Session} for chaining - * @api public - */ - -Session.prototype.reload = function(fn){ - var req = this.req - , store = this.req.sessionStore; - store.get(this.id, function(err, sess){ - if (err) return fn(err); - if (!sess) return fn(new Error('failed to load session')); - store.createSession(req, sess); - fn(); - }); - return this; -}; - -/** - * Destroy `this` session. - * - * @param {Function} fn - * @return {Session} for chaining - * @api public - */ - -Session.prototype.destroy = function(fn){ - delete this.req.session; - this.req.sessionStore.destroy(this.id, fn); - return this; -}; - -/** - * Regenerate this request's session. - * - * @param {Function} fn - * @return {Session} for chaining - * @api public - */ - -Session.prototype.regenerate = function(fn){ - this.req.sessionStore.regenerate(this.req, fn); - return this; -}; diff --git a/node_modules/connect/lib/middleware/session/store.js b/node_modules/connect/lib/middleware/session/store.js deleted file mode 100644 index d72d156..0000000 --- a/node_modules/connect/lib/middleware/session/store.js +++ /dev/null @@ -1,86 +0,0 @@ - -/*! - * Connect - session - Store - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter - , Session = require('./session') - , Cookie = require('./cookie') - , utils = require('../../utils'); - -/** - * Initialize abstract `Store`. - * - * @api private - */ - -var Store = module.exports = function Store(options){}; - -/** - * Inherit from `EventEmitter.prototype`. - */ - -Store.prototype.__proto__ = EventEmitter.prototype; - -/** - * Re-generate the given requests's session. - * - * @param {IncomingRequest} req - * @return {Function} fn - * @api public - */ - -Store.prototype.regenerate = function(req, fn){ - var self = this; - this.destroy(req.sessionID, function(err){ - self.generate(req); - fn(err); - }); -}; - -/** - * Load a `Session` instance via the given `sid` - * and invoke the callback `fn(err, sess)`. - * - * @param {String} sid - * @param {Function} fn - * @api public - */ - -Store.prototype.load = function(sid, fn){ - var self = this; - this.get(sid, function(err, sess){ - if (err) return fn(err); - if (!sess) return fn(); - var req = { sessionID: sid, sessionStore: self }; - sess = self.createSession(req, sess); - fn(null, sess); - }); -}; - -/** - * Create session from JSON `sess` data. - * - * @param {IncomingRequest} req - * @param {Object} sess - * @return {Session} - * @api private - */ - -Store.prototype.createSession = function(req, sess){ - var expires = sess.cookie.expires - , orig = sess.cookie.originalMaxAge - , update = null == update ? true : false; - sess.cookie = new Cookie(req, sess.cookie); - if ('string' == typeof expires) sess.cookie.expires = new Date(expires); - sess.cookie.originalMaxAge = orig; - req.session = new Session(req, sess); - return req.session; -}; \ No newline at end of file diff --git a/node_modules/connect/lib/middleware/static.js b/node_modules/connect/lib/middleware/static.js deleted file mode 100644 index 19dea41..0000000 --- a/node_modules/connect/lib/middleware/static.js +++ /dev/null @@ -1,249 +0,0 @@ -/*! - * Connect - staticProvider - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var fs = require('fs') - , path = require('path') - , join = path.join - , basename = path.basename - , normalize = path.normalize - , utils = require('../utils') - , Buffer = require('buffer').Buffer - , parse = require('url').parse - , mime = require('mime'); - -/** - * Static: - * - * Static file server with the given `root` path. - * - * Examples: - * - * var oneDay = 86400000; - * - * connect() - * .use(connect.static(__dirname + '/public')) - * - * connect() - * .use(connect.static(__dirname + '/public', { maxAge: oneDay })) - * - * Options: - * - * - `maxAge` Browser cache maxAge in milliseconds. defaults to 0 - * - `hidden` Allow transfer of hidden files. defaults to false - * - `redirect` Redirect to trailing "/" when the pathname is a dir - * - * @param {String} root - * @param {Object} options - * @return {Function} - * @api public - */ - -exports = module.exports = function static(root, options){ - options = options || {}; - - // root required - if (!root) throw new Error('static() root path required'); - options.root = root; - - return function static(req, res, next) { - options.path = req.url; - options.getOnly = true; - send(req, res, next, options); - }; -}; - -/** - * Expose mime module. - * - * If you wish to extend the mime table use this - * reference to the "mime" module in the npm registry. - */ - -exports.mime = mime; - -/** - * decodeURIComponent. - * - * Allows V8 to only deoptimize this fn instead of all - * of send(). - * - * @param {String} path - * @api private - */ - -function decode(path){ - try { - return decodeURIComponent(path); - } catch (err) { - return err; - } -} - -/** - * Attempt to tranfer the requested file to `res`. - * - * @param {ServerRequest} - * @param {ServerResponse} - * @param {Function} next - * @param {Object} options - * @api private - */ - -var send = exports.send = function(req, res, next, options){ - options = options || {}; - if (!options.path) throw new Error('path required'); - - // setup - var maxAge = options.maxAge || 0 - , ranges = req.headers.range - , head = 'HEAD' == req.method - , get = 'GET' == req.method - , root = options.root ? normalize(options.root) : null - , redirect = false === options.redirect ? false : true - , getOnly = options.getOnly - , fn = options.callback - , hidden = options.hidden - , done; - - if (Infinity == maxAge) maxAge = 60 * 60 * 24 * 365 * 1000; - - // replace next() with callback when available - if (fn) next = fn; - - // ignore non-GET requests - if (getOnly && !get && !head) return next(); - - // parse url - var url = parse(options.path) - , path = decode(url.pathname) - , type; - - if (path instanceof URIError) return next(utils.error(400)); - - // null byte(s) - if (~path.indexOf('\0')) return next(utils.error(400)); - - // when root is not given, consider .. malicious - if (!root && ~path.indexOf('..')) return next(utils.error(403)); - - // index.html support - if ('/' == path[path.length - 1]) path += 'index.html'; - - // join / normalize from optional root dir - path = normalize(join(root, path)); - - // malicious path - if (root && 0 != path.indexOf(root)) return next(utils.error(403)); - - // "hidden" file - if (!hidden && '.' == basename(path)[0]) return next(); - - fs.stat(path, function(err, stat){ - // mime type - type = mime.lookup(path); - - // ignore ENOENT - if (err) { - if (fn) return fn(err); - return ('ENOENT' == err.code || 'ENAMETOOLONG' == err.code) - ? next() - : next(err); - // redirect directory in case index.html is present - } else if (stat.isDirectory()) { - if (!redirect) return next(); - url = parse(req.originalUrl); - res.statusCode = 301; - res.setHeader('Location', url.pathname + '/'); - res.end('Redirecting to ' + url.pathname + '/'); - return; - } - - // header fields - if (!res.getHeader('Date')) res.setHeader('Date', new Date().toUTCString()); - if (!res.getHeader('Cache-Control')) res.setHeader('Cache-Control', 'public, max-age=' + (maxAge / 1000)); - if (!res.getHeader('Last-Modified')) res.setHeader('Last-Modified', stat.mtime.toUTCString()); - if (!res.getHeader('Content-Type')) { - var charset = mime.charsets.lookup(type); - res.setHeader('Content-Type', type + (charset ? '; charset=' + charset : '')); - } - res.setHeader('Accept-Ranges', 'bytes'); - - // conditional GET support - if (utils.conditionalGET(req)) { - if (!utils.modified(req, res)) { - req.emit('static'); - return utils.notModified(res); - } - } - - var opts = {} - , len = stat.size; - - // we have a Range request - if (ranges) { - ranges = utils.parseRange(len, ranges); - - // valid - if (ranges) { - opts.start = ranges[0].start; - opts.end = ranges[0].end; - - // unsatisfiable range - if (opts.start > len - 1) { - res.setHeader('Content-Range', 'bytes */' + stat.size); - return next(utils.error(416)); - } - - // limit last-byte-pos to current length - if (opts.end > len - 1) opts.end= len - 1; - - // Content-Range - len = opts.end - opts.start + 1; - res.statusCode = 206; - res.setHeader('Content-Range', 'bytes ' - + opts.start - + '-' - + opts.end - + '/' - + stat.size); - } - } - - res.setHeader('Content-Length', len); - - // transfer - if (head) return res.end(); - - // stream - var stream = fs.createReadStream(path, opts); - req.emit('static', stream); - req.on('close', stream.destroy.bind(stream)); - stream.pipe(res); - - // callback - if (fn) { - function callback(err) { done || fn(err); done = true } - req.on('close', callback); - req.socket.on('error', callback); - stream.on('error', callback); - stream.on('end', callback); - } else { - stream.on('error', function(err){ - if (res.headerSent) { - console.error(err.stack); - req.destroy(); - } else { - next(err); - } - }); - } - }); -}; diff --git a/node_modules/connect/lib/middleware/staticCache.js b/node_modules/connect/lib/middleware/staticCache.js deleted file mode 100644 index 8c3759d..0000000 --- a/node_modules/connect/lib/middleware/staticCache.js +++ /dev/null @@ -1,225 +0,0 @@ - -/*! - * Connect - staticCache - * Copyright(c) 2011 Sencha Inc. - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var http = require('http') - , utils = require('../utils') - , Cache = require('../cache') - , url = require('url') - , fs = require('fs'); - -/** - * Static cache: - * - * Enables a memory cache layer on top of - * the `static()` middleware, serving popular - * static files. - * - * By default a maximum of 128 objects are - * held in cache, with a max of 256k each, - * totalling ~32mb. - * - * A Least-Recently-Used (LRU) cache algo - * is implemented through the `Cache` object, - * simply rotating cache objects as they are - * hit. This means that increasingly popular - * objects maintain their positions while - * others get shoved out of the stack and - * garbage collected. - * - * Benchmarks: - * - * static(): 2700 rps - * node-static: 5300 rps - * static() + staticCache(): 7500 rps - * - * Options: - * - * - `maxObjects` max cache objects [128] - * - `maxLength` max cache object length 256kb - * - * @param {Object} options - * @return {Function} - * @api public - */ - -module.exports = function staticCache(options){ - var options = options || {} - , cache = new Cache(options.maxObjects || 128) - , maxlen = options.maxLength || 1024 * 256; - - return function staticCache(req, res, next){ - var key = cacheKey(req) - , ranges = req.headers.range - , hit = cache.get(key); - - // cache static - // TODO: change from staticCache() -> static() - // and make this work for any request - req.on('static', function(stream){ - var headers = res._headers - , cc = utils.parseCacheControl(headers['cache-control'] || '') - , contentLength = headers['content-length'] - , hit; - - // ignore larger files - if (!contentLength || contentLength > maxlen) return; - - // don't cache partial files - if (headers['content-range']) return; - - // dont cache items we shouldn't be - // TODO: real support for must-revalidate / no-cache - if ( cc['no-cache'] - || cc['no-store'] - || cc['private'] - || cc['must-revalidate']) return; - - // if already in cache then validate - if (hit = cache.get(key)){ - if (headers.etag == hit[0].etag) { - hit[0].date = new Date; - return; - } else { - cache.remove(key); - } - } - - // validation notifiactions don't contain a steam - if (null == stream) return; - - // add the cache object - var arr = []; - - // store the chunks - stream.on('data', function(chunk){ - arr.push(chunk); - }); - - // flag it as complete - stream.on('end', function(){ - var cacheEntry = cache.add(key); - delete headers['x-cache']; // Clean up (TODO: others) - cacheEntry.push(200); - cacheEntry.push(headers); - cacheEntry.push.apply(cacheEntry, arr); - }); - }); - - if (req.method == 'GET' || req.method == 'HEAD') { - if (ranges) { - next(); - } else if (hit && !mustRevalidate(req, hit)) { - res.setHeader('X-Cache', 'HIT'); - respondFromCache(req, res, hit); - } else { - res.setHeader('X-Cache', 'MISS'); - next(); - } - } else { - next(); - } - } -}; - -/** - * Respond with the provided cached value. - * TODO: Assume 200 code, that's iffy. - * - * @param {Object} req - * @param {Object} res - * @param {Object} cacheEntry - * @return {String} - * @api private - */ - -function respondFromCache(req, res, cacheEntry) { - var status = cacheEntry[0] - , headers = utils.merge({}, cacheEntry[1]) - , content = cacheEntry.slice(2); - - headers.age = (new Date - new Date(headers.date)) / 1000 || 0; - - switch (req.method) { - case 'HEAD': - res.writeHead(status, headers); - res.end(); - break; - case 'GET': - // conditional GET support - if (utils.conditionalGET(req) && !utils.modified(req, res, headers)) { - header['content-length'] = 0; - res.writeHead(304, headers); - res.end(); - } else { - res.writeHead(status, headers); - - function write() { - while (content.length) { - if (false === res.write(content.shift())) { - res.once('drain', write); - return; - } - } - res.end(); - } - - write(); - } - break; - default: - // This should never happen. - res.writeHead(500, ''); - res.end(); - } -} - -/** - * Determine whether or not a cached value must be revalidated. - * - * @param {Object} req - * @param {Object} cacheEntry - * @return {String} - * @api private - */ - -function mustRevalidate(req, cacheEntry) { - var reqHeaders = req.headers - , cacheHeaders = cacheEntry[1] - , reqCC = utils.parseCacheControl(reqHeaders['cache-control'] || '') - , cacheCC = utils.parseCacheControl(cacheHeaders['cache-control'] || '') - , cacheAge = (new Date - new Date(cacheHeaders.date)) / 1000 || 0; - - if (cacheCC['no-cache'] - || cacheCC['must-revalidate'] - || cacheCC['proxy-revalidate']) return true; - - if (reqCC['no-cache']) return true - - if (null != reqCC['max-age']) return reqCC['max-age'] < cacheAge; - - if (null != cacheCC['max-age']) return cacheCC['max-age'] < cacheAge; - - return false; -} - -/** - * The key to use in the cache. For now, this is the URL path and query. - * - * 'http://example.com?key=value' -> '/?key=value' - * - * @param {Object} req - * @return {String} - * @api private - */ - -function cacheKey(req) { - return utils.parseUrl(req).path; -} diff --git a/node_modules/connect/lib/middleware/urlencoded.js b/node_modules/connect/lib/middleware/urlencoded.js deleted file mode 100644 index 1d9149c..0000000 --- a/node_modules/connect/lib/middleware/urlencoded.js +++ /dev/null @@ -1,54 +0,0 @@ - -/*! - * Connect - urlencoded - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var utils = require('../utils') - , qs = require('qs'); - -/** - * Urlencoded: - * - * Parse x-ww-form-urlencoded request bodies, - * providing the parsed object as `req.body`. - * - * @param {Object} options - * @return {Function} - * @api public - */ - -exports = module.exports = function(options){ - options = options || {}; - return function urlencoded(req, res, next) { - if (req._body) return next(); - req.body = req.body || {}; - - // check Content-Type - if ('application/x-www-form-urlencoded' != utils.mime(req)) return next(); - - // flag as parsed - req._body = true; - - // parse - var buf = ''; - req.setEncoding('utf8'); - req.on('data', function(chunk){ buf += chunk }); - req.on('end', function(){ - try { - req.body = buf.length - ? qs.parse(buf, options) - : {}; - next(); - } catch (err){ - next(err); - } - }); - } -}; \ No newline at end of file diff --git a/node_modules/connect/lib/middleware/vhost.js b/node_modules/connect/lib/middleware/vhost.js deleted file mode 100644 index 897a9d8..0000000 --- a/node_modules/connect/lib/middleware/vhost.js +++ /dev/null @@ -1,40 +0,0 @@ - -/*! - * Connect - vhost - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Vhost: - * - * Setup vhost for the given `hostname` and `server`. - * - * connect() - * .use(connect.vhost('foo.com', fooApp)) - * .use(connect.vhost('bar.com', barApp)) - * .use(connect.vhost('*.com', mainApp)) - * - * The `server` may be a Connect server or - * a regular Node `http.Server`. - * - * @param {String} hostname - * @param {Server} server - * @return {Function} - * @api public - */ - -module.exports = function vhost(hostname, server){ - if (!hostname) throw new Error('vhost hostname required'); - if (!server) throw new Error('vhost server required'); - var regexp = new RegExp('^' + hostname.replace(/[*]/g, '(.*?)') + '$', 'i'); - if (server.onvhost) server.onvhost(hostname); - return function vhost(req, res, next){ - if (!req.headers.host) return next(); - var host = req.headers.host.split(':')[0]; - if (!regexp.test(host)) return next(); - if ('function' == typeof server) return server(req, res, next); - server.emit('request', req, res); - }; -}; diff --git a/node_modules/connect/lib/patch.js b/node_modules/connect/lib/patch.js deleted file mode 100644 index 7cf0012..0000000 --- a/node_modules/connect/lib/patch.js +++ /dev/null @@ -1,79 +0,0 @@ - -/*! - * Connect - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var http = require('http') - , res = http.ServerResponse.prototype - , setHeader = res.setHeader - , _renderHeaders = res._renderHeaders - , writeHead = res.writeHead; - -// apply only once - -if (!res._hasConnectPatch) { - - /** - * Provide a public "header sent" flag - * until node does. - * - * @return {Boolean} - * @api public - */ - - res.__defineGetter__('headerSent', function(){ - return this._header; - }); - - /** - * Set header `field` to `val`, special-casing - * the `Set-Cookie` field for multiple support. - * - * @param {String} field - * @param {String} val - * @api public - */ - - res.setHeader = function(field, val){ - var key = field.toLowerCase() - , prev; - - // special-case Set-Cookie - if (this._headers && 'set-cookie' == key) { - if (prev = this.getHeader(field)) { - val = Array.isArray(prev) - ? prev.concat(val) - : [prev, val]; - } - // charset - } else if ('content-type' == key && this.charset) { - val += '; charset=' + this.charset; - } - - return setHeader.call(this, field, val); - }; - - /** - * Proxy to emit "header" event. - */ - - res._renderHeaders = function(){ - if (!this._emittedHeader) this.emit('header'); - this._emittedHeader = true; - return _renderHeaders.call(this); - }; - - res.writeHead = function(){ - if (!this._emittedHeader) this.emit('header'); - this._emittedHeader = true; - return writeHead.apply(this, arguments); - }; - - res._hasConnectPatch = true; -} diff --git a/node_modules/connect/lib/proto.js b/node_modules/connect/lib/proto.js deleted file mode 100644 index bca6ec4..0000000 --- a/node_modules/connect/lib/proto.js +++ /dev/null @@ -1,230 +0,0 @@ - -/*! - * Connect - HTTPServer - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var http = require('http') - , utils = require('./utils') - , debug = require('debug')('connect:dispatcher'); - -// prototype - -var app = module.exports = {}; - -// environment - -var env = process.env.NODE_ENV || 'development'; - -/** - * Utilize the given middleware `handle` to the given `route`, - * defaulting to _/_. This "route" is the mount-point for the - * middleware, when given a value other than _/_ the middleware - * is only effective when that segment is present in the request's - * pathname. - * - * For example if we were to mount a function at _/admin_, it would - * be invoked on _/admin_, and _/admin/settings_, however it would - * not be invoked for _/_, or _/posts_. - * - * Examples: - * - * var app = connect(); - * app.use(connect.favicon()); - * app.use(connect.logger()); - * app.use(connect.static(__dirname + '/public')); - * - * If we wanted to prefix static files with _/public_, we could - * "mount" the `static()` middleware: - * - * app.use('/public', connect.static(__dirname + '/public')); - * - * This api is chainable, so the following is valid: - * - * connect - * .use(connect.favicon()) - * .use(connect.logger()) - * .use(connect.static(__dirname + '/public')) - * .listen(3000); - * - * @param {String|Function|Server} route, callback or server - * @param {Function|Server} callback or server - * @return {Server} for chaining - * @api public - */ - -app.use = function(route, fn){ - // default route to '/' - if ('string' != typeof route) { - fn = route; - route = '/'; - } - - // wrap sub-apps - if ('function' == typeof fn.handle) { - var server = fn; - fn.route = route; - fn = function(req, res, next){ - server.handle(req, res, next); - }; - } - - // wrap vanilla http.Servers - if (fn instanceof http.Server) { - fn = fn.listeners('request')[0]; - } - - // strip trailing slash - if ('/' == route[route.length - 1]) { - route = route.slice(0, -1); - } - - // add the middleware - debug('use %s %s', route || '/', fn.name || 'anonymous'); - this.stack.push({ route: route, handle: fn }); - - return this; -}; - -/** - * Handle server requests, punting them down - * the middleware stack. - * - * @api private - */ - -app.handle = function(req, res, out) { - var stack = this.stack - , fqdn = ~req.url.indexOf('://') - , removed = '' - , slashAdded = false - , index = 0; - - function next(err) { - var layer, path, status, c; - - if (slashAdded) { - req.url = req.url.substr(1); - slashAdded = false; - } - - req.url = removed + req.url; - req.originalUrl = req.originalUrl || req.url; - removed = ''; - - // next callback - layer = stack[index++]; - - // all done - if (!layer || res.headerSent) { - // delegate to parent - if (out) return out(err); - - // unhandled error - if (err) { - // default to 500 - if (res.statusCode < 400) res.statusCode = 500; - debug('default %s', res.statusCode); - - // respect err.status - if (err.status) res.statusCode = err.status; - - // production gets a basic error message - var msg = 'production' == env - ? http.STATUS_CODES[res.statusCode] - : err.stack || err.toString(); - - // log to stderr in a non-test env - if ('test' != env) console.error(err.stack || err.toString()); - if (res.headerSent) return req.socket.destroy(); - res.setHeader('Content-Type', 'text/plain'); - res.setHeader('Content-Length', Buffer.byteLength(msg)); - if ('HEAD' == req.method) return res.end(); - res.end(msg); - } else { - debug('default 404'); - res.statusCode = 404; - res.setHeader('Content-Type', 'text/plain'); - if ('HEAD' == req.method) return res.end(); - res.end('Cannot ' + req.method + ' ' + utils.escape(req.originalUrl)); - } - return; - } - - try { - path = utils.parseUrl(req).pathname; - if (undefined == path) path = '/'; - - // skip this layer if the route doesn't match. - if (0 != path.indexOf(layer.route)) return next(err); - - c = path[layer.route.length]; - if (c && '/' != c && '.' != c) return next(err); - - // Call the layer handler - // Trim off the part of the url that matches the route - removed = layer.route; - req.url = req.url.substr(removed.length); - - // Ensure leading slash - if (!fqdn && '/' != req.url[0]) { - req.url = '/' + req.url; - slashAdded = true; - } - - debug('%s', layer.handle.name || 'anonymous'); - var arity = layer.handle.length; - if (err) { - if (arity === 4) { - layer.handle(err, req, res, next); - } else { - next(err); - } - } else if (arity < 4) { - layer.handle(req, res, next); - } else { - next(); - } - } catch (e) { - next(e); - } - } - next(); -}; - -/** - * Listen for connections. - * - * This method takes the same arguments - * as node's `http.Server#listen()`. - * - * HTTP and HTTPS: - * - * If you run your application both as HTTP - * and HTTPS you may wrap them individually, - * since your Connect "server" is really just - * a JavaScript `Function`. - * - * var connect = require('connect') - * , http = require('http') - * , https = require('https'); - * - * var app = connect(); - * - * http.createServer(app).listen(80); - * https.createServer(options, app).listen(443); - * - * @return {http.Server} - * @api public - */ - -app.listen = function(){ - var server = http.createServer(this); - return server.listen.apply(server, arguments); -}; diff --git a/node_modules/connect/lib/public/directory.html b/node_modules/connect/lib/public/directory.html deleted file mode 100644 index 15164bb..0000000 --- a/node_modules/connect/lib/public/directory.html +++ /dev/null @@ -1,75 +0,0 @@ - - - listing directory {directory} - - - - - -
    -

    {linked-path}

    - {files} -
    - - \ No newline at end of file diff --git a/node_modules/connect/lib/public/error.html b/node_modules/connect/lib/public/error.html deleted file mode 100644 index c5ae73a..0000000 --- a/node_modules/connect/lib/public/error.html +++ /dev/null @@ -1,13 +0,0 @@ - - - {error} - - - -
    -

    {title}

    -

    {statusCode} {error}

    - -
    - - diff --git a/node_modules/connect/lib/public/favicon.ico b/node_modules/connect/lib/public/favicon.ico deleted file mode 100644 index 895fc96..0000000 Binary files a/node_modules/connect/lib/public/favicon.ico and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page.png b/node_modules/connect/lib/public/icons/page.png deleted file mode 100644 index 03ddd79..0000000 Binary files a/node_modules/connect/lib/public/icons/page.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_add.png b/node_modules/connect/lib/public/icons/page_add.png deleted file mode 100644 index d5bfa07..0000000 Binary files a/node_modules/connect/lib/public/icons/page_add.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_attach.png b/node_modules/connect/lib/public/icons/page_attach.png deleted file mode 100644 index 89ee2da..0000000 Binary files a/node_modules/connect/lib/public/icons/page_attach.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_code.png b/node_modules/connect/lib/public/icons/page_code.png deleted file mode 100644 index f7ea904..0000000 Binary files a/node_modules/connect/lib/public/icons/page_code.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_copy.png b/node_modules/connect/lib/public/icons/page_copy.png deleted file mode 100644 index 195dc6d..0000000 Binary files a/node_modules/connect/lib/public/icons/page_copy.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_delete.png b/node_modules/connect/lib/public/icons/page_delete.png deleted file mode 100644 index 3141467..0000000 Binary files a/node_modules/connect/lib/public/icons/page_delete.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_edit.png b/node_modules/connect/lib/public/icons/page_edit.png deleted file mode 100644 index 046811e..0000000 Binary files a/node_modules/connect/lib/public/icons/page_edit.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_error.png b/node_modules/connect/lib/public/icons/page_error.png deleted file mode 100644 index f07f449..0000000 Binary files a/node_modules/connect/lib/public/icons/page_error.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_excel.png b/node_modules/connect/lib/public/icons/page_excel.png deleted file mode 100644 index eb6158e..0000000 Binary files a/node_modules/connect/lib/public/icons/page_excel.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_find.png b/node_modules/connect/lib/public/icons/page_find.png deleted file mode 100644 index 2f19388..0000000 Binary files a/node_modules/connect/lib/public/icons/page_find.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_gear.png b/node_modules/connect/lib/public/icons/page_gear.png deleted file mode 100644 index 8e83281..0000000 Binary files a/node_modules/connect/lib/public/icons/page_gear.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_go.png b/node_modules/connect/lib/public/icons/page_go.png deleted file mode 100644 index 80fe1ed..0000000 Binary files a/node_modules/connect/lib/public/icons/page_go.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_green.png b/node_modules/connect/lib/public/icons/page_green.png deleted file mode 100644 index de8e003..0000000 Binary files a/node_modules/connect/lib/public/icons/page_green.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_key.png b/node_modules/connect/lib/public/icons/page_key.png deleted file mode 100644 index d6626cb..0000000 Binary files a/node_modules/connect/lib/public/icons/page_key.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_lightning.png b/node_modules/connect/lib/public/icons/page_lightning.png deleted file mode 100644 index 7e56870..0000000 Binary files a/node_modules/connect/lib/public/icons/page_lightning.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_link.png b/node_modules/connect/lib/public/icons/page_link.png deleted file mode 100644 index 312eab0..0000000 Binary files a/node_modules/connect/lib/public/icons/page_link.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_paintbrush.png b/node_modules/connect/lib/public/icons/page_paintbrush.png deleted file mode 100644 index 246a2f0..0000000 Binary files a/node_modules/connect/lib/public/icons/page_paintbrush.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_paste.png b/node_modules/connect/lib/public/icons/page_paste.png deleted file mode 100644 index 968f073..0000000 Binary files a/node_modules/connect/lib/public/icons/page_paste.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_red.png b/node_modules/connect/lib/public/icons/page_red.png deleted file mode 100644 index 0b18247..0000000 Binary files a/node_modules/connect/lib/public/icons/page_red.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_refresh.png b/node_modules/connect/lib/public/icons/page_refresh.png deleted file mode 100644 index cf347c7..0000000 Binary files a/node_modules/connect/lib/public/icons/page_refresh.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_save.png b/node_modules/connect/lib/public/icons/page_save.png deleted file mode 100644 index caea546..0000000 Binary files a/node_modules/connect/lib/public/icons/page_save.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white.png b/node_modules/connect/lib/public/icons/page_white.png deleted file mode 100644 index 8b8b1ca..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_acrobat.png b/node_modules/connect/lib/public/icons/page_white_acrobat.png deleted file mode 100644 index 8f8095e..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_acrobat.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_actionscript.png b/node_modules/connect/lib/public/icons/page_white_actionscript.png deleted file mode 100644 index 159b240..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_actionscript.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_add.png b/node_modules/connect/lib/public/icons/page_white_add.png deleted file mode 100644 index aa23dde..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_add.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_c.png b/node_modules/connect/lib/public/icons/page_white_c.png deleted file mode 100644 index 34a05cc..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_c.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_camera.png b/node_modules/connect/lib/public/icons/page_white_camera.png deleted file mode 100644 index f501a59..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_camera.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_cd.png b/node_modules/connect/lib/public/icons/page_white_cd.png deleted file mode 100644 index 848bdaf..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_cd.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_code.png b/node_modules/connect/lib/public/icons/page_white_code.png deleted file mode 100644 index 0c76bd1..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_code.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_code_red.png b/node_modules/connect/lib/public/icons/page_white_code_red.png deleted file mode 100644 index 87a6914..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_code_red.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_coldfusion.png b/node_modules/connect/lib/public/icons/page_white_coldfusion.png deleted file mode 100644 index c66011f..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_coldfusion.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_compressed.png b/node_modules/connect/lib/public/icons/page_white_compressed.png deleted file mode 100644 index 2b6b100..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_compressed.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_copy.png b/node_modules/connect/lib/public/icons/page_white_copy.png deleted file mode 100644 index a9f31a2..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_copy.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_cplusplus.png b/node_modules/connect/lib/public/icons/page_white_cplusplus.png deleted file mode 100644 index a87cf84..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_cplusplus.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_csharp.png b/node_modules/connect/lib/public/icons/page_white_csharp.png deleted file mode 100644 index ffb8fc9..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_csharp.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_cup.png b/node_modules/connect/lib/public/icons/page_white_cup.png deleted file mode 100644 index 0a7d6f4..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_cup.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_database.png b/node_modules/connect/lib/public/icons/page_white_database.png deleted file mode 100644 index bddba1f..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_database.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_delete.png b/node_modules/connect/lib/public/icons/page_white_delete.png deleted file mode 100644 index af1ecaf..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_delete.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_dvd.png b/node_modules/connect/lib/public/icons/page_white_dvd.png deleted file mode 100644 index 4cc537a..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_dvd.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_edit.png b/node_modules/connect/lib/public/icons/page_white_edit.png deleted file mode 100644 index b93e776..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_edit.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_error.png b/node_modules/connect/lib/public/icons/page_white_error.png deleted file mode 100644 index 9fc5a0a..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_error.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_excel.png b/node_modules/connect/lib/public/icons/page_white_excel.png deleted file mode 100644 index b977d7e..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_excel.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_find.png b/node_modules/connect/lib/public/icons/page_white_find.png deleted file mode 100644 index 5818436..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_find.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_flash.png b/node_modules/connect/lib/public/icons/page_white_flash.png deleted file mode 100644 index 5769120..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_flash.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_freehand.png b/node_modules/connect/lib/public/icons/page_white_freehand.png deleted file mode 100644 index 8d719df..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_freehand.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_gear.png b/node_modules/connect/lib/public/icons/page_white_gear.png deleted file mode 100644 index 106f5aa..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_gear.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_get.png b/node_modules/connect/lib/public/icons/page_white_get.png deleted file mode 100644 index e4a1ecb..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_get.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_go.png b/node_modules/connect/lib/public/icons/page_white_go.png deleted file mode 100644 index 7e62a92..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_go.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_h.png b/node_modules/connect/lib/public/icons/page_white_h.png deleted file mode 100644 index e902abb..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_h.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_horizontal.png b/node_modules/connect/lib/public/icons/page_white_horizontal.png deleted file mode 100644 index 1d2d0a4..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_horizontal.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_key.png b/node_modules/connect/lib/public/icons/page_white_key.png deleted file mode 100644 index d616484..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_key.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_lightning.png b/node_modules/connect/lib/public/icons/page_white_lightning.png deleted file mode 100644 index 7215d1e..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_lightning.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_link.png b/node_modules/connect/lib/public/icons/page_white_link.png deleted file mode 100644 index bf7bd1c..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_link.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_magnify.png b/node_modules/connect/lib/public/icons/page_white_magnify.png deleted file mode 100644 index f6b74cc..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_magnify.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_medal.png b/node_modules/connect/lib/public/icons/page_white_medal.png deleted file mode 100644 index d3fffb6..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_medal.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_office.png b/node_modules/connect/lib/public/icons/page_white_office.png deleted file mode 100644 index a65bcb3..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_office.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_paint.png b/node_modules/connect/lib/public/icons/page_white_paint.png deleted file mode 100644 index 23a37b8..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_paint.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_paintbrush.png b/node_modules/connect/lib/public/icons/page_white_paintbrush.png deleted file mode 100644 index f907e44..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_paintbrush.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_paste.png b/node_modules/connect/lib/public/icons/page_white_paste.png deleted file mode 100644 index 5b2cbb3..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_paste.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_php.png b/node_modules/connect/lib/public/icons/page_white_php.png deleted file mode 100644 index 7868a25..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_php.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_picture.png b/node_modules/connect/lib/public/icons/page_white_picture.png deleted file mode 100644 index 134b669..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_picture.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_powerpoint.png b/node_modules/connect/lib/public/icons/page_white_powerpoint.png deleted file mode 100644 index c4eff03..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_powerpoint.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_put.png b/node_modules/connect/lib/public/icons/page_white_put.png deleted file mode 100644 index 884ffd6..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_put.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_ruby.png b/node_modules/connect/lib/public/icons/page_white_ruby.png deleted file mode 100644 index f59b7c4..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_ruby.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_stack.png b/node_modules/connect/lib/public/icons/page_white_stack.png deleted file mode 100644 index 44084ad..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_stack.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_star.png b/node_modules/connect/lib/public/icons/page_white_star.png deleted file mode 100644 index 3a1441c..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_star.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_swoosh.png b/node_modules/connect/lib/public/icons/page_white_swoosh.png deleted file mode 100644 index e770829..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_swoosh.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_text.png b/node_modules/connect/lib/public/icons/page_white_text.png deleted file mode 100644 index 813f712..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_text.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_text_width.png b/node_modules/connect/lib/public/icons/page_white_text_width.png deleted file mode 100644 index d9cf132..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_text_width.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_tux.png b/node_modules/connect/lib/public/icons/page_white_tux.png deleted file mode 100644 index 52699bf..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_tux.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_vector.png b/node_modules/connect/lib/public/icons/page_white_vector.png deleted file mode 100644 index 4a05955..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_vector.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_visualstudio.png b/node_modules/connect/lib/public/icons/page_white_visualstudio.png deleted file mode 100644 index a0a433d..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_visualstudio.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_width.png b/node_modules/connect/lib/public/icons/page_white_width.png deleted file mode 100644 index 1eb8809..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_width.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_word.png b/node_modules/connect/lib/public/icons/page_white_word.png deleted file mode 100644 index ae8ecbf..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_word.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_world.png b/node_modules/connect/lib/public/icons/page_white_world.png deleted file mode 100644 index 6ed2490..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_world.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_wrench.png b/node_modules/connect/lib/public/icons/page_white_wrench.png deleted file mode 100644 index fecadd0..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_wrench.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_white_zip.png b/node_modules/connect/lib/public/icons/page_white_zip.png deleted file mode 100644 index fd4bbcc..0000000 Binary files a/node_modules/connect/lib/public/icons/page_white_zip.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_word.png b/node_modules/connect/lib/public/icons/page_word.png deleted file mode 100644 index 834cdfa..0000000 Binary files a/node_modules/connect/lib/public/icons/page_word.png and /dev/null differ diff --git a/node_modules/connect/lib/public/icons/page_world.png b/node_modules/connect/lib/public/icons/page_world.png deleted file mode 100644 index b8895dd..0000000 Binary files a/node_modules/connect/lib/public/icons/page_world.png and /dev/null differ diff --git a/node_modules/connect/lib/public/style.css b/node_modules/connect/lib/public/style.css deleted file mode 100644 index 32b6507..0000000 --- a/node_modules/connect/lib/public/style.css +++ /dev/null @@ -1,141 +0,0 @@ -body { - margin: 0; - padding: 80px 100px; - font: 13px "Helvetica Neue", "Lucida Grande", "Arial"; - background: #ECE9E9 -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ECE9E9)); - background: #ECE9E9 -moz-linear-gradient(top, #fff, #ECE9E9); - background-repeat: no-repeat; - color: #555; - -webkit-font-smoothing: antialiased; -} -h1, h2, h3 { - margin: 0; - font-size: 22px; - color: #343434; -} -h1 em, h2 em { - padding: 0 5px; - font-weight: normal; -} -h1 { - font-size: 60px; -} -h2 { - margin-top: 10px; -} -h3 { - margin: 5px 0 10px 0; - padding-bottom: 5px; - border-bottom: 1px solid #eee; - font-size: 18px; -} -ul { - margin: 0; - padding: 0; -} -ul li { - margin: 5px 0; - padding: 3px 8px; - list-style: none; -} -ul li:hover { - cursor: pointer; - color: #2e2e2e; -} -ul li .path { - padding-left: 5px; - font-weight: bold; -} -ul li .line { - padding-right: 5px; - font-style: italic; -} -ul li:first-child .path { - padding-left: 0; -} -p { - line-height: 1.5; -} -a { - color: #555; - text-decoration: none; -} -a:hover { - color: #303030; -} -#stacktrace { - margin-top: 15px; -} -.directory h1 { - margin-bottom: 15px; - font-size: 18px; -} -ul#files { - width: 100%; - height: 500px; -} -ul#files li { - padding: 0; -} -ul#files li img { - position: absolute; - top: 5px; - left: 5px; -} -ul#files li a { - position: relative; - display: block; - margin: 1px; - width: 30%; - height: 25px; - line-height: 25px; - text-indent: 8px; - float: left; - border: 1px solid transparent; - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - border-radius: 5px; - overflow: hidden; - text-overflow: ellipsis; -} -ul#files li a.icon { - text-indent: 25px; -} -ul#files li a:focus, -ul#files li a:hover { - outline: none; - background: rgba(255,255,255,0.65); - border: 1px solid #ececec; -} -ul#files li a.highlight { - -webkit-transition: background .4s ease-in-out; - background: #ffff4f; - border-color: #E9DC51; -} -#search { - display: block; - position: fixed; - top: 20px; - right: 20px; - width: 90px; - -webkit-transition: width ease 0.2s, opacity ease 0.4s; - -moz-transition: width ease 0.2s, opacity ease 0.4s; - -webkit-border-radius: 32px; - -moz-border-radius: 32px; - -webkit-box-shadow: inset 0px 0px 3px rgba(0, 0, 0, 0.25), inset 0px 1px 3px rgba(0, 0, 0, 0.7), 0px 1px 0px rgba(255, 255, 255, 0.03); - -moz-box-shadow: inset 0px 0px 3px rgba(0, 0, 0, 0.25), inset 0px 1px 3px rgba(0, 0, 0, 0.7), 0px 1px 0px rgba(255, 255, 255, 0.03); - -webkit-font-smoothing: antialiased; - text-align: left; - font: 13px "Helvetica Neue", Arial, sans-serif; - padding: 4px 10px; - border: none; - background: transparent; - margin-bottom: 0; - outline: none; - opacity: 0.7; - color: #888; -} -#search:focus { - width: 120px; - opacity: 1.0; -} diff --git a/node_modules/connect/lib/utils.js b/node_modules/connect/lib/utils.js deleted file mode 100644 index bf0731e..0000000 --- a/node_modules/connect/lib/utils.js +++ /dev/null @@ -1,508 +0,0 @@ - -/*! - * Connect - utils - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var http = require('http') - , crypto = require('crypto') - , crc16 = require('crc').crc16 - , parse = require('url').parse - , Path = require('path') - , fs = require('fs'); - -/** - * Extract the mime type from the given request's - * _Content-Type_ header. - * - * @param {IncomingMessage} req - * @return {String} - * @api private - */ - -exports.mime = function(req) { - var str = req.headers['content-type'] || ''; - return str.split(';')[0]; -}; - -/** - * Generate an `Error` from the given status `code`. - * - * @param {Number} code - * @return {Error} - * @api private - */ - -exports.error = function(code){ - var err = new Error(http.STATUS_CODES[code]); - err.status = code; - return err; -}; - -/** - * Return md5 hash of the given string and optional encoding, - * defaulting to hex. - * - * utils.md5('wahoo'); - * // => "e493298061761236c96b02ea6aa8a2ad" - * - * @param {String} str - * @param {String} encoding - * @return {String} - * @api public - */ - -exports.md5 = function(str, encoding){ - return crypto - .createHash('md5') - .update(str) - .digest(encoding || 'hex'); -}; - -/** - * Merge object b with object a. - * - * var a = { foo: 'bar' } - * , b = { bar: 'baz' }; - * - * utils.merge(a, b); - * // => { foo: 'bar', bar: 'baz' } - * - * @param {Object} a - * @param {Object} b - * @return {Object} - * @api private - */ - -exports.merge = function(a, b){ - if (a && b) { - for (var key in b) { - a[key] = b[key]; - } - } - return a; -}; - -/** - * Escape the given string of `html`. - * - * @param {String} html - * @return {String} - * @api private - */ - -exports.escape = function(html){ - return String(html) - .replace(/&(?!\w+;)/g, '&') - .replace(//g, '>') - .replace(/"/g, '"'); -}; - - -/** - * Return a unique identifier with the given `len`. - * - * utils.uid(10); - * // => "FDaS435D2z" - * - * @param {Number} len - * @return {String} - * @api private - */ - -exports.uid = function(len) { - return crypto.randomBytes(Math.ceil(len * 3 / 4)) - .toString('base64') - .slice(0, len); -}; - -/** - * Sign the given `val` with `secret`. - * - * @param {String} val - * @param {String} secret - * @return {String} - * @api private - */ - -exports.sign = function(val, secret){ - return val + '.' + crypto - .createHmac('sha256', secret) - .update(val) - .digest('base64') - .replace(/=+$/, ''); -}; - -/** - * Unsign and decode the given `val` with `secret`, - * returning `false` if the signature is invalid. - * - * @param {String} val - * @param {String} secret - * @return {String|Boolean} - * @api private - */ - -exports.unsign = function(val, secret){ - var str = val.slice(0,val.lastIndexOf('.')); - return exports.sign(str, secret) == val - ? str - : false; -}; - -/** - * Parse signed cookies, returning an object - * containing the decoded key/value pairs, - * while removing the signed key from `obj`. - * - * TODO: tag signed cookies with "s:" - * - * @param {Object} obj - * @return {Object} - * @api private - */ - -exports.parseSignedCookies = function(obj, secret){ - var ret = {}; - Object.keys(obj).forEach(function(key){ - var val = obj[key] - , signed = exports.unsign(val, secret); - - if (signed) { - ret[key] = signed; - delete obj[key]; - } - }); - return ret; -}; - -/** - * Parse JSON cookies. - * - * @param {Object} obj - * @return {Object} - * @api private - */ - -exports.parseJSONCookies = function(obj){ - var hashes = {}; - - Object.keys(obj).forEach(function(key){ - var val = obj[key]; - if (0 == val.indexOf('j:')) { - try { - hashes[key] = crc16(val); // only crc json cookies for now - obj[key] = JSON.parse(val.slice(2)); - } catch (err) { - // nothing - } - } - }); - - return { - cookies: obj, - hashes: hashes - }; -}; - -/** - * Parse the given cookie string into an object. - * - * @param {String} str - * @return {Object} - * @api private - */ - -exports.parseCookie = function(str){ - var obj = {} - , pairs = str.split(/[;,] */); - for (var i = 0, len = pairs.length; i < len; ++i) { - var pair = pairs[i] - , eqlIndex = pair.indexOf('=') - , key = pair.substr(0, eqlIndex).trim() - , val = pair.substr(++eqlIndex, pair.length).trim(); - - // quoted values - if ('"' == val[0]) val = val.slice(1, -1); - - // only assign once - if (undefined == obj[key]) { - val = val.replace(/\+/g, ' '); - try { - obj[key] = decodeURIComponent(val); - } catch (err) { - if (err instanceof URIError) { - obj[key] = val; - } else { - throw err; - } - } - } - } - return obj; -}; - -/** - * Serialize the given object into a cookie string. - * - * utils.serializeCookie('name', 'tj', { httpOnly: true }) - * // => "name=tj; httpOnly" - * - * @param {String} name - * @param {String} val - * @param {Object} obj - * @return {String} - * @api private - */ - -exports.serializeCookie = function(name, val, obj){ - var pairs = [name + '=' + encodeURIComponent(val)] - , obj = obj || {}; - - if (obj.domain) pairs.push('domain=' + obj.domain); - if (obj.path) pairs.push('path=' + obj.path); - if (obj.expires) pairs.push('expires=' + obj.expires.toUTCString()); - if (obj.httpOnly) pairs.push('httpOnly'); - if (obj.secure) pairs.push('secure'); - - return pairs.join('; '); -}; - -/** - * Pause `data` and `end` events on the given `obj`. - * Middleware performing async tasks _should_ utilize - * this utility (or similar), to re-emit data once - * the async operation has completed, otherwise these - * events may be lost. - * - * var pause = utils.pause(req); - * fs.readFile(path, function(){ - * next(); - * pause.resume(); - * }); - * - * @param {Object} obj - * @return {Object} - * @api private - */ - -exports.pause = function(obj){ - var onData - , onEnd - , events = []; - - // buffer data - obj.on('data', onData = function(data, encoding){ - events.push(['data', data, encoding]); - }); - - // buffer end - obj.on('end', onEnd = function(data, encoding){ - events.push(['end', data, encoding]); - }); - - return { - end: function(){ - obj.removeListener('data', onData); - obj.removeListener('end', onEnd); - }, - resume: function(){ - this.end(); - for (var i = 0, len = events.length; i < len; ++i) { - obj.emit.apply(obj, events[i]); - } - } - }; -}; - -/** - * Check `req` and `res` to see if it has been modified. - * - * @param {IncomingMessage} req - * @param {ServerResponse} res - * @return {Boolean} - * @api private - */ - -exports.modified = function(req, res, headers) { - var headers = headers || res._headers || {} - , modifiedSince = req.headers['if-modified-since'] - , lastModified = headers['last-modified'] - , noneMatch = req.headers['if-none-match'] - , etag = headers['etag']; - - if (noneMatch) noneMatch = noneMatch.split(/ *, */); - - // check If-None-Match - if (noneMatch && etag && ~noneMatch.indexOf(etag)) { - return false; - } - - // check If-Modified-Since - if (modifiedSince && lastModified) { - modifiedSince = new Date(modifiedSince); - lastModified = new Date(lastModified); - // Ignore invalid dates - if (!isNaN(modifiedSince.getTime())) { - if (lastModified <= modifiedSince) return false; - } - } - - return true; -}; - -/** - * Strip `Content-*` headers from `res`. - * - * @param {ServerResponse} res - * @api private - */ - -exports.removeContentHeaders = function(res){ - Object.keys(res._headers).forEach(function(field){ - if (0 == field.indexOf('content')) { - res.removeHeader(field); - } - }); -}; - -/** - * Check if `req` is a conditional GET request. - * - * @param {IncomingMessage} req - * @return {Boolean} - * @api private - */ - -exports.conditionalGET = function(req) { - return req.headers['if-modified-since'] - || req.headers['if-none-match']; -}; - -/** - * Respond with 401 "Unauthorized". - * - * @param {ServerResponse} res - * @param {String} realm - * @api private - */ - -exports.unauthorized = function(res, realm) { - res.statusCode = 401; - res.setHeader('WWW-Authenticate', 'Basic realm="' + realm + '"'); - res.end('Unauthorized'); -}; - -/** - * Respond with 304 "Not Modified". - * - * @param {ServerResponse} res - * @param {Object} headers - * @api private - */ - -exports.notModified = function(res) { - exports.removeContentHeaders(res); - res.statusCode = 304; - res.end(); -}; - -/** - * Return an ETag in the form of `"-"` - * from the given `stat`. - * - * @param {Object} stat - * @return {String} - * @api private - */ - -exports.etag = function(stat) { - return '"' + stat.size + '-' + Number(stat.mtime) + '"'; -}; - -/** - * Parse "Range" header `str` relative to the given file `size`. - * - * @param {Number} size - * @param {String} str - * @return {Array} - * @api private - */ - -exports.parseRange = function(size, str){ - var valid = true; - var arr = str.substr(6).split(',').map(function(range){ - var range = range.split('-') - , start = parseInt(range[0], 10) - , end = parseInt(range[1], 10); - - // -500 - if (isNaN(start)) { - start = size - end; - end = size - 1; - // 500- - } else if (isNaN(end)) { - end = size - 1; - } - - // Invalid - if (isNaN(start) - || isNaN(end) - || start > end - || start < 0) valid = false; - - return { - start: start, - end: end - }; - }); - - return valid ? arr : null; -}; - -/** - * Parse the given Cache-Control `str`. - * - * @param {String} str - * @return {Object} - * @api private - */ - -exports.parseCacheControl = function(str){ - var directives = str.split(',') - , obj = {}; - - for(var i = 0, len = directives.length; i < len; i++) { - var parts = directives[i].split('=') - , key = parts.shift().trim() - , val = parseInt(parts.shift(), 10); - - obj[key] = isNaN(val) ? true : val; - } - - return obj; -}; - -/** - * Parse the `req` url with memoization. - * - * @param {ServerRequest} req - * @return {Object} - * @api public - */ - -exports.parseUrl = function(req){ - var parsed = req._parsedUrl; - if (parsed && parsed.href == req.url) { - return parsed; - } else { - return req._parsedUrl = parse(req.url); - } -}; diff --git a/node_modules/connect/node_modules/crc/.gitmodules b/node_modules/connect/node_modules/crc/.gitmodules deleted file mode 100644 index 2319e18..0000000 --- a/node_modules/connect/node_modules/crc/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "tests/nodeunit"] - path = tests/nodeunit - url = git://github.com/caolan/nodeunit.git diff --git a/node_modules/connect/node_modules/crc/README.md b/node_modules/connect/node_modules/crc/README.md deleted file mode 100644 index 01482b3..0000000 --- a/node_modules/connect/node_modules/crc/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# JavaScript CRC 8, 16 and 32. - -This is a basic port/copy of the JavaScript CRC implementation. The module works with any CommonJS system supporting `module.exports` notation as well as in the browser. When loaded in the browser, all functions end up under the `window.crc` "namespace". - -Original code is taken from http://www.digsys.se/JavaScript/CRC.aspx - -## Functions - -The following functions are implemented: - - crc8(String) #=> Number - crcArc(String) #=> Number - crc16(String) #=> Number - fcs16(String) #=> Number - crc32(String) #=> Number - hex8(Number) #=> String - hex16(Number) #=> String - hex32(Number) #=> String - -## Installation - - git clone git://github.com/alexgorbatchev/node-crc.git - -or - - npm install crc - diff --git a/node_modules/connect/node_modules/crc/lib/crc.js b/node_modules/connect/node_modules/crc/lib/crc.js deleted file mode 100644 index 9eb9f0a..0000000 --- a/node_modules/connect/node_modules/crc/lib/crc.js +++ /dev/null @@ -1,362 +0,0 @@ -(function() -{ - // CRC-8 in table form - // - // Copyright (c) 1989 AnDan Software. You may use this program, or - // code or tables extracted from it, as long as this notice is not - // removed or changed. - var CRC8_TAB = new Array( - // C/C++ language: - // - // unsigned char CRC8_TAB[] = {...}; - 0x00,0x1B,0x36,0x2D,0x6C,0x77,0x5A,0x41,0xD8,0xC3,0xEE,0xF5,0xB4,0xAF,0x82,0x99,0xD3,0xC8,0xE5, - 0xFE,0xBF,0xA4,0x89,0x92,0x0B,0x10,0x3D,0x26,0x67,0x7C,0x51,0x4A,0xC5,0xDE,0xF3,0xE8,0xA9,0xB2, - 0x9F,0x84,0x1D,0x06,0x2B,0x30,0x71,0x6A,0x47,0x5C,0x16,0x0D,0x20,0x3B,0x7A,0x61,0x4C,0x57,0xCE, - 0xD5,0xF8,0xE3,0xA2,0xB9,0x94,0x8F,0xE9,0xF2,0xDF,0xC4,0x85,0x9E,0xB3,0xA8,0x31,0x2A,0x07,0x1C, - 0x5D,0x46,0x6B,0x70,0x3A,0x21,0x0C,0x17,0x56,0x4D,0x60,0x7B,0xE2,0xF9,0xD4,0xCF,0x8E,0x95,0xB8, - 0xA3,0x2C,0x37,0x1A,0x01,0x40,0x5B,0x76,0x6D,0xF4,0xEF,0xC2,0xD9,0x98,0x83,0xAE,0xB5,0xFF,0xE4, - 0xC9,0xD2,0x93,0x88,0xA5,0xBE,0x27,0x3C,0x11,0x0A,0x4B,0x50,0x7D,0x66,0xB1,0xAA,0x87,0x9C,0xDD, - 0xC6,0xEB,0xF0,0x69,0x72,0x5F,0x44,0x05,0x1E,0x33,0x28,0x62,0x79,0x54,0x4F,0x0E,0x15,0x38,0x23, - 0xBA,0xA1,0x8C,0x97,0xD6,0xCD,0xE0,0xFB,0x74,0x6F,0x42,0x59,0x18,0x03,0x2E,0x35,0xAC,0xB7,0x9A, - 0x81,0xC0,0xDB,0xF6,0xED,0xA7,0xBC,0x91,0x8A,0xCB,0xD0,0xFD,0xE6,0x7F,0x64,0x49,0x52,0x13,0x08, - 0x25,0x3E,0x58,0x43,0x6E,0x75,0x34,0x2F,0x02,0x19,0x80,0x9B,0xB6,0xAD,0xEC,0xF7,0xDA,0xC1,0x8B, - 0x90,0xBD,0xA6,0xE7,0xFC,0xD1,0xCA,0x53,0x48,0x65,0x7E,0x3F,0x24,0x09,0x12,0x9D,0x86,0xAB,0xB0, - 0xF1,0xEA,0xC7,0xDC,0x45,0x5E,0x73,0x68,0x29,0x32,0x1F,0x04,0x4E,0x55,0x78,0x63,0x22,0x39,0x14, - 0x0F,0x96,0x8D,0xA0,0xBB,0xFA,0xE1,0xCC,0xD7 - ); - - function crc8Add(crc,c) - // 'crc' should be initialized to 0x00. - { - return CRC8_TAB[(crc^c)&0xFF]; - }; - // C/C++ language: - // - // inline unsigned char crc8Add(unsigned char crc, unsigned char c) - // { - // return CRC8_TAB[crc^c]; - // } - - // CRC-16 (as it is in SEA's ARC) in table form - // - // The logic for this method of calculating the CRC 16 bit polynomial - // is taken from an article by David Schwaderer in the April 1985 - // issue of PC Tech Journal. - var CRC_ARC_TAB = new Array( - // C/C++ language: - // - // unsigned short CRC_ARC_TAB[] = {...}; - 0x0000,0xC0C1,0xC181,0x0140,0xC301,0x03C0,0x0280,0xC241,0xC601,0x06C0,0x0780,0xC741,0x0500, - 0xC5C1,0xC481,0x0440,0xCC01,0x0CC0,0x0D80,0xCD41,0x0F00,0xCFC1,0xCE81,0x0E40,0x0A00,0xCAC1, - 0xCB81,0x0B40,0xC901,0x09C0,0x0880,0xC841,0xD801,0x18C0,0x1980,0xD941,0x1B00,0xDBC1,0xDA81, - 0x1A40,0x1E00,0xDEC1,0xDF81,0x1F40,0xDD01,0x1DC0,0x1C80,0xDC41,0x1400,0xD4C1,0xD581,0x1540, - 0xD701,0x17C0,0x1680,0xD641,0xD201,0x12C0,0x1380,0xD341,0x1100,0xD1C1,0xD081,0x1040,0xF001, - 0x30C0,0x3180,0xF141,0x3300,0xF3C1,0xF281,0x3240,0x3600,0xF6C1,0xF781,0x3740,0xF501,0x35C0, - 0x3480,0xF441,0x3C00,0xFCC1,0xFD81,0x3D40,0xFF01,0x3FC0,0x3E80,0xFE41,0xFA01,0x3AC0,0x3B80, - 0xFB41,0x3900,0xF9C1,0xF881,0x3840,0x2800,0xE8C1,0xE981,0x2940,0xEB01,0x2BC0,0x2A80,0xEA41, - 0xEE01,0x2EC0,0x2F80,0xEF41,0x2D00,0xEDC1,0xEC81,0x2C40,0xE401,0x24C0,0x2580,0xE541,0x2700, - 0xE7C1,0xE681,0x2640,0x2200,0xE2C1,0xE381,0x2340,0xE101,0x21C0,0x2080,0xE041,0xA001,0x60C0, - 0x6180,0xA141,0x6300,0xA3C1,0xA281,0x6240,0x6600,0xA6C1,0xA781,0x6740,0xA501,0x65C0,0x6480, - 0xA441,0x6C00,0xACC1,0xAD81,0x6D40,0xAF01,0x6FC0,0x6E80,0xAE41,0xAA01,0x6AC0,0x6B80,0xAB41, - 0x6900,0xA9C1,0xA881,0x6840,0x7800,0xB8C1,0xB981,0x7940,0xBB01,0x7BC0,0x7A80,0xBA41,0xBE01, - 0x7EC0,0x7F80,0xBF41,0x7D00,0xBDC1,0xBC81,0x7C40,0xB401,0x74C0,0x7580,0xB541,0x7700,0xB7C1, - 0xB681,0x7640,0x7200,0xB2C1,0xB381,0x7340,0xB101,0x71C0,0x7080,0xB041,0x5000,0x90C1,0x9181, - 0x5140,0x9301,0x53C0,0x5280,0x9241,0x9601,0x56C0,0x5780,0x9741,0x5500,0x95C1,0x9481,0x5440, - 0x9C01,0x5CC0,0x5D80,0x9D41,0x5F00,0x9FC1,0x9E81,0x5E40,0x5A00,0x9AC1,0x9B81,0x5B40,0x9901, - 0x59C0,0x5880,0x9841,0x8801,0x48C0,0x4980,0x8941,0x4B00,0x8BC1,0x8A81,0x4A40,0x4E00,0x8EC1, - 0x8F81,0x4F40,0x8D01,0x4DC0,0x4C80,0x8C41,0x4400,0x84C1,0x8581,0x4540,0x8701,0x47C0,0x4680, - 0x8641,0x8201,0x42C0,0x4380,0x8341,0x4100,0x81C1,0x8081,0x4040 - ); - - function crcArcAdd(crc,c) - // 'crc' should be initialized to 0x0000. - { - return CRC_ARC_TAB[(crc^c)&0xFF]^((crc>>8)&0xFF); - }; - // C/C++ language: - // - // inline unsigned short crcArcAdd(unsigned short crc, unsigned char c) - // { - // return CRC_ARC_TAB[(unsigned char)crc^c]^(unsigned short)(crc>>8); - // } - - // CRC-16 (as it is in ZMODEM) in table form - // - // Copyright (c) 1989 AnDan Software. You may use this program, or - // code or tables extracted from it, as long as this notice is not - // removed or changed. - var CRC16_TAB = new Array( - // C/C++ language: - // - // unsigned short CRC16_TAB[] = {...}; - 0x0000,0x1021,0x2042,0x3063,0x4084,0x50A5,0x60C6,0x70E7,0x8108,0x9129,0xA14A,0xB16B,0xC18C, - 0xD1AD,0xE1CE,0xF1EF,0x1231,0x0210,0x3273,0x2252,0x52B5,0x4294,0x72F7,0x62D6,0x9339,0x8318, - 0xB37B,0xA35A,0xD3BD,0xC39C,0xF3FF,0xE3DE,0x2462,0x3443,0x0420,0x1401,0x64E6,0x74C7,0x44A4, - 0x5485,0xA56A,0xB54B,0x8528,0x9509,0xE5EE,0xF5CF,0xC5AC,0xD58D,0x3653,0x2672,0x1611,0x0630, - 0x76D7,0x66F6,0x5695,0x46B4,0xB75B,0xA77A,0x9719,0x8738,0xF7DF,0xE7FE,0xD79D,0xC7BC,0x48C4, - 0x58E5,0x6886,0x78A7,0x0840,0x1861,0x2802,0x3823,0xC9CC,0xD9ED,0xE98E,0xF9AF,0x8948,0x9969, - 0xA90A,0xB92B,0x5AF5,0x4AD4,0x7AB7,0x6A96,0x1A71,0x0A50,0x3A33,0x2A12,0xDBFD,0xCBDC,0xFBBF, - 0xEB9E,0x9B79,0x8B58,0xBB3B,0xAB1A,0x6CA6,0x7C87,0x4CE4,0x5CC5,0x2C22,0x3C03,0x0C60,0x1C41, - 0xEDAE,0xFD8F,0xCDEC,0xDDCD,0xAD2A,0xBD0B,0x8D68,0x9D49,0x7E97,0x6EB6,0x5ED5,0x4EF4,0x3E13, - 0x2E32,0x1E51,0x0E70,0xFF9F,0xEFBE,0xDFDD,0xCFFC,0xBF1B,0xAF3A,0x9F59,0x8F78,0x9188,0x81A9, - 0xB1CA,0xA1EB,0xD10C,0xC12D,0xF14E,0xE16F,0x1080,0x00A1,0x30C2,0x20E3,0x5004,0x4025,0x7046, - 0x6067,0x83B9,0x9398,0xA3FB,0xB3DA,0xC33D,0xD31C,0xE37F,0xF35E,0x02B1,0x1290,0x22F3,0x32D2, - 0x4235,0x5214,0x6277,0x7256,0xB5EA,0xA5CB,0x95A8,0x8589,0xF56E,0xE54F,0xD52C,0xC50D,0x34E2, - 0x24C3,0x14A0,0x0481,0x7466,0x6447,0x5424,0x4405,0xA7DB,0xB7FA,0x8799,0x97B8,0xE75F,0xF77E, - 0xC71D,0xD73C,0x26D3,0x36F2,0x0691,0x16B0,0x6657,0x7676,0x4615,0x5634,0xD94C,0xC96D,0xF90E, - 0xE92F,0x99C8,0x89E9,0xB98A,0xA9AB,0x5844,0x4865,0x7806,0x6827,0x18C0,0x08E1,0x3882,0x28A3, - 0xCB7D,0xDB5C,0xEB3F,0xFB1E,0x8BF9,0x9BD8,0xABBB,0xBB9A,0x4A75,0x5A54,0x6A37,0x7A16,0x0AF1, - 0x1AD0,0x2AB3,0x3A92,0xFD2E,0xED0F,0xDD6C,0xCD4D,0xBDAA,0xAD8B,0x9DE8,0x8DC9,0x7C26,0x6C07, - 0x5C64,0x4C45,0x3CA2,0x2C83,0x1CE0,0x0CC1,0xEF1F,0xFF3E,0xCF5D,0xDF7C,0xAF9B,0xBFBA,0x8FD9, - 0x9FF8,0x6E17,0x7E36,0x4E55,0x5E74,0x2E93,0x3EB2,0x0ED1,0x1EF0 - ); - - function crc16Add(crc,c) - // 'crc' should be initialized to 0x0000. - { - return CRC16_TAB[((crc>>8)^c)&0xFF]^((crc<<8)&0xFFFF); - }; - // C/C++ language: - // - // inline unsigned short crc16Add(unsigned short crc, unsigned char c) - // { - // return CRC16_TAB[(unsigned char)(crc>>8)^c]^(unsigned short)(crc<<8); - // } - - // FCS-16 (as it is in PPP) in table form - // - // Described in RFC-1662 by William Allen Simpson, see RFC-1662 for references. - // - // Modified by Anders Danielsson, March 10, 2006. - var FCS_16_TAB = new Array( - // C/C++ language: - // - // unsigned short FCS_16_TAB[256] = {...}; - 0x0000,0x1189,0x2312,0x329B,0x4624,0x57AD,0x6536,0x74BF,0x8C48,0x9DC1,0xAF5A,0xBED3,0xCA6C, - 0xDBE5,0xE97E,0xF8F7,0x1081,0x0108,0x3393,0x221A,0x56A5,0x472C,0x75B7,0x643E,0x9CC9,0x8D40, - 0xBFDB,0xAE52,0xDAED,0xCB64,0xF9FF,0xE876,0x2102,0x308B,0x0210,0x1399,0x6726,0x76AF,0x4434, - 0x55BD,0xAD4A,0xBCC3,0x8E58,0x9FD1,0xEB6E,0xFAE7,0xC87C,0xD9F5,0x3183,0x200A,0x1291,0x0318, - 0x77A7,0x662E,0x54B5,0x453C,0xBDCB,0xAC42,0x9ED9,0x8F50,0xFBEF,0xEA66,0xD8FD,0xC974,0x4204, - 0x538D,0x6116,0x709F,0x0420,0x15A9,0x2732,0x36BB,0xCE4C,0xDFC5,0xED5E,0xFCD7,0x8868,0x99E1, - 0xAB7A,0xBAF3,0x5285,0x430C,0x7197,0x601E,0x14A1,0x0528,0x37B3,0x263A,0xDECD,0xCF44,0xFDDF, - 0xEC56,0x98E9,0x8960,0xBBFB,0xAA72,0x6306,0x728F,0x4014,0x519D,0x2522,0x34AB,0x0630,0x17B9, - 0xEF4E,0xFEC7,0xCC5C,0xDDD5,0xA96A,0xB8E3,0x8A78,0x9BF1,0x7387,0x620E,0x5095,0x411C,0x35A3, - 0x242A,0x16B1,0x0738,0xFFCF,0xEE46,0xDCDD,0xCD54,0xB9EB,0xA862,0x9AF9,0x8B70,0x8408,0x9581, - 0xA71A,0xB693,0xC22C,0xD3A5,0xE13E,0xF0B7,0x0840,0x19C9,0x2B52,0x3ADB,0x4E64,0x5FED,0x6D76, - 0x7CFF,0x9489,0x8500,0xB79B,0xA612,0xD2AD,0xC324,0xF1BF,0xE036,0x18C1,0x0948,0x3BD3,0x2A5A, - 0x5EE5,0x4F6C,0x7DF7,0x6C7E,0xA50A,0xB483,0x8618,0x9791,0xE32E,0xF2A7,0xC03C,0xD1B5,0x2942, - 0x38CB,0x0A50,0x1BD9,0x6F66,0x7EEF,0x4C74,0x5DFD,0xB58B,0xA402,0x9699,0x8710,0xF3AF,0xE226, - 0xD0BD,0xC134,0x39C3,0x284A,0x1AD1,0x0B58,0x7FE7,0x6E6E,0x5CF5,0x4D7C,0xC60C,0xD785,0xE51E, - 0xF497,0x8028,0x91A1,0xA33A,0xB2B3,0x4A44,0x5BCD,0x6956,0x78DF,0x0C60,0x1DE9,0x2F72,0x3EFB, - 0xD68D,0xC704,0xF59F,0xE416,0x90A9,0x8120,0xB3BB,0xA232,0x5AC5,0x4B4C,0x79D7,0x685E,0x1CE1, - 0x0D68,0x3FF3,0x2E7A,0xE70E,0xF687,0xC41C,0xD595,0xA12A,0xB0A3,0x8238,0x93B1,0x6B46,0x7ACF, - 0x4854,0x59DD,0x2D62,0x3CEB,0x0E70,0x1FF9,0xF78F,0xE606,0xD49D,0xC514,0xB1AB,0xA022,0x92B9, - 0x8330,0x7BC7,0x6A4E,0x58D5,0x495C,0x3DE3,0x2C6A,0x1EF1,0x0F78 - ); - - function fcs16Add(fcs,c) - // 'fcs' should be initialized to 0xFFFF and after the computation it should be - // complemented (inverted). - // - // If the FCS-16 is calculated over the data and over the complemented FCS-16, the - // result will always be 0xF0B8 (without the complementation). - { - return FCS_16_TAB[(fcs^c)&0xFF]^((fcs>>8)&0xFF); - }; - - // C/C++ language: - // - // inline unsigned short fcs16Add(unsigned short fcs, unsigned char c) - // { - // return FCS_16_TAB[(unsigned char)fcs^c]^(unsigned short)(fcs>>8); - // } - - // - // CRC-32 (as it is in ZMODEM) in table form - // - // Copyright (C) 1986 Gary S. Brown. You may use this program, or - // code or tables extracted from it, as desired without restriction. - // - // Modified by Anders Danielsson, February 5, 1989 and March 10, 2006. - // - // This is also known as FCS-32 (as it is in PPP), described in - // RFC-1662 by William Allen Simpson, see RFC-1662 for references. - // - var CRC32_TAB = new Array( /* CRC polynomial 0xEDB88320 */ - // C/C++ language: - // - // unsigned long CRC32_TAB[] = {...}; - 0x00000000,0x77073096,0xEE0E612C,0x990951BA,0x076DC419,0x706AF48F,0xE963A535,0x9E6495A3, - 0x0EDB8832,0x79DCB8A4,0xE0D5E91E,0x97D2D988,0x09B64C2B,0x7EB17CBD,0xE7B82D07,0x90BF1D91, - 0x1DB71064,0x6AB020F2,0xF3B97148,0x84BE41DE,0x1ADAD47D,0x6DDDE4EB,0xF4D4B551,0x83D385C7, - 0x136C9856,0x646BA8C0,0xFD62F97A,0x8A65C9EC,0x14015C4F,0x63066CD9,0xFA0F3D63,0x8D080DF5, - 0x3B6E20C8,0x4C69105E,0xD56041E4,0xA2677172,0x3C03E4D1,0x4B04D447,0xD20D85FD,0xA50AB56B, - 0x35B5A8FA,0x42B2986C,0xDBBBC9D6,0xACBCF940,0x32D86CE3,0x45DF5C75,0xDCD60DCF,0xABD13D59, - 0x26D930AC,0x51DE003A,0xC8D75180,0xBFD06116,0x21B4F4B5,0x56B3C423,0xCFBA9599,0xB8BDA50F, - 0x2802B89E,0x5F058808,0xC60CD9B2,0xB10BE924,0x2F6F7C87,0x58684C11,0xC1611DAB,0xB6662D3D, - 0x76DC4190,0x01DB7106,0x98D220BC,0xEFD5102A,0x71B18589,0x06B6B51F,0x9FBFE4A5,0xE8B8D433, - 0x7807C9A2,0x0F00F934,0x9609A88E,0xE10E9818,0x7F6A0DBB,0x086D3D2D,0x91646C97,0xE6635C01, - 0x6B6B51F4,0x1C6C6162,0x856530D8,0xF262004E,0x6C0695ED,0x1B01A57B,0x8208F4C1,0xF50FC457, - 0x65B0D9C6,0x12B7E950,0x8BBEB8EA,0xFCB9887C,0x62DD1DDF,0x15DA2D49,0x8CD37CF3,0xFBD44C65, - 0x4DB26158,0x3AB551CE,0xA3BC0074,0xD4BB30E2,0x4ADFA541,0x3DD895D7,0xA4D1C46D,0xD3D6F4FB, - 0x4369E96A,0x346ED9FC,0xAD678846,0xDA60B8D0,0x44042D73,0x33031DE5,0xAA0A4C5F,0xDD0D7CC9, - 0x5005713C,0x270241AA,0xBE0B1010,0xC90C2086,0x5768B525,0x206F85B3,0xB966D409,0xCE61E49F, - 0x5EDEF90E,0x29D9C998,0xB0D09822,0xC7D7A8B4,0x59B33D17,0x2EB40D81,0xB7BD5C3B,0xC0BA6CAD, - 0xEDB88320,0x9ABFB3B6,0x03B6E20C,0x74B1D29A,0xEAD54739,0x9DD277AF,0x04DB2615,0x73DC1683, - 0xE3630B12,0x94643B84,0x0D6D6A3E,0x7A6A5AA8,0xE40ECF0B,0x9309FF9D,0x0A00AE27,0x7D079EB1, - 0xF00F9344,0x8708A3D2,0x1E01F268,0x6906C2FE,0xF762575D,0x806567CB,0x196C3671,0x6E6B06E7, - 0xFED41B76,0x89D32BE0,0x10DA7A5A,0x67DD4ACC,0xF9B9DF6F,0x8EBEEFF9,0x17B7BE43,0x60B08ED5, - 0xD6D6A3E8,0xA1D1937E,0x38D8C2C4,0x4FDFF252,0xD1BB67F1,0xA6BC5767,0x3FB506DD,0x48B2364B, - 0xD80D2BDA,0xAF0A1B4C,0x36034AF6,0x41047A60,0xDF60EFC3,0xA867DF55,0x316E8EEF,0x4669BE79, - 0xCB61B38C,0xBC66831A,0x256FD2A0,0x5268E236,0xCC0C7795,0xBB0B4703,0x220216B9,0x5505262F, - 0xC5BA3BBE,0xB2BD0B28,0x2BB45A92,0x5CB36A04,0xC2D7FFA7,0xB5D0CF31,0x2CD99E8B,0x5BDEAE1D, - 0x9B64C2B0,0xEC63F226,0x756AA39C,0x026D930A,0x9C0906A9,0xEB0E363F,0x72076785,0x05005713, - 0x95BF4A82,0xE2B87A14,0x7BB12BAE,0x0CB61B38,0x92D28E9B,0xE5D5BE0D,0x7CDCEFB7,0x0BDBDF21, - 0x86D3D2D4,0xF1D4E242,0x68DDB3F8,0x1FDA836E,0x81BE16CD,0xF6B9265B,0x6FB077E1,0x18B74777, - 0x88085AE6,0xFF0F6A70,0x66063BCA,0x11010B5C,0x8F659EFF,0xF862AE69,0x616BFFD3,0x166CCF45, - 0xA00AE278,0xD70DD2EE,0x4E048354,0x3903B3C2,0xA7672661,0xD06016F7,0x4969474D,0x3E6E77DB, - 0xAED16A4A,0xD9D65ADC,0x40DF0B66,0x37D83BF0,0xA9BCAE53,0xDEBB9EC5,0x47B2CF7F,0x30B5FFE9, - 0xBDBDF21C,0xCABAC28A,0x53B39330,0x24B4A3A6,0xBAD03605,0xCDD70693,0x54DE5729,0x23D967BF, - 0xB3667A2E,0xC4614AB8,0x5D681B02,0x2A6F2B94,0xB40BBE37,0xC30C8EA1,0x5A05DF1B,0x2D02EF8D - ); - - function crc32Add(crc,c) - // 'crc' should be initialized to 0xFFFFFFFF and after the computation it should be - // complemented (inverted). - // - // CRC-32 is also known as FCS-32. - // - // If the FCS-32 is calculated over the data and over the complemented FCS-32, the - // result will always be 0xDEBB20E3 (without the complementation). - { - return CRC32_TAB[(crc^c)&0xFF]^((crc>>8)&0xFFFFFF); - }; - // - // C/C++ language: - // - // inline unsigned long crc32Add(unsigned long crc, unsigned char c) - // { - // return CRC32_TAB[(unsigned char)crc^c]^(crc>>8); - // } - // - - function crc8(str) - { - var n, - len = str.length, - crc = 0 - ; - - for(i = 0; i < len; i++) - crc = crc8Add(crc, str.charCodeAt(i)); - - return crc; - }; - - function crcArc(str) - { - var i, - len = str.length, - crc = 0 - ; - - for(i = 0; i < len; i++) - crc = crcArcAdd(crc, str.charCodeAt(i)); - - return crc; - }; - - function crc16(str) - { - var i, - len = str.length, - crc = 0 - ; - - for(i = 0; i < len; i++) - crc = crc16Add(crc, str.charCodeAt(i)); - - return crc; - }; - - function fcs16(str) - { - var i, - len = str.length, - fcs = 0xFFFF - ; - - for(i = 0; i < len; i++) - fcs = fcs16Add(fcs,str.charCodeAt(i)); - - return fcs^0xFFFF; - }; - - function crc32(str) - { - var i, - len = str.length, - crc = 0xFFFFFFFF - ; - - for(i = 0; i < len; i++) - crc = crc32Add(crc, str.charCodeAt(i)); - - return crc^0xFFFFFFFF; - }; - - /** - * Convert value as 8-bit unsigned integer to 2 digit hexadecimal number. - */ - function hex8(val) - { - var n = val & 0xFF, - str = n.toString(16).toUpperCase() - ; - - while(str.length < 2) - str = "0" + str; - - return str; - }; - - /** - * Convert value as 16-bit unsigned integer to 4 digit hexadecimal number. - */ - function hex16(val) - { - return hex8(val >> 8) + hex8(val); - }; - - /** - * Convert value as 32-bit unsigned integer to 8 digit hexadecimal number. - */ - function hex32(val) - { - return hex16(val >> 16) + hex16(val); - }; - - var target, property; - - if(typeof(window) == 'undefined') - { - target = module; - property = 'exports'; - } - else - { - target = window; - property = 'crc'; - } - - target[property] = { - 'crc8' : crc8, - 'crcArc' : crcArc, - 'crc16' : crc16, - 'fcs16' : fcs16, - 'crc32' : crc32, - 'hex8' : hex8, - 'hex16' : hex16, - 'hex32' : hex32 - }; -})(); diff --git a/node_modules/connect/node_modules/crc/package.json b/node_modules/connect/node_modules/crc/package.json deleted file mode 100644 index f1ee683..0000000 --- a/node_modules/connect/node_modules/crc/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "crc", - "version": "0.1.0", - "description": "CRC JavaScript implementation", - "author": { - "name": "Alex Gorbatchev", - "email": "alex.gorbatchev@gmail.com" - }, - "contributors": [], - "main": "./lib/crc.js", - "scripts": {}, - "directories": {}, - "repository": { - "type": "git", - "url": "git://github.com/alexgorbatchev/node-crc.git" - }, - "_id": "crc@0.1.0", - "dependencies": {}, - "devDependencies": {}, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "dist": { - "shasum": "063de0486b9e711904181c1835290801d8797f4c" - }, - "_from": "crc@0.1.0" -} diff --git a/node_modules/connect/node_modules/crc/tests/crc_tests.js b/node_modules/connect/node_modules/crc/tests/crc_tests.js deleted file mode 100755 index 93eea42..0000000 --- a/node_modules/connect/node_modules/crc/tests/crc_tests.js +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env ./nodeunit/bin/nodeunit - -var crc = require('../lib/crc'); - -var fixture = { - 'crc8': [ - ['hello world', 64] - ], - - 'crc16': [ - ['hello world', 15332] - ], - - 'crc32': [ - ['hello world', 222957957] - ], - - 'crcArc': [ - ['hello world', 14785] - ], - - 'fcs16': [ - ['hello world', 44550] - ], - - 'hex8': [ - [64, '40'] - ], - - 'hex16': [ - [15332, '3BE4'] - ], - - 'hex32': [ - [222957957, '0D4A1185'] - ] -}; - -var suite = module.exports['crc'] = {}; - -for(var func in fixture) -{ - var list = fixture[func]; - - for(var i = 0; i < list.length; i++) - { - var input = list[i][0], - output = list[i][1], - name = [ func, input, output ].join(' - ') - ; - - suite[name] = (function(func, input, output) - { - - return function(assert) - { - assert.deepEqual(crc[func](input), output); - assert.done(); - }; - - })(func, input, output); - } -}; - diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/.npmignore b/node_modules/connect/node_modules/crc/tests/nodeunit/.npmignore deleted file mode 100644 index 1a82501..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -dist -stamp-build -test/fixtures/dir2 diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/CONTRIBUTORS.md b/node_modules/connect/node_modules/crc/tests/nodeunit/CONTRIBUTORS.md deleted file mode 100644 index ebaa38e..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/CONTRIBUTORS.md +++ /dev/null @@ -1,56 +0,0 @@ -Nodeunit contributors (sorted alphabeticaly) -============================================ - -* **[Alex Gorbatchev](https://github.com/alexgorbatchev)** - - * Deeper default object inspection - * Timeout to ensure flushing of console output (default reporter) - -* **[Alex Wolfe](https://github.com/alexkwolfe)** - - * HTML test reporter - -* **[Caolan McMahon](https://github.com/caolan)** - - * Author and maintainer - * Most features develpopment - -* **[Carl Fürstenberg](https://github.com/azatoth)** - - * Debian-friendly Makefile, supports both 'node' and 'nodejs' executables - * Sandbox utility - * Minimal test reporter - -* **[Gerad Suyderhoud](https://github.com/gerad)** - - * First comand-line tool - -* **[Kadir Pekel](https://github.com/coffeemate)** - - * Improvements to default test reporter - * HTTP test utility - -* **[Oleg Efimov](https://github.com/Sannis)** - - * Adding 'make lint' and fixing nodelint errors - * Option parsing, --help text and config file support - * Reporters option for command-line tool - -* **[Orlando Vazquez](https://github.com/orlandov)** - - * Added jUnit XML reporter - -* **[Ryan Dahl](https://github.com/ry)** - - * Add package.json - -* **[Sam Stephenson](https://github.com/sstephenson)** - - * Coffee-script support - -* **[Thomas Mayfield](https://github.com/thegreatape)** - - * Async setUp and tearDown support for testCase - -**[Full contributors list](https://github.com/caolan/nodeunit/contributors).** - diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/LICENSE b/node_modules/connect/node_modules/crc/tests/nodeunit/LICENSE deleted file mode 100644 index b7f9d50..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010 Caolan McMahon - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/Makefile b/node_modules/connect/node_modules/crc/tests/nodeunit/Makefile deleted file mode 100644 index f3e57cc..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/Makefile +++ /dev/null @@ -1,126 +0,0 @@ -PACKAGE = nodeunit -NODEJS = $(if $(shell test -f /usr/bin/nodejs && echo "true"),nodejs,node) - -PREFIX ?= /usr/local -BINDIR ?= $(PREFIX)/bin -DATADIR ?= $(PREFIX)/share -MANDIR ?= $(PREFIX)/share/man -LIBDIR ?= $(PREFIX)/lib -NODEJSLIBDIR ?= $(LIBDIR)/$(NODEJS) - -BUILDDIR = dist - -DOCS = $(shell find doc -name '*.md' \ - |sed 's|.md|.1|g' \ - |sed 's|doc/|man1/|g' \ - ) - - -$(shell if [ ! -d $(BUILDDIR) ]; then mkdir $(BUILDDIR); fi) - -all: build doc - -browser: - # super hacky build script for browser version! - mkdir -p $(BUILDDIR)/browser - rm -rf $(BUILDDIR)/browser/* - # build browser version of nodeunit.js - cat share/license.js >> $(BUILDDIR)/browser/nodeunit.js - echo "nodeunit = (function(){" >> $(BUILDDIR)/browser/nodeunit.js - cat deps/json2.js >> $(BUILDDIR)/browser/nodeunit.js - # make assert global - echo "var assert = this.assert = {};" >> $(BUILDDIR)/browser/nodeunit.js - echo "var types = {};" >> $(BUILDDIR)/browser/nodeunit.js - echo "var core = {};" >> $(BUILDDIR)/browser/nodeunit.js - echo "var nodeunit = {};" >> $(BUILDDIR)/browser/nodeunit.js - echo "var reporter = {};" >> $(BUILDDIR)/browser/nodeunit.js - cat deps/async.js >> $(BUILDDIR)/browser/nodeunit.js - echo "(function(exports){" >> $(BUILDDIR)/browser/nodeunit.js - cat lib/assert.js >> $(BUILDDIR)/browser/nodeunit.js - echo "})(assert);" >> $(BUILDDIR)/browser/nodeunit.js - echo "(function(exports){" >> $(BUILDDIR)/browser/nodeunit.js - cat lib/types.js >> $(BUILDDIR)/browser/nodeunit.js - echo "})(types);" >> $(BUILDDIR)/browser/nodeunit.js - echo "(function(exports){" >> $(BUILDDIR)/browser/nodeunit.js - cat lib/core.js >> $(BUILDDIR)/browser/nodeunit.js - echo "})(core);" >> $(BUILDDIR)/browser/nodeunit.js - echo "(function(exports){" >> $(BUILDDIR)/browser/nodeunit.js - cat lib/reporters/browser.js >> $(BUILDDIR)/browser/nodeunit.js - echo "})(reporter);" >> $(BUILDDIR)/browser/nodeunit.js - echo "nodeunit = core;" >> $(BUILDDIR)/browser/nodeunit.js - echo "nodeunit.assert = assert;" >> $(BUILDDIR)/browser/nodeunit.js - echo "nodeunit.reporter = reporter;" >> $(BUILDDIR)/browser/nodeunit.js - echo "nodeunit.run = reporter.run;" >> $(BUILDDIR)/browser/nodeunit.js - echo "return nodeunit; })();" >> $(BUILDDIR)/browser/nodeunit.js - sed -i "/\@REMOVE_LINE_FOR_BROWSER/d" $(BUILDDIR)/browser/nodeunit.js - # copy nodeunit.css - cp share/nodeunit.css $(BUILDDIR)/browser/nodeunit.css - # create nodeunit.min.js - uglifyjs $(BUILDDIR)/browser/nodeunit.js > $(BUILDDIR)/browser/nodeunit.min.js - # create test scripts - mkdir -p $(BUILDDIR)/browser/test - cp test/test.html $(BUILDDIR)/browser/test/test.html - # test-base.js - echo "(function (exports) {" > $(BUILDDIR)/browser/test/test-base.js - cat test/test-base.js >> $(BUILDDIR)/browser/test/test-base.js - echo "})(this.test_base = {});" >> $(BUILDDIR)/browser/test/test-base.js - sed -i "/\@REMOVE_LINE_FOR_BROWSER/d" $(BUILDDIR)/browser/test/test-base.js - # test-runmodule.js - echo "(function (exports) {" > $(BUILDDIR)/browser/test/test-runmodule.js - cat test/test-runmodule.js >> $(BUILDDIR)/browser/test/test-runmodule.js - echo "})(this.test_runmodule = {});" >> $(BUILDDIR)/browser/test/test-runmodule.js - sed -i "/\@REMOVE_LINE_FOR_BROWSER/d" $(BUILDDIR)/browser/test/test-runmodule.js - # test-runtest.js - echo "(function (exports) {" > $(BUILDDIR)/browser/test/test-runtest.js - cat test/test-runtest.js >> $(BUILDDIR)/browser/test/test-runtest.js - echo "})(this.test_runtest = {});" >> $(BUILDDIR)/browser/test/test-runtest.js - sed -i "/\@REMOVE_LINE_FOR_BROWSER/d" $(BUILDDIR)/browser/test/test-runtest.js - # test-testcase.js - echo "(function (exports) {" > $(BUILDDIR)/browser/test/test-testcase.js - cat test/test-testcase.js >> $(BUILDDIR)/browser/test/test-testcase.js - echo "})(this.test_testcase = {});" >> $(BUILDDIR)/browser/test/test-testcase.js - sed -i "/\@REMOVE_LINE_FOR_BROWSER/d" $(BUILDDIR)/browser/test/test-testcase.js - # copy nodeunit.js to dist/browser/test to make it easier for me to host and - # run on windows VMs with IE - cp $(BUILDDIR)/browser/nodeunit.js $(BUILDDIR)/browser/test/nodeunit.js - cp $(BUILDDIR)/browser/nodeunit.css $(BUILDDIR)/browser/test/nodeunit.css - -build: stamp-build - -stamp-build: $(wildcard deps/* lib/*.js) - touch $@; - mkdir -p $(BUILDDIR)/nodeunit - cp -R bin deps index.js lib package.json $(BUILDDIR)/nodeunit - printf '#!/bin/sh\n$(NODEJS) $(NODEJSLIBDIR)/$(PACKAGE)/bin/nodeunit $$@' > $(BUILDDIR)/nodeunit.sh - -test: - $(NODEJS) ./bin/nodeunit test - -install: build - install --directory $(NODEJSLIBDIR) - cp -a $(BUILDDIR)/nodeunit $(NODEJSLIBDIR) - install --mode=0755 $(BUILDDIR)/nodeunit.sh $(BINDIR)/nodeunit - install --directory $(MANDIR)/man1/ - cp -a man1/nodeunit.1 $(MANDIR)/man1/ - -uninstall: - rm -rf $(NODEJSLIBDIR)/nodeunit $(NODEJSLIBDIR)/nodeunit.js $(BINDIR)/nodeunit - rm -rf $(MANDIR)/man1/nodeunit.1 - -clean: - rm -rf $(BUILDDIR) stamp-build - -lint: - nodelint --config nodelint.cfg ./index.js ./bin/nodeunit ./bin/nodeunit.json ./lib/*.js ./lib/reporters/*.js ./test/*.js - -doc: man1 $(DOCS) - @true - -man1: - @if ! test -d man1 ; then mkdir -p man1 ; fi - -# use `npm install ronn` for this to work. -man1/%.1: doc/%.md - ronn --roff $< > $@ - -.PHONY: browser test install uninstall build all diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/README.md b/node_modules/connect/node_modules/crc/tests/nodeunit/README.md deleted file mode 100644 index 67026a2..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/README.md +++ /dev/null @@ -1,430 +0,0 @@ -Nodeunit -======== - -Simple syntax, powerful tools. Nodeunit provides easy async unit testing for -node.js and the browser. - -* Simple to use -* Just export the tests from a module -* Works with node.js and in the browser. -* Helps you avoid common pitfalls when testing asynchronous code -* Easy to add test cases with setUp and tearDown functions if you wish -* Flexible reporters for custom output, built-in support for HTML and jUnit XML -* Allows the use of mocks and stubs - -__Contributors__ - -* [alexgorbatchev](https://github.com/alexgorbatchev) -* [alexkwolfe](https://github.com/alexkwolfe) -* [azatoth](https://github.com/azatoth) -* [coffeemate](https://github.com/coffeemate) -* [orlandov](https://github.com/orlandov) -* [Sannis](https://github.com/Sannis) -* [sstephenson](https://github.com/sstephenson) -* [thegreatape](https://github.com/thegreatape) -* and thanks to [cjohansen](https://github.com/cjohansen) for input and advice - on implementing setUp and tearDown functions. See - [cjohansen's fork](https://github.com/cjohansen/nodeunit). - -Also, check out gerad's [nodeunit-dsl](https://github.com/gerad/nodeunit-dsl) -project, which implements a 'pretty dsl on top of nodeunit'. - -More contributor information can be found in the CONTRIBUTORS.md file. - -Usage ------ - -Here is an example unit test module: - - exports.testSomething = function(test){ - test.expect(1); - test.ok(true, "this assertion should pass"); - test.done(); - }; - - exports.testSomethingElse = function(test){ - test.ok(false, "this assertion should fail"); - test.done(); - }; - -When run using the included test runner, this will output the following: - - - -Installation ------------- - -There are two options for installing nodeunit: - -1. Clone / download nodeunit from [github](https://github.com/caolan/nodeunit), - then: - - make && sudo make install - -2. Install via npm: - - npm install nodeunit - -API Documentation ------------------ - -Nodeunit uses the functions available in the node.js -[assert module](http://nodejs.org/api.html#assert-280): - -* __ok(value, [message])__ - Tests if value is a true value. -* __equal(actual, expected, [message])__ - Tests shallow, coercive equality - with the equal comparison operator ( == ). -* __notEqual(actual, expected, [message])__ - Tests shallow, coercive - non-equality with the not equal comparison operator ( != ). -* __deepEqual(actual, expected, [message])__ - Tests for deep equality. -* __notDeepEqual(actual, expected, [message])__ - Tests for any deep - inequality. -* __strictEqual(actual, expected, [message])__ - Tests strict equality, as - determined by the strict equality operator ( === ) -* __notStrictEqual(actual, expected, [message])__ - Tests strict non-equality, - as determined by the strict not equal operator ( !== ) -* __throws(block, [error], [message])__ - Expects block to throw an error. -* __doesNotThrow(block, [error], [message])__ - Expects block not to throw an - error. -* __ifError(value)__ - Tests if value is not a false value, throws if it is a - true value. Useful when testing the first argument, error in callbacks. - -Nodeunit also provides the following functions within tests: - -* __expect(amount)__ - Specify how many assertions are expected to run within a - test. Very useful for ensuring that all your callbacks and assertions are - run. -* __done()__ - Finish the current test function, and move on to the next. ALL - tests should call this! - -Nodeunit aims to be simple and easy to learn. This is achieved through using -existing structures (such as node.js modules) to maximum effect, and reducing -the API where possible, to make it easier to digest. - -Tests are simply exported from a module, but they are still run in the order -they are defined. - -__Note:__ Users of old nodeunit versions may remember using ok, equals and same -in the style of qunit, instead of the assert functions above. These functions -still exist for backwards compatibility, and are simply aliases to their assert -module counterparts. - - -Asynchronous Testing --------------------- - -When testing asynchronous code, there are a number of sharp edges to watch out -for. Thankfully, nodeunit is designed to help you avoid as many of these -pitfalls as possible. For the most part, testing asynchronous code in nodeunit -_just works_. - - -### Tests run in series - -While running tests in parallel seems like a good idea for speeding up your -test suite, in practice I've found it means writing much more complicated -tests. Because of node's module cache, running tests in parallel means mocking -and stubbing is pretty much impossible. One of the nicest things about testing -in javascript is the ease of doing stubs: - - var _readFile = fs.readFile; - fs.readFile = function(path, callback){ - // its a stub! - }; - // test function that uses fs.readFile - - // we're done - fs.readFile = _readFile; - -You cannot do this when running tests in parallel. In order to keep testing as -simple as possible, nodeunit avoids it. Thankfully, most unit-test suites run -fast anyway. - - -### Explicit ending of tests - -When testing async code its important that tests end at the correct point, not -just after a given number of assertions. Otherwise your tests can run short, -ending before all assertions have completed. Its important to detect too -many assertions as well as too few. Combining explicit ending of tests with -an expected number of assertions helps to avoid false test passes, so be sure -to use the test.expect() method at the start of your test functions, and -test.done() when finished. - - -Groups, setUp and tearDown --------------------------- - -Nodeunit allows the nesting of test functions: - - exports.test1 = function (test) { - ... - } - - exports.group = { - test2: function (test) { - ... - }, - test3: function (test) { - ... - } - } - -This would be run as: - - test1 - group - test2 - group - test3 - -Using these groups its possible to add setUp and tearDown functions to your -tests. Nodeunit has a utility function called testCase which allows you to -define a setUp function, which is run before each test, and a tearDown -function, which is run after each test calls test.done(): - - var testCase = require('nodeunit').testCase; - - module.exports = testCase({ - setUp: function (callback) { - this.foo = 'bar'; - callback(); - }, - tearDown: function (callback) { - // clean up - callback(); - }, - test1: function (test) { - test.equals(this.foo, 'bar'); - test.done(); - } - }); - -In this way, its possible to have multiple groups of tests in a module, each -group with its own setUp and tearDown functions. - - -Running Tests -------------- - -Nodeunit comes with a basic command-line test runner, which can be installed -using 'sudo make install'. Example usage: - - nodeunit testmodule1.js testfolder [...] - -The default test reporter uses color output, because I think that's more fun :) I -intend to add a no-color option in future. To give you a feeling of the fun you'll -be having writing tests, lets fix the example at the start of the README: - - - -Ahhh, Doesn't that feel better? - -When using the included test runner, it will exit using the failed number of -assertions as the exit code. Exiting with 0 when all tests pass. - - -### Command-line Options - -* __--reporter FILE__ - you can set the test reporter to a custom module or -on of the modules in nodeunit/lib/reporters, when omitted, the default test runner -is used. -* __--list-reporters__ - list available build-in reporters. -* __--config FILE__ - load config options from a JSON file, allows -the customisation of color schemes for the default test reporter etc. See -bin/nodeunit.json for current available options. -* __--version__ or __-v__ - report nodeunit version -* __--help__ - show nodeunit help - - -Running tests in the browser ----------------------------- - -Nodeunit tests can also be run inside the browser. For example usage, see -the examples/browser folder. The basic syntax is as follows: - -__test.html__ - - - - Example Test Suite - - - - - - -

    b ? 1 : 0; - }; - callback(null, _map(results.sort(fn), function (x) { - return x.value; - })); - } - }); - }; - - async.auto = function (tasks, callback) { - callback = callback || function () {}; - var keys = _keys(tasks); - if (!keys.length) { - return callback(null); - } - - var completed = []; - - var listeners = []; - var addListener = function (fn) { - listeners.unshift(fn); - }; - var removeListener = function (fn) { - for (var i = 0; i < listeners.length; i += 1) { - if (listeners[i] === fn) { - listeners.splice(i, 1); - return; - } - } - }; - var taskComplete = function () { - _forEach(listeners, function (fn) { - fn(); - }); - }; - - addListener(function () { - if (completed.length === keys.length) { - callback(null); - } - }); - - _forEach(keys, function (k) { - var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k]; - var taskCallback = function (err) { - if (err) { - callback(err); - // stop subsequent errors hitting callback multiple times - callback = function () {}; - } - else { - completed.push(k); - taskComplete(); - } - }; - var requires = task.slice(0, Math.abs(task.length - 1)) || []; - var ready = function () { - return _reduce(requires, function (a, x) { - return (a && _indexOf(completed, x) !== -1); - }, true); - }; - if (ready()) { - task[task.length - 1](taskCallback); - } - else { - var listener = function () { - if (ready()) { - removeListener(listener); - task[task.length - 1](taskCallback); - } - }; - addListener(listener); - } - }); - }; - - async.waterfall = function (tasks, callback) { - if (!tasks.length) { - return callback(); - } - callback = callback || function () {}; - var wrapIterator = function (iterator) { - return function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - var args = Array.prototype.slice.call(arguments, 1); - var next = iterator.next(); - if (next) { - args.push(wrapIterator(next)); - } - else { - args.push(callback); - } - async.nextTick(function () { - iterator.apply(null, args); - }); - } - }; - }; - wrapIterator(async.iterator(tasks))(); - }; - - async.parallel = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - async.map(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args || null); - }); - } - }, callback); - } - else { - var results = {}; - async.forEach(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.series = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - async.mapSeries(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args || null); - }); - } - }, callback); - } - else { - var results = {}; - async.forEachSeries(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.iterator = function (tasks) { - var makeCallback = function (index) { - var fn = function () { - if (tasks.length) { - tasks[index].apply(null, arguments); - } - return fn.next(); - }; - fn.next = function () { - return (index < tasks.length - 1) ? makeCallback(index + 1): null; - }; - return fn; - }; - return makeCallback(0); - }; - - async.apply = function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - return function () { - return fn.apply( - null, args.concat(Array.prototype.slice.call(arguments)) - ); - }; - }; - - var _concat = function (eachfn, arr, fn, callback) { - var r = []; - eachfn(arr, function (x, cb) { - fn(x, function (err, y) { - r = r.concat(y || []); - cb(err); - }); - }, function (err) { - callback(err, r); - }); - }; - async.concat = doParallel(_concat); - async.concatSeries = doSeries(_concat); - - async.whilst = function (test, iterator, callback) { - if (test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.whilst(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.until = function (test, iterator, callback) { - if (!test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.until(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.queue = function (worker, concurrency) { - var workers = 0; - var tasks = []; - var q = { - concurrency: concurrency, - push: function (data, callback) { - tasks.push({data: data, callback: callback}); - async.nextTick(q.process); - }, - process: function () { - if (workers < q.concurrency && tasks.length) { - var task = tasks.splice(0, 1)[0]; - workers += 1; - worker(task.data, function () { - workers -= 1; - if (task.callback) { - task.callback.apply(task, arguments); - } - q.process(); - }); - } - }, - length: function () { - return tasks.length; - } - }; - return q; - }; - - var _console_fn = function (name) { - return function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - fn.apply(null, args.concat([function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (typeof console !== 'undefined') { - if (err) { - if (console.error) { - console.error(err); - } - } - else if (console[name]) { - _forEach(args, function (x) { - console[name](x); - }); - } - } - }])); - }; - }; - async.log = _console_fn('log'); - async.dir = _console_fn('dir'); - /*async.info = _console_fn('info'); - async.warn = _console_fn('warn'); - async.error = _console_fn('error');*/ - -}()); diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/deps/ejs.js b/node_modules/connect/node_modules/crc/tests/nodeunit/deps/ejs.js deleted file mode 100644 index f6abf29..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/deps/ejs.js +++ /dev/null @@ -1,125 +0,0 @@ - -/*! - * EJS - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var sys = require('sys'); - -/** - * Library version. - */ - -exports.version = '0.0.3'; - -/** - * Intermediate js cache. - * - * @type Object - */ - -var cache = {}; - -/** - * Clear intermediate js cache. - * - * @api public - */ - -exports.clearCache = function(){ - cache = {}; -}; - -/** - * Escape the given string of `html`. - * - * @param {String} html - * @return {String} - * @api private - */ - -function escape(html){ - return String(html) - .replace(/&(?!\w+;)/g, '&') - .replace(//g, '>') - .replace(/"/g, '"'); -} - -/** - * Parse the given `str` of ejs, returning the function body. - * - * @param {String} str - * @return {String} - * @api public - */ - -var parse = exports.parse = function(str){ - return 'var buf = [];\n' - + "with (locals) {\nbuf.push('" - + String(str) - .replace(/[\r\t]/g, " ") - .replace(/\n/g, "\\n") - .split("<%").join("\t") - .replace(/((^|%>)[^\t]*)'/g, "$1\r") - .replace(/\t=(.*?)%>/g, "', escape($1) ,'") - .replace(/\t-(.*?)%>/g, "', $1 ,'") - .split("\t").join("');") - .split("%>").join("buf.push('") - .split("\r").join("\\'") - + "');\n}\nreturn buf.join('');"; -}; - -/** - * Compile the given `str` of ejs into a `Function`. - * - * @param {String} str - * @param {Object} options - * @return {Function} - * @api public - */ - -var compile = exports.compile = function(str, options){ - if (options.debug) sys.puts(parse(str)); - return new Function('locals, escape', parse(str)); -}; - -/** - * Render the given `str` of ejs. - * - * Options: - * - * - `locals` Local variables object - * - `cache` Compiled functions are cached, requires `filename` - * - `filename` Used by `cache` to key caches - * - `context|scope` Function execution context - * - `debug` Output generated function body - * - * @param {String} str - * @param {Object} options - * @return {String} - * @api public - */ - -exports.render = function(str, options){ - var fn, - options = options || {}; - if (options.cache) { - if (options.filename) { - fn = cache[options.filename] = compile(str, options); - } else { - throw new Error('"cache" option requires "filename".'); - } - } else { - fn = compile(str, options); - } - return fn.call( - options.context || options.scope, - options.locals || {}, - escape); -}; \ No newline at end of file diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/deps/json2.js b/node_modules/connect/node_modules/crc/tests/nodeunit/deps/json2.js deleted file mode 100644 index 22b44d9..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/deps/json2.js +++ /dev/null @@ -1,483 +0,0 @@ -/* - http://www.JSON.org/json2.js - 2010-11-17 - - Public Domain. - - NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. - - See http://www.JSON.org/js.html - - - This code should be minified before deployment. - See http://javascript.crockford.com/jsmin.html - - USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO - NOT CONTROL. - - - This file creates a global JSON object containing two methods: stringify - and parse. - - JSON.stringify(value, replacer, space) - value any JavaScript value, usually an object or array. - - replacer an optional parameter that determines how object - values are stringified for objects. It can be a - function or an array of strings. - - space an optional parameter that specifies the indentation - of nested structures. If it is omitted, the text will - be packed without extra whitespace. If it is a number, - it will specify the number of spaces to indent at each - level. If it is a string (such as '\t' or ' '), - it contains the characters used to indent at each level. - - This method produces a JSON text from a JavaScript value. - - When an object value is found, if the object contains a toJSON - method, its toJSON method will be called and the result will be - stringified. A toJSON method does not serialize: it returns the - value represented by the name/value pair that should be serialized, - or undefined if nothing should be serialized. The toJSON method - will be passed the key associated with the value, and this will be - bound to the value - - For example, this would serialize Dates as ISO strings. - - Date.prototype.toJSON = function (key) { - function f(n) { - // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; - } - - return this.getUTCFullYear() + '-' + - f(this.getUTCMonth() + 1) + '-' + - f(this.getUTCDate()) + 'T' + - f(this.getUTCHours()) + ':' + - f(this.getUTCMinutes()) + ':' + - f(this.getUTCSeconds()) + 'Z'; - }; - - You can provide an optional replacer method. It will be passed the - key and value of each member, with this bound to the containing - object. The value that is returned from your method will be - serialized. If your method returns undefined, then the member will - be excluded from the serialization. - - If the replacer parameter is an array of strings, then it will be - used to select the members to be serialized. It filters the results - such that only members with keys listed in the replacer array are - stringified. - - Values that do not have JSON representations, such as undefined or - functions, will not be serialized. Such values in objects will be - dropped; in arrays they will be replaced with null. You can use - a replacer function to replace those with JSON values. - JSON.stringify(undefined) returns undefined. - - The optional space parameter produces a stringification of the - value that is filled with line breaks and indentation to make it - easier to read. - - If the space parameter is a non-empty string, then that string will - be used for indentation. If the space parameter is a number, then - the indentation will be that many spaces. - - Example: - - text = JSON.stringify(['e', {pluribus: 'unum'}]); - // text is '["e",{"pluribus":"unum"}]' - - - text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); - // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' - - text = JSON.stringify([new Date()], function (key, value) { - return this[key] instanceof Date ? - 'Date(' + this[key] + ')' : value; - }); - // text is '["Date(---current time---)"]' - - - JSON.parse(text, reviver) - This method parses a JSON text to produce an object or array. - It can throw a SyntaxError exception. - - The optional reviver parameter is a function that can filter and - transform the results. It receives each of the keys and values, - and its return value is used instead of the original value. - If it returns what it received, then the structure is not modified. - If it returns undefined then the member is deleted. - - Example: - - // Parse the text. Values that look like ISO date strings will - // be converted to Date objects. - - myData = JSON.parse(text, function (key, value) { - var a; - if (typeof value === 'string') { - a = -/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); - if (a) { - return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], - +a[5], +a[6])); - } - } - return value; - }); - - myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { - var d; - if (typeof value === 'string' && - value.slice(0, 5) === 'Date(' && - value.slice(-1) === ')') { - d = new Date(value.slice(5, -1)); - if (d) { - return d; - } - } - return value; - }); - - - This is a reference implementation. You are free to copy, modify, or - redistribute. -*/ - -/*jslint evil: true, strict: false, regexp: false */ - -/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, - call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, - getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, - lastIndex, length, parse, prototype, push, replace, slice, stringify, - test, toJSON, toString, valueOf -*/ - - -// Create a JSON object only if one does not already exist. We create the -// methods in a closure to avoid creating global variables. - -if (!this.JSON) { - this.JSON = {}; -} - -(function () { - "use strict"; - - function f(n) { - // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; - } - - if (typeof Date.prototype.toJSON !== 'function') { - - Date.prototype.toJSON = function (key) { - - return isFinite(this.valueOf()) ? - this.getUTCFullYear() + '-' + - f(this.getUTCMonth() + 1) + '-' + - f(this.getUTCDate()) + 'T' + - f(this.getUTCHours()) + ':' + - f(this.getUTCMinutes()) + ':' + - f(this.getUTCSeconds()) + 'Z' : null; - }; - - String.prototype.toJSON = - Number.prototype.toJSON = - Boolean.prototype.toJSON = function (key) { - return this.valueOf(); - }; - } - - var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - gap, - indent, - meta = { // table of character substitutions - '\b': '\\b', - '\t': '\\t', - '\n': '\\n', - '\f': '\\f', - '\r': '\\r', - '"' : '\\"', - '\\': '\\\\' - }, - rep; - - - function quote(string) { - -// If the string contains no control characters, no quote characters, and no -// backslash characters, then we can safely slap some quotes around it. -// Otherwise we must also replace the offending characters with safe escape -// sequences. - - escapable.lastIndex = 0; - return escapable.test(string) ? - '"' + string.replace(escapable, function (a) { - var c = meta[a]; - return typeof c === 'string' ? c : - '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }) + '"' : - '"' + string + '"'; - } - - - function str(key, holder) { - -// Produce a string from holder[key]. - - var i, // The loop counter. - k, // The member key. - v, // The member value. - length, - mind = gap, - partial, - value = holder[key]; - -// If the value has a toJSON method, call it to obtain a replacement value. - - if (value && typeof value === 'object' && - typeof value.toJSON === 'function') { - value = value.toJSON(key); - } - -// If we were called with a replacer function, then call the replacer to -// obtain a replacement value. - - if (typeof rep === 'function') { - value = rep.call(holder, key, value); - } - -// What happens next depends on the value's type. - - switch (typeof value) { - case 'string': - return quote(value); - - case 'number': - -// JSON numbers must be finite. Encode non-finite numbers as null. - - return isFinite(value) ? String(value) : 'null'; - - case 'boolean': - case 'null': - -// If the value is a boolean or null, convert it to a string. Note: -// typeof null does not produce 'null'. The case is included here in -// the remote chance that this gets fixed someday. - - return String(value); - -// If the type is 'object', we might be dealing with an object or an array or -// null. - - case 'object': - -// Due to a specification blunder in ECMAScript, typeof null is 'object', -// so watch out for that case. - - if (!value) { - return 'null'; - } - -// Make an array to hold the partial results of stringifying this object value. - - gap += indent; - partial = []; - -// Is the value an array? - - if (Object.prototype.toString.apply(value) === '[object Array]') { - -// The value is an array. Stringify every element. Use null as a placeholder -// for non-JSON values. - - length = value.length; - for (i = 0; i < length; i += 1) { - partial[i] = str(i, value) || 'null'; - } - -// Join all of the elements together, separated with commas, and wrap them in -// brackets. - - v = partial.length === 0 ? '[]' : - gap ? '[\n' + gap + - partial.join(',\n' + gap) + '\n' + - mind + ']' : - '[' + partial.join(',') + ']'; - gap = mind; - return v; - } - -// If the replacer is an array, use it to select the members to be stringified. - - if (rep && typeof rep === 'object') { - length = rep.length; - for (i = 0; i < length; i += 1) { - k = rep[i]; - if (typeof k === 'string') { - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } - } - } else { - -// Otherwise, iterate through all of the keys in the object. - - for (k in value) { - if (Object.hasOwnProperty.call(value, k)) { - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } - } - } - -// Join all of the member texts together, separated with commas, -// and wrap them in braces. - - v = partial.length === 0 ? '{}' : - gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + - mind + '}' : '{' + partial.join(',') + '}'; - gap = mind; - return v; - } - } - -// If the JSON object does not yet have a stringify method, give it one. - - if (typeof JSON.stringify !== 'function') { - JSON.stringify = function (value, replacer, space) { - -// The stringify method takes a value and an optional replacer, and an optional -// space parameter, and returns a JSON text. The replacer can be a function -// that can replace values, or an array of strings that will select the keys. -// A default replacer method can be provided. Use of the space parameter can -// produce text that is more easily readable. - - var i; - gap = ''; - indent = ''; - -// If the space parameter is a number, make an indent string containing that -// many spaces. - - if (typeof space === 'number') { - for (i = 0; i < space; i += 1) { - indent += ' '; - } - -// If the space parameter is a string, it will be used as the indent string. - - } else if (typeof space === 'string') { - indent = space; - } - -// If there is a replacer, it must be a function or an array. -// Otherwise, throw an error. - - rep = replacer; - if (replacer && typeof replacer !== 'function' && - (typeof replacer !== 'object' || - typeof replacer.length !== 'number')) { - throw new Error('JSON.stringify'); - } - -// Make a fake root object containing our value under the key of ''. -// Return the result of stringifying the value. - - return str('', {'': value}); - }; - } - - -// If the JSON object does not yet have a parse method, give it one. - - if (typeof JSON.parse !== 'function') { - JSON.parse = function (text, reviver) { - -// The parse method takes a text and an optional reviver function, and returns -// a JavaScript value if the text is a valid JSON text. - - var j; - - function walk(holder, key) { - -// The walk method is used to recursively walk the resulting structure so -// that modifications can be made. - - var k, v, value = holder[key]; - if (value && typeof value === 'object') { - for (k in value) { - if (Object.hasOwnProperty.call(value, k)) { - v = walk(value, k); - if (v !== undefined) { - value[k] = v; - } else { - delete value[k]; - } - } - } - } - return reviver.call(holder, key, value); - } - - -// Parsing happens in four stages. In the first stage, we replace certain -// Unicode characters with escape sequences. JavaScript handles many characters -// incorrectly, either silently deleting them, or treating them as line endings. - - text = String(text); - cx.lastIndex = 0; - if (cx.test(text)) { - text = text.replace(cx, function (a) { - return '\\u' + - ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }); - } - -// In the second stage, we run the text against regular expressions that look -// for non-JSON patterns. We are especially concerned with '()' and 'new' -// because they can cause invocation, and '=' because it can cause mutation. -// But just to be safe, we want to reject all unexpected forms. - -// We split the second stage into 4 regexp operations in order to work around -// crippling inefficiencies in IE's and Safari's regexp engines. First we -// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we -// replace all simple value tokens with ']' characters. Third, we delete all -// open brackets that follow a colon or comma or that begin the text. Finally, -// we look to see that the remaining characters are only whitespace or ']' or -// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. - - if (/^[\],:{}\s]*$/ -.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') -.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') -.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { - -// In the third stage we use the eval function to compile the text into a -// JavaScript structure. The '{' operator is subject to a syntactic ambiguity -// in JavaScript: it can begin a block or an object literal. We wrap the text -// in parens to eliminate the ambiguity. - - j = eval('(' + text + ')'); - -// In the optional fourth stage, we recursively walk the new structure, passing -// each name/value pair to a reviver function for possible transformation. - - return typeof reviver === 'function' ? - walk({'': j}, '') : j; - } - -// If the text is not JSON parseable, then a SyntaxError is thrown. - - throw new SyntaxError('JSON.parse'); - }; - } -}()); diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/doc/nodeunit.md b/node_modules/connect/node_modules/crc/tests/nodeunit/doc/nodeunit.md deleted file mode 100644 index efde75c..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/doc/nodeunit.md +++ /dev/null @@ -1,60 +0,0 @@ -nodeunit(1) -- simple node.js unit testing tool -=============================================== - -## SYNOPSIS - - nodeunit [options] [ ...] - -## DESCRIPTION - -Nodeunit is a simple unit testing tool based on the node.js assert module. - -* Simple to use -* Just export the tests from a module -* Helps you avoid common pitfalls when testing asynchronous code -* Easy to add test cases with setUp and tearDown functions if you wish -* Allows the use of mocks and stubs - -## OPTIONS - - __--config FILE__: - Load config options from a JSON file, allows the customisation - of color schemes for the default test reporter etc. - See bin/nodeunit.json for current available options. - - __--reporter FILE__: - You can set the test reporter to a custom module or on of the modules - in nodeunit/lib/reporters, when omitted, the default test runner is used. - - __--list-reporters__: - List available build-in reporters. - - __-h__, __--help__: - Display the help and exit. - - __-v__, __--version__: - Output version information and exit. - - ____: - You can run nodeunit on specific files or on all *\*.js* files inside - a directory. - -## AUTHORS - -Written by Caolan McMahon and other nodeunit contributors. -Contributors list: . - -## REPORTING BUGS - -Report nodeunit bugs to . - -## COPYRIGHT - -Copyright © 2010 Caolan McMahon. -Nodeunit has been released under the MIT license: -. - -## SEE ALSO - -node(1) - diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/nodeunit.js b/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/nodeunit.js deleted file mode 100644 index 8c12b0f..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/nodeunit.js +++ /dev/null @@ -1,1757 +0,0 @@ -/*! - * Nodeunit - * https://github.com/caolan/nodeunit - * Copyright (c) 2010 Caolan McMahon - * MIT Licensed - * - * json2.js - * http://www.JSON.org/json2.js - * Public Domain. - * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. - */ -nodeunit = (function(){ -/* - http://www.JSON.org/json2.js - 2010-11-17 - - Public Domain. - - NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. - - See http://www.JSON.org/js.html - - - This code should be minified before deployment. - See http://javascript.crockford.com/jsmin.html - - USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO - NOT CONTROL. - - - This file creates a global JSON object containing two methods: stringify - and parse. - - JSON.stringify(value, replacer, space) - value any JavaScript value, usually an object or array. - - replacer an optional parameter that determines how object - values are stringified for objects. It can be a - function or an array of strings. - - space an optional parameter that specifies the indentation - of nested structures. If it is omitted, the text will - be packed without extra whitespace. If it is a number, - it will specify the number of spaces to indent at each - level. If it is a string (such as '\t' or ' '), - it contains the characters used to indent at each level. - - This method produces a JSON text from a JavaScript value. - - When an object value is found, if the object contains a toJSON - method, its toJSON method will be called and the result will be - stringified. A toJSON method does not serialize: it returns the - value represented by the name/value pair that should be serialized, - or undefined if nothing should be serialized. The toJSON method - will be passed the key associated with the value, and this will be - bound to the value - - For example, this would serialize Dates as ISO strings. - - Date.prototype.toJSON = function (key) { - function f(n) { - // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; - } - - return this.getUTCFullYear() + '-' + - f(this.getUTCMonth() + 1) + '-' + - f(this.getUTCDate()) + 'T' + - f(this.getUTCHours()) + ':' + - f(this.getUTCMinutes()) + ':' + - f(this.getUTCSeconds()) + 'Z'; - }; - - You can provide an optional replacer method. It will be passed the - key and value of each member, with this bound to the containing - object. The value that is returned from your method will be - serialized. If your method returns undefined, then the member will - be excluded from the serialization. - - If the replacer parameter is an array of strings, then it will be - used to select the members to be serialized. It filters the results - such that only members with keys listed in the replacer array are - stringified. - - Values that do not have JSON representations, such as undefined or - functions, will not be serialized. Such values in objects will be - dropped; in arrays they will be replaced with null. You can use - a replacer function to replace those with JSON values. - JSON.stringify(undefined) returns undefined. - - The optional space parameter produces a stringification of the - value that is filled with line breaks and indentation to make it - easier to read. - - If the space parameter is a non-empty string, then that string will - be used for indentation. If the space parameter is a number, then - the indentation will be that many spaces. - - Example: - - text = JSON.stringify(['e', {pluribus: 'unum'}]); - // text is '["e",{"pluribus":"unum"}]' - - - text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t'); - // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]' - - text = JSON.stringify([new Date()], function (key, value) { - return this[key] instanceof Date ? - 'Date(' + this[key] + ')' : value; - }); - // text is '["Date(---current time---)"]' - - - JSON.parse(text, reviver) - This method parses a JSON text to produce an object or array. - It can throw a SyntaxError exception. - - The optional reviver parameter is a function that can filter and - transform the results. It receives each of the keys and values, - and its return value is used instead of the original value. - If it returns what it received, then the structure is not modified. - If it returns undefined then the member is deleted. - - Example: - - // Parse the text. Values that look like ISO date strings will - // be converted to Date objects. - - myData = JSON.parse(text, function (key, value) { - var a; - if (typeof value === 'string') { - a = -/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value); - if (a) { - return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], - +a[5], +a[6])); - } - } - return value; - }); - - myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) { - var d; - if (typeof value === 'string' && - value.slice(0, 5) === 'Date(' && - value.slice(-1) === ')') { - d = new Date(value.slice(5, -1)); - if (d) { - return d; - } - } - return value; - }); - - - This is a reference implementation. You are free to copy, modify, or - redistribute. -*/ - -/*jslint evil: true, strict: false, regexp: false */ - -/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply, - call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours, - getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join, - lastIndex, length, parse, prototype, push, replace, slice, stringify, - test, toJSON, toString, valueOf -*/ - - -// Create a JSON object only if one does not already exist. We create the -// methods in a closure to avoid creating global variables. - -if (!this.JSON) { - this.JSON = {}; -} - -(function () { - "use strict"; - - function f(n) { - // Format integers to have at least two digits. - return n < 10 ? '0' + n : n; - } - - if (typeof Date.prototype.toJSON !== 'function') { - - Date.prototype.toJSON = function (key) { - - return isFinite(this.valueOf()) ? - this.getUTCFullYear() + '-' + - f(this.getUTCMonth() + 1) + '-' + - f(this.getUTCDate()) + 'T' + - f(this.getUTCHours()) + ':' + - f(this.getUTCMinutes()) + ':' + - f(this.getUTCSeconds()) + 'Z' : null; - }; - - String.prototype.toJSON = - Number.prototype.toJSON = - Boolean.prototype.toJSON = function (key) { - return this.valueOf(); - }; - } - - var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, - gap, - indent, - meta = { // table of character substitutions - '\b': '\\b', - '\t': '\\t', - '\n': '\\n', - '\f': '\\f', - '\r': '\\r', - '"' : '\\"', - '\\': '\\\\' - }, - rep; - - - function quote(string) { - -// If the string contains no control characters, no quote characters, and no -// backslash characters, then we can safely slap some quotes around it. -// Otherwise we must also replace the offending characters with safe escape -// sequences. - - escapable.lastIndex = 0; - return escapable.test(string) ? - '"' + string.replace(escapable, function (a) { - var c = meta[a]; - return typeof c === 'string' ? c : - '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }) + '"' : - '"' + string + '"'; - } - - - function str(key, holder) { - -// Produce a string from holder[key]. - - var i, // The loop counter. - k, // The member key. - v, // The member value. - length, - mind = gap, - partial, - value = holder[key]; - -// If the value has a toJSON method, call it to obtain a replacement value. - - if (value && typeof value === 'object' && - typeof value.toJSON === 'function') { - value = value.toJSON(key); - } - -// If we were called with a replacer function, then call the replacer to -// obtain a replacement value. - - if (typeof rep === 'function') { - value = rep.call(holder, key, value); - } - -// What happens next depends on the value's type. - - switch (typeof value) { - case 'string': - return quote(value); - - case 'number': - -// JSON numbers must be finite. Encode non-finite numbers as null. - - return isFinite(value) ? String(value) : 'null'; - - case 'boolean': - case 'null': - -// If the value is a boolean or null, convert it to a string. Note: -// typeof null does not produce 'null'. The case is included here in -// the remote chance that this gets fixed someday. - - return String(value); - -// If the type is 'object', we might be dealing with an object or an array or -// null. - - case 'object': - -// Due to a specification blunder in ECMAScript, typeof null is 'object', -// so watch out for that case. - - if (!value) { - return 'null'; - } - -// Make an array to hold the partial results of stringifying this object value. - - gap += indent; - partial = []; - -// Is the value an array? - - if (Object.prototype.toString.apply(value) === '[object Array]') { - -// The value is an array. Stringify every element. Use null as a placeholder -// for non-JSON values. - - length = value.length; - for (i = 0; i < length; i += 1) { - partial[i] = str(i, value) || 'null'; - } - -// Join all of the elements together, separated with commas, and wrap them in -// brackets. - - v = partial.length === 0 ? '[]' : - gap ? '[\n' + gap + - partial.join(',\n' + gap) + '\n' + - mind + ']' : - '[' + partial.join(',') + ']'; - gap = mind; - return v; - } - -// If the replacer is an array, use it to select the members to be stringified. - - if (rep && typeof rep === 'object') { - length = rep.length; - for (i = 0; i < length; i += 1) { - k = rep[i]; - if (typeof k === 'string') { - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } - } - } else { - -// Otherwise, iterate through all of the keys in the object. - - for (k in value) { - if (Object.hasOwnProperty.call(value, k)) { - v = str(k, value); - if (v) { - partial.push(quote(k) + (gap ? ': ' : ':') + v); - } - } - } - } - -// Join all of the member texts together, separated with commas, -// and wrap them in braces. - - v = partial.length === 0 ? '{}' : - gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + - mind + '}' : '{' + partial.join(',') + '}'; - gap = mind; - return v; - } - } - -// If the JSON object does not yet have a stringify method, give it one. - - if (typeof JSON.stringify !== 'function') { - JSON.stringify = function (value, replacer, space) { - -// The stringify method takes a value and an optional replacer, and an optional -// space parameter, and returns a JSON text. The replacer can be a function -// that can replace values, or an array of strings that will select the keys. -// A default replacer method can be provided. Use of the space parameter can -// produce text that is more easily readable. - - var i; - gap = ''; - indent = ''; - -// If the space parameter is a number, make an indent string containing that -// many spaces. - - if (typeof space === 'number') { - for (i = 0; i < space; i += 1) { - indent += ' '; - } - -// If the space parameter is a string, it will be used as the indent string. - - } else if (typeof space === 'string') { - indent = space; - } - -// If there is a replacer, it must be a function or an array. -// Otherwise, throw an error. - - rep = replacer; - if (replacer && typeof replacer !== 'function' && - (typeof replacer !== 'object' || - typeof replacer.length !== 'number')) { - throw new Error('JSON.stringify'); - } - -// Make a fake root object containing our value under the key of ''. -// Return the result of stringifying the value. - - return str('', {'': value}); - }; - } - - -// If the JSON object does not yet have a parse method, give it one. - - if (typeof JSON.parse !== 'function') { - JSON.parse = function (text, reviver) { - -// The parse method takes a text and an optional reviver function, and returns -// a JavaScript value if the text is a valid JSON text. - - var j; - - function walk(holder, key) { - -// The walk method is used to recursively walk the resulting structure so -// that modifications can be made. - - var k, v, value = holder[key]; - if (value && typeof value === 'object') { - for (k in value) { - if (Object.hasOwnProperty.call(value, k)) { - v = walk(value, k); - if (v !== undefined) { - value[k] = v; - } else { - delete value[k]; - } - } - } - } - return reviver.call(holder, key, value); - } - - -// Parsing happens in four stages. In the first stage, we replace certain -// Unicode characters with escape sequences. JavaScript handles many characters -// incorrectly, either silently deleting them, or treating them as line endings. - - text = String(text); - cx.lastIndex = 0; - if (cx.test(text)) { - text = text.replace(cx, function (a) { - return '\\u' + - ('0000' + a.charCodeAt(0).toString(16)).slice(-4); - }); - } - -// In the second stage, we run the text against regular expressions that look -// for non-JSON patterns. We are especially concerned with '()' and 'new' -// because they can cause invocation, and '=' because it can cause mutation. -// But just to be safe, we want to reject all unexpected forms. - -// We split the second stage into 4 regexp operations in order to work around -// crippling inefficiencies in IE's and Safari's regexp engines. First we -// replace the JSON backslash pairs with '@' (a non-JSON character). Second, we -// replace all simple value tokens with ']' characters. Third, we delete all -// open brackets that follow a colon or comma or that begin the text. Finally, -// we look to see that the remaining characters are only whitespace or ']' or -// ',' or ':' or '{' or '}'. If that is so, then the text is safe for eval. - - if (/^[\],:{}\s]*$/ -.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@') -.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']') -.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) { - -// In the third stage we use the eval function to compile the text into a -// JavaScript structure. The '{' operator is subject to a syntactic ambiguity -// in JavaScript: it can begin a block or an object literal. We wrap the text -// in parens to eliminate the ambiguity. - - j = eval('(' + text + ')'); - -// In the optional fourth stage, we recursively walk the new structure, passing -// each name/value pair to a reviver function for possible transformation. - - return typeof reviver === 'function' ? - walk({'': j}, '') : j; - } - -// If the text is not JSON parseable, then a SyntaxError is thrown. - - throw new SyntaxError('JSON.parse'); - }; - } -}()); -var assert = {}; -var types = {}; -var core = {}; -var nodeunit = {}; -var reporter = {}; -(function(){ - - var async = {}; - - // global on the server, window in the browser - var root = this; - var previous_async = root.async; - - if(typeof module !== 'undefined' && module.exports) module.exports = async; - else root.async = async; - - async.noConflict = function(){ - root.async = previous_async; - return async; - }; - - //// cross-browser compatiblity functions //// - - var _forEach = function(arr, iterator){ - if(arr.forEach) return arr.forEach(iterator); - for(var i=0; i b ? 1 : 0; - }), function(x){return x.value;})); - }) - }; - - async.auto = function(tasks, callback){ - callback = callback || function(){}; - var keys = _keys(tasks); - if(!keys.length) return callback(null); - - var completed = []; - - var listeners = []; - var addListener = function(fn){ - listeners.unshift(fn); - }; - var removeListener = function(fn){ - for(var i=0; i -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the 'Software'), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -var pSlice = Array.prototype.slice; - -// 1. The assert module provides functions that throw -// AssertionError's when particular conditions are not met. The -// assert module must conform to the following interface. - -var assert = exports; - -// 2. The AssertionError is defined in assert. -// new assert.AssertionError({message: message, actual: actual, expected: expected}) - -assert.AssertionError = function AssertionError (options) { - this.name = "AssertionError"; - this.message = options.message; - this.actual = options.actual; - this.expected = options.expected; - this.operator = options.operator; - var stackStartFunction = options.stackStartFunction || fail; - - if (Error.captureStackTrace) { - Error.captureStackTrace(this, stackStartFunction); - } -}; -// code from util.inherits in node -assert.AssertionError.super_ = Error; - - -// EDITED FOR BROWSER COMPATIBILITY: replaced Object.create call -// TODO: test what effect this may have -var ctor = function () { this.constructor = assert.AssertionError; }; -ctor.prototype = Error.prototype; -assert.AssertionError.prototype = new ctor(); - - -assert.AssertionError.prototype.toString = function() { - if (this.message) { - return [this.name+":", this.message].join(' '); - } else { - return [ this.name+":" - , JSON.stringify(this.expected ) - , this.operator - , JSON.stringify(this.actual) - ].join(" "); - } -}; - -// assert.AssertionError instanceof Error - -assert.AssertionError.__proto__ = Error.prototype; - -// At present only the three keys mentioned above are used and -// understood by the spec. Implementations or sub modules can pass -// other keys to the AssertionError's constructor - they will be -// ignored. - -// 3. All of the following functions must throw an AssertionError -// when a corresponding condition is not met, with a message that -// may be undefined if not provided. All assertion methods provide -// both the actual and expected values to the assertion error for -// display purposes. - -function fail(actual, expected, message, operator, stackStartFunction) { - throw new assert.AssertionError({ - message: message, - actual: actual, - expected: expected, - operator: operator, - stackStartFunction: stackStartFunction - }); -} - -// EXTENSION! allows for well behaved errors defined elsewhere. -assert.fail = fail; - -// 4. Pure assertion tests whether a value is truthy, as determined -// by !!guard. -// assert.ok(guard, message_opt); -// This statement is equivalent to assert.equal(true, guard, -// message_opt);. To test strictly for the value true, use -// assert.strictEqual(true, guard, message_opt);. - -assert.ok = function ok(value, message) { - if (!!!value) fail(value, true, message, "==", assert.ok); -}; - -// 5. The equality assertion tests shallow, coercive equality with -// ==. -// assert.equal(actual, expected, message_opt); - -assert.equal = function equal(actual, expected, message) { - if (actual != expected) fail(actual, expected, message, "==", assert.equal); -}; - -// 6. The non-equality assertion tests for whether two objects are not equal -// with != assert.notEqual(actual, expected, message_opt); - -assert.notEqual = function notEqual(actual, expected, message) { - if (actual == expected) { - fail(actual, expected, message, "!=", assert.notEqual); - } -}; - -// 7. The equivalence assertion tests a deep equality relation. -// assert.deepEqual(actual, expected, message_opt); - -assert.deepEqual = function deepEqual(actual, expected, message) { - if (!_deepEqual(actual, expected)) { - fail(actual, expected, message, "deepEqual", assert.deepEqual); - } -}; - -function _deepEqual(actual, expected) { - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - - } else if (Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) { - if (actual.length != expected.length) return false; - - for (var i = 0; i < actual.length; i++) { - if (actual[i] !== expected[i]) return false; - } - - return true; - - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (actual instanceof Date && expected instanceof Date) { - return actual.getTime() === expected.getTime(); - - // 7.3. Other pairs that do not both pass typeof value == "object", - // equivalence is determined by ==. - } else if (typeof actual != 'object' && typeof expected != 'object') { - return actual == expected; - - // 7.4. For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical "prototype" property. Note: this - // accounts for both named and indexed properties on Arrays. - } else { - return objEquiv(actual, expected); - } -} - -function isUndefinedOrNull (value) { - return value === null || value === undefined; -} - -function isArguments (object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; -} - -function objEquiv (a, b) { - if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) - return false; - // an identical "prototype" property. - if (a.prototype !== b.prototype) return false; - //~~~I've managed to break Object.keys through screwy arguments passing. - // Converting to array solves the problem. - if (isArguments(a)) { - if (!isArguments(b)) { - return false; - } - a = pSlice.call(a); - b = pSlice.call(b); - return _deepEqual(a, b); - } - try{ - var ka = _keys(a), - kb = _keys(b), - key, i; - } catch (e) {//happens when one is a string literal and the other isn't - return false; - } - // having the same number of owned properties (keys incorporates hasOwnProperty) - if (ka.length != kb.length) - return false; - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) - return false; - } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!_deepEqual(a[key], b[key] )) - return false; - } - return true; -} - -// 8. The non-equivalence assertion tests for any deep inequality. -// assert.notDeepEqual(actual, expected, message_opt); - -assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (_deepEqual(actual, expected)) { - fail(actual, expected, message, "notDeepEqual", assert.notDeepEqual); - } -}; - -// 9. The strict equality assertion tests strict equality, as determined by ===. -// assert.strictEqual(actual, expected, message_opt); - -assert.strictEqual = function strictEqual(actual, expected, message) { - if (actual !== expected) { - fail(actual, expected, message, "===", assert.strictEqual); - } -}; - -// 10. The strict non-equality assertion tests for strict inequality, as determined by !==. -// assert.notStrictEqual(actual, expected, message_opt); - -assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (actual === expected) { - fail(actual, expected, message, "!==", assert.notStrictEqual); - } -}; - -function _throws (shouldThrow, block, err, message) { - var exception = null, - threw = false, - typematters = true; - - message = message || ""; - - //handle optional arguments - if (arguments.length == 3) { - if (typeof(err) == "string") { - message = err; - typematters = false; - } - } else if (arguments.length == 2) { - typematters = false; - } - - try { - block(); - } catch (e) { - threw = true; - exception = e; - } - - if (shouldThrow && !threw) { - fail( "Missing expected exception" - + (err && err.name ? " ("+err.name+")." : '.') - + (message ? " " + message : "") - ); - } - if (!shouldThrow && threw && typematters && exception instanceof err) { - fail( "Got unwanted exception" - + (err && err.name ? " ("+err.name+")." : '.') - + (message ? " " + message : "") - ); - } - if ((shouldThrow && threw && typematters && !(exception instanceof err)) || - (!shouldThrow && threw)) { - throw exception; - } -}; - -// 11. Expected to throw an error: -// assert.throws(block, Error_opt, message_opt); - -assert.throws = function(block, /*optional*/error, /*optional*/message) { - _throws.apply(this, [true].concat(pSlice.call(arguments))); -}; - -// EXTENSION! This is annoying to write outside this module. -assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { - _throws.apply(this, [false].concat(pSlice.call(arguments))); -}; - -assert.ifError = function (err) { if (err) {throw err;}}; -})(assert); -(function(exports){ -/*! - * Nodeunit - * Copyright (c) 2010 Caolan McMahon - * MIT Licensed - * - * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! - * Only code on that line will be removed, its mostly to avoid requiring code - * that is node specific - */ - -/** - * Module dependencies - */ - - - -/** - * Creates assertion objects representing the result of an assert call. - * Accepts an object or AssertionError as its argument. - * - * @param {object} obj - * @api public - */ - -exports.assertion = function (obj) { - return { - method: obj.method || '', - message: obj.message || (obj.error && obj.error.message) || '', - error: obj.error, - passed: function () { - return !this.error; - }, - failed: function () { - return Boolean(this.error); - } - }; -}; - -/** - * Creates an assertion list object representing a group of assertions. - * Accepts an array of assertion objects. - * - * @param {Array} arr - * @param {Number} duration - * @api public - */ - -exports.assertionList = function (arr, duration) { - var that = arr || []; - that.failures = function () { - var failures = 0; - for (var i=0; i'; -}; - - -/** - * Run all tests within each module, reporting the results - * - * @param {Array} files - * @api public - */ - -exports.run = function (modules, options) { - var start = new Date().getTime(); - exports.addStyles(); - - var html = ''; - nodeunit.runModules(modules, { - moduleStart: function (name) { - html += '

    ' + name + '

    '; - html += '
      '; - }, - testDone: function (name, assertions) { - if (!assertions.failures()) { - html += '
    1. ' + name + '
    2. '; - } - else { - html += '
    3. ' + name; - for (var i=0; i'; - } - html += '
      ';
      -                        html += a.error.stack || a.error;
      -                        html += '
      '; - } - }; - html += '
    4. '; - } - }, - moduleDone: function () { - html += '
    '; - }, - done: function (assertions) { - var end = new Date().getTime(); - var duration = end - start; - if (assertions.failures()) { - html += '

    FAILURES: ' + assertions.failures() + - '/' + assertions.length + ' assertions failed (' + - assertions.duration + 'ms)

    '; - } - else { - html += '

    OK: ' + assertions.length + - ' assertions (' + assertions.duration + 'ms)

    '; - } - document.body.innerHTML += html; - } - }); -}; -})(reporter); -nodeunit = core; -nodeunit.assert = assert; -nodeunit.reporter = reporter; -nodeunit.run = reporter.run; -return nodeunit; })(); diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/suite1.js b/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/suite1.js deleted file mode 100644 index 0d5fc90..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/suite1.js +++ /dev/null @@ -1,12 +0,0 @@ -this.suite1 = { - 'test one': function (test) { - test.ok(true, 'everythings ok'); - setTimeout(function () { - test.done(); - }, 10); - }, - 'apples and oranges': function (test) { - test.equal('apples', 'oranges', 'comparing apples and oranges'); - test.done(); - } -}; diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/suite2.js b/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/suite2.js deleted file mode 100644 index c7288e8..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/suite2.js +++ /dev/null @@ -1,13 +0,0 @@ -this.suite2 = { - 'another test': function (test) { - setTimeout(function () { - // lots of assertions - test.ok(true, 'everythings ok'); - test.ok(true, 'everythings ok'); - test.ok(true, 'everythings ok'); - test.ok(true, 'everythings ok'); - test.ok(true, 'everythings ok'); - test.done(); - }, 10); - } -}; diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/test.html b/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/test.html deleted file mode 100644 index e9f8180..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/examples/browser/test.html +++ /dev/null @@ -1,16 +0,0 @@ - - - Example tests - - - - - - - - diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/img/example_fail.png b/node_modules/connect/node_modules/crc/tests/nodeunit/img/example_fail.png deleted file mode 100644 index 78ff425..0000000 Binary files a/node_modules/connect/node_modules/crc/tests/nodeunit/img/example_fail.png and /dev/null differ diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/img/example_pass.png b/node_modules/connect/node_modules/crc/tests/nodeunit/img/example_pass.png deleted file mode 100644 index 069d716..0000000 Binary files a/node_modules/connect/node_modules/crc/tests/nodeunit/img/example_pass.png and /dev/null differ diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/index.js b/node_modules/connect/node_modules/crc/tests/nodeunit/index.js deleted file mode 100644 index 07867d0..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// This file is just added for convenience so this repository can be -// directly checked out into a project's deps folder -module.exports = require('./lib/nodeunit'); diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/lib/assert.js b/node_modules/connect/node_modules/crc/tests/nodeunit/lib/assert.js deleted file mode 100644 index 8d9e0e3..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/lib/assert.js +++ /dev/null @@ -1,316 +0,0 @@ -/** - * This file is based on the node.js assert module, but with some small - * changes for browser-compatibility - * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! - */ - - -/** - * Added for browser compatibility - */ - -var _keys = function(obj){ - if(Object.keys) return Object.keys(obj); - var keys = []; - for(var k in obj){ - if(obj.hasOwnProperty(k)) keys.push(k); - } - return keys; -}; - - - -// http://wiki.commonjs.org/wiki/Unit_Testing/1.0 -// -// THIS IS NOT TESTED NOR LIKELY TO WORK OUTSIDE V8! -// -// Originally from narwhal.js (http://narwhaljs.org) -// Copyright (c) 2009 Thomas Robinson <280north.com> -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the 'Software'), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN -// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - -var pSlice = Array.prototype.slice; - -// 1. The assert module provides functions that throw -// AssertionError's when particular conditions are not met. The -// assert module must conform to the following interface. - -var assert = exports; - -// 2. The AssertionError is defined in assert. -// new assert.AssertionError({message: message, actual: actual, expected: expected}) - -assert.AssertionError = function AssertionError (options) { - this.name = "AssertionError"; - this.message = options.message; - this.actual = options.actual; - this.expected = options.expected; - this.operator = options.operator; - var stackStartFunction = options.stackStartFunction || fail; - - if (Error.captureStackTrace) { - Error.captureStackTrace(this, stackStartFunction); - } -}; -// code from util.inherits in node -assert.AssertionError.super_ = Error; - - -// EDITED FOR BROWSER COMPATIBILITY: replaced Object.create call -// TODO: test what effect this may have -var ctor = function () { this.constructor = assert.AssertionError; }; -ctor.prototype = Error.prototype; -assert.AssertionError.prototype = new ctor(); - - -assert.AssertionError.prototype.toString = function() { - if (this.message) { - return [this.name+":", this.message].join(' '); - } else { - return [ this.name+":" - , JSON.stringify(this.expected ) - , this.operator - , JSON.stringify(this.actual) - ].join(" "); - } -}; - -// assert.AssertionError instanceof Error - -assert.AssertionError.__proto__ = Error.prototype; - -// At present only the three keys mentioned above are used and -// understood by the spec. Implementations or sub modules can pass -// other keys to the AssertionError's constructor - they will be -// ignored. - -// 3. All of the following functions must throw an AssertionError -// when a corresponding condition is not met, with a message that -// may be undefined if not provided. All assertion methods provide -// both the actual and expected values to the assertion error for -// display purposes. - -function fail(actual, expected, message, operator, stackStartFunction) { - throw new assert.AssertionError({ - message: message, - actual: actual, - expected: expected, - operator: operator, - stackStartFunction: stackStartFunction - }); -} - -// EXTENSION! allows for well behaved errors defined elsewhere. -assert.fail = fail; - -// 4. Pure assertion tests whether a value is truthy, as determined -// by !!guard. -// assert.ok(guard, message_opt); -// This statement is equivalent to assert.equal(true, guard, -// message_opt);. To test strictly for the value true, use -// assert.strictEqual(true, guard, message_opt);. - -assert.ok = function ok(value, message) { - if (!!!value) fail(value, true, message, "==", assert.ok); -}; - -// 5. The equality assertion tests shallow, coercive equality with -// ==. -// assert.equal(actual, expected, message_opt); - -assert.equal = function equal(actual, expected, message) { - if (actual != expected) fail(actual, expected, message, "==", assert.equal); -}; - -// 6. The non-equality assertion tests for whether two objects are not equal -// with != assert.notEqual(actual, expected, message_opt); - -assert.notEqual = function notEqual(actual, expected, message) { - if (actual == expected) { - fail(actual, expected, message, "!=", assert.notEqual); - } -}; - -// 7. The equivalence assertion tests a deep equality relation. -// assert.deepEqual(actual, expected, message_opt); - -assert.deepEqual = function deepEqual(actual, expected, message) { - if (!_deepEqual(actual, expected)) { - fail(actual, expected, message, "deepEqual", assert.deepEqual); - } -}; - -function _deepEqual(actual, expected) { - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (actual instanceof Date && expected instanceof Date) { - return actual.getTime() === expected.getTime(); - - // 7.3. Other pairs that do not both pass typeof value == "object", - // equivalence is determined by ==. - } else if (typeof actual != 'object' && typeof expected != 'object') { - return actual == expected; - - // 7.4. For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical "prototype" property. Note: this - // accounts for both named and indexed properties on Arrays. - } else { - return objEquiv(actual, expected); - } -} - -function isUndefinedOrNull (value) { - return value === null || value === undefined; -} - -function isArguments (object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; -} - -function objEquiv (a, b) { - if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) - return false; - // an identical "prototype" property. - if (a.prototype !== b.prototype) return false; - //~~~I've managed to break Object.keys through screwy arguments passing. - // Converting to array solves the problem. - if (isArguments(a)) { - if (!isArguments(b)) { - return false; - } - a = pSlice.call(a); - b = pSlice.call(b); - return _deepEqual(a, b); - } - try{ - var ka = _keys(a), - kb = _keys(b), - key, i; - } catch (e) {//happens when one is a string literal and the other isn't - return false; - } - // having the same number of owned properties (keys incorporates hasOwnProperty) - if (ka.length != kb.length) - return false; - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) - return false; - } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!_deepEqual(a[key], b[key] )) - return false; - } - return true; -} - -// 8. The non-equivalence assertion tests for any deep inequality. -// assert.notDeepEqual(actual, expected, message_opt); - -assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (_deepEqual(actual, expected)) { - fail(actual, expected, message, "notDeepEqual", assert.notDeepEqual); - } -}; - -// 9. The strict equality assertion tests strict equality, as determined by ===. -// assert.strictEqual(actual, expected, message_opt); - -assert.strictEqual = function strictEqual(actual, expected, message) { - if (actual !== expected) { - fail(actual, expected, message, "===", assert.strictEqual); - } -}; - -// 10. The strict non-equality assertion tests for strict inequality, as determined by !==. -// assert.notStrictEqual(actual, expected, message_opt); - -assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (actual === expected) { - fail(actual, expected, message, "!==", assert.notStrictEqual); - } -}; - -function _throws (shouldThrow, block, err, message) { - var exception = null, - threw = false, - typematters = true; - - message = message || ""; - - //handle optional arguments - if (arguments.length == 3) { - if (typeof(err) == "string") { - message = err; - typematters = false; - } - } else if (arguments.length == 2) { - typematters = false; - } - - try { - block(); - } catch (e) { - threw = true; - exception = e; - } - - if (shouldThrow && !threw) { - fail( "Missing expected exception" - + (err && err.name ? " ("+err.name+")." : '.') - + (message ? " " + message : "") - ); - } - if (!shouldThrow && threw && typematters && exception instanceof err) { - fail( "Got unwanted exception" - + (err && err.name ? " ("+err.name+")." : '.') - + (message ? " " + message : "") - ); - } - if ((shouldThrow && threw && typematters && !(exception instanceof err)) || - (!shouldThrow && threw)) { - throw exception; - } -}; - -// 11. Expected to throw an error: -// assert.throws(block, Error_opt, message_opt); - -assert.throws = function(block, /*optional*/error, /*optional*/message) { - _throws.apply(this, [true].concat(pSlice.call(arguments))); -}; - -// EXTENSION! This is annoying to write outside this module. -assert.doesNotThrow = function(block, /*optional*/error, /*optional*/message) { - _throws.apply(this, [false].concat(pSlice.call(arguments))); -}; - -assert.ifError = function (err) { if (err) {throw err;}}; diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/lib/core.js b/node_modules/connect/node_modules/crc/tests/nodeunit/lib/core.js deleted file mode 100644 index 981d7c6..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/lib/core.js +++ /dev/null @@ -1,236 +0,0 @@ -/*! - * Nodeunit - * Copyright (c) 2010 Caolan McMahon - * MIT Licensed - * - * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! - * You can use @REMOVE_LINE_FOR_BROWSER to remove code from the browser build. - * Only code on that line will be removed, its mostly to avoid requiring code - * that is node specific - */ - -/** - * Module dependencies - */ - -var async = require('../deps/async'), //@REMOVE_LINE_FOR_BROWSER - types = require('./types'); //@REMOVE_LINE_FOR_BROWSER - - -/** - * Added for browser compatibility - */ - -var _keys = function(obj){ - if(Object.keys) return Object.keys(obj); - var keys = []; - for(var k in obj){ - if(obj.hasOwnProperty(k)) keys.push(k); - } - return keys; -}; - - -/** - * Runs a test function (fn) from a loaded module. After the test function - * calls test.done(), the callback is executed with an assertionList as its - * second argument. - * - * @param {String} name - * @param {Function} fn - * @param {Object} opt - * @param {Function} callback - * @api public - */ - -exports.runTest = function (name, fn, opt, callback) { - var options = types.options(opt); - - options.testStart(name); - var start = new Date().getTime(); - var test = types.test(name, start, options, callback); - - try { - fn(test); - } - catch (e) { - test.done(e); - } -}; - -/** - * Takes an object containing test functions or other test suites as properties - * and runs each in series. After all tests have completed, the callback is - * called with a list of all assertions as the second argument. - * - * If a name is passed to this function it is prepended to all test and suite - * names that run within it. - * - * @param {String} name - * @param {Object} suite - * @param {Object} opt - * @param {Function} callback - * @api public - */ - -exports.runSuite = function (name, suite, opt, callback) { - var keys = _keys(suite); - - async.concatSeries(keys, function (k, cb) { - var prop = suite[k], _name; - - _name = name ? [].concat(name, k) : [k]; - - _name.toString = function () { - // fallback for old one - return this.join(' - '); - }; - - if (typeof prop === 'function') { - exports.runTest(_name, suite[k], opt, cb); - } - else { - exports.runSuite(_name, suite[k], opt, cb); - } - }, callback); -}; - -/** - * Run each exported test function or test suite from a loaded module. - * - * @param {String} name - * @param {Object} mod - * @param {Object} opt - * @param {Function} callback - * @api public - */ - -exports.runModule = function (name, mod, opt, callback) { - var options = types.options(opt); - - options.moduleStart(name); - var start = new Date().getTime(); - - exports.runSuite(null, mod, opt, function (err, a_list) { - var end = new Date().getTime(); - var assertion_list = types.assertionList(a_list, end - start); - options.moduleDone(name, assertion_list); - callback(null, a_list); - }); -}; - -/** - * Treats an object literal as a list of modules keyed by name. Runs each - * module and finished with calling 'done'. You can think of this as a browser - * safe alternative to runFiles in the nodeunit module. - * - * @param {Object} modules - * @param {Object} opt - * @api public - */ - -// TODO: add proper unit tests for this function -exports.runModules = function (modules, opt) { - var all_assertions = []; - var options = types.options(opt); - var start = new Date().getTime(); - - async.concatSeries(_keys(modules), function (k, cb) { - exports.runModule(k, modules[k], options, cb); - }, - function (err, all_assertions) { - var end = new Date().getTime(); - options.done(types.assertionList(all_assertions, end - start)); - }); -}; - - -/** - * Wraps a test function with setUp and tearDown functions. - * Used by testCase. - * - * @param {Function} setUp - * @param {Function} tearDown - * @param {Function} fn - * @api private - */ - -var wrapTest = function (setUp, tearDown, fn) { - return function (test) { - var context = {}; - if (tearDown) { - var done = test.done; - test.done = function (err) { - try { - tearDown.call(context, function (err2) { - if (err && err2) { - test._assertion_list.push( - types.assertion({error: err}) - ); - return done(err2); - } - done(err || err2); - }); - } - catch (e) { - done(e); - } - }; - } - if (setUp) { - setUp.call(context, function (err) { - if (err) { - return test.done(err); - } - fn.call(context, test); - }); - } - else { - fn.call(context, test); - } - } -}; - - -/** - * Wraps a group of tests with setUp and tearDown functions. - * Used by testCase. - * - * @param {Function} setUp - * @param {Function} tearDown - * @param {Object} group - * @api private - */ - -var wrapGroup = function (setUp, tearDown, group) { - var tests = {}; - var keys = _keys(group); - for (var i=0; i(' + - '' + assertions.failures() + ', ' + - '' + assertions.passes() + ', ' + - assertions.length + - ')'; - test.className = assertions.failures() ? 'fail': 'pass'; - test.appendChild(strong); - - var aList = document.createElement('ol'); - aList.style.display = 'none'; - test.onclick = function () { - var d = aList.style.display; - aList.style.display = (d == 'none') ? 'block': 'none'; - }; - for (var i=0; i' + (a.error.stack || a.error) + ''; - li.className = 'fail'; - } - else { - li.innerHTML = a.message || a.method || 'no message'; - li.className = 'pass'; - } - aList.appendChild(li); - } - test.appendChild(aList); - tests.appendChild(test); - }, - done: function (assertions) { - var end = new Date().getTime(); - var duration = end - start; - - var failures = assertions.failures(); - banner.className = failures ? 'fail': 'pass'; - - result.innerHTML = 'Tests completed in ' + duration + - ' milliseconds.
    ' + - assertions.passes() + ' assertions of ' + - '' + assertions.length + ' passed, ' + - assertions.failures() + ' failed.'; - } - }); -}; diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/default.js b/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/default.js deleted file mode 100644 index c3d725d..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/default.js +++ /dev/null @@ -1,110 +0,0 @@ -/*! - * Nodeunit - * Copyright (c) 2010 Caolan McMahon - * MIT Licensed - */ - -/** - * Module dependencies - */ - -var nodeunit = require('../nodeunit'), - utils = require('../utils'), - fs = require('fs'), - sys = require('sys'), - path = require('path'); - AssertionError = require('../assert').AssertionError; - -/** - * Reporter info string - */ - -exports.info = "Default tests reporter"; - - -/** - * Run all tests within each module, reporting the results to the command-line. - * - * @param {Array} files - * @api public - */ - -exports.run = function (files, options) { - - if (!options) { - // load default options - var content = fs.readFileSync( - __dirname + '/../../bin/nodeunit.json', 'utf8' - ); - options = JSON.parse(content); - } - - var error = function (str) { - return options.error_prefix + str + options.error_suffix; - }; - var ok = function (str) { - return options.ok_prefix + str + options.ok_suffix; - }; - var bold = function (str) { - return options.bold_prefix + str + options.bold_suffix; - }; - var assertion_message = function (str) { - return options.assertion_prefix + str + options.assertion_suffix; - }; - - var start = new Date().getTime(); - var paths = files.map(function (p) { - return path.join(process.cwd(), p); - }); - - nodeunit.runFiles(paths, { - moduleStart: function (name) { - sys.puts('\n' + bold(name)); - }, - testDone: function (name, assertions) { - if (!assertions.failures()) { - sys.puts('✔ ' + name); - } - else { - sys.puts(error('✖ ' + name) + '\n'); - assertions.forEach(function (a) { - if (a.failed()) { - a = utils.betterErrors(a); - if (a.error instanceof AssertionError && a.message) { - sys.puts( - 'Assertion Message: ' + - assertion_message(a.message) - ); - } - sys.puts(a.error.stack + '\n'); - } - }); - } - }, - done: function (assertions) { - var end = new Date().getTime(); - var duration = end - start; - if (assertions.failures()) { - sys.puts( - '\n' + bold(error('FAILURES: ')) + assertions.failures() + - '/' + assertions.length + ' assertions failed (' + - assertions.duration + 'ms)' - ); - } - else { - sys.puts( - '\n' + bold(ok('OK: ')) + assertions.length + - ' assertions (' + assertions.duration + 'ms)' - ); - } - // alexgorbatchev 2010-11-10 :: should be able to flush stdout - // here, but doesn't seem to work, instead delay the exit to give - // enough to time flush. - // process.stdout.flush() - // process.stdout.end() - setTimeout(function () { - process.reallyExit(assertions.failures()); - }, 10); - } - }); -}; diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/html.js b/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/html.js deleted file mode 100644 index a693c2d..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/html.js +++ /dev/null @@ -1,112 +0,0 @@ -/*! - * Nodeunit - * Copyright (c) 2010 Caolan McMahon - * MIT Licensed - */ - -/** - * Module dependencies - */ - -var nodeunit = require('../nodeunit'), - utils = require('../utils'), - fs = require('fs'), - sys = require('sys'), - path = require('path'), - AssertionError = require('assert').AssertionError; - -/** - * Reporter info string - */ - -exports.info = "Report tests result as HTML"; - -/** - * Run all tests within each module, reporting the results to the command-line. - * - * @param {Array} files - * @api public - */ - -exports.run = function (files, options) { - - var start = new Date().getTime(); - var paths = files.map(function (p) { - return path.join(process.cwd(), p); - }); - - sys.puts(''); - sys.puts(''); - sys.puts(''); - sys.puts(''); - sys.puts(''); - sys.puts(''); - nodeunit.runFiles(paths, { - moduleStart: function (name) { - sys.puts('

    ' + name + '

    '); - sys.puts('
      '); - }, - testDone: function (name, assertions) { - if (!assertions.failures()) { - sys.puts('
    1. ' + name + '
    2. '); - } - else { - sys.puts('
    3. ' + name); - assertions.forEach(function (a) { - if (a.failed()) { - a = utils.betterErrors(a); - if (a.error instanceof AssertionError && a.message) { - sys.puts('
      ' + - 'Assertion Message: ' + a.message + - '
      '); - } - sys.puts('
      ');
      -                        sys.puts(a.error.stack);
      -                        sys.puts('
      '); - } - }); - sys.puts('
    4. '); - } - }, - moduleDone: function () { - sys.puts('
    '); - }, - done: function (assertions) { - var end = new Date().getTime(); - var duration = end - start; - if (assertions.failures()) { - sys.puts( - '

    FAILURES: ' + assertions.failures() + - '/' + assertions.length + ' assertions failed (' + - assertions.duration + 'ms)

    ' - ); - } - else { - sys.puts( - '

    OK: ' + assertions.length + - ' assertions (' + assertions.duration + 'ms)

    ' - ); - } - sys.puts(''); - // should be able to flush stdout here, but doesn't seem to work, - // instead delay the exit to give enough to time flush. - setTimeout(function () { - process.reallyExit(assertions.failures()); - }, 10); - } - }); - -}; diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/index.js b/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/index.js deleted file mode 100644 index bbaf800..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/index.js +++ /dev/null @@ -1,9 +0,0 @@ -module.exports = { - 'junit': require('./junit'), - 'default': require('./default'), - 'skip_passed': require('./skip_passed'), - 'minimal': require('./minimal'), - 'html': require('./html') - // browser test reporter is not listed because it cannot be used - // with the command line tool, only inside a browser. -}; diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/junit.js b/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/junit.js deleted file mode 100644 index bc1e1ec..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/lib/reporters/junit.js +++ /dev/null @@ -1,183 +0,0 @@ -/*! - * Nodeunit - * Copyright (c) 2010 Caolan McMahon - * MIT Licensed - */ - -/** - * Module dependencies - */ - -var nodeunit = require('../nodeunit'), - utils = require('../utils'), - fs = require('fs'), - sys = require('sys'), - path = require('path'), - async = require('../../deps/async'), - AssertionError = require('assert').AssertionError, - child_process = require('child_process'), - ejs = require('../../deps/ejs'); - - -/** - * Reporter info string - */ - -exports.info = "jUnit XML test reports"; - - -/** - * Ensures a directory exists using mkdir -p. - * - * @param {String} path - * @param {Function} callback - * @api private - */ - -var ensureDir = function (path, callback) { - var mkdir = child_process.spawn('mkdir', ['-p', path]); - mkdir.on('error', function (err) { - callback(err); - callback = function(){}; - }); - mkdir.on('exit', function (code) { - if (code === 0) callback(); - else callback(new Error('mkdir exited with code: ' + code)); - }); -}; - - -/** - * Returns absolute version of a path. Relative paths are interpreted - * relative to process.cwd() or the cwd parameter. Paths that are already - * absolute are returned unaltered. - * - * @param {String} p - * @param {String} cwd - * @return {String} - * @api public - */ - -var abspath = function (p, /*optional*/cwd) { - if (p[0] === '/') return p; - cwd = cwd || process.cwd(); - return path.normalize(path.join(cwd, p)); -}; - - -/** - * Run all tests within each module, reporting the results to the command-line, - * then writes out junit-compatible xml documents. - * - * @param {Array} files - * @api public - */ - -exports.run = function (files, opts, callback) { - if (!opts.output) { - console.error( - 'Error: No output directory defined.\n' + - '\tEither add an "output" property to your nodeunit.json config ' + - 'file, or\n\tuse the --output command line option.' - ); - return; - } - opts.output = abspath(opts.output); - var error = function (str) { - return opts.error_prefix + str + opts.error_suffix; - }; - var ok = function (str) { - return opts.ok_prefix + str + opts.ok_suffix; - }; - var bold = function (str) { - return opts.bold_prefix + str + opts.bold_suffix; - }; - - var start = new Date().getTime(); - var paths = files.map(function (p) { - return path.join(process.cwd(), p); - }); - - var modules = {} - var curModule; - - nodeunit.runFiles(paths, { - moduleStart: function (name) { - curModule = { - errorCount: 0, - failureCount: 0, - tests: 0, - testcases: [], - name: name - }; - modules[name] = curModule; - }, - testDone: function (name, assertions) { - var testcase = {name: name}; - for (var i=0; i [ \.\.\.] -. -.fi -. -.SH "DESCRIPTION" -Nodeunit is a simple unit testing tool based on the node\.js assert module\. -. -.IP "\(bu" 4 -Simple to use -. -.IP "\(bu" 4 -Just export the tests from a module -. -.IP "\(bu" 4 -Helps you avoid common pitfalls when testing asynchronous code -. -.IP "\(bu" 4 -Easy to add test cases with setUp and tearDown functions if you wish -. -.IP "\(bu" 4 -Allows the use of mocks and stubs -. -.IP "" 0 -. -.SH "OPTIONS" - \fB\-\-config FILE\fR: -. -.br - Load config options from a JSON file, allows the customisation - of color schemes for the default test reporter etc\. - See bin/nodeunit\.json for current available options\. -. -.P - \fB\-\-reporter FILE\fR: -. -.br - You can set the test reporter to a custom module or on of the modules - in nodeunit/lib/reporters, when omitted, the default test runner is used\. -. -.P - \fB\-\-list\-reporters\fR: -. -.br - List available build\-in reporters\. -. -.P - \fB\-h\fR, \fB\-\-help\fR: -. -.br - Display the help and exit\. -. -.P - \fB\-v\fR, \fB\-\-version\fR: -. -.br - Output version information and exit\. -. -.P - \fB\fR: - You can run nodeunit on specific files or on all \fI*\.js\fR files inside -. -.br - a directory\. -. -.SH "AUTHORS" -Written by Caolan McMahon and other nodeunit contributors\. -. -.br -Contributors list: \fIhttp://github\.com/caolan/nodeunit/contributors\fR\|\. -. -.SH "REPORTING BUGS" -Report nodeunit bugs to \fIhttp://github\.com/caolan/nodeunit/issues\fR\|\. -. -.SH "COPYRIGHT" -Copyright © 2010 Caolan McMahon\. -. -.br -Nodeunit has been released under the MIT license: -. -.br -\fIhttp://github\.com/caolan/nodeunit/raw/master/LICENSE\fR\|\. -. -.SH "SEE ALSO" -node(1) diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/nodelint.cfg b/node_modules/connect/node_modules/crc/tests/nodeunit/nodelint.cfg deleted file mode 100644 index 457a967..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/nodelint.cfg +++ /dev/null @@ -1,4 +0,0 @@ -var options = { - indent: 4, - onevar: false -}; diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/package.json b/node_modules/connect/node_modules/crc/tests/nodeunit/package.json deleted file mode 100644 index 20cd2fa..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ "name": "nodeunit" -, "description": "Easy unit testing for node.js and the browser." -, "maintainers": - [ { "name": "Caolan McMahon" - , "web": "https://github.com/caolan" - } - ] -, "contributors" : - [ { "name": "Alex Gorbatchev" - , "web": "https://github.com/alexgorbatchev" - } - , { "name": "Alex Wolfe" - , "web": "https://github.com/alexkwolfe" - } - , { "name": "Carl Fürstenberg" - , "web": "https://github.com/azatoth" - } - , { "name": "Gerad Suyderhoud" - , "web": "https://github.com/gerad" - } - , { "name": "Kadir Pekel" - , "web": "https://github.com/coffeemate" - } - , { "name": "Oleg Efimov" - , "web": "https://github.com/Sannis" - } - , { "name": "Orlando Vazquez" - , "web": "https://github.com/orlandov" - } - , { "name": "Ryan Dahl" - , "web": "https://github.com/ry" - } - , { "name": "Sam Stephenson" - , "web": "https://github.com/sstephenson" - } - , { "name": "Thomas Mayfield" - , "web": "https://github.com/thegreatape" - } - ] -, "version": "0.5.0" -, "repository" : - { "type" : "git" - , "url" : "http://github.com/caolan/nodeunit.git" - } -, "bugs" : { "web" : "http://github.com/caolan/nodeunit/issues" } -, "licenses" : - [ { "type" : "MIT" - , "url" : "http://github.com/caolan/nodeunit/raw/master/LICENSE" - } - ] -, "directories" : { "lib": "./lib", "doc" : "./doc", "man" : "./man1" } -, "bin" : { "nodeunit" : "./bin/nodeunit" } -} diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/share/junit.xml.ejs b/node_modules/connect/node_modules/crc/tests/nodeunit/share/junit.xml.ejs deleted file mode 100644 index c1db5bb..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/share/junit.xml.ejs +++ /dev/null @@ -1,19 +0,0 @@ - -<% for (var i=0; i < suites.length; i++) { %> - <% var suite=suites[i]; %> - - <% for (var j=0; j < suite.testcases.length; j++) { %> - <% var testcase=suites[i].testcases[j]; %> - - <% if (testcase.failure) { %> - - <% if (testcase.failure.backtrace) { %><%= testcase.failure.backtrace %><% } %> - - <% } %> - - <% } %> - -<% } %> diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/share/license.js b/node_modules/connect/node_modules/crc/tests/nodeunit/share/license.js deleted file mode 100644 index f0f326f..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/share/license.js +++ /dev/null @@ -1,11 +0,0 @@ -/*! - * Nodeunit - * https://github.com/caolan/nodeunit - * Copyright (c) 2010 Caolan McMahon - * MIT Licensed - * - * json2.js - * http://www.JSON.org/json2.js - * Public Domain. - * NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK. - */ diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/share/nodeunit.css b/node_modules/connect/node_modules/crc/tests/nodeunit/share/nodeunit.css deleted file mode 100644 index 274434a..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/share/nodeunit.css +++ /dev/null @@ -1,70 +0,0 @@ -/*! - * Styles taken from qunit.css - */ - -h1#nodeunit-header, h1.nodeunit-header { - padding: 15px; - font-size: large; - background-color: #06b; - color: white; - font-family: 'trebuchet ms', verdana, arial; - margin: 0; -} - -h1#nodeunit-header a { - color: white; -} - -h2#nodeunit-banner { - height: 2em; - border-bottom: 1px solid white; - background-color: #eee; - margin: 0; - font-family: 'trebuchet ms', verdana, arial; -} -h2#nodeunit-banner.pass { - background-color: green; -} -h2#nodeunit-banner.fail { - background-color: red; -} - -h2#nodeunit-userAgent, h2.nodeunit-userAgent { - padding: 10px; - background-color: #eee; - color: black; - margin: 0; - font-size: small; - font-weight: normal; - font-family: 'trebuchet ms', verdana, arial; - font-size: 10pt; -} - -div#nodeunit-testrunner-toolbar { - background: #eee; - border-top: 1px solid black; - padding: 10px; - font-family: 'trebuchet ms', verdana, arial; - margin: 0; - font-size: 10pt; -} - -ol#nodeunit-tests { - font-family: 'trebuchet ms', verdana, arial; - font-size: 10pt; -} -ol#nodeunit-tests li strong { - cursor:pointer; -} -ol#nodeunit-tests .pass { - color: green; -} -ol#nodeunit-tests .fail { - color: red; -} - -p#nodeunit-testresult { - margin-left: 1em; - font-size: 10pt; - font-family: 'trebuchet ms', verdana, arial; -} diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/coffee/mock_coffee_module.coffee b/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/coffee/mock_coffee_module.coffee deleted file mode 100644 index a1c069b..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/coffee/mock_coffee_module.coffee +++ /dev/null @@ -1,4 +0,0 @@ -j = 0 -j += i for i in [0..5] - -exports.name = "mock_coffee_#{j}" diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/dir/mock_module3.js b/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/dir/mock_module3.js deleted file mode 100644 index 3021776..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/dir/mock_module3.js +++ /dev/null @@ -1 +0,0 @@ -exports.name = 'mock_module3'; diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/dir/mock_module4.js b/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/dir/mock_module4.js deleted file mode 100644 index 876f9ca..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/dir/mock_module4.js +++ /dev/null @@ -1 +0,0 @@ -exports.name = 'mock_module4'; diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/mock_module1.js b/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/mock_module1.js deleted file mode 100644 index 4c093ad..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/mock_module1.js +++ /dev/null @@ -1 +0,0 @@ -exports.name = 'mock_module1'; diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/mock_module2.js b/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/mock_module2.js deleted file mode 100644 index a63d012..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/mock_module2.js +++ /dev/null @@ -1 +0,0 @@ -exports.name = 'mock_module2'; diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/raw_jscode1.js b/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/raw_jscode1.js deleted file mode 100644 index 2ef7115..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/raw_jscode1.js +++ /dev/null @@ -1,3 +0,0 @@ -function hello_world(arg) { - return "_" + arg + "_"; -} diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/raw_jscode2.js b/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/raw_jscode2.js deleted file mode 100644 index 55a764e..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/raw_jscode2.js +++ /dev/null @@ -1,3 +0,0 @@ -function get_a_variable() { - return typeof a_variable; -} diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/raw_jscode3.js b/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/raw_jscode3.js deleted file mode 100644 index 1fd1e78..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/test/fixtures/raw_jscode3.js +++ /dev/null @@ -1 +0,0 @@ -var t=t?t+1:1; diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-base.js b/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-base.js deleted file mode 100644 index 64b8c8b..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-base.js +++ /dev/null @@ -1,219 +0,0 @@ -/* - * This module is not a plain nodeunit test suite, but instead uses the - * assert module to ensure a basic level of functionality is present, - * allowing the rest of the tests to be written using nodeunit itself. - * - * THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! - * You can use @REMOVE_LINE_FOR_BROWSER to remove code from the browser build. - * Only code on that line will be removed, its mostly to avoid requiring code - * that is node specific - */ - -var assert = require('assert'), // @REMOVE_LINE_FOR_BROWSER - async = require('../deps/async'), // @REMOVE_LINE_FOR_BROWSER - nodeunit = require('../lib/nodeunit'); // @REMOVE_LINE_FOR_BROWSER - - -// NOT A TEST - util function to make testing faster. -// retries the assertion until it passes or the timeout is reached, -// at which point it throws the assertion error -var waitFor = function (fn, timeout, callback, start) { - start = start || new Date().getTime(); - callback = callback || function () {}; - try { - fn(); - callback(); - } - catch (e) { - if (e instanceof assert.AssertionError) { - var now = new Date().getTime(); - if (now - start >= timeout) { - throw e; - } - else { - async.nextTick(function () { - waitFor(fn, timeout, callback, start); - }); - } - } - else { - throw e; - } - } -}; - - -// TESTS: - -// Are exported tests actually run? - store completed tests in this variable -// for checking later -var tests_called = {}; - -// most basic test that should run, the tests_called object is tested -// at the end of this module to ensure the tests were actually run by nodeunit -exports.testCalled = function (test) { - tests_called.testCalled = true; - test.done(); -}; - -// generates test functions for nodeunit assertions -var makeTest = function (method, args_pass, args_fail) { - return function (test) { - var test1_called = false; - var test2_called = false; - - // test pass - nodeunit.runTest( - 'testname', - function (test) { - test[method].apply(test, args_pass); - test.done(); - }, - {testDone: function (name, assertions) { - assert.equal(assertions.length, 1); - assert.equal(assertions.failures(), 0); - }}, - function () { - test1_called = true; - } - ); - - // test failure - nodeunit.runTest( - 'testname', - function (test) { - test[method].apply(test, args_fail); - test.done(); - }, - {testDone: function (name, assertions) { - assert.equal(assertions.length, 1); - assert.equal(assertions.failures(), 1); - }}, - function () { - test2_called = true; - } - ); - - // ensure tests were run - waitFor(function () { - assert.ok(test1_called); - assert.ok(test2_called); - tests_called[method] = true; - }, 500, test.done); - }; -}; - -// ensure basic assertions are working: -exports.testOk = makeTest('ok', [true], [false]); -exports.testEquals = makeTest('equals', [1, 1], [1, 2]); -exports.testSame = makeTest('same', - [{test: 'test'}, {test: 'test'}], - [{test: 'test'}, {monkey: 'penguin'}] -); - -// from the assert module: -exports.testEqual = makeTest('equal', [1, 1], [1, 2]); -exports.testNotEqual = makeTest('notEqual', [1, 2], [1, 1]); -exports.testDeepEqual = makeTest('deepEqual', - [{one: 1}, {one: 1}], [{one: 1}, {two: 2}] -); -exports.testNotDeepEqual = makeTest('notDeepEqual', - [{one: 1}, {two: 2}], [{one: 1}, {one: 1}] -); -exports.testStrictEqual = makeTest('strictEqual', [1, 1], [1, true]); -exports.testNotStrictEqual = makeTest('notStrictEqual', [true, 1], [1, 1]); -exports.testThrows = makeTest('throws', - [function () { - throw new Error('test'); - }], - [function () { - return; - }] -); -exports.testDoesNotThrows = makeTest('doesNotThrow', - [function () { - return; - }], - [function () { - throw new Error('test'); - }] -); -exports.testIfError = makeTest('ifError', [false], [new Error('test')]); - - -exports.testExpect = function (test) { - var test1_called = false, - test2_called = false, - test3_called = false; - - // correct number of tests run - nodeunit.runTest( - 'testname', - function (test) { - test.expect(2); - test.ok(true); - test.ok(true); - test.done(); - }, - {testDone: function (name, assertions) { - test.equals(assertions.length, 2); - test.equals(assertions.failures(), 0); - }}, - function () { - test1_called = true; - } - ); - - // no tests run - nodeunit.runTest( - 'testname', - function (test) { - test.expect(2); - test.done(); - }, - {testDone: function (name, assertions) { - test.equals(assertions.length, 1); - test.equals(assertions.failures(), 1); - }}, - function () { - test2_called = true; - } - ); - - // incorrect number of tests run - nodeunit.runTest( - 'testname', - function (test) { - test.expect(2); - test.ok(true); - test.ok(true); - test.ok(true); - test.done(); - }, - {testDone: function (name, assertions) { - test.equals(assertions.length, 4); - test.equals(assertions.failures(), 1); - }}, - function () { - test3_called = true; - } - ); - - // ensure callbacks fired - waitFor(function () { - assert.ok(test1_called); - assert.ok(test2_called); - assert.ok(test3_called); - tests_called.expect = true; - }, 500, test.done); -}; - - -// tests are async, so wait for them to be called -waitFor(function () { - assert.ok(tests_called.testCalled); - assert.ok(tests_called.ok); - assert.ok(tests_called.equals); - assert.ok(tests_called.same); - assert.ok(tests_called.expect); -}, 10000); diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-failing-callbacks.js b/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-failing-callbacks.js deleted file mode 100644 index 08f7eb5..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-failing-callbacks.js +++ /dev/null @@ -1,114 +0,0 @@ -var nodeunit = require('../lib/nodeunit'); - - -exports.testFailingLog = function (test) { - test.expect(3); - - // this is meant to bubble to the top, and will be ignored for the purposes - // of testing: - var ignored_error = new Error('ignore this callback error'); - var err_handler = function (err) { - if (err && err.message !== ignored_error.message) { - throw err; - } - }; - process.addListener('uncaughtException', err_handler); - - // A failing callback should not affect the test outcome - var testfn = function (test) { - test.ok(true, 'test.ok'); - test.done(); - }; - nodeunit.runTest('testname', testfn, { - log: function (assertion) { - test.ok(true, 'log called'); - throw ignored_error; - }, - testDone: function (name, assertions) { - test.equals(assertions.failures(), 0, 'failures'); - test.equals(assertions.length, 1, 'total'); - process.removeListener('uncaughtException', err_handler); - } - }, test.done); -}; - -exports.testFailingTestDone = function (test) { - test.expect(2); - - var ignored_error = new Error('ignore this callback error'); - var err_handler = function (err) { - if (err && err.message !== ignored_error.message) { - throw err; - } - }; - process.addListener('uncaughtException', err_handler); - - // A failing callback should not affect the test outcome - var testfn = function (test) { - test.done(); - }; - nodeunit.runTest('testname', testfn, { - log: function (assertion) { - test.ok(false, 'log should not be called'); - }, - testDone: function (name, assertions) { - test.equals(assertions.failures(), 0, 'failures'); - test.equals(assertions.length, 0, 'total'); - process.nextTick(function () { - process.removeListener('uncaughtException', err_handler); - test.done(); - }); - throw ignored_error; - } - }, function () {}); -}; - -exports.testAssertionObj = function (test) { - test.expect(4); - var testfn = function (test) { - test.ok(true, 'ok true'); - test.done(); - }; - nodeunit.runTest('testname', testfn, { - log: function (assertion) { - test.ok(assertion.passed() === true, 'assertion.passed'); - test.ok(assertion.failed() === false, 'assertion.failed'); - }, - testDone: function (name, assertions) { - test.equals(assertions.failures(), 0, 'failures'); - test.equals(assertions.length, 1, 'total'); - } - }, test.done); -}; - -exports.testLogOptional = function (test) { - test.expect(2); - var testfn = function (test) { - test.ok(true, 'ok true'); - test.done(); - }; - nodeunit.runTest('testname', testfn, { - testDone: function (name, assertions) { - test.equals(assertions.failures(), 0, 'failures'); - test.equals(assertions.length, 1, 'total'); - } - }, test.done); -}; - -exports.testExpectWithFailure = function (test) { - test.expect(3); - var testfn = function (test) { - test.expect(1); - test.ok(false, 'test.ok'); - test.done(); - }; - nodeunit.runTest('testname', testfn, { - log: function (assertion) { - test.equals(assertion.method, 'ok', 'assertion.method'); - }, - testDone: function (name, assertions) { - test.equals(assertions.failures(), 1, 'failures'); - test.equals(assertions.length, 1, 'total'); - } - }, test.done); -}; diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-httputil.js b/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-httputil.js deleted file mode 100644 index e5ee25c..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-httputil.js +++ /dev/null @@ -1,55 +0,0 @@ -var nodeunit = require('../lib/nodeunit'); -var httputil = require('../lib/utils').httputil; - -exports.testHttpUtilBasics = function (test) { - - test.expect(6); - - httputil(function (req, resp) { - test.equal(req.method, 'PUT'); - test.equal(req.url, '/newpair'); - test.equal(req.headers.foo, 'bar'); - - resp.writeHead(500, {'content-type': 'text/plain'}); - resp.end('failed'); - }, function (server, client) { - client.fetch('PUT', '/newpair', {'foo': 'bar'}, function (resp) { - test.equal(resp.statusCode, 500); - test.equal(resp.headers['content-type'], 'text/plain'); - test.equal(resp.body, 'failed'); - - server.close(); - test.done(); - }); - }); -}; - -exports.testHttpUtilJsonHandling = function (test) { - - test.expect(9); - - httputil(function (req, resp) { - test.equal(req.method, 'GET'); - test.equal(req.url, '/'); - test.equal(req.headers.foo, 'bar'); - - var testdata = {foo1: 'bar', foo2: 'baz'}; - - resp.writeHead(200, {'content-type': 'application/json'}); - resp.end(JSON.stringify(testdata)); - - }, function (server, client) { - client.fetch('GET', '/', {'foo': 'bar'}, function (resp) { - test.equal(resp.statusCode, 200); - test.equal(resp.headers['content-type'], 'application/json'); - - test.ok(resp.bodyAsObject); - test.equal(typeof resp.bodyAsObject, 'object'); - test.equal(resp.bodyAsObject.foo1, 'bar'); - test.equal(resp.bodyAsObject.foo2, 'baz'); - - server.close(); - test.done(); - }); - }); -}; diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-runfiles.js b/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-runfiles.js deleted file mode 100644 index b9ef754..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-runfiles.js +++ /dev/null @@ -1,214 +0,0 @@ -var assert = require('assert'), - sys = require('sys'), - fs = require('fs'), - path = require('path'), - nodeunit = require('../lib/nodeunit'); - - -var setup = function (fn) { - return function (test) { - process.chdir(__dirname); - require.paths.push(__dirname); - var env = { - mock_module1: require('./fixtures/mock_module1'), - mock_module2: require('./fixtures/mock_module2'), - mock_module3: require('./fixtures/dir/mock_module3'), - mock_module4: require('./fixtures/dir/mock_module4') - }; - fn.call(env, test); - }; -}; - - -exports.testRunFiles = setup(function (test) { - test.expect(24); - var runModule_copy = nodeunit.runModule; - - var runModule_calls = []; - var modules = []; - - var opts = { - moduleStart: function () { - return 'moduleStart'; - }, - testDone: function () { - return 'testDone'; - }, - testStart: function () { - return 'testStart'; - }, - log: function () { - return 'log'; - }, - done: function (assertions) { - test.equals(assertions.failures(), 0, 'failures'); - test.equals(assertions.length, 4, 'length'); - test.ok(typeof assertions.duration === "number"); - - var called_with = function (name) { - return runModule_calls.some(function (m) { - return m.name === name; - }); - }; - test.ok(called_with('mock_module1'), 'mock_module1 ran'); - test.ok(called_with('mock_module2'), 'mock_module2 ran'); - test.ok(called_with('mock_module3'), 'mock_module3 ran'); - test.ok(called_with('mock_module4'), 'mock_module4 ran'); - test.equals(runModule_calls.length, 4); - - nodeunit.runModule = runModule_copy; - test.done(); - } - }; - - nodeunit.runModule = function (name, mod, options, callback) { - test.equals(options.testDone, opts.testDone); - test.equals(options.testStart, opts.testStart); - test.equals(options.log, opts.log); - test.ok(typeof name === "string"); - runModule_calls.push(mod); - var m = [{failed: function () { - return false; - }}]; - modules.push(m); - callback(null, m); - }; - - nodeunit.runFiles( - ['fixtures/mock_module1.js', 'fixtures/mock_module2.js', 'fixtures/dir'], - opts - ); -}); - -exports.testRunFilesEmpty = function (test) { - test.expect(3); - nodeunit.runFiles([], { - moduleStart: function () { - test.ok(false, 'should not be called'); - }, - testDone: function () { - test.ok(false, 'should not be called'); - }, - testStart: function () { - test.ok(false, 'should not be called'); - }, - log: function () { - test.ok(false, 'should not be called'); - }, - done: function (assertions) { - test.equals(assertions.failures(), 0, 'failures'); - test.equals(assertions.length, 0, 'length'); - test.ok(typeof assertions.duration === "number"); - test.done(); - } - }); -}; - - -exports.testEmptyDir = function (test) { - var dir2 = __dirname + '/fixtures/dir2'; - - // git doesn't like empty directories, so we have to create one - path.exists(dir2, function (exists) { - if (!exists) { - fs.mkdirSync(dir2, 0777); - } - - // runFiles on empty directory: - nodeunit.runFiles([dir2], { - moduleStart: function () { - test.ok(false, 'should not be called'); - }, - testDone: function () { - test.ok(false, 'should not be called'); - }, - testStart: function () { - test.ok(false, 'should not be called'); - }, - log: function () { - test.ok(false, 'should not be called'); - }, - done: function (assertions) { - test.equals(assertions.failures(), 0, 'failures'); - test.equals(assertions.length, 0, 'length'); - test.ok(typeof assertions.duration === "number"); - test.done(); - } - }); - }); -}; - - -var CoffeeScript; -try { - CoffeeScript = require('coffee-script'); -} catch (e) { -} - -if (CoffeeScript) { - exports.testCoffeeScript = function (test) { - process.chdir(__dirname); - require.paths.push(__dirname); - var env = { - mock_coffee_module: require('./fixtures/coffee/mock_coffee_module') - }; - - test.expect(9); - var runModule_copy = nodeunit.runModule; - - var runModule_calls = []; - var modules = []; - - var opts = { - moduleStart: function () { - return 'moduleStart'; - }, - testDone: function () { - return 'testDone'; - }, - testStart: function () { - return 'testStart'; - }, - log: function () { - return 'log'; - }, - done: function (assertions) { - test.equals(assertions.failures(), 0, 'failures'); - test.equals(assertions.length, 1, 'length'); - test.ok(typeof assertions.duration === "number"); - - var called_with = function (name) { - return runModule_calls.some(function (m) { - return m.name === name; - }); - }; - test.ok( - called_with('mock_coffee_15'), - 'mock_coffee_module ran' - ); - test.equals(runModule_calls.length, 1); - - nodeunit.runModule = runModule_copy; - test.done(); - } - }; - - nodeunit.runModule = function (name, mod, options, callback) { - test.equals(options.testDone, opts.testDone); - test.equals(options.testStart, opts.testStart); - test.equals(options.log, opts.log); - test.ok(typeof name === "string"); - runModule_calls.push(mod); - var m = [{failed: function () { - return false; - }}]; - modules.push(m); - callback(null, m); - }; - - nodeunit.runFiles( - ['fixtures/coffee/mock_coffee_module.coffee'], - opts - ); - }; -} diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-runmodule.js b/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-runmodule.js deleted file mode 100644 index 218e8db..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-runmodule.js +++ /dev/null @@ -1,125 +0,0 @@ -/* THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! - * You can use @REMOVE_LINE_FOR_BROWSER to remove code from the browser build. - * Only code on that line will be removed, its mostly to avoid requiring code - * that is node specific - */ - -var nodeunit = require('../lib/nodeunit'); // @REMOVE_LINE_FOR_BROWSER - - -exports.testRunModule = function (test) { - test.expect(11); - var call_order = []; - var testmodule = { - test1: function (test) { - call_order.push('test1'); - test.ok(true, 'ok true'); - test.done(); - }, - test2: function (test) { - call_order.push('test2'); - test.ok(false, 'ok false'); - test.ok(false, 'ok false'); - test.done(); - }, - test3: function (test) { - call_order.push('test3'); - test.done(); - } - }; - nodeunit.runModule('testmodule', testmodule, { - log: function (assertion) { - call_order.push('log'); - }, - testStart: function (name) { - call_order.push('testStart'); - test.ok( - name.toString() === 'test1' || - name.toString() === 'test2' || - name.toString() === 'test3', - 'testStart called with test name ' - ); - }, - testDone: function (name, assertions) { - call_order.push('testDone'); - test.ok( - name.toString() === 'test1' || - name.toString() === 'test2' || - name.toString() === 'test3', - 'testDone called with test name' - ); - }, - moduleDone: function (name, assertions) { - call_order.push('moduleDone'); - test.equals(assertions.length, 3); - test.equals(assertions.failures(), 2); - test.equals(name, 'testmodule'); - test.ok(typeof assertions.duration === "number"); - test.same(call_order, [ - 'testStart', 'test1', 'log', 'testDone', - 'testStart', 'test2', 'log', 'log', 'testDone', - 'testStart', 'test3', 'testDone', - 'moduleDone' - ]); - } - }, test.done); -}; - -exports.testRunModuleEmpty = function (test) { - nodeunit.runModule('module with no exports', {}, { - log: function (assertion) { - test.ok(false, 'log should not be called'); - }, - testStart: function (name) { - test.ok(false, 'testStart should not be called'); - }, - testDone: function (name, assertions) { - test.ok(false, 'testDone should not be called'); - }, - moduleDone: function (name, assertions) { - test.equals(assertions.length, 0); - test.equals(assertions.failures(), 0); - test.equals(name, 'module with no exports'); - test.ok(typeof assertions.duration === "number"); - } - }, test.done); -}; - -exports.testNestedTests = function (test) { - var call_order = []; - var m = { - test1: function (test) { - test.done(); - }, - suite: { - t1: function (test) { - test.done(); - }, - t2: function (test) { - test.done(); - }, - another_suite: { - t3: function (test) { - test.done(); - } - } - } - }; - nodeunit.runModule('modulename', m, { - testStart: function (name) { - call_order.push(['testStart'].concat(name)); - }, - testDone: function (name, assertions) { - call_order.push(['testDone'].concat(name)); - } - }, function () { - test.same(call_order, [ - ['testStart', 'test1'], ['testDone', 'test1'], - ['testStart', 'suite', 't1'], ['testDone', 'suite', 't1'], - ['testStart', 'suite', 't2'], ['testDone', 'suite', 't2'], - ['testStart', 'suite', 'another_suite', 't3'], - ['testDone', 'suite', 'another_suite', 't3'] - ]); - test.done(); - }); -}; diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-runtest.js b/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-runtest.js deleted file mode 100644 index 8fc3d52..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-runtest.js +++ /dev/null @@ -1,46 +0,0 @@ -/* THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! - * You can use @REMOVE_LINE_FOR_BROWSER to remove code from the browser build. - * Only code on that line will be removed, its mostly to avoid requiring code - * that is node specific - */ - -var nodeunit = require('../lib/nodeunit'); // @REMOVE_LINE_FOR_BROWSER - - -exports.testArgs = function (test) { - test.ok(test.expect instanceof Function, 'test.expect'); - test.ok(test.done instanceof Function, 'test.done'); - test.ok(test.ok instanceof Function, 'test.ok'); - test.ok(test.same instanceof Function, 'test.same'); - test.ok(test.equals instanceof Function, 'test.equals'); - test.done(); -}; - -exports.testDoneCallback = function (test) { - test.expect(4); - nodeunit.runTest('testname', exports.testArgs, { - testDone: function (name, assertions) { - test.equals(assertions.failures(), 0, 'failures'); - test.equals(assertions.length, 5, 'length'); - test.ok(typeof assertions.duration === "number"); - test.equals(name, 'testname'); - } - }, test.done); -}; - -exports.testThrowError = function (test) { - test.expect(3); - var err = new Error('test'); - var testfn = function (test) { - throw err; - }; - nodeunit.runTest('testname', testfn, { - log: function (assertion) { - test.same(assertion.error, err, 'assertion.error'); - }, - testDone: function (name, assertions) { - test.equals(assertions.failures(), 1); - test.equals(assertions.length, 1); - } - }, test.done); -}; diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-sandbox.js b/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-sandbox.js deleted file mode 100644 index 1b249d7..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-sandbox.js +++ /dev/null @@ -1,31 +0,0 @@ -var nodeunit = require('../lib/nodeunit'); -var sandbox = require('../lib/utils').sandbox; -var testCase = nodeunit.testCase; - -exports.testSimpleSandbox = function (test) { - var raw_jscode1 = sandbox(__dirname + '/fixtures/raw_jscode1.js'); - test.equal(raw_jscode1.hello_world('foo'), '_foo_', 'evaluation ok'); - test.done(); -}; - -exports.testSandboxContext = function (test) { - var a_variable = 42; // should not be visible in the sandbox - var raw_jscode2 = sandbox(__dirname + '/fixtures/raw_jscode2.js'); - a_variable = 42; // again for the win - test.equal( - raw_jscode2.get_a_variable(), - 'undefined', - 'the variable should not be defined' - ); - test.done(); -}; - -exports.testSandboxMultiple = function (test) { - var raw_jscode3 = sandbox([ - __dirname + '/fixtures/raw_jscode3.js', - __dirname + '/fixtures/raw_jscode3.js', - __dirname + '/fixtures/raw_jscode3.js' - ]); - test.equal(raw_jscode3.t, 3, 'two files loaded'); - test.done(); -}; diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-testcase.js b/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-testcase.js deleted file mode 100644 index a3ea331..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/test/test-testcase.js +++ /dev/null @@ -1,234 +0,0 @@ -/* THIS FILE SHOULD BE BROWSER-COMPATIBLE JS! - * You can use @REMOVE_LINE_FOR_BROWSER to remove code from the browser build. - * Only code on that line will be removed, its mostly to avoid requiring code - * that is node specific - */ - -var nodeunit = require('../lib/nodeunit'); // @REMOVE_LINE_FOR_BROWSER -var testCase = nodeunit.testCase; - -exports.testTestCase = function (test) { - test.expect(7); - var call_order = []; - var s = testCase({ - setUp: function (callback) { - call_order.push('setUp'); - test.equals(this.one, undefined); - this.one = 1; - callback(); - }, - tearDown: function (callback) { - call_order.push('tearDown'); - test.ok(true, 'tearDown called'); - callback(); - }, - test1: function (t) { - call_order.push('test1'); - test.equals(this.one, 1); - this.one = 2; - t.done(); - }, - test2: function (t) { - call_order.push('test2'); - test.equals(this.one, 1); - t.done(); - } - }); - nodeunit.runSuite(null, s, {}, function () { - test.same(call_order, [ - 'setUp', 'test1', 'tearDown', - 'setUp', 'test2', 'tearDown' - ]); - test.done(); - }); -}; - -exports.tearDownAfterError = function (test) { - test.expect(1); - var s = testCase({ - tearDown: function (callback) { - test.ok(true, 'tearDown called'); - callback(); - }, - test: function (t) { - throw new Error('some error'); - } - }); - nodeunit.runSuite(null, s, {}, function () { - test.done(); - }); -}; - -exports.catchSetUpError = function (test) { - test.expect(2); - var test_error = new Error('test error'); - var s = testCase({ - setUp: function (callback) { - throw test_error; - }, - test: function (t) { - test.ok(false, 'test function should not be called'); - t.done(); - } - }); - nodeunit.runSuite(null, s, {}, function (err, assertions) { - test.equal(assertions.length, 1); - test.equal(assertions[0].error, test_error); - test.done(); - }); -}; - -exports.setUpErrorCallback = function (test) { - test.expect(2); - var test_error = new Error('test error'); - var s = testCase({ - setUp: function (callback) { - callback(test_error); - }, - test: function (t) { - test.ok(false, 'test function should not be called'); - t.done(); - } - }); - nodeunit.runSuite(null, s, {}, function (err, assertions) { - test.equal(assertions.length, 1); - test.equal(assertions[0].error, test_error); - test.done(); - }); -}; - -exports.catchTearDownError = function (test) { - test.expect(2); - var test_error = new Error('test error'); - var s = testCase({ - tearDown: function (callback) { - throw test_error; - }, - test: function (t) { - t.done(); - } - }); - nodeunit.runSuite(null, s, {}, function (err, assertions) { - test.equal(assertions.length, 1); - test.equal(assertions[0].error, test_error); - test.done(); - }); -}; - -exports.tearDownErrorCallback = function (test) { - test.expect(2); - var test_error = new Error('test error'); - var s = testCase({ - tearDown: function (callback) { - callback(test_error); - }, - test: function (t) { - t.done(); - } - }); - nodeunit.runSuite(null, s, {}, function (err, assertions) { - test.equal(assertions.length, 1); - test.equal(assertions[0].error, test_error); - test.done(); - }); -}; - -exports.testErrorAndtearDownError = function (test) { - test.expect(3); - var error1 = new Error('test error one'); - var error2 = new Error('test error two'); - var s = testCase({ - tearDown: function (callback) { - callback(error2); - }, - test: function (t) { - t.done(error1); - } - }); - nodeunit.runSuite(null, s, {}, function (err, assertions) { - test.equal(assertions.length, 2); - test.equal(assertions[0].error, error1); - test.equal(assertions[1].error, error2); - test.done(); - }); -}; - -exports.testCaseGroups = function (test) { - var call_order = []; - var s = testCase({ - setUp: function (callback) { - call_order.push('setUp'); - callback(); - }, - tearDown: function (callback) { - call_order.push('tearDown'); - callback(); - }, - test1: function (test) { - call_order.push('test1'); - test.done(); - }, - group1: { - test2: function (test) { - call_order.push('group1.test2'); - test.done(); - } - } - }); - nodeunit.runSuite(null, s, {}, function (err, assertions) { - test.same(call_order, [ - 'setUp', - 'test1', - 'tearDown', - 'setUp', - 'group1.test2', - 'tearDown' - ]); - test.done(); - }); -}; - -exports.nestedTestCases = function (test) { - var call_order = []; - var s = testCase({ - setUp: function (callback) { - call_order.push('setUp'); - callback(); - }, - tearDown: function (callback) { - call_order.push('tearDown'); - callback(); - }, - test1: function (test) { - call_order.push('test1'); - test.done(); - }, - group1: testCase({ - setUp: function (callback) { - call_order.push('group1.setUp'); - callback(); - }, - tearDown: function (callback) { - call_order.push('group1.tearDown'); - callback(); - }, - test2: function (test) { - call_order.push('group1.test2'); - test.done(); - } - }) - }); - nodeunit.runSuite(null, s, {}, function (err, assertions) { - test.same(call_order, [ - 'setUp', - 'test1', - 'tearDown', - 'setUp', - 'group1.setUp', - 'group1.test2', - 'group1.tearDown', - 'tearDown' - ]); - test.done(); - }); -}; diff --git a/node_modules/connect/node_modules/crc/tests/nodeunit/test/test.html b/node_modules/connect/node_modules/crc/tests/nodeunit/test/test.html deleted file mode 100644 index 31bda30..0000000 --- a/node_modules/connect/node_modules/crc/tests/nodeunit/test/test.html +++ /dev/null @@ -1,26 +0,0 @@ - - - Nodeunit Test Suite - - - - - - - - - -

    Nodeunit Test Suite

    - - - diff --git a/node_modules/connect/node_modules/debug/.npmignore b/node_modules/connect/node_modules/debug/.npmignore deleted file mode 100644 index f1250e5..0000000 --- a/node_modules/connect/node_modules/debug/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -support -test -examples -*.sock diff --git a/node_modules/connect/node_modules/debug/History.md b/node_modules/connect/node_modules/debug/History.md deleted file mode 100644 index f3c1a98..0000000 --- a/node_modules/connect/node_modules/debug/History.md +++ /dev/null @@ -1,41 +0,0 @@ - -0.6.0 / 2012-03-16 -================== - - * Added support for "-" prefix in DEBUG [Vinay Pulim] - * Added `.enabled` flag to the node version [TooTallNate] - -0.5.0 / 2012-02-02 -================== - - * Added: humanize diffs. Closes #8 - * Added `debug.disable()` to the CS variant - * Removed padding. Closes #10 - * Fixed: persist client-side variant again. Closes #9 - -0.4.0 / 2012-02-01 -================== - - * Added browser variant support for older browsers [TooTallNate] - * Added `debug.enable('project:*')` to browser variant [TooTallNate] - * Added padding to diff (moved it to the right) - -0.3.0 / 2012-01-26 -================== - - * Added millisecond diff when isatty, otherwise UTC string - -0.2.0 / 2012-01-22 -================== - - * Added wildcard support - -0.1.0 / 2011-12-02 -================== - - * Added: remove colors unless stderr isatty [TooTallNate] - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/node_modules/connect/node_modules/debug/Makefile b/node_modules/connect/node_modules/debug/Makefile deleted file mode 100644 index 36a3ed7..0000000 --- a/node_modules/connect/node_modules/debug/Makefile +++ /dev/null @@ -1,5 +0,0 @@ - -test: - @echo "populate me" - -.PHONY: test \ No newline at end of file diff --git a/node_modules/connect/node_modules/debug/Readme.md b/node_modules/connect/node_modules/debug/Readme.md deleted file mode 100644 index 419fcdf..0000000 --- a/node_modules/connect/node_modules/debug/Readme.md +++ /dev/null @@ -1,130 +0,0 @@ - -# debug - - tiny node.js debugging utility. - -## Installation - -``` -$ npm install debug -``` - -## Example - - This module is modelled after node core's debugging technique, allowing you to enable one or more topic-specific debugging functions, for example core does the following within many modules: - -```js -var debug; -if (process.env.NODE_DEBUG && /cluster/.test(process.env.NODE_DEBUG)) { - debug = function(x) { - var prefix = process.pid + ',' + - (process.env.NODE_WORKER_ID ? 'Worker' : 'Master'); - console.error(prefix, x); - }; -} else { - debug = function() { }; -} -``` - - This concept is extremely simple but it works well. With `debug` you simply invoke the exported function to generate your debug function, passing it a name which will determine if a noop function is returned, or a decorated `console.error`, so all of the `console` format string goodies you're used to work fine. A unique color is selected per-function for visibility. - -Example _app.js_: - -```js -var debug = require('debug')('http') - , http = require('http') - , name = 'My App'; - -// fake app - -debug('booting %s', name); - -http.createServer(function(req, res){ - debug(req.method + ' ' + req.url); - res.end('hello\n'); -}).listen(3000, function(){ - debug('listening'); -}); - -// fake worker of some kind - -require('./worker'); -``` - -Example _worker.js_: - -```js -var debug = require('debug')('worker'); - -setInterval(function(){ - debug('doing some work'); -}, 1000); -``` - - The __DEBUG__ environment variable is then used to enable these based on space or comma-delimited names. Here are some examples: - - ![debug http and worker](http://f.cl.ly/items/18471z1H402O24072r1J/Screenshot.png) - - ![debug worker](http://f.cl.ly/items/1X413v1a3M0d3C2c1E0i/Screenshot.png) - -## Millisecond diff - - When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. - - ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png) - - When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below: - - ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png) - -## Conventions - - If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". - -## Wildcards - - The "*" character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect.compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. - - You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=* -connect:*` would include all debuggers except those starting with "connect:". - -## Browser support - - Debug works in the browser as well, currently persisted by `localStorage`. For example if you have `worker:a` and `worker:b` as shown below, and wish to debug both type `debug.enable('worker:*')` in the console and refresh the page, this will remain until you disable with `debug.disable()`. - -```js -a = debug('worker:a'); -b = debug('worker:b'); - -setInterval(function(){ - a('doing some work'); -}, 1000); - -setInterval(function(){ - a('doing some work'); -}, 1200); -``` - -## License - -(The MIT License) - -Copyright (c) 2011 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/connect/node_modules/debug/debug.js b/node_modules/connect/node_modules/debug/debug.js deleted file mode 100644 index b2f0798..0000000 --- a/node_modules/connect/node_modules/debug/debug.js +++ /dev/null @@ -1,122 +0,0 @@ - -/*! - * debug - * Copyright(c) 2012 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Create a debugger with the given `name`. - * - * @param {String} name - * @return {Type} - * @api public - */ - -function debug(name) { - if (!debug.enabled(name)) return function(){}; - - return function(fmt){ - var curr = new Date; - var ms = curr - (debug[name] || curr); - debug[name] = curr; - - fmt = name - + ' ' - + fmt - + ' +' + debug.humanize(ms); - - // This hackery is required for IE8 - // where `console.log` doesn't have 'apply' - window.console - && console.log - && Function.prototype.apply.call(console.log, console, arguments); - } -} - -/** - * The currently active debug mode names. - */ - -debug.names = []; -debug.skips = []; - -/** - * Enables a debug mode by name. This can include modes - * separated by a colon and wildcards. - * - * @param {String} name - * @api public - */ - -debug.enable = function(name) { - localStorage.debug = name; - - var split = (name || '').split(/[\s,]+/) - , len = split.length; - - for (var i = 0; i < len; i++) { - name = split[i].replace('*', '.*?'); - if (name[0] === '-') { - debug.skips.push(new RegExp('^' + name.substr(1) + '$')); - } - else { - debug.names.push(new RegExp('^' + name + '$')); - } - } -}; - -/** - * Disable debug output. - * - * @api public - */ - -debug.disable = function(){ - debug.enable(''); -}; - -/** - * Humanize the given `ms`. - * - * @param {Number} m - * @return {String} - * @api private - */ - -debug.humanize = function(ms) { - var sec = 1000 - , min = 60 * 1000 - , hour = 60 * min; - - if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; - if (ms >= min) return (ms / min).toFixed(1) + 'm'; - if (ms >= sec) return (ms / sec | 0) + 's'; - return ms + 'ms'; -}; - -/** - * Returns true if the given mode name is enabled, false otherwise. - * - * @param {String} name - * @return {Boolean} - * @api public - */ - -debug.enabled = function(name) { - for (var i = 0, len = debug.skips.length; i < len; i++) { - if (debug.skips[i].test(name)) { - return false; - } - } - for (var i = 0, len = debug.names.length; i < len; i++) { - if (debug.names[i].test(name)) { - return true; - } - } - return false; -}; - -// persist - -if (window.localStorage) debug.enable(localStorage.debug); \ No newline at end of file diff --git a/node_modules/connect/node_modules/debug/example/app.js b/node_modules/connect/node_modules/debug/example/app.js deleted file mode 100644 index 05374d9..0000000 --- a/node_modules/connect/node_modules/debug/example/app.js +++ /dev/null @@ -1,19 +0,0 @@ - -var debug = require('../')('http') - , http = require('http') - , name = 'My App'; - -// fake app - -debug('booting %s', name); - -http.createServer(function(req, res){ - debug(req.method + ' ' + req.url); - res.end('hello\n'); -}).listen(3000, function(){ - debug('listening'); -}); - -// fake worker of some kind - -require('./worker'); \ No newline at end of file diff --git a/node_modules/connect/node_modules/debug/example/browser.html b/node_modules/connect/node_modules/debug/example/browser.html deleted file mode 100644 index 7510eee..0000000 --- a/node_modules/connect/node_modules/debug/example/browser.html +++ /dev/null @@ -1,24 +0,0 @@ - - - debug() - - - - - - - diff --git a/node_modules/connect/node_modules/debug/example/wildcards.js b/node_modules/connect/node_modules/debug/example/wildcards.js deleted file mode 100644 index 1fdac20..0000000 --- a/node_modules/connect/node_modules/debug/example/wildcards.js +++ /dev/null @@ -1,10 +0,0 @@ - -var debug = { - foo: require('../')('test:foo'), - bar: require('../')('test:bar'), - baz: require('../')('test:baz') -}; - -debug.foo('foo') -debug.bar('bar') -debug.baz('baz') \ No newline at end of file diff --git a/node_modules/connect/node_modules/debug/example/worker.js b/node_modules/connect/node_modules/debug/example/worker.js deleted file mode 100644 index 7f6d288..0000000 --- a/node_modules/connect/node_modules/debug/example/worker.js +++ /dev/null @@ -1,22 +0,0 @@ - -// DEBUG=* node example/worker -// DEBUG=worker:* node example/worker -// DEBUG=worker:a node example/worker -// DEBUG=worker:b node example/worker - -var a = require('../')('worker:a') - , b = require('../')('worker:b'); - -function work() { - a('doing lots of uninteresting work'); - setTimeout(work, Math.random() * 1000); -} - -work(); - -function workb() { - b('doing some work'); - setTimeout(workb, Math.random() * 2000); -} - -workb(); \ No newline at end of file diff --git a/node_modules/connect/node_modules/debug/index.js b/node_modules/connect/node_modules/debug/index.js deleted file mode 100644 index ee54454..0000000 --- a/node_modules/connect/node_modules/debug/index.js +++ /dev/null @@ -1,2 +0,0 @@ - -module.exports = require('./lib/debug'); \ No newline at end of file diff --git a/node_modules/connect/node_modules/debug/lib/debug.js b/node_modules/connect/node_modules/debug/lib/debug.js deleted file mode 100644 index 984dfb5..0000000 --- a/node_modules/connect/node_modules/debug/lib/debug.js +++ /dev/null @@ -1,147 +0,0 @@ - -/*! - * debug - * Copyright(c) 2012 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var tty = require('tty'); - -/** - * Expose `debug()` as the module. - */ - -module.exports = debug; - -/** - * Library version. - */ - -exports.version = '0.6.0'; - -/** - * Enabled debuggers. - */ - -var names = [] - , skips = []; - -(process.env.DEBUG || '') - .split(/[\s,]+/) - .forEach(function(name){ - name = name.replace('*', '.*?'); - if (name[0] === '-') { - skips.push(new RegExp('^' + name.substr(1) + '$')); - } else { - names.push(new RegExp('^' + name + '$')); - } - }); - -/** - * Colors. - */ - -var colors = [6, 2, 3, 4, 5, 1]; - -/** - * Previous debug() call. - */ - -var prev = {}; - -/** - * Previously assigned color. - */ - -var prevColor = 0; - -/** - * Is stdout a TTY? Colored output is disabled when `true`. - */ - -var isatty = tty.isatty(2); - -/** - * Select a color. - * - * @return {Number} - * @api private - */ - -function color() { - return colors[prevColor++ % colors.length]; -} - -/** - * Humanize the given `ms`. - * - * @param {Number} m - * @return {String} - * @api private - */ - -function humanize(ms) { - var sec = 1000 - , min = 60 * 1000 - , hour = 60 * min; - - if (ms >= hour) return (ms / hour).toFixed(1) + 'h'; - if (ms >= min) return (ms / min).toFixed(1) + 'm'; - if (ms >= sec) return (ms / sec | 0) + 's'; - return ms + 'ms'; -} - -/** - * Create a debugger with the given `name`. - * - * @param {String} name - * @return {Type} - * @api public - */ - -function debug(name) { - function disabled(){} - disabled.enabled = false; - - var match = skips.some(function(re){ - return re.test(name); - }); - - if (match) return disabled; - - match = names.some(function(re){ - return re.test(name); - }); - - if (!match) return disabled; - var c = color(); - - function colored(fmt) { - var curr = new Date; - var ms = curr - (prev[name] || curr); - prev[name] = curr; - - fmt = ' \033[9' + c + 'm' + name + ' ' - + '\033[3' + c + 'm\033[90m' - + fmt + '\033[3' + c + 'm' - + ' +' + humanize(ms) + '\033[0m'; - - console.error.apply(this, arguments); - } - - function plain(fmt) { - fmt = new Date().toUTCString() - + ' ' + name + ' ' + fmt; - console.error.apply(this, arguments); - } - - colored.enabled = plain.enabled = true; - - return isatty - ? colored - : plain; -} diff --git a/node_modules/connect/node_modules/debug/package.json b/node_modules/connect/node_modules/debug/package.json deleted file mode 100644 index 83c12bb..0000000 --- a/node_modules/connect/node_modules/debug/package.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "name": "debug", - "version": "0.6.0", - "description": "small debugging utility", - "keywords": [ - "debug", - "log", - "debugger" - ], - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca" - }, - "dependencies": {}, - "devDependencies": { - "mocha": "*" - }, - "main": "index", - "engines": { - "node": "*" - }, - "_id": "debug@0.6.0", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "debug@*" -} diff --git a/node_modules/connect/node_modules/formidable/.npmignore b/node_modules/connect/node_modules/formidable/.npmignore deleted file mode 100644 index 4fbabb3..0000000 --- a/node_modules/connect/node_modules/formidable/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -/test/tmp/ -*.upload -*.un~ -*.http diff --git a/node_modules/connect/node_modules/formidable/.travis.yml b/node_modules/connect/node_modules/formidable/.travis.yml deleted file mode 100644 index f1d0f13..0000000 --- a/node_modules/connect/node_modules/formidable/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 diff --git a/node_modules/connect/node_modules/formidable/Makefile b/node_modules/connect/node_modules/formidable/Makefile deleted file mode 100644 index 8945872..0000000 --- a/node_modules/connect/node_modules/formidable/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -SHELL := /bin/bash - -test: - @./test/run.js - -build: npm test - -npm: - npm install . - -clean: - rm test/tmp/* - -.PHONY: test clean build diff --git a/node_modules/connect/node_modules/formidable/Readme.md b/node_modules/connect/node_modules/formidable/Readme.md deleted file mode 100644 index cfa2462..0000000 --- a/node_modules/connect/node_modules/formidable/Readme.md +++ /dev/null @@ -1,303 +0,0 @@ -# Formidable - -[![Build Status](https://secure.travis-ci.org/felixge/node-formidable.png?branch=master)](http://travis-ci.org/felixge/node-formidable) - -## Purpose - -A node.js module for parsing form data, especially file uploads. - -## Current status - -This module was developed for [Transloadit](http://transloadit.com/), a service focused on uploading -and encoding images and videos. It has been battle-tested against hundreds of GB of file uploads from -a large variety of clients and is considered production-ready. - -## Features - -* Fast (~500mb/sec), non-buffering multipart parser -* Automatically writing file uploads to disk -* Low memory footprint -* Graceful error handling -* Very high test coverage - -## Changelog - -### v1.0.9 - -* Emit progress when content length header parsed (Tim Koschützki) -* Fix Readme syntax due to GitHub changes (goob) -* Replace references to old 'sys' module in Readme with 'util' (Peter Sugihara) - -### v1.0.8 - -* Strip potentially unsafe characters when using `keepExtensions: true`. -* Switch to utest / urun for testing -* Add travis build - -### v1.0.7 - -* Remove file from package that was causing problems when installing on windows. (#102) -* Fix typos in Readme (Jason Davies). - -### v1.0.6 - -* Do not default to the default to the field name for file uploads where - filename="". - -### v1.0.5 - -* Support filename="" in multipart parts -* Explain unexpected end() errors in parser better - -**Note:** Starting with this version, formidable emits 'file' events for empty -file input fields. Previously those were incorrectly emitted as regular file -input fields with value = "". - -### v1.0.4 - -* Detect a good default tmp directory regardless of platform. (#88) - -### v1.0.3 - -* Fix problems with utf8 characters (#84) / semicolons in filenames (#58) -* Small performance improvements -* New test suite and fixture system - -### v1.0.2 - -* Exclude node\_modules folder from git -* Implement new `'aborted'` event -* Fix files in example folder to work with recent node versions -* Make gently a devDependency - -[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.1...v1.0.2) - -### v1.0.1 - -* Fix package.json to refer to proper main directory. (#68, Dean Landolt) - -[See Commits](https://github.com/felixge/node-formidable/compare/v1.0.0...v1.0.1) - -### v1.0.0 - -* Add support for multipart boundaries that are quoted strings. (Jeff Craig) - -This marks the beginning of development on version 2.0 which will include -several architectural improvements. - -[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.11...v1.0.0) - -### v0.9.11 - -* Emit `'progress'` event when receiving data, regardless of parsing it. (Tim Koschützki) -* Use [W3C FileAPI Draft](http://dev.w3.org/2006/webapi/FileAPI/) properties for File class - -**Important:** The old property names of the File class will be removed in a -future release. - -[See Commits](https://github.com/felixge/node-formidable/compare/v0.9.10...v0.9.11) - -### Older releases - -These releases were done before starting to maintain the above Changelog: - -* [v0.9.10](https://github.com/felixge/node-formidable/compare/v0.9.9...v0.9.10) -* [v0.9.9](https://github.com/felixge/node-formidable/compare/v0.9.8...v0.9.9) -* [v0.9.8](https://github.com/felixge/node-formidable/compare/v0.9.7...v0.9.8) -* [v0.9.7](https://github.com/felixge/node-formidable/compare/v0.9.6...v0.9.7) -* [v0.9.6](https://github.com/felixge/node-formidable/compare/v0.9.5...v0.9.6) -* [v0.9.5](https://github.com/felixge/node-formidable/compare/v0.9.4...v0.9.5) -* [v0.9.4](https://github.com/felixge/node-formidable/compare/v0.9.3...v0.9.4) -* [v0.9.3](https://github.com/felixge/node-formidable/compare/v0.9.2...v0.9.3) -* [v0.9.2](https://github.com/felixge/node-formidable/compare/v0.9.1...v0.9.2) -* [v0.9.1](https://github.com/felixge/node-formidable/compare/v0.9.0...v0.9.1) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.9.0](https://github.com/felixge/node-formidable/compare/v0.8.0...v0.9.0) -* [v0.1.0](https://github.com/felixge/node-formidable/commits/v0.1.0) - -## Installation - -Via [npm](http://github.com/isaacs/npm): - - npm install formidable@latest - -Manually: - - git clone git://github.com/felixge/node-formidable.git formidable - vim my.js - # var formidable = require('./formidable'); - -Note: Formidable requires [gently](http://github.com/felixge/node-gently) to run the unit tests, but you won't need it for just using the library. - -## Example - -Parse an incoming file upload. - - var formidable = require('formidable'), - http = require('http'), - - util = require('util'); - - http.createServer(function(req, res) { - if (req.url == '/upload' && req.method.toLowerCase() == 'post') { - // parse a file upload - var form = new formidable.IncomingForm(); - form.parse(req, function(err, fields, files) { - res.writeHead(200, {'content-type': 'text/plain'}); - res.write('received upload:\n\n'); - res.end(util.inspect({fields: fields, files: files})); - }); - return; - } - - // show a file upload form - res.writeHead(200, {'content-type': 'text/html'}); - res.end( - '
    '+ - '
    '+ - '
    '+ - ''+ - '
    ' - ); - }).listen(80); - -## API - -### formidable.IncomingForm - -__new formidable.IncomingForm()__ - -Creates a new incoming form. - -__incomingForm.encoding = 'utf-8'__ - -The encoding to use for incoming form fields. - -__incomingForm.uploadDir = process.env.TMP || '/tmp' || process.cwd()__ - -The directory for placing file uploads in. You can move them later on using -`fs.rename()`. The default directory is picked at module load time depending on -the first existing directory from those listed above. - -__incomingForm.keepExtensions = false__ - -If you want the files written to `incomingForm.uploadDir` to include the extensions of the original files, set this property to `true`. - -__incomingForm.type__ - -Either 'multipart' or 'urlencoded' depending on the incoming request. - -__incomingForm.maxFieldsSize = 2 * 1024 * 1024__ - -Limits the amount of memory a field (not file) can allocate in bytes. -If this value is exceeded, an `'error'` event is emitted. The default -size is 2MB. - -__incomingForm.bytesReceived__ - -The amount of bytes received for this form so far. - -__incomingForm.bytesExpected__ - -The expected number of bytes in this form. - -__incomingForm.parse(request, [cb])__ - -Parses an incoming node.js `request` containing form data. If `cb` is provided, all fields an files are collected and passed to the callback: - - incomingForm.parse(req, function(err, fields, files) { - // ... - }); - -__incomingForm.onPart(part)__ - -You may overwrite this method if you are interested in directly accessing the multipart stream. Doing so will disable any `'field'` / `'file'` events processing which would occur otherwise, making you fully responsible for handling the processing. - - incomingForm.onPart = function(part) { - part.addListener('data', function() { - // ... - }); - } - -If you want to use formidable to only handle certain parts for you, you can do so: - - incomingForm.onPart = function(part) { - if (!part.filename) { - // let formidable handle all non-file parts - incomingForm.handlePart(part); - } - } - -Check the code in this method for further inspiration. - -__Event: 'progress' (bytesReceived, bytesExpected)__ - -Emitted after each incoming chunk of data that has been parsed. Can be used to roll your own progress bar. - -__Event: 'field' (name, value)__ - -Emitted whenever a field / value pair has been received. - -__Event: 'fileBegin' (name, file)__ - -Emitted whenever a new file is detected in the upload stream. Use this even if -you want to stream the file to somewhere else while buffering the upload on -the file system. - -__Event: 'file' (name, file)__ - -Emitted whenever a field / file pair has been received. `file` is an instance of `File`. - -__Event: 'error' (err)__ - -Emitted when there is an error processing the incoming form. A request that experiences an error is automatically paused, you will have to manually call `request.resume()` if you want the request to continue firing `'data'` events. - -__Event: 'aborted'__ - -Emitted when the request was aborted by the user. Right now this can be due to a 'timeout' or 'close' event on the socket. In the future there will be a separate 'timeout' event (needs a change in the node core). - -__Event: 'end' ()__ - -Emitted when the entire request has been received, and all contained files have finished flushing to disk. This is a great place for you to send your response. - -### formidable.File - -__file.size = 0__ - -The size of the uploaded file in bytes. If the file is still being uploaded (see `'fileBegin'` event), this property says how many bytes of the file have been written to disk yet. - -__file.path = null__ - -The path this file is being written to. You can modify this in the `'fileBegin'` event in -case you are unhappy with the way formidable generates a temporary path for your files. - -__file.name = null__ - -The name this file had according to the uploading client. - -__file.type = null__ - -The mime type of this file, according to the uploading client. - -__file.lastModifiedDate = null__ - -A date object (or `null`) containing the time this file was last written to. Mostly -here for compatibility with the [W3C File API Draft](http://dev.w3.org/2006/webapi/FileAPI/). - -## License - -Formidable is licensed under the MIT license. - -## Ports - -* [multipart-parser](http://github.com/FooBarWidget/multipart-parser): a C++ parser based on formidable - -## Credits - -* [Ryan Dahl](http://twitter.com/ryah) for his work on [http-parser](http://github.com/ry/http-parser) which heavily inspired multipart_parser.js diff --git a/node_modules/connect/node_modules/formidable/TODO b/node_modules/connect/node_modules/formidable/TODO deleted file mode 100644 index e1107f2..0000000 --- a/node_modules/connect/node_modules/formidable/TODO +++ /dev/null @@ -1,3 +0,0 @@ -- Better bufferMaxSize handling approach -- Add tests for JSON parser pull request and merge it -- Implement QuerystringParser the same way as MultipartParser diff --git a/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js b/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js deleted file mode 100644 index bff41f1..0000000 --- a/node_modules/connect/node_modules/formidable/benchmark/bench-multipart-parser.js +++ /dev/null @@ -1,70 +0,0 @@ -require('../test/common'); -var multipartParser = require('../lib/multipart_parser'), - MultipartParser = multipartParser.MultipartParser, - parser = new MultipartParser(), - Buffer = require('buffer').Buffer, - boundary = '-----------------------------168072824752491622650073', - mb = 100, - buffer = createMultipartBuffer(boundary, mb * 1024 * 1024), - callbacks = - { partBegin: -1, - partEnd: -1, - headerField: -1, - headerValue: -1, - partData: -1, - end: -1, - }; - - -parser.initWithBoundary(boundary); -parser.onHeaderField = function() { - callbacks.headerField++; -}; - -parser.onHeaderValue = function() { - callbacks.headerValue++; -}; - -parser.onPartBegin = function() { - callbacks.partBegin++; -}; - -parser.onPartData = function() { - callbacks.partData++; -}; - -parser.onPartEnd = function() { - callbacks.partEnd++; -}; - -parser.onEnd = function() { - callbacks.end++; -}; - -var start = +new Date(), - nparsed = parser.write(buffer), - duration = +new Date - start, - mbPerSec = (mb / (duration / 1000)).toFixed(2); - -console.log(mbPerSec+' mb/sec'); - -assert.equal(nparsed, buffer.length); - -function createMultipartBuffer(boundary, size) { - var head = - '--'+boundary+'\r\n' - + 'content-disposition: form-data; name="field1"\r\n' - + '\r\n' - , tail = '\r\n--'+boundary+'--\r\n' - , buffer = new Buffer(size); - - buffer.write(head, 'ascii', 0); - buffer.write(tail, 'ascii', buffer.length - tail.length); - return buffer; -} - -process.on('exit', function() { - for (var k in callbacks) { - assert.equal(0, callbacks[k], k+' count off by '+callbacks[k]); - } -}); diff --git a/node_modules/connect/node_modules/formidable/example/post.js b/node_modules/connect/node_modules/formidable/example/post.js deleted file mode 100644 index f6c15a6..0000000 --- a/node_modules/connect/node_modules/formidable/example/post.js +++ /dev/null @@ -1,43 +0,0 @@ -require('../test/common'); -var http = require('http'), - util = require('util'), - formidable = require('formidable'), - server; - -server = http.createServer(function(req, res) { - if (req.url == '/') { - res.writeHead(200, {'content-type': 'text/html'}); - res.end( - '
    '+ - '
    '+ - '
    '+ - ''+ - '
    ' - ); - } else if (req.url == '/post') { - var form = new formidable.IncomingForm(), - fields = []; - - form - .on('error', function(err) { - res.writeHead(200, {'content-type': 'text/plain'}); - res.end('error:\n\n'+util.inspect(err)); - }) - .on('field', function(field, value) { - console.log(field, value); - fields.push([field, value]); - }) - .on('end', function() { - console.log('-> post done'); - res.writeHead(200, {'content-type': 'text/plain'}); - res.end('received fields:\n\n '+util.inspect(fields)); - }); - form.parse(req); - } else { - res.writeHead(404, {'content-type': 'text/plain'}); - res.end('404'); - } -}); -server.listen(TEST_PORT); - -console.log('listening on http://localhost:'+TEST_PORT+'/'); diff --git a/node_modules/connect/node_modules/formidable/example/upload.js b/node_modules/connect/node_modules/formidable/example/upload.js deleted file mode 100644 index 050cdd9..0000000 --- a/node_modules/connect/node_modules/formidable/example/upload.js +++ /dev/null @@ -1,48 +0,0 @@ -require('../test/common'); -var http = require('http'), - util = require('util'), - formidable = require('formidable'), - server; - -server = http.createServer(function(req, res) { - if (req.url == '/') { - res.writeHead(200, {'content-type': 'text/html'}); - res.end( - '
    '+ - '
    '+ - '
    '+ - ''+ - '
    ' - ); - } else if (req.url == '/upload') { - var form = new formidable.IncomingForm(), - files = [], - fields = []; - - form.uploadDir = TEST_TMP; - - form - .on('field', function(field, value) { - console.log(field, value); - fields.push([field, value]); - }) - .on('file', function(field, file) { - console.log(field, file); - files.push([field, file]); - }) - .on('end', function() { - console.log('-> upload done'); - res.writeHead(200, {'content-type': 'text/plain'}); - res.write('received fields:\n\n '+util.inspect(fields)); - res.write('\n\n'); - res.end('received files:\n\n '+util.inspect(files)); - }); - form.parse(req); - } else { - res.writeHead(404, {'content-type': 'text/plain'}); - res.end('404'); - } -}); -server.listen(TEST_PORT); - -console.log('listening on http://localhost:'+TEST_PORT+'/'); diff --git a/node_modules/connect/node_modules/formidable/index.js b/node_modules/connect/node_modules/formidable/index.js deleted file mode 100644 index be41032..0000000 --- a/node_modules/connect/node_modules/formidable/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/formidable'); \ No newline at end of file diff --git a/node_modules/connect/node_modules/formidable/lib/file.js b/node_modules/connect/node_modules/formidable/lib/file.js deleted file mode 100644 index 6dc8720..0000000 --- a/node_modules/connect/node_modules/formidable/lib/file.js +++ /dev/null @@ -1,61 +0,0 @@ -if (global.GENTLY) require = GENTLY.hijack(require); - -var util = require('./util'), - WriteStream = require('fs').WriteStream, - EventEmitter = require('events').EventEmitter; - -function File(properties) { - EventEmitter.call(this); - - this.size = 0; - this.path = null; - this.name = null; - this.type = null; - this.lastModifiedDate = null; - - this._writeStream = null; - - for (var key in properties) { - this[key] = properties[key]; - } - - this._backwardsCompatibility(); -} -module.exports = File; -util.inherits(File, EventEmitter); - -// @todo Next release: Show error messages when accessing these -File.prototype._backwardsCompatibility = function() { - var self = this; - this.__defineGetter__('length', function() { - return self.size; - }); - this.__defineGetter__('filename', function() { - return self.name; - }); - this.__defineGetter__('mime', function() { - return self.type; - }); -}; - -File.prototype.open = function() { - this._writeStream = new WriteStream(this.path); -}; - -File.prototype.write = function(buffer, cb) { - var self = this; - this._writeStream.write(buffer, function() { - self.lastModifiedDate = new Date(); - self.size += buffer.length; - self.emit('progress', self.size); - cb(); - }); -}; - -File.prototype.end = function(cb) { - var self = this; - this._writeStream.end(function() { - self.emit('end'); - cb(); - }); -}; diff --git a/node_modules/connect/node_modules/formidable/lib/incoming_form.js b/node_modules/connect/node_modules/formidable/lib/incoming_form.js deleted file mode 100644 index b1e2bfb..0000000 --- a/node_modules/connect/node_modules/formidable/lib/incoming_form.js +++ /dev/null @@ -1,378 +0,0 @@ -if (global.GENTLY) require = GENTLY.hijack(require); - -var fs = require('fs'); -var util = require('./util'), - path = require('path'), - File = require('./file'), - MultipartParser = require('./multipart_parser').MultipartParser, - QuerystringParser = require('./querystring_parser').QuerystringParser, - StringDecoder = require('string_decoder').StringDecoder, - EventEmitter = require('events').EventEmitter; - -function IncomingForm() { - if (!(this instanceof IncomingForm)) return new IncomingForm; - EventEmitter.call(this); - - this.error = null; - this.ended = false; - - this.maxFieldsSize = 2 * 1024 * 1024; - this.keepExtensions = false; - this.uploadDir = IncomingForm.UPLOAD_DIR; - this.encoding = 'utf-8'; - this.headers = null; - this.type = null; - - this.bytesReceived = null; - this.bytesExpected = null; - - this._parser = null; - this._flushing = 0; - this._fieldsSize = 0; -}; -util.inherits(IncomingForm, EventEmitter); -exports.IncomingForm = IncomingForm; - -IncomingForm.UPLOAD_DIR = (function() { - var dirs = [process.env.TMP, '/tmp', process.cwd()]; - for (var i = 0; i < dirs.length; i++) { - var dir = dirs[i]; - var isDirectory = false; - - try { - isDirectory = fs.statSync(dir).isDirectory(); - } catch (e) {} - - if (isDirectory) return dir; - } -})(); - -IncomingForm.prototype.parse = function(req, cb) { - this.pause = function() { - try { - req.pause(); - } catch (err) { - // the stream was destroyed - if (!this.ended) { - // before it was completed, crash & burn - this._error(err); - } - return false; - } - return true; - }; - - this.resume = function() { - try { - req.resume(); - } catch (err) { - // the stream was destroyed - if (!this.ended) { - // before it was completed, crash & burn - this._error(err); - } - return false; - } - - return true; - }; - - this.writeHeaders(req.headers); - - var self = this; - req - .on('error', function(err) { - self._error(err); - }) - .on('aborted', function() { - self.emit('aborted'); - }) - .on('data', function(buffer) { - self.write(buffer); - }) - .on('end', function() { - if (self.error) { - return; - } - - var err = self._parser.end(); - if (err) { - self._error(err); - } - }); - - if (cb) { - var fields = {}, files = {}; - this - .on('field', function(name, value) { - fields[name] = value; - }) - .on('file', function(name, file) { - files[name] = file; - }) - .on('error', function(err) { - cb(err, fields, files); - }) - .on('end', function() { - cb(null, fields, files); - }); - } - - return this; -}; - -IncomingForm.prototype.writeHeaders = function(headers) { - this.headers = headers; - this._parseContentLength(); - this._parseContentType(); -}; - -IncomingForm.prototype.write = function(buffer) { - if (!this._parser) { - this._error(new Error('unintialized parser')); - return; - } - - this.bytesReceived += buffer.length; - this.emit('progress', this.bytesReceived, this.bytesExpected); - - var bytesParsed = this._parser.write(buffer); - if (bytesParsed !== buffer.length) { - this._error(new Error('parser error, '+bytesParsed+' of '+buffer.length+' bytes parsed')); - } - - return bytesParsed; -}; - -IncomingForm.prototype.pause = function() { - // this does nothing, unless overwritten in IncomingForm.parse - return false; -}; - -IncomingForm.prototype.resume = function() { - // this does nothing, unless overwritten in IncomingForm.parse - return false; -}; - -IncomingForm.prototype.onPart = function(part) { - // this method can be overwritten by the user - this.handlePart(part); -}; - -IncomingForm.prototype.handlePart = function(part) { - var self = this; - - if (part.filename === undefined) { - var value = '' - , decoder = new StringDecoder(this.encoding); - - part.on('data', function(buffer) { - self._fieldsSize += buffer.length; - if (self._fieldsSize > self.maxFieldsSize) { - self._error(new Error('maxFieldsSize exceeded, received '+self._fieldsSize+' bytes of field data')); - return; - } - value += decoder.write(buffer); - }); - - part.on('end', function() { - self.emit('field', part.name, value); - }); - return; - } - - this._flushing++; - - var file = new File({ - path: this._uploadPath(part.filename), - name: part.filename, - type: part.mime, - }); - - this.emit('fileBegin', part.name, file); - - file.open(); - - part.on('data', function(buffer) { - self.pause(); - file.write(buffer, function() { - self.resume(); - }); - }); - - part.on('end', function() { - file.end(function() { - self._flushing--; - self.emit('file', part.name, file); - self._maybeEnd(); - }); - }); -}; - -IncomingForm.prototype._parseContentType = function() { - if (!this.headers['content-type']) { - this._error(new Error('bad content-type header, no content-type')); - return; - } - - if (this.headers['content-type'].match(/urlencoded/i)) { - this._initUrlencoded(); - return; - } - - if (this.headers['content-type'].match(/multipart/i)) { - var m; - if (m = this.headers['content-type'].match(/boundary=(?:"([^"]+)"|([^;]+))/i)) { - this._initMultipart(m[1] || m[2]); - } else { - this._error(new Error('bad content-type header, no multipart boundary')); - } - return; - } - - this._error(new Error('bad content-type header, unknown content-type: '+this.headers['content-type'])); -}; - -IncomingForm.prototype._error = function(err) { - if (this.error) { - return; - } - - this.error = err; - this.pause(); - this.emit('error', err); -}; - -IncomingForm.prototype._parseContentLength = function() { - if (this.headers['content-length']) { - this.bytesReceived = 0; - this.bytesExpected = parseInt(this.headers['content-length'], 10); - this.emit('progress', this.bytesReceived, this.bytesExpected); - } -}; - -IncomingForm.prototype._newParser = function() { - return new MultipartParser(); -}; - -IncomingForm.prototype._initMultipart = function(boundary) { - this.type = 'multipart'; - - var parser = new MultipartParser(), - self = this, - headerField, - headerValue, - part; - - parser.initWithBoundary(boundary); - - parser.onPartBegin = function() { - part = new EventEmitter(); - part.headers = {}; - part.name = null; - part.filename = null; - part.mime = null; - headerField = ''; - headerValue = ''; - }; - - parser.onHeaderField = function(b, start, end) { - headerField += b.toString(self.encoding, start, end); - }; - - parser.onHeaderValue = function(b, start, end) { - headerValue += b.toString(self.encoding, start, end); - }; - - parser.onHeaderEnd = function() { - headerField = headerField.toLowerCase(); - part.headers[headerField] = headerValue; - - var m; - if (headerField == 'content-disposition') { - if (m = headerValue.match(/name="([^"]+)"/i)) { - part.name = m[1]; - } - - part.filename = self._fileName(headerValue); - } else if (headerField == 'content-type') { - part.mime = headerValue; - } - - headerField = ''; - headerValue = ''; - }; - - parser.onHeadersEnd = function() { - self.onPart(part); - }; - - parser.onPartData = function(b, start, end) { - part.emit('data', b.slice(start, end)); - }; - - parser.onPartEnd = function() { - part.emit('end'); - }; - - parser.onEnd = function() { - self.ended = true; - self._maybeEnd(); - }; - - this._parser = parser; -}; - -IncomingForm.prototype._fileName = function(headerValue) { - var m = headerValue.match(/filename="(.*?)"($|; )/i) - if (!m) return; - - var filename = m[1].substr(m[1].lastIndexOf('\\') + 1); - filename = filename.replace(/%22/g, '"'); - filename = filename.replace(/&#([\d]{4});/g, function(m, code) { - return String.fromCharCode(code); - }); - return filename; -}; - -IncomingForm.prototype._initUrlencoded = function() { - this.type = 'urlencoded'; - - var parser = new QuerystringParser() - , self = this; - - parser.onField = function(key, val) { - self.emit('field', key, val); - }; - - parser.onEnd = function() { - self.ended = true; - self._maybeEnd(); - }; - - this._parser = parser; -}; - -IncomingForm.prototype._uploadPath = function(filename) { - var name = ''; - for (var i = 0; i < 32; i++) { - name += Math.floor(Math.random() * 16).toString(16); - } - - if (this.keepExtensions) { - var ext = path.extname(filename); - ext = ext.replace(/(\.[a-z0-9]+).*/, '$1') - - name += ext; - } - - return path.join(this.uploadDir, name); -}; - -IncomingForm.prototype._maybeEnd = function() { - if (!this.ended || this._flushing) { - return; - } - - this.emit('end'); -}; diff --git a/node_modules/connect/node_modules/formidable/lib/index.js b/node_modules/connect/node_modules/formidable/lib/index.js deleted file mode 100644 index 7a6e3e1..0000000 --- a/node_modules/connect/node_modules/formidable/lib/index.js +++ /dev/null @@ -1,3 +0,0 @@ -var IncomingForm = require('./incoming_form').IncomingForm; -IncomingForm.IncomingForm = IncomingForm; -module.exports = IncomingForm; diff --git a/node_modules/connect/node_modules/formidable/lib/multipart_parser.js b/node_modules/connect/node_modules/formidable/lib/multipart_parser.js deleted file mode 100644 index 9ca567c..0000000 --- a/node_modules/connect/node_modules/formidable/lib/multipart_parser.js +++ /dev/null @@ -1,312 +0,0 @@ -var Buffer = require('buffer').Buffer, - s = 0, - S = - { PARSER_UNINITIALIZED: s++, - START: s++, - START_BOUNDARY: s++, - HEADER_FIELD_START: s++, - HEADER_FIELD: s++, - HEADER_VALUE_START: s++, - HEADER_VALUE: s++, - HEADER_VALUE_ALMOST_DONE: s++, - HEADERS_ALMOST_DONE: s++, - PART_DATA_START: s++, - PART_DATA: s++, - PART_END: s++, - END: s++, - }, - - f = 1, - F = - { PART_BOUNDARY: f, - LAST_BOUNDARY: f *= 2, - }, - - LF = 10, - CR = 13, - SPACE = 32, - HYPHEN = 45, - COLON = 58, - A = 97, - Z = 122, - - lower = function(c) { - return c | 0x20; - }; - -for (var s in S) { - exports[s] = S[s]; -} - -function MultipartParser() { - this.boundary = null; - this.boundaryChars = null; - this.lookbehind = null; - this.state = S.PARSER_UNINITIALIZED; - - this.index = null; - this.flags = 0; -}; -exports.MultipartParser = MultipartParser; - -MultipartParser.stateToString = function(stateNumber) { - for (var state in S) { - var number = S[state]; - if (number === stateNumber) return state; - } -}; - -MultipartParser.prototype.initWithBoundary = function(str) { - this.boundary = new Buffer(str.length+4); - this.boundary.write('\r\n--', 'ascii', 0); - this.boundary.write(str, 'ascii', 4); - this.lookbehind = new Buffer(this.boundary.length+8); - this.state = S.START; - - this.boundaryChars = {}; - for (var i = 0; i < this.boundary.length; i++) { - this.boundaryChars[this.boundary[i]] = true; - } -}; - -MultipartParser.prototype.write = function(buffer) { - var self = this, - i = 0, - len = buffer.length, - prevIndex = this.index, - index = this.index, - state = this.state, - flags = this.flags, - lookbehind = this.lookbehind, - boundary = this.boundary, - boundaryChars = this.boundaryChars, - boundaryLength = this.boundary.length, - boundaryEnd = boundaryLength - 1, - bufferLength = buffer.length, - c, - cl, - - mark = function(name) { - self[name+'Mark'] = i; - }, - clear = function(name) { - delete self[name+'Mark']; - }, - callback = function(name, buffer, start, end) { - if (start !== undefined && start === end) { - return; - } - - var callbackSymbol = 'on'+name.substr(0, 1).toUpperCase()+name.substr(1); - if (callbackSymbol in self) { - self[callbackSymbol](buffer, start, end); - } - }, - dataCallback = function(name, clear) { - var markSymbol = name+'Mark'; - if (!(markSymbol in self)) { - return; - } - - if (!clear) { - callback(name, buffer, self[markSymbol], buffer.length); - self[markSymbol] = 0; - } else { - callback(name, buffer, self[markSymbol], i); - delete self[markSymbol]; - } - }; - - for (i = 0; i < len; i++) { - c = buffer[i]; - switch (state) { - case S.PARSER_UNINITIALIZED: - return i; - case S.START: - index = 0; - state = S.START_BOUNDARY; - case S.START_BOUNDARY: - if (index == boundary.length - 2) { - if (c != CR) { - return i; - } - index++; - break; - } else if (index - 1 == boundary.length - 2) { - if (c != LF) { - return i; - } - index = 0; - callback('partBegin'); - state = S.HEADER_FIELD_START; - break; - } - - if (c != boundary[index+2]) { - return i; - } - index++; - break; - case S.HEADER_FIELD_START: - state = S.HEADER_FIELD; - mark('headerField'); - index = 0; - case S.HEADER_FIELD: - if (c == CR) { - clear('headerField'); - state = S.HEADERS_ALMOST_DONE; - break; - } - - index++; - if (c == HYPHEN) { - break; - } - - if (c == COLON) { - if (index == 1) { - // empty header field - return i; - } - dataCallback('headerField', true); - state = S.HEADER_VALUE_START; - break; - } - - cl = lower(c); - if (cl < A || cl > Z) { - return i; - } - break; - case S.HEADER_VALUE_START: - if (c == SPACE) { - break; - } - - mark('headerValue'); - state = S.HEADER_VALUE; - case S.HEADER_VALUE: - if (c == CR) { - dataCallback('headerValue', true); - callback('headerEnd'); - state = S.HEADER_VALUE_ALMOST_DONE; - } - break; - case S.HEADER_VALUE_ALMOST_DONE: - if (c != LF) { - return i; - } - state = S.HEADER_FIELD_START; - break; - case S.HEADERS_ALMOST_DONE: - if (c != LF) { - return i; - } - - callback('headersEnd'); - state = S.PART_DATA_START; - break; - case S.PART_DATA_START: - state = S.PART_DATA - mark('partData'); - case S.PART_DATA: - prevIndex = index; - - if (index == 0) { - // boyer-moore derrived algorithm to safely skip non-boundary data - i += boundaryEnd; - while (i < bufferLength && !(buffer[i] in boundaryChars)) { - i += boundaryLength; - } - i -= boundaryEnd; - c = buffer[i]; - } - - if (index < boundary.length) { - if (boundary[index] == c) { - if (index == 0) { - dataCallback('partData', true); - } - index++; - } else { - index = 0; - } - } else if (index == boundary.length) { - index++; - if (c == CR) { - // CR = part boundary - flags |= F.PART_BOUNDARY; - } else if (c == HYPHEN) { - // HYPHEN = end boundary - flags |= F.LAST_BOUNDARY; - } else { - index = 0; - } - } else if (index - 1 == boundary.length) { - if (flags & F.PART_BOUNDARY) { - index = 0; - if (c == LF) { - // unset the PART_BOUNDARY flag - flags &= ~F.PART_BOUNDARY; - callback('partEnd'); - callback('partBegin'); - state = S.HEADER_FIELD_START; - break; - } - } else if (flags & F.LAST_BOUNDARY) { - if (c == HYPHEN) { - callback('partEnd'); - callback('end'); - state = S.END; - } else { - index = 0; - } - } else { - index = 0; - } - } - - if (index > 0) { - // when matching a possible boundary, keep a lookbehind reference - // in case it turns out to be a false lead - lookbehind[index-1] = c; - } else if (prevIndex > 0) { - // if our boundary turned out to be rubbish, the captured lookbehind - // belongs to partData - callback('partData', lookbehind, 0, prevIndex); - prevIndex = 0; - mark('partData'); - - // reconsider the current character even so it interrupted the sequence - // it could be the beginning of a new sequence - i--; - } - - break; - case S.END: - break; - default: - return i; - } - } - - dataCallback('headerField'); - dataCallback('headerValue'); - dataCallback('partData'); - - this.index = index; - this.state = state; - this.flags = flags; - - return len; -}; - -MultipartParser.prototype.end = function() { - if (this.state != S.END) { - return new Error('MultipartParser.end(): stream ended unexpectedly: ' + this.explain()); - } -}; - -MultipartParser.prototype.explain = function() { - return 'state = ' + MultipartParser.stateToString(this.state); -}; diff --git a/node_modules/connect/node_modules/formidable/lib/querystring_parser.js b/node_modules/connect/node_modules/formidable/lib/querystring_parser.js deleted file mode 100644 index 63f109e..0000000 --- a/node_modules/connect/node_modules/formidable/lib/querystring_parser.js +++ /dev/null @@ -1,25 +0,0 @@ -if (global.GENTLY) require = GENTLY.hijack(require); - -// This is a buffering parser, not quite as nice as the multipart one. -// If I find time I'll rewrite this to be fully streaming as well -var querystring = require('querystring'); - -function QuerystringParser() { - this.buffer = ''; -}; -exports.QuerystringParser = QuerystringParser; - -QuerystringParser.prototype.write = function(buffer) { - this.buffer += buffer.toString('ascii'); - return buffer.length; -}; - -QuerystringParser.prototype.end = function() { - var fields = querystring.parse(this.buffer); - for (var field in fields) { - this.onField(field, fields[field]); - } - this.buffer = ''; - - this.onEnd(); -}; \ No newline at end of file diff --git a/node_modules/connect/node_modules/formidable/lib/util.js b/node_modules/connect/node_modules/formidable/lib/util.js deleted file mode 100644 index e9493e9..0000000 --- a/node_modules/connect/node_modules/formidable/lib/util.js +++ /dev/null @@ -1,6 +0,0 @@ -// Backwards compatibility ... -try { - module.exports = require('util'); -} catch (e) { - module.exports = require('sys'); -} diff --git a/node_modules/connect/node_modules/formidable/package.json b/node_modules/connect/node_modules/formidable/package.json deleted file mode 100644 index 5dee23e..0000000 --- a/node_modules/connect/node_modules/formidable/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "formidable", - "version": "1.0.9", - "dependencies": {}, - "devDependencies": { - "gently": "0.8.0", - "findit": "0.1.1", - "hashish": "0.0.4", - "urun": "0.0.4", - "utest": "0.0.3" - }, - "directories": { - "lib": "./lib" - }, - "main": "./lib/index", - "scripts": { - "test": "make test" - }, - "engines": { - "node": "*" - }, - "_id": "formidable@1.0.9", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "dist": { - "shasum": "7d94c49846d9de5dfdc8e43d831ae715cfc9ac63" - }, - "_from": "formidable@1.0.9" -} diff --git a/node_modules/connect/node_modules/formidable/test/common.js b/node_modules/connect/node_modules/formidable/test/common.js deleted file mode 100644 index eb432ad..0000000 --- a/node_modules/connect/node_modules/formidable/test/common.js +++ /dev/null @@ -1,19 +0,0 @@ -var mysql = require('..'); -var path = require('path'); - -var root = path.join(__dirname, '../'); -exports.dir = { - root : root, - lib : root + '/lib', - fixture : root + '/test/fixture', - tmp : root + '/test/tmp', -}; - -exports.port = 13532; - -exports.formidable = require('..'); -exports.assert = require('assert'); - -exports.require = function(lib) { - return require(exports.dir.lib + '/' + lib); -}; diff --git a/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt b/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt deleted file mode 100644 index e7a4785..0000000 --- a/node_modules/connect/node_modules/formidable/test/fixture/file/funkyfilename.txt +++ /dev/null @@ -1 +0,0 @@ -I am a text file with a funky name! diff --git a/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt b/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt deleted file mode 100644 index 9b6903e..0000000 --- a/node_modules/connect/node_modules/formidable/test/fixture/file/plain.txt +++ /dev/null @@ -1 +0,0 @@ -I am a plain text file diff --git a/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md b/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md deleted file mode 100644 index 3c9dbe3..0000000 --- a/node_modules/connect/node_modules/formidable/test/fixture/http/special-chars-in-filename/info.md +++ /dev/null @@ -1,3 +0,0 @@ -* Opera does not allow submitting this file, it shows a warning to the - user that the file could not be found instead. Tested in 9.8, 11.51 on OSX. - Reported to Opera on 08.09.2011 (tracking email DSK-346009@bugs.opera.com). diff --git a/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js b/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js deleted file mode 100644 index 0bae449..0000000 --- a/node_modules/connect/node_modules/formidable/test/fixture/js/no-filename.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports['generic.http'] = [ - {type: 'file', name: 'upload', filename: '', fixture: 'plain.txt'}, -]; diff --git a/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js b/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js deleted file mode 100644 index eb76fdc..0000000 --- a/node_modules/connect/node_modules/formidable/test/fixture/js/special-chars-in-filename.js +++ /dev/null @@ -1,21 +0,0 @@ -var properFilename = 'funkyfilename.txt'; - -function expect(filename) { - return [ - {type: 'field', name: 'title', value: 'Weird filename'}, - {type: 'file', name: 'upload', filename: filename, fixture: properFilename}, - ]; -}; - -var webkit = " ? % * | \" < > . ? ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt"; -var ffOrIe = " ? % * | \" < > . ☃ ; ' @ # $ ^ & ( ) - _ = + { } [ ] ` ~.txt"; - -module.exports = { - 'osx-chrome-13.http' : expect(webkit), - 'osx-firefox-3.6.http' : expect(ffOrIe), - 'osx-safari-5.http' : expect(webkit), - 'xp-chrome-12.http' : expect(webkit), - 'xp-ie-7.http' : expect(ffOrIe), - 'xp-ie-8.http' : expect(ffOrIe), - 'xp-safari-5.http' : expect(webkit), -}; diff --git a/node_modules/connect/node_modules/formidable/test/fixture/multipart.js b/node_modules/connect/node_modules/formidable/test/fixture/multipart.js deleted file mode 100644 index a476169..0000000 --- a/node_modules/connect/node_modules/formidable/test/fixture/multipart.js +++ /dev/null @@ -1,72 +0,0 @@ -exports['rfc1867'] = - { boundary: 'AaB03x', - raw: - '--AaB03x\r\n'+ - 'content-disposition: form-data; name="field1"\r\n'+ - '\r\n'+ - 'Joe Blow\r\nalmost tricked you!\r\n'+ - '--AaB03x\r\n'+ - 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+ - 'Content-Type: text/plain\r\n'+ - '\r\n'+ - '... contents of file1.txt ...\r\r\n'+ - '--AaB03x--\r\n', - parts: - [ { headers: { - 'content-disposition': 'form-data; name="field1"', - }, - data: 'Joe Blow\r\nalmost tricked you!', - }, - { headers: { - 'content-disposition': 'form-data; name="pics"; filename="file1.txt"', - 'Content-Type': 'text/plain', - }, - data: '... contents of file1.txt ...\r', - } - ] - }; - -exports['noTrailing\r\n'] = - { boundary: 'AaB03x', - raw: - '--AaB03x\r\n'+ - 'content-disposition: form-data; name="field1"\r\n'+ - '\r\n'+ - 'Joe Blow\r\nalmost tricked you!\r\n'+ - '--AaB03x\r\n'+ - 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+ - 'Content-Type: text/plain\r\n'+ - '\r\n'+ - '... contents of file1.txt ...\r\r\n'+ - '--AaB03x--', - parts: - [ { headers: { - 'content-disposition': 'form-data; name="field1"', - }, - data: 'Joe Blow\r\nalmost tricked you!', - }, - { headers: { - 'content-disposition': 'form-data; name="pics"; filename="file1.txt"', - 'Content-Type': 'text/plain', - }, - data: '... contents of file1.txt ...\r', - } - ] - }; - -exports['emptyHeader'] = - { boundary: 'AaB03x', - raw: - '--AaB03x\r\n'+ - 'content-disposition: form-data; name="field1"\r\n'+ - ': foo\r\n'+ - '\r\n'+ - 'Joe Blow\r\nalmost tricked you!\r\n'+ - '--AaB03x\r\n'+ - 'content-disposition: form-data; name="pics"; filename="file1.txt"\r\n'+ - 'Content-Type: text/plain\r\n'+ - '\r\n'+ - '... contents of file1.txt ...\r\r\n'+ - '--AaB03x--\r\n', - expectError: true, - }; diff --git a/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js b/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js deleted file mode 100644 index 66ad259..0000000 --- a/node_modules/connect/node_modules/formidable/test/integration/test-fixtures.js +++ /dev/null @@ -1,89 +0,0 @@ -var hashish = require('hashish'); -var fs = require('fs'); -var findit = require('findit'); -var path = require('path'); -var http = require('http'); -var net = require('net'); -var assert = require('assert'); - -var common = require('../common'); -var formidable = common.formidable; - -var server = http.createServer(); -server.listen(common.port, findFixtures); - -function findFixtures() { - var fixtures = []; - findit - .sync(common.dir.fixture + '/js') - .forEach(function(jsPath) { - if (!/\.js$/.test(jsPath)) return; - - var group = path.basename(jsPath, '.js'); - hashish.forEach(require(jsPath), function(fixture, name) { - fixtures.push({ - name : group + '/' + name, - fixture : fixture, - }); - }); - }); - - testNext(fixtures); -} - -function testNext(fixtures) { - var fixture = fixtures.shift(); - if (!fixture) return server.close(); - - var name = fixture.name; - var fixture = fixture.fixture; - - uploadFixture(name, function(err, parts) { - if (err) throw err; - - fixture.forEach(function(expectedPart, i) { - var parsedPart = parts[i]; - assert.equal(parsedPart.type, expectedPart.type); - assert.equal(parsedPart.name, expectedPart.name); - - if (parsedPart.type === 'file') { - var filename = parsedPart.value.name; - assert.equal(filename, expectedPart.filename); - } - }); - - testNext(fixtures); - }); -}; - -function uploadFixture(name, cb) { - server.once('request', function(req, res) { - var form = new formidable.IncomingForm(); - form.uploadDir = common.dir.tmp; - form.parse(req); - - function callback() { - var realCallback = cb; - cb = function() {}; - realCallback.apply(null, arguments); - } - - var parts = []; - form - .on('error', callback) - .on('fileBegin', function(name, value) { - parts.push({type: 'file', name: name, value: value}); - }) - .on('field', function(name, value) { - parts.push({type: 'field', name: name, value: value}); - }) - .on('end', function() { - callback(null, parts); - }); - }); - - var socket = net.createConnection(common.port); - var file = fs.createReadStream(common.dir.fixture + '/http/' + name); - - file.pipe(socket); -} diff --git a/node_modules/connect/node_modules/formidable/test/legacy/common.js b/node_modules/connect/node_modules/formidable/test/legacy/common.js deleted file mode 100644 index 2b98598..0000000 --- a/node_modules/connect/node_modules/formidable/test/legacy/common.js +++ /dev/null @@ -1,24 +0,0 @@ -var path = require('path'), - fs = require('fs'); - -try { - global.Gently = require('gently'); -} catch (e) { - throw new Error('this test suite requires node-gently'); -} - -exports.lib = path.join(__dirname, '../../lib'); - -global.GENTLY = new Gently(); - -global.assert = require('assert'); -global.TEST_PORT = 13532; -global.TEST_FIXTURES = path.join(__dirname, '../fixture'); -global.TEST_TMP = path.join(__dirname, '../tmp'); - -// Stupid new feature in node that complains about gently attaching too many -// listeners to process 'exit'. This is a workaround until I can think of a -// better way to deal with this. -if (process.setMaxListeners) { - process.setMaxListeners(10000); -} diff --git a/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js b/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js deleted file mode 100644 index 75232aa..0000000 --- a/node_modules/connect/node_modules/formidable/test/legacy/integration/test-multipart-parser.js +++ /dev/null @@ -1,80 +0,0 @@ -var common = require('../common'); -var CHUNK_LENGTH = 10, - multipartParser = require(common.lib + '/multipart_parser'), - MultipartParser = multipartParser.MultipartParser, - parser = new MultipartParser(), - fixtures = require(TEST_FIXTURES + '/multipart'), - Buffer = require('buffer').Buffer; - -Object.keys(fixtures).forEach(function(name) { - var fixture = fixtures[name], - buffer = new Buffer(Buffer.byteLength(fixture.raw, 'binary')), - offset = 0, - chunk, - nparsed, - - parts = [], - part = null, - headerField, - headerValue, - endCalled = ''; - - parser.initWithBoundary(fixture.boundary); - parser.onPartBegin = function() { - part = {headers: {}, data: ''}; - parts.push(part); - headerField = ''; - headerValue = ''; - }; - - parser.onHeaderField = function(b, start, end) { - headerField += b.toString('ascii', start, end); - }; - - parser.onHeaderValue = function(b, start, end) { - headerValue += b.toString('ascii', start, end); - } - - parser.onHeaderEnd = function() { - part.headers[headerField] = headerValue; - headerField = ''; - headerValue = ''; - }; - - parser.onPartData = function(b, start, end) { - var str = b.toString('ascii', start, end); - part.data += b.slice(start, end); - } - - parser.onEnd = function() { - endCalled = true; - } - - buffer.write(fixture.raw, 'binary', 0); - - while (offset < buffer.length) { - if (offset + CHUNK_LENGTH < buffer.length) { - chunk = buffer.slice(offset, offset+CHUNK_LENGTH); - } else { - chunk = buffer.slice(offset, buffer.length); - } - offset = offset + CHUNK_LENGTH; - - nparsed = parser.write(chunk); - if (nparsed != chunk.length) { - if (fixture.expectError) { - return; - } - puts('-- ERROR --'); - p(chunk.toString('ascii')); - throw new Error(chunk.length+' bytes written, but only '+nparsed+' bytes parsed!'); - } - } - - if (fixture.expectError) { - throw new Error('expected parse error did not happen'); - } - - assert.ok(endCalled); - assert.deepEqual(parts, fixture.parts); -}); diff --git a/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js b/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js deleted file mode 100644 index 52ceedb..0000000 --- a/node_modules/connect/node_modules/formidable/test/legacy/simple/test-file.js +++ /dev/null @@ -1,104 +0,0 @@ -var common = require('../common'); -var WriteStreamStub = GENTLY.stub('fs', 'WriteStream'); - -var File = require(common.lib + '/file'), - EventEmitter = require('events').EventEmitter, - file, - gently; - -function test(test) { - gently = new Gently(); - file = new File(); - test(); - gently.verify(test.name); -} - -test(function constructor() { - assert.ok(file instanceof EventEmitter); - assert.strictEqual(file.size, 0); - assert.strictEqual(file.path, null); - assert.strictEqual(file.name, null); - assert.strictEqual(file.type, null); - assert.strictEqual(file.lastModifiedDate, null); - - assert.strictEqual(file._writeStream, null); - - (function testSetProperties() { - var file2 = new File({foo: 'bar'}); - assert.equal(file2.foo, 'bar'); - })(); -}); - -test(function open() { - var WRITE_STREAM; - file.path = '/foo'; - - gently.expect(WriteStreamStub, 'new', function (path) { - WRITE_STREAM = this; - assert.strictEqual(path, file.path); - }); - - file.open(); - assert.strictEqual(file._writeStream, WRITE_STREAM); -}); - -test(function write() { - var BUFFER = {length: 10}, - CB_STUB, - CB = function() { - CB_STUB.apply(this, arguments); - }; - - file._writeStream = {}; - - gently.expect(file._writeStream, 'write', function (buffer, cb) { - assert.strictEqual(buffer, BUFFER); - - gently.expect(file, 'emit', function (event, bytesWritten) { - assert.ok(file.lastModifiedDate instanceof Date); - assert.equal(event, 'progress'); - assert.equal(bytesWritten, file.size); - }); - - CB_STUB = gently.expect(function writeCb() { - assert.equal(file.size, 10); - }); - - cb(); - - gently.expect(file, 'emit', function (event, bytesWritten) { - assert.equal(event, 'progress'); - assert.equal(bytesWritten, file.size); - }); - - CB_STUB = gently.expect(function writeCb() { - assert.equal(file.size, 20); - }); - - cb(); - }); - - file.write(BUFFER, CB); -}); - -test(function end() { - var CB_STUB, - CB = function() { - CB_STUB.apply(this, arguments); - }; - - file._writeStream = {}; - - gently.expect(file._writeStream, 'end', function (cb) { - gently.expect(file, 'emit', function (event) { - assert.equal(event, 'end'); - }); - - CB_STUB = gently.expect(function endCb() { - }); - - cb(); - }); - - file.end(CB); -}); diff --git a/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js b/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js deleted file mode 100644 index b64df8b..0000000 --- a/node_modules/connect/node_modules/formidable/test/legacy/simple/test-incoming-form.js +++ /dev/null @@ -1,726 +0,0 @@ -var common = require('../common'); -var MultipartParserStub = GENTLY.stub('./multipart_parser', 'MultipartParser'), - QuerystringParserStub = GENTLY.stub('./querystring_parser', 'QuerystringParser'), - EventEmitterStub = GENTLY.stub('events', 'EventEmitter'), - FileStub = GENTLY.stub('./file'); - -var formidable = require(common.lib + '/index'), - IncomingForm = formidable.IncomingForm, - events = require('events'), - fs = require('fs'), - path = require('path'), - Buffer = require('buffer').Buffer, - fixtures = require(TEST_FIXTURES + '/multipart'), - form, - gently; - -function test(test) { - gently = new Gently(); - gently.expect(EventEmitterStub, 'call'); - form = new IncomingForm(); - test(); - gently.verify(test.name); -} - -test(function constructor() { - assert.strictEqual(form.error, null); - assert.strictEqual(form.ended, false); - assert.strictEqual(form.type, null); - assert.strictEqual(form.headers, null); - assert.strictEqual(form.keepExtensions, false); - assert.strictEqual(form.uploadDir, '/tmp'); - assert.strictEqual(form.encoding, 'utf-8'); - assert.strictEqual(form.bytesReceived, null); - assert.strictEqual(form.bytesExpected, null); - assert.strictEqual(form.maxFieldsSize, 2 * 1024 * 1024); - assert.strictEqual(form._parser, null); - assert.strictEqual(form._flushing, 0); - assert.strictEqual(form._fieldsSize, 0); - assert.ok(form instanceof EventEmitterStub); - assert.equal(form.constructor.name, 'IncomingForm'); - - (function testSimpleConstructor() { - gently.expect(EventEmitterStub, 'call'); - var form = IncomingForm(); - assert.ok(form instanceof IncomingForm); - })(); - - (function testSimpleConstructorShortcut() { - gently.expect(EventEmitterStub, 'call'); - var form = formidable(); - assert.ok(form instanceof IncomingForm); - })(); -}); - -test(function parse() { - var REQ = {headers: {}} - , emit = {}; - - gently.expect(form, 'writeHeaders', function(headers) { - assert.strictEqual(headers, REQ.headers); - }); - - var events = ['error', 'aborted', 'data', 'end']; - gently.expect(REQ, 'on', events.length, function(event, fn) { - assert.equal(event, events.shift()); - emit[event] = fn; - return this; - }); - - form.parse(REQ); - - (function testPause() { - gently.expect(REQ, 'pause'); - assert.strictEqual(form.pause(), true); - })(); - - (function testPauseCriticalException() { - form.ended = false; - - var ERR = new Error('dasdsa'); - gently.expect(REQ, 'pause', function() { - throw ERR; - }); - - gently.expect(form, '_error', function(err) { - assert.strictEqual(err, ERR); - }); - - assert.strictEqual(form.pause(), false); - })(); - - (function testPauseHarmlessException() { - form.ended = true; - - var ERR = new Error('dasdsa'); - gently.expect(REQ, 'pause', function() { - throw ERR; - }); - - assert.strictEqual(form.pause(), false); - })(); - - (function testResume() { - gently.expect(REQ, 'resume'); - assert.strictEqual(form.resume(), true); - })(); - - (function testResumeCriticalException() { - form.ended = false; - - var ERR = new Error('dasdsa'); - gently.expect(REQ, 'resume', function() { - throw ERR; - }); - - gently.expect(form, '_error', function(err) { - assert.strictEqual(err, ERR); - }); - - assert.strictEqual(form.resume(), false); - })(); - - (function testResumeHarmlessException() { - form.ended = true; - - var ERR = new Error('dasdsa'); - gently.expect(REQ, 'resume', function() { - throw ERR; - }); - - assert.strictEqual(form.resume(), false); - })(); - - (function testEmitError() { - var ERR = new Error('something bad happened'); - gently.expect(form, '_error',function(err) { - assert.strictEqual(err, ERR); - }); - emit.error(ERR); - })(); - - (function testEmitAborted() { - gently.expect(form, 'emit',function(event) { - assert.equal(event, 'aborted'); - }); - - emit.aborted(); - })(); - - - (function testEmitData() { - var BUFFER = [1, 2, 3]; - gently.expect(form, 'write', function(buffer) { - assert.strictEqual(buffer, BUFFER); - }); - emit.data(BUFFER); - })(); - - (function testEmitEnd() { - form._parser = {}; - - (function testWithError() { - var ERR = new Error('haha'); - gently.expect(form._parser, 'end', function() { - return ERR; - }); - - gently.expect(form, '_error', function(err) { - assert.strictEqual(err, ERR); - }); - - emit.end(); - })(); - - (function testWithoutError() { - gently.expect(form._parser, 'end'); - emit.end(); - })(); - - (function testAfterError() { - form.error = true; - emit.end(); - })(); - })(); - - (function testWithCallback() { - gently.expect(EventEmitterStub, 'call'); - var form = new IncomingForm(), - REQ = {headers: {}}, - parseCalled = 0; - - gently.expect(form, 'writeHeaders'); - gently.expect(REQ, 'on', 4, function() { - return this; - }); - - gently.expect(form, 'on', 4, function(event, fn) { - if (event == 'field') { - fn('field1', 'foo'); - fn('field1', 'bar'); - fn('field2', 'nice'); - } - - if (event == 'file') { - fn('file1', '1'); - fn('file1', '2'); - fn('file2', '3'); - } - - if (event == 'end') { - fn(); - } - return this; - }); - - form.parse(REQ, gently.expect(function parseCbOk(err, fields, files) { - assert.deepEqual(fields, {field1: 'bar', field2: 'nice'}); - assert.deepEqual(files, {file1: '2', file2: '3'}); - })); - - gently.expect(form, 'writeHeaders'); - gently.expect(REQ, 'on', 4, function() { - return this; - }); - - var ERR = new Error('test'); - gently.expect(form, 'on', 3, function(event, fn) { - if (event == 'field') { - fn('foo', 'bar'); - } - - if (event == 'error') { - fn(ERR); - gently.expect(form, 'on'); - } - return this; - }); - - form.parse(REQ, gently.expect(function parseCbErr(err, fields, files) { - assert.strictEqual(err, ERR); - assert.deepEqual(fields, {foo: 'bar'}); - })); - })(); -}); - -test(function pause() { - assert.strictEqual(form.pause(), false); -}); - -test(function resume() { - assert.strictEqual(form.resume(), false); -}); - - -test(function writeHeaders() { - var HEADERS = {}; - gently.expect(form, '_parseContentLength'); - gently.expect(form, '_parseContentType'); - - form.writeHeaders(HEADERS); - assert.strictEqual(form.headers, HEADERS); -}); - -test(function write() { - var parser = {}, - BUFFER = [1, 2, 3]; - - form._parser = parser; - form.bytesExpected = 523423; - - (function testBasic() { - gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) { - assert.equal(event, 'progress'); - assert.equal(bytesReceived, BUFFER.length); - assert.equal(bytesExpected, form.bytesExpected); - }); - - gently.expect(parser, 'write', function(buffer) { - assert.strictEqual(buffer, BUFFER); - return buffer.length; - }); - - assert.equal(form.write(BUFFER), BUFFER.length); - assert.equal(form.bytesReceived, BUFFER.length); - })(); - - (function testParserError() { - gently.expect(form, 'emit'); - - gently.expect(parser, 'write', function(buffer) { - assert.strictEqual(buffer, BUFFER); - return buffer.length - 1; - }); - - gently.expect(form, '_error', function(err) { - assert.ok(err.message.match(/parser error/i)); - }); - - assert.equal(form.write(BUFFER), BUFFER.length - 1); - assert.equal(form.bytesReceived, BUFFER.length + BUFFER.length); - })(); - - (function testUninitialized() { - delete form._parser; - - gently.expect(form, '_error', function(err) { - assert.ok(err.message.match(/unintialized parser/i)); - }); - form.write(BUFFER); - })(); -}); - -test(function parseContentType() { - var HEADERS = {}; - - form.headers = {'content-type': 'application/x-www-form-urlencoded'}; - gently.expect(form, '_initUrlencoded'); - form._parseContentType(); - - // accept anything that has 'urlencoded' in it - form.headers = {'content-type': 'broken-client/urlencoded-stupid'}; - gently.expect(form, '_initUrlencoded'); - form._parseContentType(); - - var BOUNDARY = '---------------------------57814261102167618332366269'; - form.headers = {'content-type': 'multipart/form-data; boundary='+BOUNDARY}; - - gently.expect(form, '_initMultipart', function(boundary) { - assert.equal(boundary, BOUNDARY); - }); - form._parseContentType(); - - (function testQuotedBoundary() { - form.headers = {'content-type': 'multipart/form-data; boundary="' + BOUNDARY + '"'}; - - gently.expect(form, '_initMultipart', function(boundary) { - assert.equal(boundary, BOUNDARY); - }); - form._parseContentType(); - })(); - - (function testNoBoundary() { - form.headers = {'content-type': 'multipart/form-data'}; - - gently.expect(form, '_error', function(err) { - assert.ok(err.message.match(/no multipart boundary/i)); - }); - form._parseContentType(); - })(); - - (function testNoContentType() { - form.headers = {}; - - gently.expect(form, '_error', function(err) { - assert.ok(err.message.match(/no content-type/i)); - }); - form._parseContentType(); - })(); - - (function testUnknownContentType() { - form.headers = {'content-type': 'invalid'}; - - gently.expect(form, '_error', function(err) { - assert.ok(err.message.match(/unknown content-type/i)); - }); - form._parseContentType(); - })(); -}); - -test(function parseContentLength() { - var HEADERS = {}; - - form.headers = {}; - form._parseContentLength(); - assert.strictEqual(form.bytesReceived, null); - assert.strictEqual(form.bytesExpected, null); - - form.headers['content-length'] = '8'; - gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) { - assert.equal(event, 'progress'); - assert.equal(bytesReceived, 0); - assert.equal(bytesExpected, 8); - }); - form._parseContentLength(); - assert.strictEqual(form.bytesReceived, 0); - assert.strictEqual(form.bytesExpected, 8); - - // JS can be evil, lets make sure we are not - form.headers['content-length'] = '08'; - gently.expect(form, 'emit', function(event, bytesReceived, bytesExpected) { - assert.equal(event, 'progress'); - assert.equal(bytesReceived, 0); - assert.equal(bytesExpected, 8); - }); - form._parseContentLength(); - assert.strictEqual(form.bytesExpected, 8); -}); - -test(function _initMultipart() { - var BOUNDARY = '123', - PARSER; - - gently.expect(MultipartParserStub, 'new', function() { - PARSER = this; - }); - - gently.expect(MultipartParserStub.prototype, 'initWithBoundary', function(boundary) { - assert.equal(boundary, BOUNDARY); - }); - - form._initMultipart(BOUNDARY); - assert.equal(form.type, 'multipart'); - assert.strictEqual(form._parser, PARSER); - - (function testRegularField() { - var PART; - gently.expect(EventEmitterStub, 'new', function() { - PART = this; - }); - - gently.expect(form, 'onPart', function(part) { - assert.strictEqual(part, PART); - assert.deepEqual - ( part.headers - , { 'content-disposition': 'form-data; name="field1"' - , 'foo': 'bar' - } - ); - assert.equal(part.name, 'field1'); - - var strings = ['hello', ' world']; - gently.expect(part, 'emit', 2, function(event, b) { - assert.equal(event, 'data'); - assert.equal(b.toString(), strings.shift()); - }); - - gently.expect(part, 'emit', function(event, b) { - assert.equal(event, 'end'); - }); - }); - - PARSER.onPartBegin(); - PARSER.onHeaderField(new Buffer('content-disposition'), 0, 10); - PARSER.onHeaderField(new Buffer('content-disposition'), 10, 19); - PARSER.onHeaderValue(new Buffer('form-data; name="field1"'), 0, 14); - PARSER.onHeaderValue(new Buffer('form-data; name="field1"'), 14, 24); - PARSER.onHeaderEnd(); - PARSER.onHeaderField(new Buffer('foo'), 0, 3); - PARSER.onHeaderValue(new Buffer('bar'), 0, 3); - PARSER.onHeaderEnd(); - PARSER.onHeadersEnd(); - PARSER.onPartData(new Buffer('hello world'), 0, 5); - PARSER.onPartData(new Buffer('hello world'), 5, 11); - PARSER.onPartEnd(); - })(); - - (function testFileField() { - var PART; - gently.expect(EventEmitterStub, 'new', function() { - PART = this; - }); - - gently.expect(form, 'onPart', function(part) { - assert.deepEqual - ( part.headers - , { 'content-disposition': 'form-data; name="field2"; filename="C:\\Documents and Settings\\IE\\Must\\Die\\Sun"et.jpg"' - , 'content-type': 'text/plain' - } - ); - assert.equal(part.name, 'field2'); - assert.equal(part.filename, 'Sun"et.jpg'); - assert.equal(part.mime, 'text/plain'); - - gently.expect(part, 'emit', function(event, b) { - assert.equal(event, 'data'); - assert.equal(b.toString(), '... contents of file1.txt ...'); - }); - - gently.expect(part, 'emit', function(event, b) { - assert.equal(event, 'end'); - }); - }); - - PARSER.onPartBegin(); - PARSER.onHeaderField(new Buffer('content-disposition'), 0, 19); - PARSER.onHeaderValue(new Buffer('form-data; name="field2"; filename="C:\\Documents and Settings\\IE\\Must\\Die\\Sun"et.jpg"'), 0, 85); - PARSER.onHeaderEnd(); - PARSER.onHeaderField(new Buffer('Content-Type'), 0, 12); - PARSER.onHeaderValue(new Buffer('text/plain'), 0, 10); - PARSER.onHeaderEnd(); - PARSER.onHeadersEnd(); - PARSER.onPartData(new Buffer('... contents of file1.txt ...'), 0, 29); - PARSER.onPartEnd(); - })(); - - (function testEnd() { - gently.expect(form, '_maybeEnd'); - PARSER.onEnd(); - assert.ok(form.ended); - })(); -}); - -test(function _fileName() { - // TODO - return; -}); - -test(function _initUrlencoded() { - var PARSER; - - gently.expect(QuerystringParserStub, 'new', function() { - PARSER = this; - }); - - form._initUrlencoded(); - assert.equal(form.type, 'urlencoded'); - assert.strictEqual(form._parser, PARSER); - - (function testOnField() { - var KEY = 'KEY', VAL = 'VAL'; - gently.expect(form, 'emit', function(field, key, val) { - assert.equal(field, 'field'); - assert.equal(key, KEY); - assert.equal(val, VAL); - }); - - PARSER.onField(KEY, VAL); - })(); - - (function testOnEnd() { - gently.expect(form, '_maybeEnd'); - - PARSER.onEnd(); - assert.equal(form.ended, true); - })(); -}); - -test(function _error() { - var ERR = new Error('bla'); - - gently.expect(form, 'pause'); - gently.expect(form, 'emit', function(event, err) { - assert.equal(event, 'error'); - assert.strictEqual(err, ERR); - }); - - form._error(ERR); - assert.strictEqual(form.error, ERR); - - // make sure _error only does its thing once - form._error(ERR); -}); - -test(function onPart() { - var PART = {}; - gently.expect(form, 'handlePart', function(part) { - assert.strictEqual(part, PART); - }); - - form.onPart(PART); -}); - -test(function handlePart() { - (function testUtf8Field() { - var PART = new events.EventEmitter(); - PART.name = 'my_field'; - - gently.expect(form, 'emit', function(event, field, value) { - assert.equal(event, 'field'); - assert.equal(field, 'my_field'); - assert.equal(value, 'hello world: €'); - }); - - form.handlePart(PART); - PART.emit('data', new Buffer('hello')); - PART.emit('data', new Buffer(' world: ')); - PART.emit('data', new Buffer([0xE2])); - PART.emit('data', new Buffer([0x82, 0xAC])); - PART.emit('end'); - })(); - - (function testBinaryField() { - var PART = new events.EventEmitter(); - PART.name = 'my_field2'; - - gently.expect(form, 'emit', function(event, field, value) { - assert.equal(event, 'field'); - assert.equal(field, 'my_field2'); - assert.equal(value, 'hello world: '+new Buffer([0xE2, 0x82, 0xAC]).toString('binary')); - }); - - form.encoding = 'binary'; - form.handlePart(PART); - PART.emit('data', new Buffer('hello')); - PART.emit('data', new Buffer(' world: ')); - PART.emit('data', new Buffer([0xE2])); - PART.emit('data', new Buffer([0x82, 0xAC])); - PART.emit('end'); - })(); - - (function testFieldSize() { - form.maxFieldsSize = 8; - var PART = new events.EventEmitter(); - PART.name = 'my_field'; - - gently.expect(form, '_error', function(err) { - assert.equal(err.message, 'maxFieldsSize exceeded, received 9 bytes of field data'); - }); - - form.handlePart(PART); - form._fieldsSize = 1; - PART.emit('data', new Buffer(7)); - PART.emit('data', new Buffer(1)); - })(); - - (function testFilePart() { - var PART = new events.EventEmitter(), - FILE = new events.EventEmitter(), - PATH = '/foo/bar'; - - PART.name = 'my_file'; - PART.filename = 'sweet.txt'; - PART.mime = 'sweet.txt'; - - gently.expect(form, '_uploadPath', function(filename) { - assert.equal(filename, PART.filename); - return PATH; - }); - - gently.expect(FileStub, 'new', function(properties) { - assert.equal(properties.path, PATH); - assert.equal(properties.name, PART.filename); - assert.equal(properties.type, PART.mime); - FILE = this; - - gently.expect(form, 'emit', function (event, field, file) { - assert.equal(event, 'fileBegin'); - assert.strictEqual(field, PART.name); - assert.strictEqual(file, FILE); - }); - - gently.expect(FILE, 'open'); - }); - - form.handlePart(PART); - assert.equal(form._flushing, 1); - - var BUFFER; - gently.expect(form, 'pause'); - gently.expect(FILE, 'write', function(buffer, cb) { - assert.strictEqual(buffer, BUFFER); - gently.expect(form, 'resume'); - // @todo handle cb(new Err) - cb(); - }); - - PART.emit('data', BUFFER = new Buffer('test')); - - gently.expect(FILE, 'end', function(cb) { - gently.expect(form, 'emit', function(event, field, file) { - assert.equal(event, 'file'); - assert.strictEqual(file, FILE); - }); - - gently.expect(form, '_maybeEnd'); - - cb(); - assert.equal(form._flushing, 0); - }); - - PART.emit('end'); - })(); -}); - -test(function _uploadPath() { - (function testUniqueId() { - var UUID_A, UUID_B; - gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, uuid) { - assert.equal(uploadDir, form.uploadDir); - UUID_A = uuid; - }); - form._uploadPath(); - - gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, uuid) { - UUID_B = uuid; - }); - form._uploadPath(); - - assert.notEqual(UUID_A, UUID_B); - })(); - - (function testFileExtension() { - form.keepExtensions = true; - var FILENAME = 'foo.jpg', - EXT = '.bar'; - - gently.expect(GENTLY.hijacked.path, 'extname', function(filename) { - assert.equal(filename, FILENAME); - gently.restore(path, 'extname'); - - return EXT; - }); - - gently.expect(GENTLY.hijacked.path, 'join', function(uploadDir, name) { - assert.equal(path.extname(name), EXT); - }); - form._uploadPath(FILENAME); - })(); -}); - -test(function _maybeEnd() { - gently.expect(form, 'emit', 0); - form._maybeEnd(); - - form.ended = true; - form._flushing = 1; - form._maybeEnd(); - - gently.expect(form, 'emit', function(event) { - assert.equal(event, 'end'); - }); - - form.ended = true; - form._flushing = 0; - form._maybeEnd(); -}); diff --git a/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js b/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js deleted file mode 100644 index d8dc968..0000000 --- a/node_modules/connect/node_modules/formidable/test/legacy/simple/test-multipart-parser.js +++ /dev/null @@ -1,50 +0,0 @@ -var common = require('../common'); -var multipartParser = require(common.lib + '/multipart_parser'), - MultipartParser = multipartParser.MultipartParser, - events = require('events'), - Buffer = require('buffer').Buffer, - parser; - -function test(test) { - parser = new MultipartParser(); - test(); -} - -test(function constructor() { - assert.equal(parser.boundary, null); - assert.equal(parser.state, 0); - assert.equal(parser.flags, 0); - assert.equal(parser.boundaryChars, null); - assert.equal(parser.index, null); - assert.equal(parser.lookbehind, null); - assert.equal(parser.constructor.name, 'MultipartParser'); -}); - -test(function initWithBoundary() { - var boundary = 'abc'; - parser.initWithBoundary(boundary); - assert.deepEqual(Array.prototype.slice.call(parser.boundary), [13, 10, 45, 45, 97, 98, 99]); - assert.equal(parser.state, multipartParser.START); - - assert.deepEqual(parser.boundaryChars, {10: true, 13: true, 45: true, 97: true, 98: true, 99: true}); -}); - -test(function parserError() { - var boundary = 'abc', - buffer = new Buffer(5); - - parser.initWithBoundary(boundary); - buffer.write('--ad', 'ascii', 0); - assert.equal(parser.write(buffer), 3); -}); - -test(function end() { - (function testError() { - assert.equal(parser.end().message, 'MultipartParser.end(): stream ended unexpectedly: ' + parser.explain()); - })(); - - (function testRegular() { - parser.state = multipartParser.END; - assert.strictEqual(parser.end(), undefined); - })(); -}); diff --git a/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js b/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js deleted file mode 100644 index 54d3e2d..0000000 --- a/node_modules/connect/node_modules/formidable/test/legacy/simple/test-querystring-parser.js +++ /dev/null @@ -1,45 +0,0 @@ -var common = require('../common'); -var QuerystringParser = require(common.lib + '/querystring_parser').QuerystringParser, - Buffer = require('buffer').Buffer, - gently, - parser; - -function test(test) { - gently = new Gently(); - parser = new QuerystringParser(); - test(); - gently.verify(test.name); -} - -test(function constructor() { - assert.equal(parser.buffer, ''); - assert.equal(parser.constructor.name, 'QuerystringParser'); -}); - -test(function write() { - var a = new Buffer('a=1'); - assert.equal(parser.write(a), a.length); - - var b = new Buffer('&b=2'); - parser.write(b); - assert.equal(parser.buffer, a + b); -}); - -test(function end() { - var FIELDS = {a: ['b', {c: 'd'}], e: 'f'}; - - gently.expect(GENTLY.hijacked.querystring, 'parse', function(str) { - assert.equal(str, parser.buffer); - return FIELDS; - }); - - gently.expect(parser, 'onField', Object.keys(FIELDS).length, function(key, val) { - assert.deepEqual(FIELDS[key], val); - }); - - gently.expect(parser, 'onEnd'); - - parser.buffer = 'my buffer'; - parser.end(); - assert.equal(parser.buffer, ''); -}); diff --git a/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js b/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js deleted file mode 100644 index fcfdb94..0000000 --- a/node_modules/connect/node_modules/formidable/test/legacy/system/test-multi-video-upload.js +++ /dev/null @@ -1,72 +0,0 @@ -var common = require('../common'); -var BOUNDARY = '---------------------------10102754414578508781458777923', - FIXTURE = TEST_FIXTURES+'/multi_video.upload', - fs = require('fs'), - util = require(common.lib + '/util'), - http = require('http'), - formidable = require(common.lib + '/index'), - server = http.createServer(); - -server.on('request', function(req, res) { - var form = new formidable.IncomingForm(), - uploads = {}; - - form.uploadDir = TEST_TMP; - form.parse(req); - - form - .on('fileBegin', function(field, file) { - assert.equal(field, 'upload'); - - var tracker = {file: file, progress: [], ended: false}; - uploads[file.filename] = tracker; - file - .on('progress', function(bytesReceived) { - tracker.progress.push(bytesReceived); - assert.equal(bytesReceived, file.length); - }) - .on('end', function() { - tracker.ended = true; - }); - }) - .on('field', function(field, value) { - assert.equal(field, 'title'); - assert.equal(value, ''); - }) - .on('file', function(field, file) { - assert.equal(field, 'upload'); - assert.strictEqual(uploads[file.filename].file, file); - }) - .on('end', function() { - assert.ok(uploads['shortest_video.flv']); - assert.ok(uploads['shortest_video.flv'].ended); - assert.ok(uploads['shortest_video.flv'].progress.length > 3); - assert.equal(uploads['shortest_video.flv'].progress.slice(-1), uploads['shortest_video.flv'].file.length); - assert.ok(uploads['shortest_video.mp4']); - assert.ok(uploads['shortest_video.mp4'].ended); - assert.ok(uploads['shortest_video.mp4'].progress.length > 3); - - server.close(); - res.writeHead(200); - res.end('good'); - }); -}); - -server.listen(TEST_PORT, function() { - var client = http.createClient(TEST_PORT), - stat = fs.statSync(FIXTURE), - headers = { - 'content-type': 'multipart/form-data; boundary='+BOUNDARY, - 'content-length': stat.size, - } - request = client.request('POST', '/', headers), - fixture = new fs.ReadStream(FIXTURE); - - fixture - .on('data', function(b) { - request.write(b); - }) - .on('end', function() { - request.end(); - }); -}); diff --git a/node_modules/connect/node_modules/formidable/test/run.js b/node_modules/connect/node_modules/formidable/test/run.js deleted file mode 100755 index 50b2361..0000000 --- a/node_modules/connect/node_modules/formidable/test/run.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -require('urun')(__dirname) diff --git a/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js b/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js deleted file mode 100644 index bcf61d7..0000000 --- a/node_modules/connect/node_modules/formidable/test/unit/test-incoming-form.js +++ /dev/null @@ -1,63 +0,0 @@ -var common = require('../common'); -var test = require('utest'); -var assert = common.assert; -var IncomingForm = common.require('incoming_form').IncomingForm; -var path = require('path'); - -var from; -test('IncomingForm', { - before: function() { - form = new IncomingForm(); - }, - - '#_fileName with regular characters': function() { - var filename = 'foo.txt'; - assert.equal(form._fileName(makeHeader(filename)), 'foo.txt'); - }, - - '#_fileName with unescaped quote': function() { - var filename = 'my".txt'; - assert.equal(form._fileName(makeHeader(filename)), 'my".txt'); - }, - - '#_fileName with escaped quote': function() { - var filename = 'my%22.txt'; - assert.equal(form._fileName(makeHeader(filename)), 'my".txt'); - }, - - '#_fileName with bad quote and additional sub-header': function() { - var filename = 'my".txt'; - var header = makeHeader(filename) + '; foo="bar"'; - assert.equal(form._fileName(header), filename); - }, - - '#_fileName with semicolon': function() { - var filename = 'my;.txt'; - assert.equal(form._fileName(makeHeader(filename)), 'my;.txt'); - }, - - '#_fileName with utf8 character': function() { - var filename = 'my☃.txt'; - assert.equal(form._fileName(makeHeader(filename)), 'my☃.txt'); - }, - - '#_uploadPath strips harmful characters from extension when keepExtensions': function() { - form.keepExtensions = true; - - var ext = path.extname(form._uploadPath('fine.jpg?foo=bar')); - assert.equal(ext, '.jpg'); - - var ext = path.extname(form._uploadPath('fine?foo=bar')); - assert.equal(ext, ''); - - var ext = path.extname(form._uploadPath('super.cr2+dsad')); - assert.equal(ext, '.cr2'); - - var ext = path.extname(form._uploadPath('super.bar')); - assert.equal(ext, '.bar'); - }, -}); - -function makeHeader(filename) { - return 'Content-Disposition: form-data; name="upload"; filename="' + filename + '"'; -} diff --git a/node_modules/connect/node_modules/formidable/tool/record.js b/node_modules/connect/node_modules/formidable/tool/record.js deleted file mode 100644 index 9f1cef8..0000000 --- a/node_modules/connect/node_modules/formidable/tool/record.js +++ /dev/null @@ -1,47 +0,0 @@ -var http = require('http'); -var fs = require('fs'); -var connections = 0; - -var server = http.createServer(function(req, res) { - var socket = req.socket; - console.log('Request: %s %s -> %s', req.method, req.url, socket.filename); - - req.on('end', function() { - if (req.url !== '/') { - res.end(JSON.stringify({ - method: req.method, - url: req.url, - filename: socket.filename, - })); - return; - } - - res.writeHead(200, {'content-type': 'text/html'}); - res.end( - '
    '+ - '
    '+ - '
    '+ - ''+ - '
    ' - ); - }); -}); - -server.on('connection', function(socket) { - connections++; - - socket.id = connections; - socket.filename = 'connection-' + socket.id + '.http'; - socket.file = fs.createWriteStream(socket.filename); - socket.pipe(socket.file); - - console.log('--> %s', socket.filename); - socket.on('close', function() { - console.log('<-- %s', socket.filename); - }); -}); - -var port = process.env.PORT || 8080; -server.listen(port, function() { - console.log('Recording connections on port %s', port); -}); diff --git a/node_modules/connect/node_modules/mime/LICENSE b/node_modules/connect/node_modules/mime/LICENSE deleted file mode 100644 index 451fc45..0000000 --- a/node_modules/connect/node_modules/mime/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010 Benjamin Thomas, Robert Kieffer - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/connect/node_modules/mime/README.md b/node_modules/connect/node_modules/mime/README.md deleted file mode 100644 index a157de1..0000000 --- a/node_modules/connect/node_modules/mime/README.md +++ /dev/null @@ -1,50 +0,0 @@ -# mime - -Support for mapping between file extensions and MIME types. This module uses the latest version of the Apache "mime.types" file (maps over 620 types to 800+ extensions). It is also trivially easy to add your own types and extensions, should you need to do that. - -## Install - -Install with [npm](http://github.com/isaacs/npm): - - npm install mime - -## API - Queries - -### mime.lookup(path) -Get the mime type associated with a file. This is method is case-insensitive. Everything in path up to and including the last '/' or '.' is ignored, so you can pass it paths, filenames, or extensions, like so: - - var mime = require('mime'); - - mime.lookup('/path/to/file.txt'); // => 'text/plain' - mime.lookup('file.txt'); // => 'text/plain' - mime.lookup('.txt'); // => 'text/plain' - mime.lookup('htm'); // => 'text/html' - -### mime.extension(type) - lookup the default extension for type - - mime.extension('text/html'); // => 'html' - mime.extension('application/octet-stream'); // => 'bin' - -### mime.charsets.lookup() - map mime-type to charset - - mime.charsets.lookup('text/plain'); // => 'UTF-8' - -(The logic for charset lookups is pretty rudimentary. Feel free to suggest improvements.) - -## API - Customizing - -The following APIs allow you to add your own type mappings within your project. If you feel a type should be included as part of node-mime, see [requesting new types](https://github.com/bentomas/node-mime/wiki/Requesting-New-Types). -### mime.define() - Add custom mime/extension mappings - - mime.define({ - 'text/x-some-format': ['x-sf', 'x-sft', 'x-sfml'], - 'application/x-my-type': ['x-mt', 'x-mtt'], - // etc ... - }); - - mime.lookup('x-sft'); // => 'text/x-some-format' - mime.extension('text/x-some-format'); // => 'x-sf' - -### mime.load(filepath) - Load mappings from an Apache ".types" format file - - mime.load('./my_project.types'); diff --git a/node_modules/connect/node_modules/mime/mime.js b/node_modules/connect/node_modules/mime/mime.js deleted file mode 100644 index 5fac753..0000000 --- a/node_modules/connect/node_modules/mime/mime.js +++ /dev/null @@ -1,92 +0,0 @@ -var path = require('path'), - fs = require('fs'); - -var mime = module.exports = { - /** Map of extension to mime type */ - types: {}, - - /** Map of mime type to extension */ - extensions :{}, - - /** - * Define mimetype -> extension mappings. Each key is a mime-type that maps - * to an array of extensions associated with the type. The first extension is - * used as the default extension for the type. - * - * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']}); - * - * @param map (Object) type definitions - */ - define: function(map) { - for (var type in map) { - var exts = map[type]; - - for (var i = 0; i < exts.length; i++) { - mime.types[exts[i]] = type; - } - - // Default extension is the first one we encounter - if (!mime.extensions[type]) { - mime.extensions[type] = exts[0]; - } - } - }, - - /** - * Load an Apache2-style ".types" file - * - * This may be called multiple times (it's expected). Where files declare - * overlapping types/extensions, the last file wins. - * - * @param file (String) path of file to load. - */ - load: function(file) { - // Read file and split into lines - var map = {}, - content = fs.readFileSync(file, 'ascii'), - lines = content.split(/[\r\n]+/); - - lines.forEach(function(line, lineno) { - // Clean up whitespace/comments, and split into fields - var fields = line.replace(/\s*#.*|^\s*|\s*$/g, '').split(/\s+/); - map[fields.shift()] = fields; - }); - - mime.define(map); - }, - - /** - * Lookup a mime type based on extension - */ - lookup: function(path, fallback) { - var ext = path.replace(/.*[\.\/]/, '').toLowerCase(); - return mime.types[ext] || fallback || mime.default_type; - }, - - /** - * Return file extension associated with a mime type - */ - extension: function(mimeType) { - return mime.extensions[mimeType]; - }, - - /** - * Lookup a charset based on mime type. - */ - charsets: { - lookup: function (mimeType, fallback) { - // Assume text types are utf8. Modify mime logic as needed. - return (/^text\//).test(mimeType) ? 'UTF-8' : fallback; - } - } -}; - -// Load our local copy of -// http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types -mime.load(path.join(__dirname, 'types/mime.types')); - -// Overlay enhancements submitted by the node.js community -mime.load(path.join(__dirname, 'types/node.types')); - -// Set the default type -mime.default_type = mime.types.bin; diff --git a/node_modules/connect/node_modules/mime/package.json b/node_modules/connect/node_modules/mime/package.json deleted file mode 100644 index ae217c3..0000000 --- a/node_modules/connect/node_modules/mime/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "author": { - "name": "Robert Kieffer", - "email": "robert@broofa.com", - "url": "http://github.com/broofa" - }, - "contributors": [ - { - "name": "Benjamin Thomas", - "email": "benjamin@benjaminthomas.org", - "url": "http://github.com/bentomas" - } - ], - "dependencies": {}, - "description": "A comprehensive library for mime-type mapping", - "devDependencies": { - "async_testing": "" - }, - "keywords": [ - "util", - "mime" - ], - "main": "mime.js", - "name": "mime", - "repository": { - "url": "git://github.com/bentomas/node-mime.git", - "type": "git" - }, - "version": "1.2.4", - "_id": "mime@1.2.4", - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "dist": { - "shasum": "12dd25885715fff0b2ef3022c8180d54c5ef936a" - }, - "_from": "mime@1.2.4" -} diff --git a/node_modules/connect/node_modules/mime/test.js b/node_modules/connect/node_modules/mime/test.js deleted file mode 100644 index b904895..0000000 --- a/node_modules/connect/node_modules/mime/test.js +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Requires the async_testing module - * - * Usage: node test.js - */ -var mime = require('./mime'); -exports["test mime lookup"] = function(test) { - // easy - test.equal('text/plain', mime.lookup('text.txt')); - - // hidden file or multiple periods - test.equal('text/plain', mime.lookup('.text.txt')); - - // just an extension - test.equal('text/plain', mime.lookup('.txt')); - - // just an extension without a dot - test.equal('text/plain', mime.lookup('txt')); - - // default - test.equal('application/octet-stream', mime.lookup('text.nope')); - - // fallback - test.equal('fallback', mime.lookup('text.fallback', 'fallback')); - - test.finish(); -}; - -exports["test extension lookup"] = function(test) { - // easy - test.equal('txt', mime.extension(mime.types.text)); - test.equal('html', mime.extension(mime.types.htm)); - test.equal('bin', mime.extension('application/octet-stream')); - - test.finish(); -}; - -exports["test mime lookup uppercase"] = function(test) { - // easy - test.equal('text/plain', mime.lookup('TEXT.TXT')); - - // just an extension - test.equal('text/plain', mime.lookup('.TXT')); - - // just an extension without a dot - test.equal('text/plain', mime.lookup('TXT')); - - // default - test.equal('application/octet-stream', mime.lookup('TEXT.NOPE')); - - // fallback - test.equal('fallback', mime.lookup('TEXT.FALLBACK', 'fallback')); - - test.finish(); -}; - -exports["test custom types"] = function(test) { - test.equal('application/octet-stream', mime.lookup('file.buffer')); - test.equal('audio/mp4', mime.lookup('file.m4a')); - - test.finish(); -}; - -exports["test charset lookup"] = function(test) { - // easy - test.equal('UTF-8', mime.charsets.lookup('text/plain')); - - // none - test.ok(typeof mime.charsets.lookup(mime.types.js) == 'undefined'); - - // fallback - test.equal('fallback', mime.charsets.lookup('application/octet-stream', 'fallback')); - - test.finish(); -}; - -if (module == require.main) { - require('async_testing').run(__filename, process.ARGV); -} diff --git a/node_modules/connect/node_modules/mime/types/mime.types b/node_modules/connect/node_modules/mime/types/mime.types deleted file mode 100644 index 6a90929..0000000 --- a/node_modules/connect/node_modules/mime/types/mime.types +++ /dev/null @@ -1,1479 +0,0 @@ -# This file maps Internet media types to unique file extension(s). -# Although created for httpd, this file is used by many software systems -# and has been placed in the public domain for unlimited redisribution. -# -# The table below contains both registered and (common) unregistered types. -# A type that has no unique extension can be ignored -- they are listed -# here to guide configurations toward known types and to make it easier to -# identify "new" types. File extensions are also commonly used to indicate -# content languages and encodings, so choose them carefully. -# -# Internet media types should be registered as described in RFC 4288. -# The registry is at . -# -# MIME type (lowercased) Extensions -# ============================================ ========== -# application/1d-interleaved-parityfec -# application/3gpp-ims+xml -# application/activemessage -application/andrew-inset ez -# application/applefile -application/applixware aw -application/atom+xml atom -application/atomcat+xml atomcat -# application/atomicmail -application/atomsvc+xml atomsvc -# application/auth-policy+xml -# application/batch-smtp -# application/beep+xml -# application/cals-1840 -application/ccxml+xml ccxml -application/cdmi-capability cdmia -application/cdmi-container cdmic -application/cdmi-domain cdmid -application/cdmi-object cdmio -application/cdmi-queue cdmiq -# application/cea-2018+xml -# application/cellml+xml -# application/cfw -# application/cnrp+xml -# application/commonground -# application/conference-info+xml -# application/cpl+xml -# application/csta+xml -# application/cstadata+xml -application/cu-seeme cu -# application/cybercash -application/davmount+xml davmount -# application/dca-rft -# application/dec-dx -# application/dialog-info+xml -# application/dicom -# application/dns -# application/dskpp+xml -application/dssc+der dssc -application/dssc+xml xdssc -# application/dvcs -application/ecmascript ecma -# application/edi-consent -# application/edi-x12 -# application/edifact -application/emma+xml emma -# application/epp+xml -application/epub+zip epub -# application/eshop -# application/example -application/exi exi -# application/fastinfoset -# application/fastsoap -# application/fits -application/font-tdpfr pfr -# application/framework-attributes+xml -# application/h224 -# application/held+xml -# application/http -application/hyperstudio stk -# application/ibe-key-request+xml -# application/ibe-pkg-reply+xml -# application/ibe-pp-data -# application/iges -# application/im-iscomposing+xml -# application/index -# application/index.cmd -# application/index.obj -# application/index.response -# application/index.vnd -# application/iotp -application/ipfix ipfix -# application/ipp -# application/isup -application/java-archive jar -application/java-serialized-object ser -application/java-vm class -application/javascript js -application/json json -# application/kpml-request+xml -# application/kpml-response+xml -application/lost+xml lostxml -application/mac-binhex40 hqx -application/mac-compactpro cpt -# application/macwriteii -application/mads+xml mads -application/marc mrc -application/marcxml+xml mrcx -application/mathematica ma nb mb -# application/mathml-content+xml -# application/mathml-presentation+xml -application/mathml+xml mathml -# application/mbms-associated-procedure-description+xml -# application/mbms-deregister+xml -# application/mbms-envelope+xml -# application/mbms-msk+xml -# application/mbms-msk-response+xml -# application/mbms-protection-description+xml -# application/mbms-reception-report+xml -# application/mbms-register+xml -# application/mbms-register-response+xml -# application/mbms-user-service-description+xml -application/mbox mbox -# application/media_control+xml -application/mediaservercontrol+xml mscml -application/metalink4+xml meta4 -application/mets+xml mets -# application/mikey -application/mods+xml mods -# application/moss-keys -# application/moss-signature -# application/mosskey-data -# application/mosskey-request -application/mp21 m21 mp21 -application/mp4 mp4s -# application/mpeg4-generic -# application/mpeg4-iod -# application/mpeg4-iod-xmt -# application/msc-ivr+xml -# application/msc-mixer+xml -application/msword doc dot -application/mxf mxf -# application/nasdata -# application/news-checkgroups -# application/news-groupinfo -# application/news-transmission -# application/nss -# application/ocsp-request -# application/ocsp-response -application/octet-stream bin dms lha lrf lzh so iso dmg dist distz pkg bpk dump elc deploy -application/oda oda -application/oebps-package+xml opf -application/ogg ogx -application/onenote onetoc onetoc2 onetmp onepkg -# application/parityfec -application/patch-ops-error+xml xer -application/pdf pdf -application/pgp-encrypted pgp -# application/pgp-keys -application/pgp-signature asc sig -application/pics-rules prf -# application/pidf+xml -# application/pidf-diff+xml -application/pkcs10 p10 -application/pkcs7-mime p7m p7c -application/pkcs7-signature p7s -application/pkcs8 p8 -application/pkix-attr-cert ac -application/pkix-cert cer -application/pkix-crl crl -application/pkix-pkipath pkipath -application/pkixcmp pki -application/pls+xml pls -# application/poc-settings+xml -application/postscript ai eps ps -# application/prs.alvestrand.titrax-sheet -application/prs.cww cww -# application/prs.nprend -# application/prs.plucker -# application/prs.rdf-xml-crypt -# application/prs.xsf+xml -application/pskc+xml pskcxml -# application/qsig -application/rdf+xml rdf -application/reginfo+xml rif -application/relax-ng-compact-syntax rnc -# application/remote-printing -application/resource-lists+xml rl -application/resource-lists-diff+xml rld -# application/riscos -# application/rlmi+xml -application/rls-services+xml rs -application/rsd+xml rsd -application/rss+xml rss -application/rtf rtf -# application/rtx -# application/samlassertion+xml -# application/samlmetadata+xml -application/sbml+xml sbml -application/scvp-cv-request scq -application/scvp-cv-response scs -application/scvp-vp-request spq -application/scvp-vp-response spp -application/sdp sdp -# application/set-payment -application/set-payment-initiation setpay -# application/set-registration -application/set-registration-initiation setreg -# application/sgml -# application/sgml-open-catalog -application/shf+xml shf -# application/sieve -# application/simple-filter+xml -# application/simple-message-summary -# application/simplesymbolcontainer -# application/slate -# application/smil -application/smil+xml smi smil -# application/soap+fastinfoset -# application/soap+xml -application/sparql-query rq -application/sparql-results+xml srx -# application/spirits-event+xml -application/srgs gram -application/srgs+xml grxml -application/sru+xml sru -application/ssml+xml ssml -# application/tamp-apex-update -# application/tamp-apex-update-confirm -# application/tamp-community-update -# application/tamp-community-update-confirm -# application/tamp-error -# application/tamp-sequence-adjust -# application/tamp-sequence-adjust-confirm -# application/tamp-status-query -# application/tamp-status-response -# application/tamp-update -# application/tamp-update-confirm -application/tei+xml tei teicorpus -application/thraud+xml tfi -# application/timestamp-query -# application/timestamp-reply -application/timestamped-data tsd -# application/tve-trigger -# application/ulpfec -# application/vemmi -# application/vividence.scriptfile -# application/vnd.3gpp.bsf+xml -application/vnd.3gpp.pic-bw-large plb -application/vnd.3gpp.pic-bw-small psb -application/vnd.3gpp.pic-bw-var pvb -# application/vnd.3gpp.sms -# application/vnd.3gpp2.bcmcsinfo+xml -# application/vnd.3gpp2.sms -application/vnd.3gpp2.tcap tcap -application/vnd.3m.post-it-notes pwn -application/vnd.accpac.simply.aso aso -application/vnd.accpac.simply.imp imp -application/vnd.acucobol acu -application/vnd.acucorp atc acutc -application/vnd.adobe.air-application-installer-package+zip air -application/vnd.adobe.fxp fxp fxpl -# application/vnd.adobe.partial-upload -application/vnd.adobe.xdp+xml xdp -application/vnd.adobe.xfdf xfdf -# application/vnd.aether.imp -# application/vnd.ah-barcode -application/vnd.ahead.space ahead -application/vnd.airzip.filesecure.azf azf -application/vnd.airzip.filesecure.azs azs -application/vnd.amazon.ebook azw -application/vnd.americandynamics.acc acc -application/vnd.amiga.ami ami -# application/vnd.amundsen.maze+xml -application/vnd.android.package-archive apk -application/vnd.anser-web-certificate-issue-initiation cii -application/vnd.anser-web-funds-transfer-initiation fti -application/vnd.antix.game-component atx -application/vnd.apple.installer+xml mpkg -application/vnd.apple.mpegurl m3u8 -# application/vnd.arastra.swi -application/vnd.aristanetworks.swi swi -application/vnd.audiograph aep -# application/vnd.autopackage -# application/vnd.avistar+xml -application/vnd.blueice.multipass mpm -# application/vnd.bluetooth.ep.oob -application/vnd.bmi bmi -application/vnd.businessobjects rep -# application/vnd.cab-jscript -# application/vnd.canon-cpdl -# application/vnd.canon-lips -# application/vnd.cendio.thinlinc.clientconf -application/vnd.chemdraw+xml cdxml -application/vnd.chipnuts.karaoke-mmd mmd -application/vnd.cinderella cdy -# application/vnd.cirpack.isdn-ext -application/vnd.claymore cla -application/vnd.cloanto.rp9 rp9 -application/vnd.clonk.c4group c4g c4d c4f c4p c4u -application/vnd.cluetrust.cartomobile-config c11amc -application/vnd.cluetrust.cartomobile-config-pkg c11amz -# application/vnd.commerce-battelle -application/vnd.commonspace csp -application/vnd.contact.cmsg cdbcmsg -application/vnd.cosmocaller cmc -application/vnd.crick.clicker clkx -application/vnd.crick.clicker.keyboard clkk -application/vnd.crick.clicker.palette clkp -application/vnd.crick.clicker.template clkt -application/vnd.crick.clicker.wordbank clkw -application/vnd.criticaltools.wbs+xml wbs -application/vnd.ctc-posml pml -# application/vnd.ctct.ws+xml -# application/vnd.cups-pdf -# application/vnd.cups-postscript -application/vnd.cups-ppd ppd -# application/vnd.cups-raster -# application/vnd.cups-raw -application/vnd.curl.car car -application/vnd.curl.pcurl pcurl -# application/vnd.cybank -application/vnd.data-vision.rdz rdz -application/vnd.dece.data uvf uvvf uvd uvvd -application/vnd.dece.ttml+xml uvt uvvt -application/vnd.dece.unspecified uvx uvvx -application/vnd.denovo.fcselayout-link fe_launch -# application/vnd.dir-bi.plate-dl-nosuffix -application/vnd.dna dna -application/vnd.dolby.mlp mlp -# application/vnd.dolby.mobile.1 -# application/vnd.dolby.mobile.2 -application/vnd.dpgraph dpg -application/vnd.dreamfactory dfac -application/vnd.dvb.ait ait -# application/vnd.dvb.dvbj -# application/vnd.dvb.esgcontainer -# application/vnd.dvb.ipdcdftnotifaccess -# application/vnd.dvb.ipdcesgaccess -# application/vnd.dvb.ipdcesgaccess2 -# application/vnd.dvb.ipdcesgpdd -# application/vnd.dvb.ipdcroaming -# application/vnd.dvb.iptv.alfec-base -# application/vnd.dvb.iptv.alfec-enhancement -# application/vnd.dvb.notif-aggregate-root+xml -# application/vnd.dvb.notif-container+xml -# application/vnd.dvb.notif-generic+xml -# application/vnd.dvb.notif-ia-msglist+xml -# application/vnd.dvb.notif-ia-registration-request+xml -# application/vnd.dvb.notif-ia-registration-response+xml -# application/vnd.dvb.notif-init+xml -# application/vnd.dvb.pfr -application/vnd.dvb.service svc -# application/vnd.dxr -application/vnd.dynageo geo -# application/vnd.easykaraoke.cdgdownload -# application/vnd.ecdis-update -application/vnd.ecowin.chart mag -# application/vnd.ecowin.filerequest -# application/vnd.ecowin.fileupdate -# application/vnd.ecowin.series -# application/vnd.ecowin.seriesrequest -# application/vnd.ecowin.seriesupdate -# application/vnd.emclient.accessrequest+xml -application/vnd.enliven nml -application/vnd.epson.esf esf -application/vnd.epson.msf msf -application/vnd.epson.quickanime qam -application/vnd.epson.salt slt -application/vnd.epson.ssf ssf -# application/vnd.ericsson.quickcall -application/vnd.eszigno3+xml es3 et3 -# application/vnd.etsi.aoc+xml -# application/vnd.etsi.cug+xml -# application/vnd.etsi.iptvcommand+xml -# application/vnd.etsi.iptvdiscovery+xml -# application/vnd.etsi.iptvprofile+xml -# application/vnd.etsi.iptvsad-bc+xml -# application/vnd.etsi.iptvsad-cod+xml -# application/vnd.etsi.iptvsad-npvr+xml -# application/vnd.etsi.iptvservice+xml -# application/vnd.etsi.iptvsync+xml -# application/vnd.etsi.iptvueprofile+xml -# application/vnd.etsi.mcid+xml -# application/vnd.etsi.overload-control-policy-dataset+xml -# application/vnd.etsi.sci+xml -# application/vnd.etsi.simservs+xml -# application/vnd.etsi.tsl+xml -# application/vnd.etsi.tsl.der -# application/vnd.eudora.data -application/vnd.ezpix-album ez2 -application/vnd.ezpix-package ez3 -# application/vnd.f-secure.mobile -application/vnd.fdf fdf -application/vnd.fdsn.mseed mseed -application/vnd.fdsn.seed seed dataless -# application/vnd.ffsns -# application/vnd.fints -application/vnd.flographit gph -application/vnd.fluxtime.clip ftc -# application/vnd.font-fontforge-sfd -application/vnd.framemaker fm frame maker book -application/vnd.frogans.fnc fnc -application/vnd.frogans.ltf ltf -application/vnd.fsc.weblaunch fsc -application/vnd.fujitsu.oasys oas -application/vnd.fujitsu.oasys2 oa2 -application/vnd.fujitsu.oasys3 oa3 -application/vnd.fujitsu.oasysgp fg5 -application/vnd.fujitsu.oasysprs bh2 -# application/vnd.fujixerox.art-ex -# application/vnd.fujixerox.art4 -# application/vnd.fujixerox.hbpl -application/vnd.fujixerox.ddd ddd -application/vnd.fujixerox.docuworks xdw -application/vnd.fujixerox.docuworks.binder xbd -# application/vnd.fut-misnet -application/vnd.fuzzysheet fzs -application/vnd.genomatix.tuxedo txd -# application/vnd.geocube+xml -application/vnd.geogebra.file ggb -application/vnd.geogebra.tool ggt -application/vnd.geometry-explorer gex gre -application/vnd.geonext gxt -application/vnd.geoplan g2w -application/vnd.geospace g3w -# application/vnd.globalplatform.card-content-mgt -# application/vnd.globalplatform.card-content-mgt-response -application/vnd.gmx gmx -application/vnd.google-earth.kml+xml kml -application/vnd.google-earth.kmz kmz -application/vnd.grafeq gqf gqs -# application/vnd.gridmp -application/vnd.groove-account gac -application/vnd.groove-help ghf -application/vnd.groove-identity-message gim -application/vnd.groove-injector grv -application/vnd.groove-tool-message gtm -application/vnd.groove-tool-template tpl -application/vnd.groove-vcard vcg -application/vnd.hal+xml hal -application/vnd.handheld-entertainment+xml zmm -application/vnd.hbci hbci -# application/vnd.hcl-bireports -application/vnd.hhe.lesson-player les -application/vnd.hp-hpgl hpgl -application/vnd.hp-hpid hpid -application/vnd.hp-hps hps -application/vnd.hp-jlyt jlt -application/vnd.hp-pcl pcl -application/vnd.hp-pclxl pclxl -# application/vnd.httphone -application/vnd.hydrostatix.sof-data sfd-hdstx -application/vnd.hzn-3d-crossword x3d -# application/vnd.ibm.afplinedata -# application/vnd.ibm.electronic-media -application/vnd.ibm.minipay mpy -application/vnd.ibm.modcap afp listafp list3820 -application/vnd.ibm.rights-management irm -application/vnd.ibm.secure-container sc -application/vnd.iccprofile icc icm -application/vnd.igloader igl -application/vnd.immervision-ivp ivp -application/vnd.immervision-ivu ivu -# application/vnd.informedcontrol.rms+xml -# application/vnd.informix-visionary -# application/vnd.infotech.project -# application/vnd.infotech.project+xml -application/vnd.insors.igm igm -application/vnd.intercon.formnet xpw xpx -application/vnd.intergeo i2g -# application/vnd.intertrust.digibox -# application/vnd.intertrust.nncp -application/vnd.intu.qbo qbo -application/vnd.intu.qfx qfx -# application/vnd.iptc.g2.conceptitem+xml -# application/vnd.iptc.g2.knowledgeitem+xml -# application/vnd.iptc.g2.newsitem+xml -# application/vnd.iptc.g2.packageitem+xml -application/vnd.ipunplugged.rcprofile rcprofile -application/vnd.irepository.package+xml irp -application/vnd.is-xpr xpr -application/vnd.isac.fcs fcs -application/vnd.jam jam -# application/vnd.japannet-directory-service -# application/vnd.japannet-jpnstore-wakeup -# application/vnd.japannet-payment-wakeup -# application/vnd.japannet-registration -# application/vnd.japannet-registration-wakeup -# application/vnd.japannet-setstore-wakeup -# application/vnd.japannet-verification -# application/vnd.japannet-verification-wakeup -application/vnd.jcp.javame.midlet-rms rms -application/vnd.jisp jisp -application/vnd.joost.joda-archive joda -application/vnd.kahootz ktz ktr -application/vnd.kde.karbon karbon -application/vnd.kde.kchart chrt -application/vnd.kde.kformula kfo -application/vnd.kde.kivio flw -application/vnd.kde.kontour kon -application/vnd.kde.kpresenter kpr kpt -application/vnd.kde.kspread ksp -application/vnd.kde.kword kwd kwt -application/vnd.kenameaapp htke -application/vnd.kidspiration kia -application/vnd.kinar kne knp -application/vnd.koan skp skd skt skm -application/vnd.kodak-descriptor sse -application/vnd.las.las+xml lasxml -# application/vnd.liberty-request+xml -application/vnd.llamagraphics.life-balance.desktop lbd -application/vnd.llamagraphics.life-balance.exchange+xml lbe -application/vnd.lotus-1-2-3 123 -application/vnd.lotus-approach apr -application/vnd.lotus-freelance pre -application/vnd.lotus-notes nsf -application/vnd.lotus-organizer org -application/vnd.lotus-screencam scm -application/vnd.lotus-wordpro lwp -application/vnd.macports.portpkg portpkg -# application/vnd.marlin.drm.actiontoken+xml -# application/vnd.marlin.drm.conftoken+xml -# application/vnd.marlin.drm.license+xml -# application/vnd.marlin.drm.mdcf -application/vnd.mcd mcd -application/vnd.medcalcdata mc1 -application/vnd.mediastation.cdkey cdkey -# application/vnd.meridian-slingshot -application/vnd.mfer mwf -application/vnd.mfmp mfm -application/vnd.micrografx.flo flo -application/vnd.micrografx.igx igx -application/vnd.mif mif -# application/vnd.minisoft-hp3000-save -# application/vnd.mitsubishi.misty-guard.trustweb -application/vnd.mobius.daf daf -application/vnd.mobius.dis dis -application/vnd.mobius.mbk mbk -application/vnd.mobius.mqy mqy -application/vnd.mobius.msl msl -application/vnd.mobius.plc plc -application/vnd.mobius.txf txf -application/vnd.mophun.application mpn -application/vnd.mophun.certificate mpc -# application/vnd.motorola.flexsuite -# application/vnd.motorola.flexsuite.adsi -# application/vnd.motorola.flexsuite.fis -# application/vnd.motorola.flexsuite.gotap -# application/vnd.motorola.flexsuite.kmr -# application/vnd.motorola.flexsuite.ttc -# application/vnd.motorola.flexsuite.wem -# application/vnd.motorola.iprm -application/vnd.mozilla.xul+xml xul -application/vnd.ms-artgalry cil -# application/vnd.ms-asf -application/vnd.ms-cab-compressed cab -application/vnd.ms-excel xls xlm xla xlc xlt xlw -application/vnd.ms-excel.addin.macroenabled.12 xlam -application/vnd.ms-excel.sheet.binary.macroenabled.12 xlsb -application/vnd.ms-excel.sheet.macroenabled.12 xlsm -application/vnd.ms-excel.template.macroenabled.12 xltm -application/vnd.ms-fontobject eot -application/vnd.ms-htmlhelp chm -application/vnd.ms-ims ims -application/vnd.ms-lrm lrm -# application/vnd.ms-office.activex+xml -application/vnd.ms-officetheme thmx -application/vnd.ms-pki.seccat cat -application/vnd.ms-pki.stl stl -# application/vnd.ms-playready.initiator+xml -application/vnd.ms-powerpoint ppt pps pot -application/vnd.ms-powerpoint.addin.macroenabled.12 ppam -application/vnd.ms-powerpoint.presentation.macroenabled.12 pptm -application/vnd.ms-powerpoint.slide.macroenabled.12 sldm -application/vnd.ms-powerpoint.slideshow.macroenabled.12 ppsm -application/vnd.ms-powerpoint.template.macroenabled.12 potm -application/vnd.ms-project mpp mpt -# application/vnd.ms-tnef -# application/vnd.ms-wmdrm.lic-chlg-req -# application/vnd.ms-wmdrm.lic-resp -# application/vnd.ms-wmdrm.meter-chlg-req -# application/vnd.ms-wmdrm.meter-resp -application/vnd.ms-word.document.macroenabled.12 docm -application/vnd.ms-word.template.macroenabled.12 dotm -application/vnd.ms-works wps wks wcm wdb -application/vnd.ms-wpl wpl -application/vnd.ms-xpsdocument xps -application/vnd.mseq mseq -# application/vnd.msign -# application/vnd.multiad.creator -# application/vnd.multiad.creator.cif -# application/vnd.music-niff -application/vnd.musician mus -application/vnd.muvee.style msty -# application/vnd.ncd.control -# application/vnd.ncd.reference -# application/vnd.nervana -# application/vnd.netfpx -application/vnd.neurolanguage.nlu nlu -application/vnd.noblenet-directory nnd -application/vnd.noblenet-sealer nns -application/vnd.noblenet-web nnw -# application/vnd.nokia.catalogs -# application/vnd.nokia.conml+wbxml -# application/vnd.nokia.conml+xml -# application/vnd.nokia.isds-radio-presets -# application/vnd.nokia.iptv.config+xml -# application/vnd.nokia.landmark+wbxml -# application/vnd.nokia.landmark+xml -# application/vnd.nokia.landmarkcollection+xml -# application/vnd.nokia.n-gage.ac+xml -application/vnd.nokia.n-gage.data ngdat -application/vnd.nokia.n-gage.symbian.install n-gage -# application/vnd.nokia.ncd -# application/vnd.nokia.pcd+wbxml -# application/vnd.nokia.pcd+xml -application/vnd.nokia.radio-preset rpst -application/vnd.nokia.radio-presets rpss -application/vnd.novadigm.edm edm -application/vnd.novadigm.edx edx -application/vnd.novadigm.ext ext -# application/vnd.ntt-local.file-transfer -# application/vnd.ntt-local.sip-ta_remote -# application/vnd.ntt-local.sip-ta_tcp_stream -application/vnd.oasis.opendocument.chart odc -application/vnd.oasis.opendocument.chart-template otc -application/vnd.oasis.opendocument.database odb -application/vnd.oasis.opendocument.formula odf -application/vnd.oasis.opendocument.formula-template odft -application/vnd.oasis.opendocument.graphics odg -application/vnd.oasis.opendocument.graphics-template otg -application/vnd.oasis.opendocument.image odi -application/vnd.oasis.opendocument.image-template oti -application/vnd.oasis.opendocument.presentation odp -application/vnd.oasis.opendocument.presentation-template otp -application/vnd.oasis.opendocument.spreadsheet ods -application/vnd.oasis.opendocument.spreadsheet-template ots -application/vnd.oasis.opendocument.text odt -application/vnd.oasis.opendocument.text-master odm -application/vnd.oasis.opendocument.text-template ott -application/vnd.oasis.opendocument.text-web oth -# application/vnd.obn -# application/vnd.oipf.contentaccessdownload+xml -# application/vnd.oipf.contentaccessstreaming+xml -# application/vnd.oipf.cspg-hexbinary -# application/vnd.oipf.dae.svg+xml -# application/vnd.oipf.dae.xhtml+xml -# application/vnd.oipf.mippvcontrolmessage+xml -# application/vnd.oipf.pae.gem -# application/vnd.oipf.spdiscovery+xml -# application/vnd.oipf.spdlist+xml -# application/vnd.oipf.ueprofile+xml -# application/vnd.oipf.userprofile+xml -application/vnd.olpc-sugar xo -# application/vnd.oma-scws-config -# application/vnd.oma-scws-http-request -# application/vnd.oma-scws-http-response -# application/vnd.oma.bcast.associated-procedure-parameter+xml -# application/vnd.oma.bcast.drm-trigger+xml -# application/vnd.oma.bcast.imd+xml -# application/vnd.oma.bcast.ltkm -# application/vnd.oma.bcast.notification+xml -# application/vnd.oma.bcast.provisioningtrigger -# application/vnd.oma.bcast.sgboot -# application/vnd.oma.bcast.sgdd+xml -# application/vnd.oma.bcast.sgdu -# application/vnd.oma.bcast.simple-symbol-container -# application/vnd.oma.bcast.smartcard-trigger+xml -# application/vnd.oma.bcast.sprov+xml -# application/vnd.oma.bcast.stkm -# application/vnd.oma.cab-address-book+xml -# application/vnd.oma.cab-pcc+xml -# application/vnd.oma.dcd -# application/vnd.oma.dcdc -application/vnd.oma.dd2+xml dd2 -# application/vnd.oma.drm.risd+xml -# application/vnd.oma.group-usage-list+xml -# application/vnd.oma.poc.detailed-progress-report+xml -# application/vnd.oma.poc.final-report+xml -# application/vnd.oma.poc.groups+xml -# application/vnd.oma.poc.invocation-descriptor+xml -# application/vnd.oma.poc.optimized-progress-report+xml -# application/vnd.oma.push -# application/vnd.oma.scidm.messages+xml -# application/vnd.oma.xcap-directory+xml -# application/vnd.omads-email+xml -# application/vnd.omads-file+xml -# application/vnd.omads-folder+xml -# application/vnd.omaloc-supl-init -application/vnd.openofficeorg.extension oxt -# application/vnd.openxmlformats-officedocument.custom-properties+xml -# application/vnd.openxmlformats-officedocument.customxmlproperties+xml -# application/vnd.openxmlformats-officedocument.drawing+xml -# application/vnd.openxmlformats-officedocument.drawingml.chart+xml -# application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml -# application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml -# application/vnd.openxmlformats-officedocument.extended-properties+xml -# application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml -# application/vnd.openxmlformats-officedocument.presentationml.comments+xml -# application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml -# application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml -# application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml -application/vnd.openxmlformats-officedocument.presentationml.presentation pptx -# application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml -# application/vnd.openxmlformats-officedocument.presentationml.presprops+xml -application/vnd.openxmlformats-officedocument.presentationml.slide sldx -# application/vnd.openxmlformats-officedocument.presentationml.slide+xml -# application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml -# application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml -application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx -# application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml -# application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml -# application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml -# application/vnd.openxmlformats-officedocument.presentationml.tags+xml -application/vnd.openxmlformats-officedocument.presentationml.template potx -# application/vnd.openxmlformats-officedocument.presentationml.template.main+xml -# application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml -application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx -# application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml -application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx -# application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml -# application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml -# application/vnd.openxmlformats-officedocument.theme+xml -# application/vnd.openxmlformats-officedocument.themeoverride+xml -# application/vnd.openxmlformats-officedocument.vmldrawing -# application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml -application/vnd.openxmlformats-officedocument.wordprocessingml.document docx -# application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml -application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx -# application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml -# application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml -# application/vnd.openxmlformats-package.core-properties+xml -# application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml -# application/vnd.openxmlformats-package.relationships+xml -# application/vnd.quobject-quoxdocument -# application/vnd.osa.netdeploy -application/vnd.osgeo.mapguide.package mgp -# application/vnd.osgi.bundle -application/vnd.osgi.dp dp -# application/vnd.otps.ct-kip+xml -application/vnd.palm pdb pqa oprc -# application/vnd.paos.xml -application/vnd.pawaafile paw -application/vnd.pg.format str -application/vnd.pg.osasli ei6 -# application/vnd.piaccess.application-licence -application/vnd.picsel efif -application/vnd.pmi.widget wg -# application/vnd.poc.group-advertisement+xml -application/vnd.pocketlearn plf -application/vnd.powerbuilder6 pbd -# application/vnd.powerbuilder6-s -# application/vnd.powerbuilder7 -# application/vnd.powerbuilder7-s -# application/vnd.powerbuilder75 -# application/vnd.powerbuilder75-s -# application/vnd.preminet -application/vnd.previewsystems.box box -application/vnd.proteus.magazine mgz -application/vnd.publishare-delta-tree qps -application/vnd.pvi.ptid1 ptid -# application/vnd.pwg-multiplexed -# application/vnd.pwg-xhtml-print+xml -# application/vnd.qualcomm.brew-app-res -application/vnd.quark.quarkxpress qxd qxt qwd qwt qxl qxb -# application/vnd.radisys.moml+xml -# application/vnd.radisys.msml+xml -# application/vnd.radisys.msml-audit+xml -# application/vnd.radisys.msml-audit-conf+xml -# application/vnd.radisys.msml-audit-conn+xml -# application/vnd.radisys.msml-audit-dialog+xml -# application/vnd.radisys.msml-audit-stream+xml -# application/vnd.radisys.msml-conf+xml -# application/vnd.radisys.msml-dialog+xml -# application/vnd.radisys.msml-dialog-base+xml -# application/vnd.radisys.msml-dialog-fax-detect+xml -# application/vnd.radisys.msml-dialog-fax-sendrecv+xml -# application/vnd.radisys.msml-dialog-group+xml -# application/vnd.radisys.msml-dialog-speech+xml -# application/vnd.radisys.msml-dialog-transform+xml -# application/vnd.rainstor.data -# application/vnd.rapid -application/vnd.realvnc.bed bed -application/vnd.recordare.musicxml mxl -application/vnd.recordare.musicxml+xml musicxml -# application/vnd.renlearn.rlprint -application/vnd.rig.cryptonote cryptonote -application/vnd.rim.cod cod -application/vnd.rn-realmedia rm -application/vnd.route66.link66+xml link66 -# application/vnd.ruckus.download -# application/vnd.s3sms -application/vnd.sailingtracker.track st -# application/vnd.sbm.cid -# application/vnd.sbm.mid2 -# application/vnd.scribus -# application/vnd.sealed.3df -# application/vnd.sealed.csf -# application/vnd.sealed.doc -# application/vnd.sealed.eml -# application/vnd.sealed.mht -# application/vnd.sealed.net -# application/vnd.sealed.ppt -# application/vnd.sealed.tiff -# application/vnd.sealed.xls -# application/vnd.sealedmedia.softseal.html -# application/vnd.sealedmedia.softseal.pdf -application/vnd.seemail see -application/vnd.sema sema -application/vnd.semd semd -application/vnd.semf semf -application/vnd.shana.informed.formdata ifm -application/vnd.shana.informed.formtemplate itp -application/vnd.shana.informed.interchange iif -application/vnd.shana.informed.package ipk -application/vnd.simtech-mindmapper twd twds -application/vnd.smaf mmf -# application/vnd.smart.notebook -application/vnd.smart.teacher teacher -# application/vnd.software602.filler.form+xml -# application/vnd.software602.filler.form-xml-zip -application/vnd.solent.sdkm+xml sdkm sdkd -application/vnd.spotfire.dxp dxp -application/vnd.spotfire.sfs sfs -# application/vnd.sss-cod -# application/vnd.sss-dtf -# application/vnd.sss-ntf -application/vnd.stardivision.calc sdc -application/vnd.stardivision.draw sda -application/vnd.stardivision.impress sdd -application/vnd.stardivision.math smf -application/vnd.stardivision.writer sdw vor -application/vnd.stardivision.writer-global sgl -application/vnd.stepmania.stepchart sm -# application/vnd.street-stream -application/vnd.sun.xml.calc sxc -application/vnd.sun.xml.calc.template stc -application/vnd.sun.xml.draw sxd -application/vnd.sun.xml.draw.template std -application/vnd.sun.xml.impress sxi -application/vnd.sun.xml.impress.template sti -application/vnd.sun.xml.math sxm -application/vnd.sun.xml.writer sxw -application/vnd.sun.xml.writer.global sxg -application/vnd.sun.xml.writer.template stw -# application/vnd.sun.wadl+xml -application/vnd.sus-calendar sus susp -application/vnd.svd svd -# application/vnd.swiftview-ics -application/vnd.symbian.install sis sisx -application/vnd.syncml+xml xsm -application/vnd.syncml.dm+wbxml bdm -application/vnd.syncml.dm+xml xdm -# application/vnd.syncml.dm.notification -# application/vnd.syncml.ds.notification -application/vnd.tao.intent-module-archive tao -application/vnd.tmobile-livetv tmo -application/vnd.trid.tpt tpt -application/vnd.triscape.mxs mxs -application/vnd.trueapp tra -# application/vnd.truedoc -# application/vnd.ubisoft.webplayer -application/vnd.ufdl ufd ufdl -application/vnd.uiq.theme utz -application/vnd.umajin umj -application/vnd.unity unityweb -application/vnd.uoml+xml uoml -# application/vnd.uplanet.alert -# application/vnd.uplanet.alert-wbxml -# application/vnd.uplanet.bearer-choice -# application/vnd.uplanet.bearer-choice-wbxml -# application/vnd.uplanet.cacheop -# application/vnd.uplanet.cacheop-wbxml -# application/vnd.uplanet.channel -# application/vnd.uplanet.channel-wbxml -# application/vnd.uplanet.list -# application/vnd.uplanet.list-wbxml -# application/vnd.uplanet.listcmd -# application/vnd.uplanet.listcmd-wbxml -# application/vnd.uplanet.signal -application/vnd.vcx vcx -# application/vnd.vd-study -# application/vnd.vectorworks -# application/vnd.verimatrix.vcas -# application/vnd.vidsoft.vidconference -application/vnd.visio vsd vst vss vsw -application/vnd.visionary vis -# application/vnd.vividence.scriptfile -application/vnd.vsf vsf -# application/vnd.wap.sic -# application/vnd.wap.slc -application/vnd.wap.wbxml wbxml -application/vnd.wap.wmlc wmlc -application/vnd.wap.wmlscriptc wmlsc -application/vnd.webturbo wtb -# application/vnd.wfa.wsc -# application/vnd.wmc -# application/vnd.wmf.bootstrap -# application/vnd.wolfram.mathematica -# application/vnd.wolfram.mathematica.package -application/vnd.wolfram.player nbp -application/vnd.wordperfect wpd -application/vnd.wqd wqd -# application/vnd.wrq-hp3000-labelled -application/vnd.wt.stf stf -# application/vnd.wv.csp+wbxml -# application/vnd.wv.csp+xml -# application/vnd.wv.ssp+xml -application/vnd.xara xar -application/vnd.xfdl xfdl -# application/vnd.xfdl.webform -# application/vnd.xmi+xml -# application/vnd.xmpie.cpkg -# application/vnd.xmpie.dpkg -# application/vnd.xmpie.plan -# application/vnd.xmpie.ppkg -# application/vnd.xmpie.xlim -application/vnd.yamaha.hv-dic hvd -application/vnd.yamaha.hv-script hvs -application/vnd.yamaha.hv-voice hvp -application/vnd.yamaha.openscoreformat osf -application/vnd.yamaha.openscoreformat.osfpvg+xml osfpvg -# application/vnd.yamaha.remote-setup -application/vnd.yamaha.smaf-audio saf -application/vnd.yamaha.smaf-phrase spf -# application/vnd.yamaha.tunnel-udpencap -application/vnd.yellowriver-custom-menu cmp -application/vnd.zul zir zirz -application/vnd.zzazz.deck+xml zaz -application/voicexml+xml vxml -# application/vq-rtcpxr -# application/watcherinfo+xml -# application/whoispp-query -# application/whoispp-response -application/widget wgt -application/winhlp hlp -# application/wita -# application/wordperfect5.1 -application/wsdl+xml wsdl -application/wspolicy+xml wspolicy -application/x-7z-compressed 7z -application/x-abiword abw -application/x-ace-compressed ace -application/x-authorware-bin aab x32 u32 vox -application/x-authorware-map aam -application/x-authorware-seg aas -application/x-bcpio bcpio -application/x-bittorrent torrent -application/x-bzip bz -application/x-bzip2 bz2 boz -application/x-cdlink vcd -application/x-chat chat -application/x-chess-pgn pgn -# application/x-compress -application/x-cpio cpio -application/x-csh csh -application/x-debian-package deb udeb -application/x-director dir dcr dxr cst cct cxt w3d fgd swa -application/x-doom wad -application/x-dtbncx+xml ncx -application/x-dtbook+xml dtb -application/x-dtbresource+xml res -application/x-dvi dvi -application/x-font-bdf bdf -# application/x-font-dos -# application/x-font-framemaker -application/x-font-ghostscript gsf -# application/x-font-libgrx -application/x-font-linux-psf psf -application/x-font-otf otf -application/x-font-pcf pcf -application/x-font-snf snf -# application/x-font-speedo -# application/x-font-sunos-news -application/x-font-ttf ttf ttc -application/x-font-type1 pfa pfb pfm afm -application/x-font-woff woff -# application/x-font-vfont -application/x-futuresplash spl -application/x-gnumeric gnumeric -application/x-gtar gtar -# application/x-gzip -application/x-hdf hdf -application/x-java-jnlp-file jnlp -application/x-latex latex -application/x-mobipocket-ebook prc mobi -application/x-ms-application application -application/x-ms-wmd wmd -application/x-ms-wmz wmz -application/x-ms-xbap xbap -application/x-msaccess mdb -application/x-msbinder obd -application/x-mscardfile crd -application/x-msclip clp -application/x-msdownload exe dll com bat msi -application/x-msmediaview mvb m13 m14 -application/x-msmetafile wmf -application/x-msmoney mny -application/x-mspublisher pub -application/x-msschedule scd -application/x-msterminal trm -application/x-mswrite wri -application/x-netcdf nc cdf -application/x-pkcs12 p12 pfx -application/x-pkcs7-certificates p7b spc -application/x-pkcs7-certreqresp p7r -application/x-rar-compressed rar -application/x-sh sh -application/x-shar shar -application/x-shockwave-flash swf -application/x-silverlight-app xap -application/x-stuffit sit -application/x-stuffitx sitx -application/x-sv4cpio sv4cpio -application/x-sv4crc sv4crc -application/x-tar tar -application/x-tcl tcl -application/x-tex tex -application/x-tex-tfm tfm -application/x-texinfo texinfo texi -application/x-ustar ustar -application/x-wais-source src -application/x-x509-ca-cert der crt -application/x-xfig fig -application/x-xpinstall xpi -# application/x400-bp -# application/xcap-att+xml -# application/xcap-caps+xml -application/xcap-diff+xml xdf -# application/xcap-el+xml -# application/xcap-error+xml -# application/xcap-ns+xml -# application/xcon-conference-info-diff+xml -# application/xcon-conference-info+xml -application/xenc+xml xenc -application/xhtml+xml xhtml xht -# application/xhtml-voice+xml -application/xml xml xsl -application/xml-dtd dtd -# application/xml-external-parsed-entity -# application/xmpp+xml -application/xop+xml xop -application/xslt+xml xslt -application/xspf+xml xspf -application/xv+xml mxml xhvml xvml xvm -application/yang yang -application/yin+xml yin -application/zip zip -# audio/1d-interleaved-parityfec -# audio/32kadpcm -# audio/3gpp -# audio/3gpp2 -# audio/ac3 -audio/adpcm adp -# audio/amr -# audio/amr-wb -# audio/amr-wb+ -# audio/asc -# audio/atrac-advanced-lossless -# audio/atrac-x -# audio/atrac3 -audio/basic au snd -# audio/bv16 -# audio/bv32 -# audio/clearmode -# audio/cn -# audio/dat12 -# audio/dls -# audio/dsr-es201108 -# audio/dsr-es202050 -# audio/dsr-es202211 -# audio/dsr-es202212 -# audio/dvi4 -# audio/eac3 -# audio/evrc -# audio/evrc-qcp -# audio/evrc0 -# audio/evrc1 -# audio/evrcb -# audio/evrcb0 -# audio/evrcb1 -# audio/evrcwb -# audio/evrcwb0 -# audio/evrcwb1 -# audio/example -# audio/g719 -# audio/g722 -# audio/g7221 -# audio/g723 -# audio/g726-16 -# audio/g726-24 -# audio/g726-32 -# audio/g726-40 -# audio/g728 -# audio/g729 -# audio/g7291 -# audio/g729d -# audio/g729e -# audio/gsm -# audio/gsm-efr -# audio/gsm-hr-08 -# audio/ilbc -# audio/l16 -# audio/l20 -# audio/l24 -# audio/l8 -# audio/lpc -audio/midi mid midi kar rmi -# audio/mobile-xmf -audio/mp4 mp4a -# audio/mp4a-latm -# audio/mpa -# audio/mpa-robust -audio/mpeg mpga mp2 mp2a mp3 m2a m3a -# audio/mpeg4-generic -audio/ogg oga ogg spx -# audio/parityfec -# audio/pcma -# audio/pcma-wb -# audio/pcmu-wb -# audio/pcmu -# audio/prs.sid -# audio/qcelp -# audio/red -# audio/rtp-enc-aescm128 -# audio/rtp-midi -# audio/rtx -# audio/smv -# audio/smv0 -# audio/smv-qcp -# audio/sp-midi -# audio/speex -# audio/t140c -# audio/t38 -# audio/telephone-event -# audio/tone -# audio/uemclip -# audio/ulpfec -# audio/vdvi -# audio/vmr-wb -# audio/vnd.3gpp.iufp -# audio/vnd.4sb -# audio/vnd.audiokoz -# audio/vnd.celp -# audio/vnd.cisco.nse -# audio/vnd.cmles.radio-events -# audio/vnd.cns.anp1 -# audio/vnd.cns.inf1 -audio/vnd.dece.audio uva uvva -audio/vnd.digital-winds eol -# audio/vnd.dlna.adts -# audio/vnd.dolby.heaac.1 -# audio/vnd.dolby.heaac.2 -# audio/vnd.dolby.mlp -# audio/vnd.dolby.mps -# audio/vnd.dolby.pl2 -# audio/vnd.dolby.pl2x -# audio/vnd.dolby.pl2z -# audio/vnd.dolby.pulse.1 -audio/vnd.dra dra -audio/vnd.dts dts -audio/vnd.dts.hd dtshd -# audio/vnd.everad.plj -# audio/vnd.hns.audio -audio/vnd.lucent.voice lvp -audio/vnd.ms-playready.media.pya pya -# audio/vnd.nokia.mobile-xmf -# audio/vnd.nortel.vbk -audio/vnd.nuera.ecelp4800 ecelp4800 -audio/vnd.nuera.ecelp7470 ecelp7470 -audio/vnd.nuera.ecelp9600 ecelp9600 -# audio/vnd.octel.sbc -# audio/vnd.qcelp -# audio/vnd.rhetorex.32kadpcm -audio/vnd.rip rip -# audio/vnd.sealedmedia.softseal.mpeg -# audio/vnd.vmx.cvsd -# audio/vorbis -# audio/vorbis-config -audio/webm weba -audio/x-aac aac -audio/x-aiff aif aiff aifc -audio/x-mpegurl m3u -audio/x-ms-wax wax -audio/x-ms-wma wma -audio/x-pn-realaudio ram ra -audio/x-pn-realaudio-plugin rmp -audio/x-wav wav -chemical/x-cdx cdx -chemical/x-cif cif -chemical/x-cmdf cmdf -chemical/x-cml cml -chemical/x-csml csml -# chemical/x-pdb -chemical/x-xyz xyz -image/bmp bmp -image/cgm cgm -# image/example -# image/fits -image/g3fax g3 -image/gif gif -image/ief ief -# image/jp2 -image/jpeg jpeg jpg jpe -# image/jpm -# image/jpx -image/ktx ktx -# image/naplps -image/png png -image/prs.btif btif -# image/prs.pti -image/svg+xml svg svgz -# image/t38 -image/tiff tiff tif -# image/tiff-fx -image/vnd.adobe.photoshop psd -# image/vnd.cns.inf2 -image/vnd.dece.graphic uvi uvvi uvg uvvg -image/vnd.dvb.subtitle sub -image/vnd.djvu djvu djv -image/vnd.dwg dwg -image/vnd.dxf dxf -image/vnd.fastbidsheet fbs -image/vnd.fpx fpx -image/vnd.fst fst -image/vnd.fujixerox.edmics-mmr mmr -image/vnd.fujixerox.edmics-rlc rlc -# image/vnd.globalgraphics.pgb -# image/vnd.microsoft.icon -# image/vnd.mix -image/vnd.ms-modi mdi -image/vnd.net-fpx npx -# image/vnd.radiance -# image/vnd.sealed.png -# image/vnd.sealedmedia.softseal.gif -# image/vnd.sealedmedia.softseal.jpg -# image/vnd.svf -image/vnd.wap.wbmp wbmp -image/vnd.xiff xif -image/webp webp -image/x-cmu-raster ras -image/x-cmx cmx -image/x-freehand fh fhc fh4 fh5 fh7 -image/x-icon ico -image/x-pcx pcx -image/x-pict pic pct -image/x-portable-anymap pnm -image/x-portable-bitmap pbm -image/x-portable-graymap pgm -image/x-portable-pixmap ppm -image/x-rgb rgb -image/x-xbitmap xbm -image/x-xpixmap xpm -image/x-xwindowdump xwd -# message/cpim -# message/delivery-status -# message/disposition-notification -# message/example -# message/external-body -# message/feedback-report -# message/global -# message/global-delivery-status -# message/global-disposition-notification -# message/global-headers -# message/http -# message/imdn+xml -# message/news -# message/partial -message/rfc822 eml mime -# message/s-http -# message/sip -# message/sipfrag -# message/tracking-status -# message/vnd.si.simp -# model/example -model/iges igs iges -model/mesh msh mesh silo -model/vnd.collada+xml dae -model/vnd.dwf dwf -# model/vnd.flatland.3dml -model/vnd.gdl gdl -# model/vnd.gs-gdl -# model/vnd.gs.gdl -model/vnd.gtw gtw -# model/vnd.moml+xml -model/vnd.mts mts -# model/vnd.parasolid.transmit.binary -# model/vnd.parasolid.transmit.text -model/vnd.vtu vtu -model/vrml wrl vrml -# multipart/alternative -# multipart/appledouble -# multipart/byteranges -# multipart/digest -# multipart/encrypted -# multipart/example -# multipart/form-data -# multipart/header-set -# multipart/mixed -# multipart/parallel -# multipart/related -# multipart/report -# multipart/signed -# multipart/voice-message -# text/1d-interleaved-parityfec -text/calendar ics ifb -text/css css -text/csv csv -# text/directory -# text/dns -# text/ecmascript -# text/enriched -# text/example -text/html html htm -# text/javascript -text/n3 n3 -# text/parityfec -text/plain txt text conf def list log in -# text/prs.fallenstein.rst -text/prs.lines.tag dsc -# text/vnd.radisys.msml-basic-layout -# text/red -# text/rfc822-headers -text/richtext rtx -# text/rtf -# text/rtp-enc-aescm128 -# text/rtx -text/sgml sgml sgm -# text/t140 -text/tab-separated-values tsv -text/troff t tr roff man me ms -text/turtle ttl -# text/ulpfec -text/uri-list uri uris urls -# text/vnd.abc -text/vnd.curl curl -text/vnd.curl.dcurl dcurl -text/vnd.curl.scurl scurl -text/vnd.curl.mcurl mcurl -# text/vnd.dmclientscript -# text/vnd.esmertec.theme-descriptor -text/vnd.fly fly -text/vnd.fmi.flexstor flx -text/vnd.graphviz gv -text/vnd.in3d.3dml 3dml -text/vnd.in3d.spot spot -# text/vnd.iptc.newsml -# text/vnd.iptc.nitf -# text/vnd.latex-z -# text/vnd.motorola.reflex -# text/vnd.ms-mediapackage -# text/vnd.net2phone.commcenter.command -# text/vnd.si.uricatalogue -text/vnd.sun.j2me.app-descriptor jad -# text/vnd.trolltech.linguist -# text/vnd.wap.si -# text/vnd.wap.sl -text/vnd.wap.wml wml -text/vnd.wap.wmlscript wmls -text/x-asm s asm -text/x-c c cc cxx cpp h hh dic -text/x-fortran f for f77 f90 -text/x-pascal p pas -text/x-java-source java -text/x-setext etx -text/x-uuencode uu -text/x-vcalendar vcs -text/x-vcard vcf -# text/xml -# text/xml-external-parsed-entity -# video/1d-interleaved-parityfec -video/3gpp 3gp -# video/3gpp-tt -video/3gpp2 3g2 -# video/bmpeg -# video/bt656 -# video/celb -# video/dv -# video/example -video/h261 h261 -video/h263 h263 -# video/h263-1998 -# video/h263-2000 -video/h264 h264 -# video/h264-rcdo -# video/h264-svc -video/jpeg jpgv -# video/jpeg2000 -video/jpm jpm jpgm -video/mj2 mj2 mjp2 -# video/mp1s -# video/mp2p -# video/mp2t -video/mp4 mp4 mp4v mpg4 -# video/mp4v-es -video/mpeg mpeg mpg mpe m1v m2v -# video/mpeg4-generic -# video/mpv -# video/nv -video/ogg ogv -# video/parityfec -# video/pointer -video/quicktime qt mov -# video/raw -# video/rtp-enc-aescm128 -# video/rtx -# video/smpte292m -# video/ulpfec -# video/vc1 -# video/vnd.cctv -video/vnd.dece.hd uvh uvvh -video/vnd.dece.mobile uvm uvvm -# video/vnd.dece.mp4 -video/vnd.dece.pd uvp uvvp -video/vnd.dece.sd uvs uvvs -video/vnd.dece.video uvv uvvv -# video/vnd.directv.mpeg -# video/vnd.directv.mpeg-tts -# video/vnd.dlna.mpeg-tts -video/vnd.fvt fvt -# video/vnd.hns.video -# video/vnd.iptvforum.1dparityfec-1010 -# video/vnd.iptvforum.1dparityfec-2005 -# video/vnd.iptvforum.2dparityfec-1010 -# video/vnd.iptvforum.2dparityfec-2005 -# video/vnd.iptvforum.ttsavc -# video/vnd.iptvforum.ttsmpeg2 -# video/vnd.motorola.video -# video/vnd.motorola.videop -video/vnd.mpegurl mxu m4u -video/vnd.ms-playready.media.pyv pyv -# video/vnd.nokia.interleaved-multimedia -# video/vnd.nokia.videovoip -# video/vnd.objectvideo -# video/vnd.sealed.mpeg1 -# video/vnd.sealed.mpeg4 -# video/vnd.sealed.swf -# video/vnd.sealedmedia.softseal.mov -video/vnd.uvvu.mp4 uvu uvvu -video/vnd.vivo viv -video/webm webm -video/x-f4v f4v -video/x-fli fli -video/x-flv flv -video/x-m4v m4v -video/x-ms-asf asf asx -video/x-ms-wm wm -video/x-ms-wmv wmv -video/x-ms-wmx wmx -video/x-ms-wvx wvx -video/x-msvideo avi -video/x-sgi-movie movie -x-conference/x-cooltalk ice diff --git a/node_modules/connect/node_modules/mime/types/node.types b/node_modules/connect/node_modules/mime/types/node.types deleted file mode 100644 index fdabaa4..0000000 --- a/node_modules/connect/node_modules/mime/types/node.types +++ /dev/null @@ -1,43 +0,0 @@ -# What: Google Chrome Extension -# Why: To allow apps to (work) be served with the right content type header. -# http://codereview.chromium.org/2830017 -# Added by: niftylettuce -application/x-chrome-extension crx - -# What: OTF Message Silencer -# Why: To silence the "Resource interpreted as font but transferred with MIME -# type font/otf" message that occurs in Google Chrome -# Added by: niftylettuce -font/opentype otf - -# What: HTC support -# Why: To properly render .htc files such as CSS3PIE -# Added by: niftylettuce -text/x-component htc - -# What: HTML5 application cache manifest -# Why: De-facto standard. Required by Mozilla browser when serving HTML5 apps -# per https://developer.mozilla.org/en/offline_resources_in_firefox -# Added by: louisremi -text/cache-manifest appcache manifest - -# What: node binary buffer format -# Why: semi-standard extension w/in the node community -# Added by: tootallnate -application/octet-stream buffer - -# What: The "protected" MP-4 formats used by iTunes. -# Why: Required for streaming music to browsers (?) -# Added by: broofa -application/mp4 m4p -audio/mp4 m4a - -# What: Music playlist format (http://en.wikipedia.org/wiki/M3U) -# Why: See https://github.com/bentomas/node-mime/pull/6 -# Added by: mjrusso -application/x-mpegURL m3u8 - -# What: Video format, Part of RFC1890 -# Why: See https://github.com/bentomas/node-mime/pull/6 -# Added by: mjrusso -video/MP2T ts diff --git a/node_modules/connect/node_modules/qs/.gitmodules b/node_modules/connect/node_modules/qs/.gitmodules deleted file mode 100644 index 49e31da..0000000 --- a/node_modules/connect/node_modules/qs/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "support/expresso"] - path = support/expresso - url = git://github.com/visionmedia/expresso.git -[submodule "support/should"] - path = support/should - url = git://github.com/visionmedia/should.js.git diff --git a/node_modules/connect/node_modules/qs/.npmignore b/node_modules/connect/node_modules/qs/.npmignore deleted file mode 100644 index 3c3629e..0000000 --- a/node_modules/connect/node_modules/qs/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/node_modules/connect/node_modules/qs/.travis.yml b/node_modules/connect/node_modules/qs/.travis.yml deleted file mode 100644 index 2c0a8f6..0000000 --- a/node_modules/connect/node_modules/qs/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.6 - - 0.4 \ No newline at end of file diff --git a/node_modules/connect/node_modules/qs/History.md b/node_modules/connect/node_modules/qs/History.md deleted file mode 100644 index 3eaf7df..0000000 --- a/node_modules/connect/node_modules/qs/History.md +++ /dev/null @@ -1,73 +0,0 @@ - -0.4.2 / 2012-02-08 -================== - - * Fixed: ensure objects are created when appropriate not arrays [aheckmann] - -0.4.1 / 2012-01-26 -================== - - * Fixed stringify()ing numbers. Closes #23 - -0.4.0 / 2011-11-21 -================== - - * Allow parsing of an existing object (for `bodyParser()`) [jackyz] - * Replaced expresso with mocha - -0.3.2 / 2011-11-08 -================== - - * Fixed global variable leak - -0.3.1 / 2011-08-17 -================== - - * Added `try/catch` around malformed uri components - * Add test coverage for Array native method bleed-though - -0.3.0 / 2011-07-19 -================== - - * Allow `array[index]` and `object[property]` syntaxes [Aria Stewart] - -0.2.0 / 2011-06-29 -================== - - * Added `qs.stringify()` [Cory Forsyth] - -0.1.0 / 2011-04-13 -================== - - * Added jQuery-ish array support - -0.0.7 / 2011-03-13 -================== - - * Fixed; handle empty string and `== null` in `qs.parse()` [dmit] - allows for convenient `qs.parse(url.parse(str).query)` - -0.0.6 / 2011-02-14 -================== - - * Fixed; support for implicit arrays - -0.0.4 / 2011-02-09 -================== - - * Fixed `+` as a space - -0.0.3 / 2011-02-08 -================== - - * Fixed case when right-hand value contains "]" - -0.0.2 / 2011-02-07 -================== - - * Fixed "=" presence in key - -0.0.1 / 2011-02-07 -================== - - * Initial release \ No newline at end of file diff --git a/node_modules/connect/node_modules/qs/Makefile b/node_modules/connect/node_modules/qs/Makefile deleted file mode 100644 index e4df837..0000000 --- a/node_modules/connect/node_modules/qs/Makefile +++ /dev/null @@ -1,5 +0,0 @@ - -test: - @./node_modules/.bin/mocha - -.PHONY: test \ No newline at end of file diff --git a/node_modules/connect/node_modules/qs/Readme.md b/node_modules/connect/node_modules/qs/Readme.md deleted file mode 100644 index db0d145..0000000 --- a/node_modules/connect/node_modules/qs/Readme.md +++ /dev/null @@ -1,54 +0,0 @@ -# node-querystring - - query string parser for node supporting nesting, as it was removed from `0.3.x`, so this library provides the previous and commonly desired behaviour (and twice as fast). Used by [express](http://expressjs.com), [connect](http://senchalabs.github.com/connect) and others. - -## Installation - - $ npm install qs - -## Examples - -```js -var qs = require('qs'); - -qs.parse('user[name][first]=Tobi&user[email]=tobi@learnboost.com'); -// => { user: { name: { first: 'Tobi' }, email: 'tobi@learnboost.com' } } - -qs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }}) -// => user[name]=Tobi&user[email]=tobi%40learnboost.com -``` - -## Testing - -Install dev dependencies: - - $ npm install -d - -and execute: - - $ make test - -## License - -(The MIT License) - -Copyright (c) 2010 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/connect/node_modules/qs/benchmark.js b/node_modules/connect/node_modules/qs/benchmark.js deleted file mode 100644 index 97e2c93..0000000 --- a/node_modules/connect/node_modules/qs/benchmark.js +++ /dev/null @@ -1,17 +0,0 @@ - -var qs = require('./'); - -var times = 100000 - , start = new Date - , n = times; - -console.log('times: %d', times); - -while (n--) qs.parse('foo=bar'); -console.log('simple: %dms', new Date - start); - -var start = new Date - , n = times; - -while (n--) qs.parse('user[name][first]=tj&user[name][last]=holowaychuk'); -console.log('nested: %dms', new Date - start); \ No newline at end of file diff --git a/node_modules/connect/node_modules/qs/examples.js b/node_modules/connect/node_modules/qs/examples.js deleted file mode 100644 index 27617b7..0000000 --- a/node_modules/connect/node_modules/qs/examples.js +++ /dev/null @@ -1,51 +0,0 @@ - -/** - * Module dependencies. - */ - -var qs = require('./'); - -var obj = qs.parse('foo'); -console.log(obj) - -var obj = qs.parse('foo=bar=baz'); -console.log(obj) - -var obj = qs.parse('users[]'); -console.log(obj) - -var obj = qs.parse('name=tj&email=tj@vision-media.ca'); -console.log(obj) - -var obj = qs.parse('users[]=tj&users[]=tobi&users[]=jane'); -console.log(obj) - -var obj = qs.parse('user[name][first]=tj&user[name][last]=holowaychuk'); -console.log(obj) - -var obj = qs.parse('users[][name][first]=tj&users[][name][last]=holowaychuk'); -console.log(obj) - -var obj = qs.parse('a=a&a=b&a=c'); -console.log(obj) - -var obj = qs.parse('user[tj]=tj&user[tj]=TJ'); -console.log(obj) - -var obj = qs.parse('user[names]=tj&user[names]=TJ&user[names]=Tyler'); -console.log(obj) - -var obj = qs.parse('user[name][first]=tj&user[name][first]=TJ'); -console.log(obj) - -var obj = qs.parse('user[0]=tj&user[1]=TJ'); -console.log(obj) - -var obj = qs.parse('user[0]=tj&user[]=TJ'); -console.log(obj) - -var obj = qs.parse('user[0]=tj&user[foo]=TJ'); -console.log(obj) - -var str = qs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }}); -console.log(str); \ No newline at end of file diff --git a/node_modules/connect/node_modules/qs/index.js b/node_modules/connect/node_modules/qs/index.js deleted file mode 100644 index d177d20..0000000 --- a/node_modules/connect/node_modules/qs/index.js +++ /dev/null @@ -1,2 +0,0 @@ - -module.exports = require('./lib/querystring'); \ No newline at end of file diff --git a/node_modules/connect/node_modules/qs/lib/querystring.js b/node_modules/connect/node_modules/qs/lib/querystring.js deleted file mode 100644 index 6c72712..0000000 --- a/node_modules/connect/node_modules/qs/lib/querystring.js +++ /dev/null @@ -1,264 +0,0 @@ - -/*! - * querystring - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Library version. - */ - -exports.version = '0.4.2'; - -/** - * Object#toString() ref for stringify(). - */ - -var toString = Object.prototype.toString; - -/** - * Cache non-integer test regexp. - */ - -var isint = /^[0-9]+$/; - -function promote(parent, key) { - if (parent[key].length == 0) return parent[key] = {}; - var t = {}; - for (var i in parent[key]) t[i] = parent[key][i]; - parent[key] = t; - return t; -} - -function parse(parts, parent, key, val) { - var part = parts.shift(); - // end - if (!part) { - if (Array.isArray(parent[key])) { - parent[key].push(val); - } else if ('object' == typeof parent[key]) { - parent[key] = val; - } else if ('undefined' == typeof parent[key]) { - parent[key] = val; - } else { - parent[key] = [parent[key], val]; - } - // array - } else { - var obj = parent[key] = parent[key] || []; - if (']' == part) { - if (Array.isArray(obj)) { - if ('' != val) obj.push(val); - } else if ('object' == typeof obj) { - obj[Object.keys(obj).length] = val; - } else { - obj = parent[key] = [parent[key], val]; - } - // prop - } else if (~part.indexOf(']')) { - part = part.substr(0, part.length - 1); - if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key); - parse(parts, obj, part, val); - // key - } else { - if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key); - parse(parts, obj, part, val); - } - } -} - -/** - * Merge parent key/val pair. - */ - -function merge(parent, key, val){ - if (~key.indexOf(']')) { - var parts = key.split('[') - , len = parts.length - , last = len - 1; - parse(parts, parent, 'base', val); - // optimize - } else { - if (!isint.test(key) && Array.isArray(parent.base)) { - var t = {}; - for (var k in parent.base) t[k] = parent.base[k]; - parent.base = t; - } - set(parent.base, key, val); - } - - return parent; -} - -/** - * Parse the given obj. - */ - -function parseObject(obj){ - var ret = { base: {} }; - Object.keys(obj).forEach(function(name){ - merge(ret, name, obj[name]); - }); - return ret.base; -} - -/** - * Parse the given str. - */ - -function parseString(str){ - return String(str) - .split('&') - .reduce(function(ret, pair){ - try{ - pair = decodeURIComponent(pair.replace(/\+/g, ' ')); - } catch(e) { - // ignore - } - - var eql = pair.indexOf('=') - , brace = lastBraceInKey(pair) - , key = pair.substr(0, brace || eql) - , val = pair.substr(brace || eql, pair.length) - , val = val.substr(val.indexOf('=') + 1, val.length); - - // ?foo - if ('' == key) key = pair, val = ''; - - return merge(ret, key, val); - }, { base: {} }).base; -} - -/** - * Parse the given query `str` or `obj`, returning an object. - * - * @param {String} str | {Object} obj - * @return {Object} - * @api public - */ - -exports.parse = function(str){ - if (null == str || '' == str) return {}; - return 'object' == typeof str - ? parseObject(str) - : parseString(str); -}; - -/** - * Turn the given `obj` into a query string - * - * @param {Object} obj - * @return {String} - * @api public - */ - -var stringify = exports.stringify = function(obj, prefix) { - if (Array.isArray(obj)) { - return stringifyArray(obj, prefix); - } else if ('[object Object]' == toString.call(obj)) { - return stringifyObject(obj, prefix); - } else if ('string' == typeof obj) { - return stringifyString(obj, prefix); - } else { - return prefix + '=' + obj; - } -}; - -/** - * Stringify the given `str`. - * - * @param {String} str - * @param {String} prefix - * @return {String} - * @api private - */ - -function stringifyString(str, prefix) { - if (!prefix) throw new TypeError('stringify expects an object'); - return prefix + '=' + encodeURIComponent(str); -} - -/** - * Stringify the given `arr`. - * - * @param {Array} arr - * @param {String} prefix - * @return {String} - * @api private - */ - -function stringifyArray(arr, prefix) { - var ret = []; - if (!prefix) throw new TypeError('stringify expects an object'); - for (var i = 0; i < arr.length; i++) { - ret.push(stringify(arr[i], prefix + '[]')); - } - return ret.join('&'); -} - -/** - * Stringify the given `obj`. - * - * @param {Object} obj - * @param {String} prefix - * @return {String} - * @api private - */ - -function stringifyObject(obj, prefix) { - var ret = [] - , keys = Object.keys(obj) - , key; - - for (var i = 0, len = keys.length; i < len; ++i) { - key = keys[i]; - ret.push(stringify(obj[key], prefix - ? prefix + '[' + encodeURIComponent(key) + ']' - : encodeURIComponent(key))); - } - - return ret.join('&'); -} - -/** - * Set `obj`'s `key` to `val` respecting - * the weird and wonderful syntax of a qs, - * where "foo=bar&foo=baz" becomes an array. - * - * @param {Object} obj - * @param {String} key - * @param {String} val - * @api private - */ - -function set(obj, key, val) { - var v = obj[key]; - if (undefined === v) { - obj[key] = val; - } else if (Array.isArray(v)) { - v.push(val); - } else { - obj[key] = [v, val]; - } -} - -/** - * Locate last brace in `str` within the key. - * - * @param {String} str - * @return {Number} - * @api private - */ - -function lastBraceInKey(str) { - var len = str.length - , brace - , c; - for (var i = 0; i < len; ++i) { - c = str[i]; - if (']' == c) brace = false; - if ('[' == c) brace = true; - if ('=' == c && !brace) return i; - } -} diff --git a/node_modules/connect/node_modules/qs/package.json b/node_modules/connect/node_modules/qs/package.json deleted file mode 100644 index bb37117..0000000 --- a/node_modules/connect/node_modules/qs/package.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "name": "qs", - "description": "querystring parser", - "version": "0.4.2", - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/node-querystring.git" - }, - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca", - "url": "http://tjholowaychuk.com" - }, - "main": "index", - "engines": { - "node": "*" - }, - "_id": "qs@0.4.2", - "dependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "dist": { - "shasum": "0fd82692498e1c9474dfa5cb3d494e2a04008c1e" - }, - "_from": "qs@0.4.2" -} diff --git a/node_modules/connect/node_modules/qs/test/mocha.opts b/node_modules/connect/node_modules/qs/test/mocha.opts deleted file mode 100644 index 521cbb2..0000000 --- a/node_modules/connect/node_modules/qs/test/mocha.opts +++ /dev/null @@ -1,2 +0,0 @@ ---require should ---ui exports diff --git a/node_modules/connect/node_modules/qs/test/parse.js b/node_modules/connect/node_modules/qs/test/parse.js deleted file mode 100644 index f219e27..0000000 --- a/node_modules/connect/node_modules/qs/test/parse.js +++ /dev/null @@ -1,167 +0,0 @@ - -/** - * Module dependencies. - */ - -var qs = require('../'); - -module.exports = { - 'test basics': function(){ - qs.parse('0=foo').should.eql({ '0': 'foo' }); - - qs.parse('foo=c++') - .should.eql({ foo: 'c ' }); - - qs.parse('a[>=]=23') - .should.eql({ a: { '>=': '23' }}); - - qs.parse('a[<=>]==23') - .should.eql({ a: { '<=>': '=23' }}); - - qs.parse('a[==]=23') - .should.eql({ a: { '==': '23' }}); - - qs.parse('foo') - .should.eql({ foo: '' }); - - qs.parse('foo=bar') - .should.eql({ foo: 'bar' }); - - qs.parse('foo%3Dbar=baz') - .should.eql({ foo: 'bar=baz' }); - - qs.parse(' foo = bar = baz ') - .should.eql({ ' foo ': ' bar = baz ' }); - - qs.parse('foo=bar=baz') - .should.eql({ foo: 'bar=baz' }); - - qs.parse('foo=bar&bar=baz') - .should.eql({ foo: 'bar', bar: 'baz' }); - - qs.parse('foo=bar&baz') - .should.eql({ foo: 'bar', baz: '' }); - - qs.parse('cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World') - .should.eql({ - cht: 'p3' - , chd: 't:60,40' - , chs: '250x100' - , chl: 'Hello|World' - }); - }, - - 'test nesting': function(){ - qs.parse('ops[>=]=25') - .should.eql({ ops: { '>=': '25' }}); - - qs.parse('user[name]=tj') - .should.eql({ user: { name: 'tj' }}); - - qs.parse('user[name][first]=tj&user[name][last]=holowaychuk') - .should.eql({ user: { name: { first: 'tj', last: 'holowaychuk' }}}); - }, - - 'test escaping': function(){ - qs.parse('foo=foo%20bar') - .should.eql({ foo: 'foo bar' }); - }, - - 'test arrays': function(){ - qs.parse('images[]') - .should.eql({ images: [] }); - - qs.parse('user[]=tj') - .should.eql({ user: ['tj'] }); - - qs.parse('user[]=tj&user[]=tobi&user[]=jane') - .should.eql({ user: ['tj', 'tobi', 'jane'] }); - - qs.parse('user[names][]=tj&user[names][]=tyler') - .should.eql({ user: { names: ['tj', 'tyler'] }}); - - qs.parse('user[names][]=tj&user[names][]=tyler&user[email]=tj@vision-media.ca') - .should.eql({ user: { names: ['tj', 'tyler'], email: 'tj@vision-media.ca' }}); - - qs.parse('items=a&items=b') - .should.eql({ items: ['a', 'b'] }); - - qs.parse('user[names]=tj&user[names]=holowaychuk&user[names]=TJ') - .should.eql({ user: { names: ['tj', 'holowaychuk', 'TJ'] }}); - - qs.parse('user[name][first]=tj&user[name][first]=TJ') - .should.eql({ user: { name: { first: ['tj', 'TJ'] }}}); - - var o = qs.parse('existing[fcbaebfecc][name][last]=tj') - o.should.eql({ existing: { 'fcbaebfecc': { name: { last: 'tj' }}}}) - Array.isArray(o.existing).should.be.false; - }, - - 'test right-hand brackets': function(){ - qs.parse('pets=["tobi"]') - .should.eql({ pets: '["tobi"]' }); - - qs.parse('operators=[">=", "<="]') - .should.eql({ operators: '[">=", "<="]' }); - - qs.parse('op[>=]=[1,2,3]') - .should.eql({ op: { '>=': '[1,2,3]' }}); - - qs.parse('op[>=]=[1,2,3]&op[=]=[[[[1]]]]') - .should.eql({ op: { '>=': '[1,2,3]', '=': '[[[[1]]]]' }}); - }, - - 'test duplicates': function(){ - qs.parse('items=bar&items=baz&items=raz') - .should.eql({ items: ['bar', 'baz', 'raz'] }); - }, - - 'test empty': function(){ - qs.parse('').should.eql({}); - qs.parse(undefined).should.eql({}); - qs.parse(null).should.eql({}); - }, - - 'test arrays with indexes': function(){ - qs.parse('foo[0]=bar&foo[1]=baz').should.eql({ foo: ['bar', 'baz'] }); - qs.parse('foo[1]=bar&foo[0]=baz').should.eql({ foo: ['baz', 'bar'] }); - qs.parse('foo[base64]=RAWR').should.eql({ foo: { base64: 'RAWR' }}); - qs.parse('foo[64base]=RAWR').should.eql({ foo: { '64base': 'RAWR' }}); - }, - - 'test arrays becoming objects': function(){ - qs.parse('foo[0]=bar&foo[bad]=baz').should.eql({ foo: { 0: "bar", bad: "baz" }}); - qs.parse('foo[bad]=baz&foo[0]=bar').should.eql({ foo: { 0: "bar", bad: "baz" }}); - }, - - 'test bleed-through of Array native properties/methods': function(){ - Array.prototype.protoProperty = true; - Array.prototype.protoFunction = function () {}; - qs.parse('foo=bar').should.eql({ foo: 'bar' }); - }, - - 'test malformed uri': function(){ - qs.parse('{%:%}').should.eql({ '{%:%}': '' }); - qs.parse('foo=%:%}').should.eql({ 'foo': '%:%}' }); - }, - - 'test semi-parsed': function(){ - qs.parse({ 'user[name]': 'tobi' }) - .should.eql({ user: { name: 'tobi' }}); - - qs.parse({ 'user[name]': 'tobi', 'user[email][main]': 'tobi@lb.com' }) - .should.eql({ user: { name: 'tobi', email: { main: 'tobi@lb.com' } }}); - } - - // 'test complex': function(){ - // qs.parse('users[][name][first]=tj&users[foo]=bar') - // .should.eql({ - // users: [ { name: 'tj' }, { name: 'tobi' }, { foo: 'bar' }] - // }); - // - // qs.parse('users[][name][first]=tj&users[][name][first]=tobi') - // .should.eql({ - // users: [ { name: 'tj' }, { name: 'tobi' }] - // }); - // } -}; diff --git a/node_modules/connect/node_modules/qs/test/stringify.js b/node_modules/connect/node_modules/qs/test/stringify.js deleted file mode 100644 index c2195cb..0000000 --- a/node_modules/connect/node_modules/qs/test/stringify.js +++ /dev/null @@ -1,103 +0,0 @@ - -/** - * Module dependencies. - */ - -var qs = require('../') - , should = require('should') - , str_identities = { - 'basics': [ - { str: 'foo=bar', obj: {'foo' : 'bar'}}, - { str: 'foo=%22bar%22', obj: {'foo' : '\"bar\"'}}, - { str: 'foo=', obj: {'foo': ''}}, - { str: 'foo=1&bar=2', obj: {'foo' : '1', 'bar' : '2'}}, - { str: 'my%20weird%20field=q1!2%22\'w%245%267%2Fz8)%3F', obj: {'my weird field': "q1!2\"'w$5&7/z8)?"}}, - { str: 'foo%3Dbaz=bar', obj: {'foo=baz': 'bar'}}, - { str: 'foo=bar&bar=baz', obj: {foo: 'bar', bar: 'baz'}} - ], - 'escaping': [ - { str: 'foo=foo%20bar', obj: {foo: 'foo bar'}}, - { str: 'cht=p3&chd=t%3A60%2C40&chs=250x100&chl=Hello%7CWorld', obj: { - cht: 'p3' - , chd: 't:60,40' - , chs: '250x100' - , chl: 'Hello|World' - }} - ], - 'nested': [ - { str: 'foo[]=bar&foo[]=quux', obj: {'foo' : ['bar', 'quux']}}, - { str: 'foo[]=bar', obj: {foo: ['bar']}}, - { str: 'foo[]=1&foo[]=2', obj: {'foo' : ['1', '2']}}, - { str: 'foo=bar&baz[]=1&baz[]=2&baz[]=3', obj: {'foo' : 'bar', 'baz' : ['1', '2', '3']}}, - { str: 'foo[]=bar&baz[]=1&baz[]=2&baz[]=3', obj: {'foo' : ['bar'], 'baz' : ['1', '2', '3']}}, - { str: 'x[y][z]=1', obj: {'x' : {'y' : {'z' : '1'}}}}, - { str: 'x[y][z][]=1', obj: {'x' : {'y' : {'z' : ['1']}}}}, - { str: 'x[y][z]=2', obj: {'x' : {'y' : {'z' : '2'}}}}, - { str: 'x[y][z][]=1&x[y][z][]=2', obj: {'x' : {'y' : {'z' : ['1', '2']}}}}, - { str: 'x[y][][z]=1', obj: {'x' : {'y' : [{'z' : '1'}]}}}, - { str: 'x[y][][z][]=1', obj: {'x' : {'y' : [{'z' : ['1']}]}}}, - { str: 'x[y][][z]=1&x[y][][w]=2', obj: {'x' : {'y' : [{'z' : '1', 'w' : '2'}]}}}, - { str: 'x[y][][v][w]=1', obj: {'x' : {'y' : [{'v' : {'w' : '1'}}]}}}, - { str: 'x[y][][z]=1&x[y][][v][w]=2', obj: {'x' : {'y' : [{'z' : '1', 'v' : {'w' : '2'}}]}}}, - { str: 'x[y][][z]=1&x[y][][z]=2', obj: {'x' : {'y' : [{'z' : '1'}, {'z' : '2'}]}}}, - { str: 'x[y][][z]=1&x[y][][w]=a&x[y][][z]=2&x[y][][w]=3', obj: {'x' : {'y' : [{'z' : '1', 'w' : 'a'}, {'z' : '2', 'w' : '3'}]}}}, - { str: 'user[name][first]=tj&user[name][last]=holowaychuk', obj: { user: { name: { first: 'tj', last: 'holowaychuk' }}}} - ], - 'errors': [ - { obj: 'foo=bar', message: 'stringify expects an object' }, - { obj: ['foo', 'bar'], message: 'stringify expects an object' } - ], - 'numbers': [ - { str: 'limit[]=1&limit[]=2&limit[]=3', obj: { limit: [1, 2, '3'] }}, - { str: 'limit=1', obj: { limit: 1 }} - ] - }; - - -// Assert error -function err(fn, msg){ - var err; - try { - fn(); - } catch (e) { - should.equal(e.message, msg); - return; - } - throw new Error('no exception thrown, expected "' + msg + '"'); -} - -function test(type) { - var str, obj; - for (var i = 0; i < str_identities[type].length; i++) { - str = str_identities[type][i].str; - obj = str_identities[type][i].obj; - qs.stringify(obj).should.eql(str); - } -} - -module.exports = { - 'test basics': function() { - test('basics'); - }, - - 'test escaping': function() { - test('escaping'); - }, - - 'test nested': function() { - test('nested'); - }, - - 'test numbers': function(){ - test('numbers'); - }, - - 'test errors': function() { - var obj, message; - for (var i = 0; i < str_identities['errors'].length; i++) { - message = str_identities['errors'][i].message; - obj = str_identities['errors'][i].obj; - err(function(){ qs.stringify(obj) }, message); - } - } -}; \ No newline at end of file diff --git a/node_modules/connect/package.json b/node_modules/connect/package.json deleted file mode 100644 index ced2cd8..0000000 --- a/node_modules/connect/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "connect", - "version": "2.2.1", - "description": "High performance middleware framework", - "keywords": [ - "framework", - "web", - "middleware", - "connect", - "rack" - ], - "repository": { - "type": "git", - "url": "git://github.com/senchalabs/connect.git" - }, - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca", - "url": "http://tjholowaychuk.com" - }, - "dependencies": { - "qs": "0.4.2", - "mime": "1.2.4", - "formidable": "1.0.9", - "crc": "0.1.0", - "debug": "*" - }, - "devDependencies": { - "should": "*", - "mocha": "*", - "jade": "*", - "dox": "*" - }, - "main": "index", - "engines": { - "node": ">= 0.5.0 < 0.7.0" - }, - "_id": "connect@2.2.1", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "dist": { - "shasum": "1110f065e8450c737a8f4f8b3114c54113e56744" - }, - "_from": "connect@git://github.com/senchalabs/connect.git" -} diff --git a/node_modules/director/.npmignore b/node_modules/director/.npmignore deleted file mode 100644 index 9702d10..0000000 --- a/node_modules/director/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -/.idea/ -node_modules -npm-debug.log -.DS_Store \ No newline at end of file diff --git a/node_modules/director/.travis.yml b/node_modules/director/.travis.yml deleted file mode 100644 index c958222..0000000 --- a/node_modules/director/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 - - 0.7 - -notifications: - email: - - travis@nodejitsu.com - irc: "irc.freenode.org#nodejitsu" - diff --git a/node_modules/director/LICENSE b/node_modules/director/LICENSE deleted file mode 100644 index 1f01e2b..0000000 --- a/node_modules/director/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011 Nodejitsu Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/director/README.md b/node_modules/director/README.md deleted file mode 100644 index 5f7ce8a..0000000 --- a/node_modules/director/README.md +++ /dev/null @@ -1,677 +0,0 @@ - - - -# Synopsis -Director is a router. Routing is the process of determining what code to run when a URL is requested. - -# Motivation -A routing library that works in both the browser and node.js environments with as few differences as possible. Simplifies the development of Single Page Apps and Node.js applications. Dependency free (doesn't require jQuery or Express, etc). - -# Status -[![Build Status](https://secure.travis-ci.org/flatiron/director.png)](http://travis-ci.org/flatiron/director) - -# Features -* [Client-Side Routing](#client-side) -* [Server-Side HTTP Routing](#http-routing) -* [Server-Side CLI Routing](#cli-routing) - -# Usage -* [API Documentation](#api-documentation) -* [Frequently Asked Questions](#faq) - - -## Client-side Routing -It simply watches the hash of the URL to determine what to do, for example: - -``` -http://foo.com/#/bar -``` - -Client-side routing (aka hash-routing) allows you to specify some information about the state of the application using the URL. So that when the user visits a specific URL, the application can be transformed accordingly. - - - -Here is a simple example: - -```html - - - - - - - - - -``` - -Director works great with your favorite DOM library, such as jQuery. - -```html - - - - - - - -
    Author Name
    -
    Book1, Book2, Book3
    - - -``` - -You can find a browser-specific build of `director` [here][1] which has all of the server code stripped away. - - -## Server-Side HTTP Routing - -Director handles routing for HTTP requests similar to `journey` or `express`: - -```js - // - // require the native http module, as well as director. - // - var http = require('http'), - director = require('director'); - - // - // create some logic to be routed to. - // - function helloWorld(route) { - this.res.writeHead(200, { 'Content-Type': 'text/plain' }) - this.res.end('hello world from (' + route + ')'); - } - - // - // define a routing table. - // - var router = new director.http.Router({ - '/hello': { - get: helloWorld - } - }); - - // - // setup a server and when there is a request, dispatch the - // route that was requestd in the request object. - // - var server = http.createServer(function (req, res) { - router.dispatch(req, res, function (err) { - if (err) { - res.writeHead(404); - res.end(); - } - }); - }); - - // - // You can also do ad-hoc routing, similar to `journey` or `express`. - // This can be done with a string or a regexp. - // - router.get('/bonjour', helloWorld); - router.get(/hola/, helloWorld); - - // - // set the server to listen on port `8080`. - // - server.listen(8080); -``` - - -## CLI Routing - -Director supports Command Line Interface routing. Routes for cli options are based on command line input (i.e. `process.argv`) instead of a URL. - -``` js - var director = require('director'); - - var router = new director.cli.Router(); - - router.on('create', function () { - console.log('create something'); - }); - - router.on(/destroy/, function () { - console.log('destroy something'); - }); - - // You will need to dispatch the cli arguments yourself - router.dispatch('on', process.argv.slice(2).join(' ')); -``` - -Using the cli router, you can dispatch commands by passing them as a string. For example, if this example is in a file called `foo.js`: - -``` bash -$ node foo.js create -create something -$ node foo.js destroy -destroy something -``` - - -# API Documentation - -* [Constructor](#constructor) -* [Routing Table](#routing-table) -* [Adhoc Routing](#adhoc-routing) -* [Scoped Routing](#scoped-routing) -* [Routing Events](#routing-events) -* [Configuration](#configuration) -* [URL Matching](#url-matching) -* [URL Params](#url-params) -* [Route Recursion](#route-recursion) -* [Async Routing](#async-routing) -* [Resources](#resources) -* [Instance Methods](#instance-methods) - - -## Constructor - -``` js - var router = Router(routes); -``` - - -## Routing Table - -An object literal that contains nested route definitions. A potentially nested set of key/value pairs. The keys in the object literal represent each potential part of the URL. The values in the object literal contain references to the functions that should be associated with them. *bark* and *meow* are two functions that you have defined in your code. - -``` js - // - // Assign routes to an object literal. - // - var routes = { - // - // a route which assigns the function `bark`. - // - '/dog': bark, - // - // a route which assigns the functions `meow` and `scratch`. - // - '/cat': [meow, scratch] - }; - - // - // Instantiate the router. - // - var router = Router(routes); -``` - - -## Adhoc Routing - -When developing large client-side or server-side applications it is not always possible to define routes in one location. Usually individual decoupled components register their own routes with the application router. We refer to this as _Adhoc Routing._ Lets take a look at the API `director` exposes for adhoc routing: - -**Client-side Routing** - -``` js - var router = new Router().init(); - - router.on('/some/resource', function () { - // - // Do something on `/#/some/resource` - // - }); -``` - -**HTTP Routing** - -``` js - var router = new director.http.Router(); - - router.get(/\/some\/resource/, function () { - // - // Do something on an GET to `/some/resource` - // - }); -``` - - -## Scoped Routing - -In large web appliations, both [Client-side](#client-side) and [Server-side](#server-side), routes are often scoped within a few individual resources. Director exposes a simple way to do this for [Adhoc Routing](#adhoc-routing) scenarios: - -``` js - var router = new director.http.Router(); - - // - // Create routes inside the `/users` scope. - // - router.path(/\/users\/(\w+)/, function () { - // - // The `this` context of the function passed to `.path()` - // is the Router itself. - // - - this.post(function (id) { - // - // Create the user with the specified `id`. - // - }); - - this.get(function (id) { - // - // Retreive the user with the specified `id`. - // - }); - - this.get(/\/friends/, function (id) { - // - // Get the friends for the user with the specified `id`. - // - }); - }); -``` - - -## Routing Events - -In `director`, a "routing event" is a named property in the [Routing Table](#routing-table) which can be assigned to a function or an Array of functions to be called when a route is matched in a call to `router.dispatch()`. - -* **on:** A function or Array of functions to execute when the route is matched. -* **before:** A function or Array of functions to execute before calling the `on` method(s). - -**Client-side only** - -* **after:** A function or Array of functions to execute when leaving a particular route. -* **once:** A function or Array of functions to execute only once for a particular route. - - -## Configuration - -Given the flexible nature of `director` there are several options available for both the [Client-side](#client-side) and [Server-side](#server-side). These options can be set using the `.configure()` method: - -``` js - var router = new director.Router(routes).configure(options); -``` - -The `options` are: - -* **recurse:** Controls [route recursion](#route-recursion). Use `forward`, `backward`, or `false`. Default is `false` Client-side, and `backward` Server-side. -* **strict:** If set to `false`, then trailing slashes (or other delimiters) are allowed in routes. Default is `true`. -* **async:** Controls [async routing](#async-routing). Use `true` or `false`. Default is `false`. -* **delimiter:** Character separator between route fragments. Default is `/`. -* **notfound:** A function to call if no route is found on a call to `router.dispatch()`. -* **on:** A function (or list of functions) to call on every call to `router.dispatch()` when a route is found. -* **before:** A function (or list of functions) to call before every call to `router.dispatch()` when a route is found. - -**Client-side only** - -* **resource:** An object to which string-based routes will be bound. This can be especially useful for late-binding to route functions (such as async client-side requires). -* **after:** A function (or list of functions) to call when a given route is no longer the active route. - - -## URL Matching - -``` js - var router = Router({ - // - // given the route '/dog/yella'. - // - '/dog': { - '/:color': { - // - // this function will return the value 'yella'. - // - on: function (color) { console.log(color) } - } - } - }); -``` - -Routes can sometimes become very complex, `simple/:tokens` don't always suffice. Director supports regular expressions inside the route names. The values captured from the regular expressions are passed to your listener function. - -``` js - var router = Router({ - // - // given the route '/hello/world'. - // - '/hello': { - '/(\\w+)': { - // - // this function will return the value 'world'. - // - on: function (who) { console.log(who) } - } - } - }); -``` - -``` js - var router = Router({ - // - // given the route '/hello/world/johny/appleseed'. - // - '/hello': { - '/world/?([^\/]*)\/([^\/]*)/?': function (a, b) { - console.log(a, b); - } - } - }); -``` - - -## URL Parameters - -When you are using the same route fragments it is more descriptive to define these fragments by name and then use them in your [Routing Table](#routing-table) or [Adhoc Routes](#adhoc-routing). Consider a simple example where a `userId` is used repeatedly. - -``` js - // - // Create a router. This could also be director.cli.Router() or - // director.http.Router(). - // - var router = new director.Router(); - - // - // A route could be defined using the `userId` explicitly. - // - router.on(/([\w-_]+)/, function (userId) { }); - - // - // Define a shorthand for this fragment called `userId`. - // - router.param('userId', /([\\w\\-]+)/); - - // - // Now multiple routes can be defined with the same - // regular expression. - // - router.on('/anything/:userId', function (userId) { }); - router.on('/something-else/:userId', function (userId) { }); -``` - - -## Route Recursion - -Can be assigned the value of `forward` or `backward`. The recurse option will determine the order in which to fire the listeners that are associated with your routes. If this option is NOT specified or set to null, then only the listeners associated with an exact match will be fired. - -### No recursion, with the URL /dog/angry - -``` js - var routes = { - '/dog': { - '/angry': { - // - // Only this method will be fired. - // - on: growl - }, - on: bark - } - }; - - var router = Router(routes); -``` - -### Recursion set to `backward`, with the URL /dog/angry - -``` js - var routes = { - '/dog': { - '/angry': { - // - // This method will be fired first. - // - on: growl - }, - // - // This method will be fired second. - // - on: bark - } - }; - - var router = Router(routes).configure({ recurse: 'backward' }); -``` - -### Recursion set to `forward`, with the URL /dog/angry - -``` js - var routes = { - '/dog': { - '/angry': { - // - // This method will be fired second. - // - on: growl - }, - // - // This method will be fired first. - // - on: bark - } - }; - - var router = Router(routes).configure({ recurse: 'forward' }); -``` - -### Breaking out of recursion, with the URL /dog/angry - -``` js - var routes = { - '/dog': { - '/angry': { - // - // This method will be fired first. - // - on: function() { return false; } - }, - // - // This method will not be fired. - // - on: bark - } - }; - - // - // This feature works in reverse with recursion set to true. - // - var router = Router(routes).configure({ recurse: 'backward' }); -``` - - -## Async Routing - -Before diving into how Director exposes async routing, you should understand [Route Recursion](#route-recursion). At it's core route recursion is about evaluating a series of functions gathered when traversing the [Routing Table](#routing-table). - -Normally this series of functions is evaluated synchronously. In async routing, these functions are evaluated asynchronously. Async routing can be extremely useful both on the client-side and the server-side: - -* **Client-side:** To ensure an animation or other async operations (such as HTTP requests for authentication) have completed before continuing evaluation of a route. -* **Server-side:** To ensure arbitrary async operations (such as performing authentication) have completed before continuing the evaluation of a route. - -The method signatures for route functions in synchronous and asynchronous evaluation are different: async route functions take an additional `next()` callback. - -### Synchronous route functions - -``` js - var router = new director.Router(); - - router.on('/:foo/:bar/:bazz', function (foo, bar, bazz) { - // - // Do something asynchronous with `foo`, `bar`, and `bazz`. - // - }); -``` - -### Asynchronous route functions - -``` js - var router = new director.http.Router().configure({ async: true }); - - router.on('/:foo/:bar/:bazz', function (foo, bar, bazz, next) { - // - // Go do something async, and determine that routing should stop - // - next(false); - }); -``` - - -## Resources - -**Available on the Client-side only.** An object literal containing functions. If a host object is specified, your route definitions can provide string literals that represent the function names inside the host object. A host object can provide the means for better encapsulation and design. - -``` js - - var router = Router({ - - '/hello': { - '/usa': 'americas', - '/china': 'asia' - } - - }).configure({ resource: container }).init(); - - var container = { - americas: function() { return true; }, - china: function() { return true; } - }; - -``` - - -## Instance methods - -### configure(options) -* `options` {Object}: Options to configure this instance with. - -Configures the Router instance with the specified `options`. See [Configuration](#configuration) for more documentation. - -### param(token, matcher) -* token {string}: Named parameter token to set to the specified `matcher` -* matcher {string|Regexp}: Matcher for the specified `token`. - -Adds a route fragment for the given string `token` to the specified regex `matcher` to this Router instance. See [URL Parameters](#url-parameters) for more documentation. - -### on(method, path, route) -* `method` {string}: Method to insert within the Routing Table (e.g. `on`, `get`, etc.). -* `path` {string}: Path within the Routing Table to set the `route` to. -* `route` {function|Array}: Route handler to invoke for the `method` and `path`. - -Adds the `route` handler for the specified `method` and `path` within the [Routing Table](#routing-table). - -### path(path, routesFn) -* `path` {string|Regexp}: Scope within the Routing Table to invoke the `routesFn` within. -* `routesFn` {function}: Adhoc Routing function with calls to `this.on()`, `this.get()` etc. - -Invokes the `routesFn` within the scope of the specified `path` for this Router instance. - -### dispatch(method, path[, callback]) -* method {string}: Method to invoke handlers for within the Routing Table -* path {string}: Path within the Routing Table to match -* callback {function}: Invoked once all route handlers have been called. - -Dispatches the route handlers matched within the [Routing Table](#routing-table) for this instance for the specified `method` and `path`. - -### mount(routes, path) -* routes {object}: Partial routing table to insert into this instance. -* path {string|Regexp}: Path within the Routing Table to insert the `routes` into. - -Inserts the partial [Routing Table](#routing-table), `routes`, into the Routing Table for this Router instance at the specified `path`. - -## Instance methods (Client-side only) - -### init() -Initialize the router, start listening for changes to the URL. - -### getState() -Returns the state object that is relative to the current route. - -### getRoute([index]) -* `index` {Number}: The hash value is divided by forward slashes, each section then has an index, if this is provided, only that section of the route will be returned. - -Returns the entire route or just a section of it. - -### setRoute(route) -* `route` {String}: Supply a route value, such as `home/stats`. - -Set the current route. - -### setRoute(start, length) -* `start` {Number} - The position at which to start removing items. -* `length` {Number} - The number of items to remove from the route. - -Remove a segment from the current route. - -### setRoute(index, value) -* `index` {Number} - The hash value is divided by forward slashes, each section then has an index. -* `value` {String} - The new value to assign the the position indicated by the first parameter. - -Set a segment of the current route. - - -# Frequently Asked Questions - -## What About SEO? - -Is using a Client-side router a problem for SEO? Yes. If advertising is a requirement, you are probably building a "Web Page" and not a "Web Application". Director on the client is meant for script-heavy Web Applications. - -## Is Director compatible with X? - -Director is known to be Ender.js compatible. However, the project still needs solid cross-browser testing. - -# Licence - -(The MIT License) - -Copyright (c) 2010 Nodejitsu Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -[0]: http://github.com/flatiron/director -[1]: https://github.com/flatiron/director/blob/master/build/director-1.0.7.min.js diff --git a/node_modules/director/bin/build b/node_modules/director/bin/build deleted file mode 100755 index d232b84..0000000 --- a/node_modules/director/bin/build +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env node - -var Codesurgeon = require('codesurgeon').Codesurgeon; -var surgeon = new Codesurgeon; - -var path = require('path'); - -var root = path.join(__dirname, '..'); -var lib = path.join(root, 'lib', 'director'); - -// -// Distill and package the browser version. -// -surgeon - // - .configure({ - package: root + '/package.json', - owner: 'Nodejitsu, Inc (Using Codesurgeon).' - }) - .read( - path.join(lib, 'browser.js') - ) - // - // we want everything so far. specify extract with no - // parameters to get everything into the output buffer. - // - .extract() - // - // clear the input so far, but don't clear the output. - // - .clear('inputs') - // - // read the `router.js` file - // - .read( - path.join(lib, 'router.js') - ) - // - // the current input buffer contains stuff that we dont - // want in the browser build, so let's cherry pick from - // the buffer. - // - .extract( - '_every', - '_flatten', - '_asyncEverySeries', - 'paramifyString', - 'regifyString', - 'Router.prototype.configure', - 'Router.prototype.param', - 'Router.prototype.on', - 'Router.prototype.dispatch', - 'Router.prototype.invoke', - 'Router.prototype.traverse', - 'Router.prototype.insert', - 'Router.prototype.insertEx', - 'Router.prototype.extend', - 'Router.prototype.runlist', - 'Router.prototype.mount' - ) - // - // wrap everything that is in the current buffer with a - // closure so that we dont get any collisions with other - // libraries - // - .wrap() - // - // write the debuggable version of the file. This file will - // get renamed to include the version from the package.json - // - .write(root + '/build/director.js') - // - // now lets make a minified version for production use. - // - .uglify() - .write(root + '/build/director.min.js') -; diff --git a/node_modules/director/examples/http.js b/node_modules/director/examples/http.js deleted file mode 100644 index a74fd8e..0000000 --- a/node_modules/director/examples/http.js +++ /dev/null @@ -1,21 +0,0 @@ -var http = require('http'), - director = require('../lib/director'); - -var router = new director.http.Router(); - -var server = http.createServer(function (req, res) { - router.dispatch(req, res, function (err) { - if (err) { - res.writeHead(404); - res.end(); - } - }); -}); - -router.get(/foo/, function () { - this.res.writeHead(200, { 'Content-Type': 'text/plain' }) - this.res.end('hello world\n'); -}); - -server.listen(8080); -console.log('vanilla http server with director running on 8080'); diff --git a/node_modules/director/img/director.png b/node_modules/director/img/director.png deleted file mode 100644 index ce1a92a..0000000 Binary files a/node_modules/director/img/director.png and /dev/null differ diff --git a/node_modules/director/img/hashRoute.png b/node_modules/director/img/hashRoute.png deleted file mode 100644 index f8b29b6..0000000 Binary files a/node_modules/director/img/hashRoute.png and /dev/null differ diff --git a/node_modules/director/lib/director.js b/node_modules/director/lib/director.js deleted file mode 100644 index f43ae82..0000000 --- a/node_modules/director/lib/director.js +++ /dev/null @@ -1,6 +0,0 @@ - - - -exports.Router = require('./director/router').Router; -exports.http = require('./director/http'); -exports.cli = require('./director/cli'); diff --git a/node_modules/director/lib/director/browser.js b/node_modules/director/lib/director/browser.js deleted file mode 100644 index c40b5ff..0000000 --- a/node_modules/director/lib/director/browser.js +++ /dev/null @@ -1,249 +0,0 @@ - -/* - * browser.js: Browser specific functionality for director. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -if (!Array.prototype.filter) { - Array.prototype.filter = function(filter, that) { - var other = [], v; - for (var i = 0, n = this.length; i < n; i++) { - if (i in this && filter.call(that, v = this[i], i, this)) { - other.push(v); - } - } - return other; - }; -} - -if (!Array.isArray){ - Array.isArray = function(obj) { - return Object.prototype.toString.call(obj) === '[object Array]'; - }; -} - -var dloc = document.location; - -var listener = { - mode: 'modern', - hash: dloc.hash, - - check: function () { - var h = dloc.hash; - if (h != this.hash) { - this.hash = h; - this.onHashChanged(); - } - }, - - fire: function () { - if (this.mode === 'modern') { - window.onhashchange(); - } - else { - this.onHashChanged(); - } - }, - - init: function (fn) { - var self = this; - - if (!window.Router.listeners) { - window.Router.listeners = []; - } - - function onchange() { - for (var i = 0, l = window.Router.listeners.length; i < l; i++) { - window.Router.listeners[i](); - } - } - - //note IE8 is being counted as 'modern' because it has the hashchange event - if ('onhashchange' in window && (document.documentMode === undefined - || document.documentMode > 7)) { - window.onhashchange = onchange; - this.mode = 'modern'; - } - else { - // - // IE support, based on a concept by Erik Arvidson ... - // - var frame = document.createElement('iframe'); - frame.id = 'state-frame'; - frame.style.display = 'none'; - document.body.appendChild(frame); - this.writeFrame(''); - - if ('onpropertychange' in document && 'attachEvent' in document) { - document.attachEvent('onpropertychange', function () { - if (event.propertyName === 'location') { - self.check(); - } - }); - } - - window.setInterval(function () { self.check(); }, 50); - - this.onHashChanged = onchange; - this.mode = 'legacy'; - } - - window.Router.listeners.push(fn); - - return this.mode; - }, - - destroy: function (fn) { - if (!window.Router || !window.Router.listeners) { - return; - } - - var listeners = window.Router.listeners; - - for (var i = listeners.length - 1; i >= 0; i--) { - if (listeners[i] === fn) { - listeners.splice(i, 1); - } - } - }, - - setHash: function (s) { - // Mozilla always adds an entry to the history - if (this.mode === 'legacy') { - this.writeFrame(s); - } - - dloc.hash = (s[0] === '/') ? s : '/' + s; - return this; - }, - - writeFrame: function (s) { - // IE support... - var f = document.getElementById('state-frame'); - var d = f.contentDocument || f.contentWindow.document; - d.open(); - d.write(" - - - - - diff --git a/node_modules/director/test/browser/adhoc-test.js b/node_modules/director/test/browser/adhoc-test.js deleted file mode 100644 index fb1e220..0000000 --- a/node_modules/director/test/browser/adhoc-test.js +++ /dev/null @@ -1,40 +0,0 @@ -//reset these each test -var activity; - -//create the router -var router = new Router(); - -//setup/takedown -module("SS.js", { - setup: function() { - window.location.hash = ""; - activity = 0;; - }, - teardown: function() { - window.location.hash = ""; - } -}); - - -asyncTest("adhoc routing", function() { - - // - - router.path('/a', function() { - - // the bennifit of calling `this.route` as opposed to `this.get` or `this.post` is that - // you can continue to define the route structure (ad-hoc) and then assign units of logic - // per event type, there will be less repetition of definition, and the code will be more - // readable/centralized. - - this.path('/b', { - on: function() {}, - after: function() {} - before: function() {} - }); - - }); - - window.location.hash = "/a"; - -}); diff --git a/node_modules/director/test/browser/helpers/api.js b/node_modules/director/test/browser/helpers/api.js deleted file mode 100644 index 9d1cbcc..0000000 --- a/node_modules/director/test/browser/helpers/api.js +++ /dev/null @@ -1,45 +0,0 @@ -module("Director.js", { - setup: function() { - window.location.hash = ""; - shared = {}; - }, - teardown: function() { - window.location.hash = ""; - shared = {}; - } -}); - -var shared; - -function createTest(name, config, use, test) { - if (typeof use === 'function') { - test = use; - use = undefined; - } - asyncTest(name, function() { - setTimeout(function() { - var router = new Router(config), - context; - - if (use !== undefined) { - router.configure(use); - } - - router.init(); - - test.call(context = { - router: router, - navigate: function(url, callback) { - window.location.hash = url; - setTimeout(function() { - callback.call(context); - }, 14); - }, - finish: function() { - router.destroy(); - start(); - } - }); - }, 14); - }); -}; diff --git a/node_modules/director/test/browser/helpers/jquery.js b/node_modules/director/test/browser/helpers/jquery.js deleted file mode 100644 index c72011d..0000000 --- a/node_modules/director/test/browser/helpers/jquery.js +++ /dev/null @@ -1,16 +0,0 @@ -/*! - * jQuery JavaScript Library v1.6 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Mon May 2 13:50:00 2011 -0400 - */ -(function(a,b){function cw(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function ct(a){if(!ch[a]){var b=f("<"+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d===""){ci||(ci=c.createElement("iframe"),ci.frameBorder=ci.width=ci.height=0),c.body.appendChild(ci);if(!cj||!ci.createElement)cj=(ci.contentWindow||ci.contentDocument).document,cj.write("");b=cj.createElement(a),cj.body.appendChild(b),d=f.css(b,"display"),c.body.removeChild(ci)}ch[a]=d}return ch[a]}function cs(a,b){var c={};f.each(cn.concat.apply([],cn.slice(0,b)),function(){c[this]=a});return c}function cr(){co=b}function cq(){setTimeout(cr,0);return co=f.now()}function cg(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function cf(){try{return new a.XMLHttpRequest}catch(b){}}function b_(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g=0===c})}function V(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function N(a,b){return(a&&a!=="*"?a+".":"")+b.replace(z,"`").replace(A,"&")}function M(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;ic)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function K(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function E(){return!0}function D(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){name="data-"+c.replace(j,"$1-$2").toLowerCase(),d=a.getAttribute(name);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(e){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function H(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(H,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=d.userAgent,x,y,z,A=Object.prototype.toString,B=Object.prototype.hasOwnProperty,C=Array.prototype.push,D=Array.prototype.slice,E=String.prototype.trim,F=Array.prototype.indexOf,G={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?g=[null,a,null]:g=i.exec(a);if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6",length:0,size:function(){return this.length},toArray:function(){return D.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?C.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(D.apply(this,arguments),"slice",D.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:C,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;y.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!y){y=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",z,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",z),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&H()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):G[A.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!B.call(a,"constructor")&&!B.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||B.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c
    a",b=a.getElementsByTagName("*"),d=a.getElementsByTagName("a")[0];if(!b||!b.length||!d)return{};e=c.createElement("select"),f=e.appendChild(c.createElement("option")),g=a.getElementsByTagName("input")[0],i={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.55$/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:g.value==="on",optSelected:f.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},g.checked=!0,i.noCloneChecked=g.cloneNode(!0).checked,e.disabled=!0,i.optDisabled=!f.disabled;try{delete a.test}catch(r){i.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function click(){i.noCloneEvent=!1,a.detachEvent("onclick",click)}),a.cloneNode(!0).fireEvent("onclick")),g=c.createElement("input"),g.value="t",g.setAttribute("type","radio"),i.radioValue=g.value==="t",g.setAttribute("checked","checked"),a.appendChild(g),j=c.createDocumentFragment(),j.appendChild(a.firstChild),i.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",k=c.createElement("body"),l={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};for(p in l)k.style[p]=l[p];k.appendChild(a),c.documentElement.appendChild(k),i.appendChecked=g.checked,i.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,i.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
    ",i.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
    t
    ",m=a.getElementsByTagName("td"),q=m[0].offsetHeight===0,m[0].style.display="",m[1].style.display="none",i.reliableHiddenOffsets=q&&m[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(h=c.createElement("div"),h.style.width="0",h.style.marginRight="0",a.appendChild(h),i.reliableMarginRight=(parseInt(c.defaultView.getComputedStyle(h,null).marginRight,10)||0)===0),k.innerHTML="",c.documentElement.removeChild(k);if(a.attachEvent)for(p in{submit:1,change:1,focusin:1})o="on"+p,q=o in a,q||(a.setAttribute(o,"return;"),q=typeof a[o]=="function"),i[p+"Bubbles"]=q;return i}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([a-z])([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g=f.expando,h=typeof c=="string",i,j=a.nodeType,k=j?f.cache:a,l=j?a[f.expando]:a[f.expando]&&f.expando;if((!l||e&&l&&!k[l][g])&&h&&d===b)return;l||(j?a[f.expando]=l=++f.uuid:l=f.expando),k[l]||(k[l]={},j||(k[l].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?k[l][g]=f.extend(k[l][g],c):k[l]=f.extend(k[l],c);i=k[l],e&&(i[g]||(i[g]={}),i=i[g]),d!==b&&(i[c]=d);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[c]:i}},removeData:function(b,c,d){if(!!f.acceptData(b)){var e=f.expando,g=b.nodeType,h=g?f.cache:b,i=g?b[f.expando]:f.expando;if(!h[i])return;if(c){var j=d?h[i][e]:h[i];if(j){delete j[c];if(!l(j))return}}if(d){delete h[i][e];if(!l(h[i]))return}var k=h[i][e];f.support.deleteExpando||h!=a?delete h[i]:h[i]=null,k?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=k):g&&(f.support.deleteExpando?delete b[f.expando]:b.removeAttribute?b.removeAttribute(f.expando):b[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;return(e.value||"").replace(p,"")}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||"set"in c&&c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b=a.selectedIndex,c=[],d=a.options,e=a.type==="select-one";if(b<0)return null;for(var g=e?b:0,h=e?b+1:d.length;g=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex",readonly:"readOnly"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);var h,i,j=g!==1||!f.isXMLDoc(a);c=j&&f.attrFix[c]||c,i=f.attrHooks[c]||(v&&(f.nodeName(a,"form")||u.test(c))?v:b);if(d!==b){if(d===null||d===!1&&!t.test(c)){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;d===!0&&!t.test(c)&&(d=c),a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j)return i.get(a,c);h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){a.nodeType===1&&(b=f.attrFix[b]||b,f.support.getSetAttribute?a.removeAttribute(b):(f.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.getAttribute("value");a.setAttribute("type",b),c&&(a.value=c);return b}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}},propFix:{},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);c=i&&f.propFix[c]||c,h=f.propHooks[c];return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==b?g:a[c]},propHooks:{}}),f.support.getSetAttribute||(f.attrFix=f.extend(f.attrFix,{"for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder"}),v=f.attrHooks.name=f.attrHooks.value=f.valHooks.button={get:function(a,c){var d;if(c==="value"&&!f.nodeName(a,"button"))return a.getAttribute(c);d=a.getAttributeNode(c);return d&&d.specified?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);if(d){d.nodeValue=b;return b}}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var w=Object.prototype.hasOwnProperty,x=/\.(.*)$/,y=/^(?:textarea|input|select)$/i,z=/\./g,A=/ /g,B=/[^\w\s.|`]/g,C=function(a){return a.replace(B,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=D;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=D);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),C).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},J=function J(a){var c=a.target,d,e;if(!!y.test(c.nodeName)&&!c.readOnly){d=f._data(c,"_change_data"),e=I(c),(a.type!=="focusout"||c.type!=="radio")&&f._data(c,"_change_data",e);if(d===b||e===d)return;if(d!=null||e)a.type="change",a.liveFired=b,f.event.trigger(a,arguments[1],c)}};f.event.special.change={filters:{focusout:J,beforedeactivate:J,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&J.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&J.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",I(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in H)f.event.add(this,c+".specialChange",H[c]);return y.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return y.test(this.nodeName)}},H=f.event.special.change.filters,H.focus=H.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){return a.nodeName.toLowerCase()==="input"&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

    ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
    ";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g0)for(h=g;h0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=T.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a=="string")return f.inArray(this[0],a?f(a):this.parent().children());return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(V(c[0])||V(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=S.call(arguments);O.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!U[a]?f.unique(e):e,(this.length>1||Q.test(d))&&P.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var X=/ jQuery\d+="(?:\d+|null)"/g,Y=/^\s+/,Z=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,$=/<([\w:]+)/,_=/",""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]};be.optgroup=be.option,be.tbody=be.tfoot=be.colgroup=be.caption=be.thead,be.th=be.td,f.support.htmlSerialize||(be._default=[1,"div
    ","
    "]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(X,""):null;if(typeof a=="string"&&!bb.test(a)&&(f.support.leadingWhitespace||!Y.test(a))&&!be[($.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Z,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bh(a,d),e=bi(a),g=bi(d);for(h=0;e[h];++h)bh(e[h],g[h])}if(b){bg(a,d);if(c){e=bi(a),g=bi(d);for(h=0;e[h];++h)bg(e[h],g[h])}}return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[];for(var i=0,j;(j=a[i])!=null;i++){typeof j=="number"&&(j+="");if(!j)continue;if(typeof j=="string")if(!ba.test(j))j=b.createTextNode(j);else{j=j.replace(Z,"<$1>");var k=($.exec(j)||["",""])[1].toLowerCase(),l=be[k]||be._default,m=l[0],n=b.createElement("div");n.innerHTML=l[1]+j+l[2];while(m--)n=n.lastChild;if(!f.support.tbody){var o=_.test(j),p=k==="table"&&!o?n.firstChild&&n.firstChild.childNodes:l[1]===""&&!o?n.childNodes:[];for(var q=p.length-1;q>=0;--q)f.nodeName(p[q],"tbody")&&!p[q].childNodes.length&&p[q].parentNode.removeChild(p[q])}!f.support.leadingWhitespace&&Y.test(j)&&n.insertBefore(b.createTextNode(Y.exec(j)[0]),n.firstChild),j=n.childNodes}var r;if(!f.support.appendChecked)if(j[0]&&typeof (r=j.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bn.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.filter=bm.test(g)?g.replace(bm,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bx(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(by=function(a,c){var d,e,g;c=c.replace(bp,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bz=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bq.test(d)&&br.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bx=by||bz,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV;try{bU=e.href}catch(bW){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
    ").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?f.extend(!0,a,f.ajaxSettings,b):(b=a,a=f.extend(!0,f.ajaxSettings,b));for(var c in{context:1,url:1})c in b?a[c]=b[c]:c in f.ajaxSettings&&(a[c]=f.ajaxSettings[c]);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML}},ajaxPrefilter:bX(bS),ajaxTransport:bX(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a?4:0;var o,r,u,w=l?b$(d,v,l):b,x,y;if(a>=200&&a<300||a===304){if(d.ifModified){if(x=v.getResponseHeader("Last-Modified"))f.lastModified[k]=x;if(y=v.getResponseHeader("Etag"))f.etag[k]=y}if(a===304)c="notmodified",o=!0;else try{r=b_(d,w),c="success",o=!0}catch(z){c="parsererror",u=z}}else{u=c;if(!c||a)c="error",a<0&&(a=0)}v.status=a,v.statusText=c,o?h.resolveWith(e,[r,c,v]):h.rejectWith(e,[v,c,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,c]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bY(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", */*; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bY(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){status<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)bZ(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var ca=f.now(),cb=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+ca++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cb.test(b.url)||e&&cb.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cb,l),b.url===j&&(e&&(k=k.replace(cb,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cc=a.ActiveXObject?function(){for(var a in ce)ce[a](0,1)}:!1,cd=0,ce;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cf()||cg()}:cf,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cc&&delete ce[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cd,cc&&(ce||(ce={},f(a).unload(cc)),ce[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ch={},ci,cj,ck=/^(?:toggle|show|hide)$/,cl=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cm,cn=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],co,cp=a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cs("show",3),a,b,c);for(var g=0,h=this.length;g=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a=f.timers,b=a.length;while(b--)a[b]()||a.splice(b,1);a.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cm),cm=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cu=/^t(?:able|d|h)$/i,cv=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cw(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);f.offset.initialize();var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.offset.doesNotAddBorder&&(!f.offset.doesAddBorderForTableAndCells||!cu.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={initialize:function(){var a=c.body,b=c.createElement("div"),d,e,g,h,i=parseFloat(f.css(a,"marginTop"))||0,j="
    ";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cv.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cv.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cw(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cw(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){return this[0]?parseFloat(f.css(this[0],d,"padding")):null},f.fn["outer"+c]=function(a){return this[0]?parseFloat(f.css(this[0],d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c];return e.document.compatMode==="CSS1Compat"&&g||e.document.body["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=f.css(e,d),i=parseFloat(h);return f.isNaN(i)?h:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window); \ No newline at end of file diff --git a/node_modules/director/test/browser/helpers/qunit.css b/node_modules/director/test/browser/helpers/qunit.css deleted file mode 100644 index 80f6f72..0000000 --- a/node_modules/director/test/browser/helpers/qunit.css +++ /dev/null @@ -1,236 +0,0 @@ -/** - * QUnit - A JavaScript Unit Testing Framework - * - * http://docs.jquery.com/QUnit - * - * Copyright (c) 2011 John Resig, Jörn Zaefferer - * Dual licensed under the MIT (MIT-LICENSE.txt) - * or GPL (GPL-LICENSE.txt) licenses. - * Pulled Live from Git Thu Jul 14 20:05:01 UTC 2011 - * Last Commit: 28be4753ea257da54721aa44f8599adb005e1033 - */ - -/** Font Family and Sizes */ - -#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult { - font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif; -} - -#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; } -#qunit-tests { font-size: smaller; } - - -/** Resets */ - -#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult { - margin: 0; - padding: 0; -} - - -/** Header */ - -#qunit-header { - padding: 0.5em 0 0.5em 1em; - - color: #8699a4; - background-color: #f8f8f8; - text-align: center; - - font-size: 1.5em; - line-height: 1em; - font-weight: normal; - margin-bottom: -18px; - border-radius: 4px 4px 0 0; - -moz-border-radius: 4px 4px 0 0; - -webkit-border-top-right-radius: 4px; - -webkit-border-top-left-radius: 4px; - text-align: right; - height: 20px; - padding: 40px; -} - -#qunit-header img { - float: left; - margin: -25px; -} - -#qunit-header a { - text-decoration: none; - color: #c2ccd1; -} - -#qunit-header a:hover, -#qunit-header a:focus { - color: #fff; -} - -#qunit-banner { - height: 5px; -} - -#qunit-testrunner-toolbar { - padding: 0.5em 0 0.5em 2em; - color: #5E740B; - background-color: #333; -} - -#qunit-userAgent { - padding: 0.5em 0 0.5em 2.5em; - background-color: #333; - color: #fff; - text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px; -} - - -/** Tests: Pass/Fail */ - -#qunit-tests { - list-style-position: inside; -} - -#qunit-tests li { - padding: 0.4em 0.5em 0.4em 2.5em; - border-bottom: 1px solid #fff; - list-style-position: inside; -} - -#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running { - display: none; -} - -#qunit-tests li strong { - cursor: pointer; -} - -#qunit-tests li a { - padding: 0.5em; - color: #111; - text-decoration: none; -} -#qunit-tests li a:hover, -#qunit-tests li a:focus { - color: #000; -} - -#qunit-tests ol { - margin-top: 0.5em; - padding: 0.5em; - - background-color: #fff; - - border-radius: 4px; - -moz-border-radius: 4px; - -webkit-border-radius: 4px; - - box-shadow: inset 0px 2px 2px #999; - -moz-box-shadow: inset 0px 2px 2px #999; - -webkit-box-shadow: inset 0px 2px 2px #999; -} - -#qunit-tests table { - border-collapse: collapse; - margin-top: .2em; -} - -#qunit-tests th { - text-align: right; - vertical-align: top; - padding: 0 .5em 0 0; -} - -#qunit-tests td { - vertical-align: top; -} - -#qunit-tests pre { - margin: 0; - white-space: pre-wrap; - word-wrap: break-word; -} - -#qunit-tests del { - background-color: #e0f2be; - color: #374e0c; - text-decoration: none; -} - -#qunit-tests ins { - background-color: #ffcaca; - color: #500; - text-decoration: none; -} - -/*** Test Counts */ - -#qunit-tests b.counts { color: black; } -#qunit-tests b.passed { color: #5E740B; } -#qunit-tests b.failed { color: #710909; } - -#qunit-tests li li { - margin: 0.5em; - padding: 0.4em 0.5em 0.4em 0.5em; - background-color: #fff; - border-bottom: none; - list-style-position: inside; -} - -/*** Passing Styles */ - -#qunit-tests li li.pass { - color: #5E740B; - background-color: #fff; - border-left: 26px solid #C6E746; -} - -#qunit-tests .pass { color: #528CE0; background-color: #ddd; } -#qunit-tests .pass .test-name { color: #366097; } - -#qunit-tests .pass .test-actual, -#qunit-tests .pass .test-expected { color: #999999; } - -#qunit-banner.qunit-pass { background-color: #C6E746; } - -/*** Failing Styles */ - -#qunit-tests li li.fail { - color: #710909; - background-color: #fff; - border-left: 26px solid #EE5757; -} - -#qunit-tests > li:last-child { - border-radius: 0 0 4px 4px; - -moz-border-radius: 0 0 4px 4px; - -webkit-border-bottom-right-radius: 4px; - -webkit-border-bottom-left-radius: 4px; -} - -#qunit-tests .fail { color: #000000; background-color: #EE5757; } -#qunit-tests .fail .test-name, -#qunit-tests .fail .module-name { color: #000000; } - -#qunit-tests .fail .test-actual { color: #EE5757; } -#qunit-tests .fail .test-expected { color: green; } - -#qunit-banner.qunit-fail { background-color: #EE5757; } - - -/** Result */ - -#qunit-testresult { - padding: 0.5em 0.5em 0.5em 2.5em; - - color: #eee; - background-color: #333; - - border-bottom: 1px solid white; -} - -/** Fixture */ - -#qunit-fixture { - position: absolute; - top: -10000px; - left: -10000px; -} diff --git a/node_modules/director/test/browser/helpers/qunit.js b/node_modules/director/test/browser/helpers/qunit.js deleted file mode 100644 index 6f0d976..0000000 --- a/node_modules/director/test/browser/helpers/qunit.js +++ /dev/null @@ -1,1450 +0,0 @@ -/** - * QUnit - A JavaScript Unit Testing Framework - * - * http://docs.jquery.com/QUnit - * - * Copyright (c) 2011 John Resig, Jörn Zaefferer - * Dual licensed under the MIT (MIT-LICENSE.txt) - * or GPL (GPL-LICENSE.txt) licenses. - * Pulled Live from Git Thu Jul 14 20:05:01 UTC 2011 - * Last Commit: 28be4753ea257da54721aa44f8599adb005e1033 - */ - -(function(window) { - -var defined = { - setTimeout: typeof window.setTimeout !== "undefined", - sessionStorage: (function() { - try { - return !!sessionStorage.getItem; - } catch(e){ - return false; - } - })() -}; - -var testId = 0; - -var Test = function(name, testName, expected, testEnvironmentArg, async, callback) { - this.name = name; - this.testName = testName; - this.expected = expected; - this.testEnvironmentArg = testEnvironmentArg; - this.async = async; - this.callback = callback; - this.assertions = []; -}; -Test.prototype = { - init: function() { - var tests = id("qunit-tests"); - if (tests) { - var b = document.createElement("strong"); - b.innerHTML = "Running " + this.name; - var li = document.createElement("li"); - li.appendChild( b ); - li.className = "running"; - li.id = this.id = "test-output" + testId++; - tests.appendChild( li ); - } - }, - setup: function() { - if (this.module != config.previousModule) { - if ( config.previousModule ) { - QUnit.moduleDone( { - name: config.previousModule, - failed: config.moduleStats.bad, - passed: config.moduleStats.all - config.moduleStats.bad, - total: config.moduleStats.all - } ); - } - config.previousModule = this.module; - config.moduleStats = { all: 0, bad: 0 }; - QUnit.moduleStart( { - name: this.module - } ); - } - - config.current = this; - this.testEnvironment = extend({ - setup: function() {}, - teardown: function() {} - }, this.moduleTestEnvironment); - if (this.testEnvironmentArg) { - extend(this.testEnvironment, this.testEnvironmentArg); - } - - QUnit.testStart( { - name: this.testName - } ); - - // allow utility functions to access the current test environment - // TODO why?? - QUnit.current_testEnvironment = this.testEnvironment; - - try { - if ( !config.pollution ) { - saveGlobal(); - } - - this.testEnvironment.setup.call(this.testEnvironment); - } catch(e) { - QUnit.ok( false, "Setup failed on " + this.testName + ": " + e.message ); - } - }, - run: function() { - if ( this.async ) { - QUnit.stop(); - } - - if ( config.notrycatch ) { - this.callback.call(this.testEnvironment); - return; - } - try { - this.callback.call(this.testEnvironment); - } catch(e) { - fail("Test " + this.testName + " died, exception and test follows", e, this.callback); - QUnit.ok( false, "Died on test #" + (this.assertions.length + 1) + ": " + e.message + " - " + QUnit.jsDump.parse(e) ); - // else next test will carry the responsibility - saveGlobal(); - - // Restart the tests if they're blocking - if ( config.blocking ) { - start(); - } - } - }, - teardown: function() { - try { - this.testEnvironment.teardown.call(this.testEnvironment); - checkPollution(); - } catch(e) { - QUnit.ok( false, "Teardown failed on " + this.testName + ": " + e.message ); - } - }, - finish: function() { - if ( this.expected && this.expected != this.assertions.length ) { - QUnit.ok( false, "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run" ); - } - - var good = 0, bad = 0, - tests = id("qunit-tests"); - - config.stats.all += this.assertions.length; - config.moduleStats.all += this.assertions.length; - - if ( tests ) { - var ol = document.createElement("ol"); - - for ( var i = 0; i < this.assertions.length; i++ ) { - var assertion = this.assertions[i]; - - var li = document.createElement("li"); - li.className = assertion.result ? "pass" : "fail"; - li.innerHTML = assertion.message || (assertion.result ? "okay" : "failed"); - ol.appendChild( li ); - - if ( assertion.result ) { - good++; - } else { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - - // store result when possible - if ( QUnit.config.reorder && defined.sessionStorage ) { - if (bad) { - sessionStorage.setItem("qunit-" + this.module + "-" + this.testName, bad); - } else { - sessionStorage.removeItem("qunit-" + this.module + "-" + this.testName); - } - } - - if (bad == 0) { - ol.style.display = "none"; - } - - var b = document.createElement("strong"); - b.innerHTML = this.name + " (" + bad + ", " + good + ", " + this.assertions.length + ")"; - - var a = document.createElement("a"); - a.innerHTML = "Rerun"; - a.href = QUnit.url({ filter: getText([b]).replace(/\([^)]+\)$/, "").replace(/(^\s*|\s*$)/g, "") }); - - addEvent(b, "click", function() { - var next = b.nextSibling.nextSibling, - display = next.style.display; - next.style.display = display === "none" ? "block" : "none"; - }); - - addEvent(b, "dblclick", function(e) { - var target = e && e.target ? e.target : window.event.srcElement; - if ( target.nodeName.toLowerCase() == "span" || target.nodeName.toLowerCase() == "b" ) { - target = target.parentNode; - } - if ( window.location && target.nodeName.toLowerCase() === "strong" ) { - window.location = QUnit.url({ filter: getText([target]).replace(/\([^)]+\)$/, "").replace(/(^\s*|\s*$)/g, "") }); - } - }); - - var li = id(this.id); - li.className = bad ? "fail" : "pass"; - li.removeChild( li.firstChild ); - li.appendChild( b ); - li.appendChild( a ); - li.appendChild( ol ); - - } else { - for ( var i = 0; i < this.assertions.length; i++ ) { - if ( !this.assertions[i].result ) { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - } - - try { - QUnit.reset(); - } catch(e) { - fail("reset() failed, following Test " + this.testName + ", exception and reset fn follows", e, QUnit.reset); - } - - QUnit.testDone( { - name: this.testName, - failed: bad, - passed: this.assertions.length - bad, - total: this.assertions.length - } ); - }, - - queue: function() { - var test = this; - synchronize(function() { - test.init(); - }); - function run() { - // each of these can by async - synchronize(function() { - test.setup(); - }); - synchronize(function() { - test.run(); - }); - synchronize(function() { - test.teardown(); - }); - synchronize(function() { - test.finish(); - }); - } - // defer when previous test run passed, if storage is available - var bad = QUnit.config.reorder && defined.sessionStorage && +sessionStorage.getItem("qunit-" + this.module + "-" + this.testName); - if (bad) { - run(); - } else { - synchronize(run); - }; - } - -}; - -var QUnit = { - - // call on start of module test to prepend name to all tests - module: function(name, testEnvironment) { - config.currentModule = name; - config.currentModuleTestEnviroment = testEnvironment; - }, - - asyncTest: function(testName, expected, callback) { - if ( arguments.length === 2 ) { - callback = expected; - expected = 0; - } - - QUnit.test(testName, expected, callback, true); - }, - - test: function(testName, expected, callback, async) { - var name = '' + testName + '', testEnvironmentArg; - - if ( arguments.length === 2 ) { - callback = expected; - expected = null; - } - // is 2nd argument a testEnvironment? - if ( expected && typeof expected === 'object') { - testEnvironmentArg = expected; - expected = null; - } - - if ( config.currentModule ) { - name = '' + config.currentModule + ": " + name; - } - - if ( !validTest(config.currentModule + ": " + testName) ) { - return; - } - - var test = new Test(name, testName, expected, testEnvironmentArg, async, callback); - test.module = config.currentModule; - test.moduleTestEnvironment = config.currentModuleTestEnviroment; - test.queue(); - }, - - /** - * Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through. - */ - expect: function(asserts) { - config.current.expected = asserts; - }, - - /** - * Asserts true. - * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" ); - */ - ok: function(a, msg) { - a = !!a; - var details = { - result: a, - message: msg - }; - msg = escapeHtml(msg); - QUnit.log(details); - config.current.assertions.push({ - result: a, - message: msg - }); - }, - - /** - * Checks that the first two arguments are equal, with an optional message. - * Prints out both actual and expected values. - * - * Prefered to ok( actual == expected, message ) - * - * @example equal( format("Received {0} bytes.", 2), "Received 2 bytes." ); - * - * @param Object actual - * @param Object expected - * @param String message (optional) - */ - equal: function(actual, expected, message) { - QUnit.push(expected == actual, actual, expected, message); - }, - - notEqual: function(actual, expected, message) { - QUnit.push(expected != actual, actual, expected, message); - }, - - deepEqual: function(actual, expected, message) { - QUnit.push(QUnit.equiv(actual, expected), actual, expected, message); - }, - - notDeepEqual: function(actual, expected, message) { - QUnit.push(!QUnit.equiv(actual, expected), actual, expected, message); - }, - - strictEqual: function(actual, expected, message) { - QUnit.push(expected === actual, actual, expected, message); - }, - - notStrictEqual: function(actual, expected, message) { - QUnit.push(expected !== actual, actual, expected, message); - }, - - raises: function(block, expected, message) { - var actual, ok = false; - - if (typeof expected === 'string') { - message = expected; - expected = null; - } - - try { - block(); - } catch (e) { - actual = e; - } - - if (actual) { - // we don't want to validate thrown error - if (!expected) { - ok = true; - // expected is a regexp - } else if (QUnit.objectType(expected) === "regexp") { - ok = expected.test(actual); - // expected is a constructor - } else if (actual instanceof expected) { - ok = true; - // expected is a validation function which returns true is validation passed - } else if (expected.call({}, actual) === true) { - ok = true; - } - } - - QUnit.ok(ok, message); - }, - - start: function() { - config.semaphore--; - if (config.semaphore > 0) { - // don't start until equal number of stop-calls - return; - } - if (config.semaphore < 0) { - // ignore if start is called more often then stop - config.semaphore = 0; - } - // A slight delay, to avoid any current callbacks - if ( defined.setTimeout ) { - window.setTimeout(function() { - if ( config.timeout ) { - clearTimeout(config.timeout); - } - - config.blocking = false; - process(); - }, 13); - } else { - config.blocking = false; - process(); - } - }, - - stop: function(timeout) { - config.semaphore++; - config.blocking = true; - - if ( timeout && defined.setTimeout ) { - clearTimeout(config.timeout); - config.timeout = window.setTimeout(function() { - QUnit.ok( false, "Test timed out" ); - QUnit.start(); - }, timeout); - } - } -}; - -// Backwards compatibility, deprecated -QUnit.equals = QUnit.equal; -QUnit.same = QUnit.deepEqual; - -// Maintain internal state -var config = { - // The queue of tests to run - queue: [], - - // block until document ready - blocking: true, - - // by default, run previously failed tests first - // very useful in combination with "Hide passed tests" checked - reorder: true, - - noglobals: false, - notrycatch: false -}; - -// Load paramaters -(function() { - var location = window.location || { search: "", protocol: "file:" }, - params = location.search.slice( 1 ).split( "&" ), - length = params.length, - urlParams = {}, - current; - - if ( params[ 0 ] ) { - for ( var i = 0; i < length; i++ ) { - current = params[ i ].split( "=" ); - current[ 0 ] = decodeURIComponent( current[ 0 ] ); - // allow just a key to turn on a flag, e.g., test.html?noglobals - current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true; - urlParams[ current[ 0 ] ] = current[ 1 ]; - if ( current[ 0 ] in config ) { - config[ current[ 0 ] ] = current[ 1 ]; - } - } - } - - QUnit.urlParams = urlParams; - config.filter = urlParams.filter; - - // Figure out if we're running the tests from a server or not - QUnit.isLocal = !!(location.protocol === 'file:'); -})(); - -// Expose the API as global variables, unless an 'exports' -// object exists, in that case we assume we're in CommonJS -if ( typeof exports === "undefined" || typeof require === "undefined" ) { - extend(window, QUnit); - window.QUnit = QUnit; -} else { - extend(exports, QUnit); - exports.QUnit = QUnit; -} - -// define these after exposing globals to keep them in these QUnit namespace only -extend(QUnit, { - config: config, - - // Initialize the configuration options - init: function() { - extend(config, { - stats: { all: 0, bad: 0 }, - moduleStats: { all: 0, bad: 0 }, - started: +new Date, - updateRate: 1000, - blocking: false, - autostart: true, - autorun: false, - filter: "", - queue: [], - semaphore: 0 - }); - - var tests = id( "qunit-tests" ), - banner = id( "qunit-banner" ), - result = id( "qunit-testresult" ); - - if ( tests ) { - tests.innerHTML = ""; - } - - if ( banner ) { - banner.className = ""; - } - - if ( result ) { - result.parentNode.removeChild( result ); - } - - if ( tests ) { - result = document.createElement( "p" ); - result.id = "qunit-testresult"; - result.className = "result"; - tests.parentNode.insertBefore( result, tests ); - result.innerHTML = 'Running...
     '; - } - }, - - /** - * Resets the test setup. Useful for tests that modify the DOM. - * - * If jQuery is available, uses jQuery's html(), otherwise just innerHTML. - */ - reset: function() { - if ( window.jQuery ) { - jQuery( "#qunit-fixture" ).html( config.fixture ); - } else { - var main = id( 'qunit-fixture' ); - if ( main ) { - main.innerHTML = config.fixture; - } - } - }, - - /** - * Trigger an event on an element. - * - * @example triggerEvent( document.body, "click" ); - * - * @param DOMElement elem - * @param String type - */ - triggerEvent: function( elem, type, event ) { - if ( document.createEvent ) { - event = document.createEvent("MouseEvents"); - event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView, - 0, 0, 0, 0, 0, false, false, false, false, 0, null); - elem.dispatchEvent( event ); - - } else if ( elem.fireEvent ) { - elem.fireEvent("on"+type); - } - }, - - // Safe object type checking - is: function( type, obj ) { - return QUnit.objectType( obj ) == type; - }, - - objectType: function( obj ) { - if (typeof obj === "undefined") { - return "undefined"; - - // consider: typeof null === object - } - if (obj === null) { - return "null"; - } - - var type = Object.prototype.toString.call( obj ) - .match(/^\[object\s(.*)\]$/)[1] || ''; - - switch (type) { - case 'Number': - if (isNaN(obj)) { - return "nan"; - } else { - return "number"; - } - case 'String': - case 'Boolean': - case 'Array': - case 'Date': - case 'RegExp': - case 'Function': - return type.toLowerCase(); - } - if (typeof obj === "object") { - return "object"; - } - return undefined; - }, - - push: function(result, actual, expected, message) { - var details = { - result: result, - message: message, - actual: actual, - expected: expected - }; - - message = escapeHtml(message) || (result ? "okay" : "failed"); - message = '' + message + ""; - expected = escapeHtml(QUnit.jsDump.parse(expected)); - actual = escapeHtml(QUnit.jsDump.parse(actual)); - var output = message + ''; - if (actual != expected) { - output += ''; - output += ''; - } - if (!result) { - var source = sourceFromStacktrace(); - if (source) { - details.source = source; - output += ''; - } - } - output += "
    Expected:
    ' + expected + '
    Result:
    ' + actual + '
    Diff:
    ' + QUnit.diff(expected, actual) +'
    Source:
    ' + escapeHtml(source) + '
    "; - - QUnit.log(details); - - config.current.assertions.push({ - result: !!result, - message: output - }); - }, - - url: function( params ) { - params = extend( extend( {}, QUnit.urlParams ), params ); - var querystring = "?", - key; - for ( key in params ) { - querystring += encodeURIComponent( key ) + "=" + - encodeURIComponent( params[ key ] ) + "&"; - } - return window.location.pathname + querystring.slice( 0, -1 ); - }, - - // Logging callbacks; all receive a single argument with the listed properties - // run test/logs.html for any related changes - begin: function() {}, - // done: { failed, passed, total, runtime } - done: function() {}, - // log: { result, actual, expected, message } - log: function() {}, - // testStart: { name } - testStart: function() {}, - // testDone: { name, failed, passed, total } - testDone: function() {}, - // moduleStart: { name } - moduleStart: function() {}, - // moduleDone: { name, failed, passed, total } - moduleDone: function() {} -}); - -if ( typeof document === "undefined" || document.readyState === "complete" ) { - config.autorun = true; -} - -addEvent(window, "load", function() { - QUnit.begin({}); - - // Initialize the config, saving the execution queue - var oldconfig = extend({}, config); - QUnit.init(); - extend(config, oldconfig); - - config.blocking = false; - - var userAgent = id("qunit-userAgent"); - if ( userAgent ) { - userAgent.innerHTML = navigator.userAgent; - } - var banner = id("qunit-header"); - if ( banner ) { - banner.innerHTML = ' ' + banner.innerHTML + ' ' + - '' + - ''; - addEvent( banner, "change", function( event ) { - var params = {}; - params[ event.target.name ] = event.target.checked ? true : undefined; - window.location = QUnit.url( params ); - }); - } - - var toolbar = id("qunit-testrunner-toolbar"); - if ( toolbar ) { - var filter = document.createElement("input"); - filter.type = "checkbox"; - filter.id = "qunit-filter-pass"; - addEvent( filter, "click", function() { - var ol = document.getElementById("qunit-tests"); - if ( filter.checked ) { - ol.className = ol.className + " hidepass"; - } else { - var tmp = " " + ol.className.replace( /[\n\t\r]/g, " " ) + " "; - ol.className = tmp.replace(/ hidepass /, " "); - } - if ( defined.sessionStorage ) { - if (filter.checked) { - sessionStorage.setItem("qunit-filter-passed-tests", "true"); - } else { - sessionStorage.removeItem("qunit-filter-passed-tests"); - } - } - }); - if ( defined.sessionStorage && sessionStorage.getItem("qunit-filter-passed-tests") ) { - filter.checked = true; - var ol = document.getElementById("qunit-tests"); - ol.className = ol.className + " hidepass"; - } - toolbar.appendChild( filter ); - - var label = document.createElement("label"); - label.setAttribute("for", "qunit-filter-pass"); - label.innerHTML = "Hide passed tests"; - toolbar.appendChild( label ); - } - - var main = id('qunit-fixture'); - if ( main ) { - config.fixture = main.innerHTML; - } - - if (config.autostart) { - QUnit.start(); - } -}); - -function done() { - config.autorun = true; - - // Log the last module results - if ( config.currentModule ) { - QUnit.moduleDone( { - name: config.currentModule, - failed: config.moduleStats.bad, - passed: config.moduleStats.all - config.moduleStats.bad, - total: config.moduleStats.all - } ); - } - - var banner = id("qunit-banner"), - tests = id("qunit-tests"), - runtime = +new Date - config.started, - passed = config.stats.all - config.stats.bad, - html = [ - 'Tests completed in ', - runtime, - ' milliseconds.
    ', - '', - passed, - ' tests of ', - config.stats.all, - ' passed, ', - config.stats.bad, - ' failed.' - ].join(''); - - if ( banner ) { - banner.className = (config.stats.bad ? "qunit-fail" : "qunit-pass"); - } - - if ( tests ) { - id( "qunit-testresult" ).innerHTML = html; - } - - if ( typeof document !== "undefined" && document.title ) { - // show ✖ for good, ✔ for bad suite result in title - // use escape sequences in case file gets loaded with non-utf-8-charset - document.title = (config.stats.bad ? "\u2716" : "\u2714") + " " + document.title; - } - - QUnit.done( { - failed: config.stats.bad, - passed: passed, - total: config.stats.all, - runtime: runtime - } ); -} - -function validTest( name ) { - var filter = config.filter, - run = false; - - if ( !filter ) { - return true; - } - - var not = filter.charAt( 0 ) === "!"; - if ( not ) { - filter = filter.slice( 1 ); - } - - if ( name.indexOf( filter ) !== -1 ) { - return !not; - } - - if ( not ) { - run = true; - } - - return run; -} - -// so far supports only Firefox, Chrome and Opera (buggy) -// could be extended in the future to use something like https://github.com/csnover/TraceKit -function sourceFromStacktrace() { - try { - throw new Error(); - } catch ( e ) { - if (e.stacktrace) { - // Opera - return e.stacktrace.split("\n")[6]; - } else if (e.stack) { - // Firefox, Chrome - return e.stack.split("\n")[4]; - } - } -} - -function escapeHtml(s) { - if (!s) { - return ""; - } - s = s + ""; - return s.replace(/[\&"<>\\]/g, function(s) { - switch(s) { - case "&": return "&"; - case "\\": return "\\\\"; - case '"': return '\"'; - case "<": return "<"; - case ">": return ">"; - default: return s; - } - }); -} - -function synchronize( callback ) { - config.queue.push( callback ); - - if ( config.autorun && !config.blocking ) { - process(); - } -} - -function process() { - var start = (new Date()).getTime(); - - while ( config.queue.length && !config.blocking ) { - if ( config.updateRate <= 0 || (((new Date()).getTime() - start) < config.updateRate) ) { - config.queue.shift()(); - } else { - window.setTimeout( process, 13 ); - break; - } - } - if (!config.blocking && !config.queue.length) { - done(); - } -} - -function saveGlobal() { - config.pollution = []; - - if ( config.noglobals ) { - for ( var key in window ) { - config.pollution.push( key ); - } - } -} - -function checkPollution( name ) { - var old = config.pollution; - saveGlobal(); - - var newGlobals = diff( config.pollution, old ); - if ( newGlobals.length > 0 ) { - ok( false, "Introduced global variable(s): " + newGlobals.join(", ") ); - } - - var deletedGlobals = diff( old, config.pollution ); - if ( deletedGlobals.length > 0 ) { - ok( false, "Deleted global variable(s): " + deletedGlobals.join(", ") ); - } -} - -// returns a new Array with the elements that are in a but not in b -function diff( a, b ) { - var result = a.slice(); - for ( var i = 0; i < result.length; i++ ) { - for ( var j = 0; j < b.length; j++ ) { - if ( result[i] === b[j] ) { - result.splice(i, 1); - i--; - break; - } - } - } - return result; -} - -function fail(message, exception, callback) { - if ( typeof console !== "undefined" && console.error && console.warn ) { - console.error(message); - console.error(exception); - console.warn(callback.toString()); - - } else if ( window.opera && opera.postError ) { - opera.postError(message, exception, callback.toString); - } -} - -function extend(a, b) { - for ( var prop in b ) { - if ( b[prop] === undefined ) { - delete a[prop]; - } else { - a[prop] = b[prop]; - } - } - - return a; -} - -function addEvent(elem, type, fn) { - if ( elem.addEventListener ) { - elem.addEventListener( type, fn, false ); - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, fn ); - } else { - fn(); - } -} - -function id(name) { - return !!(typeof document !== "undefined" && document && document.getElementById) && - document.getElementById( name ); -} - -// Test for equality any JavaScript type. -// Discussions and reference: http://philrathe.com/articles/equiv -// Test suites: http://philrathe.com/tests/equiv -// Author: Philippe Rathé -QUnit.equiv = function () { - - var innerEquiv; // the real equiv function - var callers = []; // stack to decide between skip/abort functions - var parents = []; // stack to avoiding loops from circular referencing - - // Call the o related callback with the given arguments. - function bindCallbacks(o, callbacks, args) { - var prop = QUnit.objectType(o); - if (prop) { - if (QUnit.objectType(callbacks[prop]) === "function") { - return callbacks[prop].apply(callbacks, args); - } else { - return callbacks[prop]; // or undefined - } - } - } - - var callbacks = function () { - - // for string, boolean, number and null - function useStrictEquality(b, a) { - if (b instanceof a.constructor || a instanceof b.constructor) { - // to catch short annotaion VS 'new' annotation of a declaration - // e.g. var i = 1; - // var j = new Number(1); - return a == b; - } else { - return a === b; - } - } - - return { - "string": useStrictEquality, - "boolean": useStrictEquality, - "number": useStrictEquality, - "null": useStrictEquality, - "undefined": useStrictEquality, - - "nan": function (b) { - return isNaN(b); - }, - - "date": function (b, a) { - return QUnit.objectType(b) === "date" && a.valueOf() === b.valueOf(); - }, - - "regexp": function (b, a) { - return QUnit.objectType(b) === "regexp" && - a.source === b.source && // the regex itself - a.global === b.global && // and its modifers (gmi) ... - a.ignoreCase === b.ignoreCase && - a.multiline === b.multiline; - }, - - // - skip when the property is a method of an instance (OOP) - // - abort otherwise, - // initial === would have catch identical references anyway - "function": function () { - var caller = callers[callers.length - 1]; - return caller !== Object && - typeof caller !== "undefined"; - }, - - "array": function (b, a) { - var i, j, loop; - var len; - - // b could be an object literal here - if ( ! (QUnit.objectType(b) === "array")) { - return false; - } - - len = a.length; - if (len !== b.length) { // safe and faster - return false; - } - - //track reference to avoid circular references - parents.push(a); - for (i = 0; i < len; i++) { - loop = false; - for(j=0;j= 0) { - type = "array"; - } else { - type = typeof obj; - } - return type; - }, - separator:function() { - return this.multiline ? this.HTML ? '
    ' : '\n' : this.HTML ? ' ' : ' '; - }, - indent:function( extra ) {// extra can be a number, shortcut for increasing-calling-decreasing - if ( !this.multiline ) - return ''; - var chr = this.indentChar; - if ( this.HTML ) - chr = chr.replace(/\t/g,' ').replace(/ /g,' '); - return Array( this._depth_ + (extra||0) ).join(chr); - }, - up:function( a ) { - this._depth_ += a || 1; - }, - down:function( a ) { - this._depth_ -= a || 1; - }, - setParser:function( name, parser ) { - this.parsers[name] = parser; - }, - // The next 3 are exposed so you can use them - quote:quote, - literal:literal, - join:join, - // - _depth_: 1, - // This is the list of parsers, to modify them, use jsDump.setParser - parsers:{ - window: '[Window]', - document: '[Document]', - error:'[ERROR]', //when no parser is found, shouldn't happen - unknown: '[Unknown]', - 'null':'null', - 'undefined':'undefined', - 'function':function( fn ) { - var ret = 'function', - name = 'name' in fn ? fn.name : (reName.exec(fn)||[])[1];//functions never have name in IE - if ( name ) - ret += ' ' + name; - ret += '('; - - ret = [ ret, QUnit.jsDump.parse( fn, 'functionArgs' ), '){'].join(''); - return join( ret, QUnit.jsDump.parse(fn,'functionCode'), '}' ); - }, - array: array, - nodelist: array, - arguments: array, - object:function( map ) { - var ret = [ ]; - QUnit.jsDump.up(); - for ( var key in map ) - ret.push( QUnit.jsDump.parse(key,'key') + ': ' + QUnit.jsDump.parse(map[key]) ); - QUnit.jsDump.down(); - return join( '{', ret, '}' ); - }, - node:function( node ) { - var open = QUnit.jsDump.HTML ? '<' : '<', - close = QUnit.jsDump.HTML ? '>' : '>'; - - var tag = node.nodeName.toLowerCase(), - ret = open + tag; - - for ( var a in QUnit.jsDump.DOMAttrs ) { - var val = node[QUnit.jsDump.DOMAttrs[a]]; - if ( val ) - ret += ' ' + a + '=' + QUnit.jsDump.parse( val, 'attribute' ); - } - return ret + close + open + '/' + tag + close; - }, - functionArgs:function( fn ) {//function calls it internally, it's the arguments part of the function - var l = fn.length; - if ( !l ) return ''; - - var args = Array(l); - while ( l-- ) - args[l] = String.fromCharCode(97+l);//97 is 'a' - return ' ' + args.join(', ') + ' '; - }, - key:quote, //object calls it internally, the key part of an item in a map - functionCode:'[code]', //function calls it internally, it's the content of the function - attribute:quote, //node calls it internally, it's an html attribute value - string:quote, - date:quote, - regexp:literal, //regex - number:literal, - 'boolean':literal - }, - DOMAttrs:{//attributes to dump from nodes, name=>realName - id:'id', - name:'name', - 'class':'className' - }, - HTML:false,//if true, entities are escaped ( <, >, \t, space and \n ) - indentChar:' ',//indentation unit - multiline:true //if true, items in a collection, are separated by a \n, else just a space. - }; - - return jsDump; -})(); - -// from Sizzle.js -function getText( elems ) { - var ret = "", elem; - - for ( var i = 0; elems[i]; i++ ) { - elem = elems[i]; - - // Get the text from text nodes and CDATA nodes - if ( elem.nodeType === 3 || elem.nodeType === 4 ) { - ret += elem.nodeValue; - - // Traverse everything else, except comment nodes - } else if ( elem.nodeType !== 8 ) { - ret += getText( elem.childNodes ); - } - } - - return ret; -}; - -/* - * Javascript Diff Algorithm - * By John Resig (http://ejohn.org/) - * Modified by Chu Alan "sprite" - * - * Released under the MIT license. - * - * More Info: - * http://ejohn.org/projects/javascript-diff-algorithm/ - * - * Usage: QUnit.diff(expected, actual) - * - * QUnit.diff("the quick brown fox jumped over", "the quick fox jumps over") == "the quick brown fox jumped jumps over" - */ -QUnit.diff = (function() { - function diff(o, n){ - var ns = new Object(); - var os = new Object(); - - for (var i = 0; i < n.length; i++) { - if (ns[n[i]] == null) - ns[n[i]] = { - rows: new Array(), - o: null - }; - ns[n[i]].rows.push(i); - } - - for (var i = 0; i < o.length; i++) { - if (os[o[i]] == null) - os[o[i]] = { - rows: new Array(), - n: null - }; - os[o[i]].rows.push(i); - } - - for (var i in ns) { - if (ns[i].rows.length == 1 && typeof(os[i]) != "undefined" && os[i].rows.length == 1) { - n[ns[i].rows[0]] = { - text: n[ns[i].rows[0]], - row: os[i].rows[0] - }; - o[os[i].rows[0]] = { - text: o[os[i].rows[0]], - row: ns[i].rows[0] - }; - } - } - - for (var i = 0; i < n.length - 1; i++) { - if (n[i].text != null && n[i + 1].text == null && n[i].row + 1 < o.length && o[n[i].row + 1].text == null && - n[i + 1] == o[n[i].row + 1]) { - n[i + 1] = { - text: n[i + 1], - row: n[i].row + 1 - }; - o[n[i].row + 1] = { - text: o[n[i].row + 1], - row: i + 1 - }; - } - } - - for (var i = n.length - 1; i > 0; i--) { - if (n[i].text != null && n[i - 1].text == null && n[i].row > 0 && o[n[i].row - 1].text == null && - n[i - 1] == o[n[i].row - 1]) { - n[i - 1] = { - text: n[i - 1], - row: n[i].row - 1 - }; - o[n[i].row - 1] = { - text: o[n[i].row - 1], - row: i - 1 - }; - } - } - - return { - o: o, - n: n - }; - } - - return function(o, n){ - o = o.replace(/\s+$/, ''); - n = n.replace(/\s+$/, ''); - var out = diff(o == "" ? [] : o.split(/\s+/), n == "" ? [] : n.split(/\s+/)); - - var str = ""; - - var oSpace = o.match(/\s+/g); - if (oSpace == null) { - oSpace = [" "]; - } - else { - oSpace.push(" "); - } - var nSpace = n.match(/\s+/g); - if (nSpace == null) { - nSpace = [" "]; - } - else { - nSpace.push(" "); - } - - if (out.n.length == 0) { - for (var i = 0; i < out.o.length; i++) { - str += '' + out.o[i] + oSpace[i] + ""; - } - } - else { - if (out.n[0].text == null) { - for (n = 0; n < out.o.length && out.o[n].text == null; n++) { - str += '' + out.o[n] + oSpace[n] + ""; - } - } - - for (var i = 0; i < out.n.length; i++) { - if (out.n[i].text == null) { - str += '' + out.n[i] + nSpace[i] + ""; - } - else { - var pre = ""; - - for (n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++) { - pre += '' + out.o[n] + oSpace[n] + ""; - } - str += " " + out.n[i].text + nSpace[i] + pre; - } - } - } - - return str; - }; -})(); - -})(this); diff --git a/node_modules/director/test/browser/routes-harness.html b/node_modules/director/test/browser/routes-harness.html deleted file mode 100644 index 51e792a..0000000 --- a/node_modules/director/test/browser/routes-harness.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - Director Tests - - - -

    - Director -


    -

    -
    -

    -
      -
      test markup, will be hidden
      - - - - - - - - diff --git a/node_modules/director/test/browser/routes-test.js b/node_modules/director/test/browser/routes-test.js deleted file mode 100644 index 81100d1..0000000 --- a/node_modules/director/test/browser/routes-test.js +++ /dev/null @@ -1,647 +0,0 @@ - -createTest('Nested route with the many children as a tokens, callbacks should yield historic params', { - '/a': { - '/:id': { - '/:id': function(a, b) { - shared.fired.push(location.hash, a, b); - } - } - } -}, function() { - shared.fired = []; - this.navigate('/a/b/c', function() { - deepEqual(shared.fired, ['#/a/b/c', 'b', 'c']); - this.finish(); - }); -}); - -createTest('Nested route with the first child as a token, callback should yield a param', { - '/foo': { - '/:id': { - on: function(id) { - shared.fired.push(location.hash, id); - } - } - } -}, function() { - shared.fired = []; - this.navigate('/foo/a', function() { - this.navigate('/foo/b/c', function() { - deepEqual(shared.fired, ['#/foo/a', 'a']); - this.finish(); - }); - }); -}); - -createTest('Nested route with the first child as a regexp, callback should yield a param', { - '/foo': { - '/(\\w+)': { - on: function(value) { - shared.fired.push(location.hash, value); - } - } - } -}, function() { - shared.fired = []; - this.navigate('/foo/a', function() { - this.navigate('/foo/b/c', function() { - deepEqual(shared.fired, ['#/foo/a', 'a']); - this.finish(); - }); - }); -}); - -createTest('Nested route with the several regular expressions, callback should yield a param', { - '/a': { - '/(\\w+)': { - '/(\\w+)': function(a, b) { - shared.fired.push(a, b); - } - } - } -}, function() { - shared.fired = []; - this.navigate('/a/b/c', function() { - deepEqual(shared.fired, ['b', 'c']); - this.finish(); - }); -}); - - - -createTest('Single nested route with on member containing function value', { - '/a': { - '/b': { - on: function() { - shared.fired.push(location.hash); - } - } - } -}, function() { - shared.fired = []; - this.navigate('/a/b', function() { - deepEqual(shared.fired, ['#/a/b']); - this.finish(); - }); -}); - -createTest('Single non-nested route with on member containing function value', { - '/a/b': { - on: function() { - shared.fired.push(location.hash); - } - } -}, function() { - shared.fired = []; - this.navigate('/a/b', function() { - deepEqual(shared.fired, ['#/a/b']); - this.finish(); - }); -}); - -createTest('Single nested route with on member containing array of function values', { - '/a': { - '/b': { - on: [function() { shared.fired.push(location.hash); }, - function() { shared.fired.push(location.hash); }] - } - } -}, function() { - shared.fired = []; - this.navigate('/a/b', function() { - deepEqual(shared.fired, ['#/a/b', '#/a/b']); - this.finish(); - }); -}); - -createTest('method should only fire once on the route.', { - '/a': { - '/b': { - once: function() { - shared.fired++; - } - } - } -}, function() { - shared.fired = 0; - this.navigate('/a/b', function() { - this.navigate('/a/b', function() { - this.navigate('/a/b', function() { - deepEqual(shared.fired, 1); - this.finish(); - }); - }); - }); -}); - -createTest('method should only fire once on the route, multiple nesting.', { - '/a': { - on: function() { shared.fired++; }, - once: function() { shared.fired++; } - }, - '/b': { - on: function() { shared.fired++; }, - once: function() { shared.fired++; } - } -}, function() { - shared.fired = 0; - this.navigate('/a', function() { - this.navigate('/b', function() { - this.navigate('/a', function() { - this.navigate('/b', function() { - deepEqual(shared.fired, 6); - this.finish(); - }); - }); - }); - }); -}); - -createTest('overlapping routes with tokens.', { - '/a/:b/c' : function() { - shared.fired.push(location.hash); - }, - '/a/:b/c/:d' : function() { - shared.fired.push(location.hash); - } -}, function() { - shared.fired = []; - this.navigate('/a/b/c', function() { - - this.navigate('/a/b/c/d', function() { - deepEqual(shared.fired, ['#/a/b/c', '#/a/b/c/d']); - this.finish(); - }); - }); -}); - -// // // -// // // Recursion features -// // // ---------------------------------------------------------- - -createTest('Nested routes with no recursion', { - '/a': { - '/b': { - '/c': { - on: function c() { - shared.fired.push('c'); - } - }, - on: function b() { - shared.fired.push('b'); - } - }, - on: function a() { - shared.fired.push('a'); - } - } -}, function() { - shared.fired = []; - - this.navigate('/a/b/c', function() { - deepEqual(shared.fired, ['c']); - this.finish(); - }); -}); - -createTest('Nested routes with backward recursion', { - '/a': { - '/b': { - '/c': { - on: function c() { - shared.fired.push('c'); - } - }, - on: function b() { - shared.fired.push('b'); - } - }, - on: function a() { - shared.fired.push('a'); - } - } -}, { - recurse: 'backward' -}, function() { - shared.fired = []; - - this.navigate('/a/b/c', function() { - deepEqual(shared.fired, ['c', 'b', 'a']); - this.finish(); - }); -}); - -createTest('Breaking out of nested routes with backward recursion', { - '/a': { - '/:b': { - '/c': { - on: function c() { - shared.fired.push('c'); - } - }, - on: function b() { - shared.fired.push('b'); - return false; - } - }, - on: function a() { - shared.fired.push('a'); - } - } -}, { - recurse: 'backward' -}, function() { - shared.fired = []; - - this.navigate('/a/b/c', function() { - deepEqual(shared.fired, ['c', 'b']); - this.finish(); - }); -}); - -createTest('Nested routes with forward recursion', { - '/a': { - '/b': { - '/c': { - on: function c() { - shared.fired.push('c'); - } - }, - on: function b() { - shared.fired.push('b'); - } - }, - on: function a() { - shared.fired.push('a'); - } - } -}, { - recurse: 'forward' -}, function() { - shared.fired = []; - - this.navigate('/a/b/c', function() { - deepEqual(shared.fired, ['a', 'b', 'c']); - this.finish(); - }); -}); - -createTest('Nested routes with forward recursion, single route with an after event.', { - '/a': { - '/b': { - '/c': { - on: function c() { - shared.fired.push('c'); - }, - after: function() { - shared.fired.push('c-after'); - } - }, - on: function b() { - shared.fired.push('b'); - } - }, - on: function a() { - shared.fired.push('a'); - } - } -}, { - recurse: 'forward' -}, function() { - shared.fired = []; - - this.navigate('/a/b/c', function() { - this.navigate('/a/b', function() { - deepEqual(shared.fired, ['a', 'b', 'c', 'c-after', 'a', 'b']); - this.finish(); - }); - }); -}); - -createTest('Breaking out of nested routes with forward recursion', { - '/a': { - '/b': { - '/c': { - on: function c() { - shared.fired.push('c'); - } - }, - on: function b() { - shared.fired.push('b'); - return false; - } - }, - on: function a() { - shared.fired.push('a'); - } - } -}, { - recurse: 'forward' -}, function() { - shared.fired = []; - - this.navigate('/a/b/c', function() { - deepEqual(shared.fired, ['a', 'b']); - this.finish(); - }); -}); - -// -// ABOVE IS WORKING -// - -// // -// // Special Events -// // ---------------------------------------------------------- - -createTest('All global event should fire after every route', { - '/a': { - on: function a() { - shared.fired.push('a'); - } - }, - '/b': { - '/c': { - on: function a() { - shared.fired.push('a'); - } - } - }, - '/d': { - '/:e': { - on: function a() { - shared.fired.push('a'); - } - } - } -}, { - after: function() { - shared.fired.push('b'); - } -}, function() { - shared.fired = []; - - this.navigate('/a', function() { - this.navigate('/b/c', function() { - this.navigate('/d/e', function() { - deepEqual(shared.fired, ['a', 'b', 'a', 'b', 'a']); - this.finish(); - }); - }); - }); - -}); - -createTest('Not found.', { - '/a': { - on: function a() { - shared.fired.push('a'); - } - }, - '/b': { - on: function a() { - shared.fired.push('b'); - } - } -}, { - notfound: function() { - shared.fired.push('notfound'); - } -}, function() { - shared.fired = []; - - this.navigate('/c', function() { - this.navigate('/d', function() { - deepEqual(shared.fired, ['notfound', 'notfound']); - this.finish(); - }); - }); -}); - -createTest('On all.', { - '/a': { - on: function a() { - shared.fired.push('a'); - } - }, - '/b': { - on: function a() { - shared.fired.push('b'); - } - } -}, { - on: function() { - shared.fired.push('c'); - } -}, function() { - shared.fired = []; - - this.navigate('/a', function() { - this.navigate('/b', function() { - deepEqual(shared.fired, ['a', 'c', 'b', 'c']); - this.finish(); - }); - }); -}); - - -createTest('After all.', { - '/a': { - on: function a() { - shared.fired.push('a'); - } - }, - '/b': { - on: function a() { - shared.fired.push('b'); - } - } -}, { - after: function() { - shared.fired.push('c'); - } -}, function() { - shared.fired = []; - - this.navigate('/a', function() { - this.navigate('/b', function() { - deepEqual(shared.fired, ['a', 'c', 'b']); - this.finish(); - }); - }); -}); - -createTest('resource object.', { - '/a': { - '/b/:c': { - on: 'f1' - }, - on: 'f2' - }, - '/d': { - on: ['f1', 'f2'] - } -}, -{ - resource: { - f1: function (name){ - shared.fired.push("f1-" + name); - }, - f2: function (name){ - shared.fired.push("f2"); - } - } -}, function() { - shared.fired = []; - - this.navigate('/a/b/c', function() { - this.navigate('/d', function() { - deepEqual(shared.fired, ['f1-c', 'f1-undefined', 'f2']); - this.finish(); - }); - }); -}); - -createTest('argument matching should be case agnostic', { - '/fooBar/:name': { - on: function(name) { - shared.fired.push("fooBar-" + name); - } - } -}, function() { - shared.fired = []; - this.navigate('/fooBar/tesTing', function() { - deepEqual(shared.fired, ['fooBar-tesTing']); - this.finish(); - }); -}); - -createTest('sanity test', { - '/is/:this/:sane': { - on: function(a, b) { - shared.fired.push('yes ' + a + ' is ' + b); - } - }, - '/': { - on: function() { - shared.fired.push('is there sanity?'); - } - } -}, function() { - shared.fired = []; - this.navigate('/is/there/sanity', function() { - deepEqual(shared.fired, ['yes there is sanity']); - this.finish(); - }); -}); - -createTest('`/` route should be navigable from the routing table', { - '/': { - on: function root() { - shared.fired.push('/'); - } - }, - '/:username': { - on: function afunc(username) { - shared.fired.push('/' + username); - } - } -}, function() { - shared.fired = []; - this.navigate('/', function root() { - deepEqual(shared.fired, ['/']); - this.finish(); - }); -}); - -createTest('`/` route should not override a `/:token` route', { - '/': { - on: function root() { - shared.fired.push('/'); - } - }, - '/:username': { - on: function afunc(username) { - shared.fired.push('/' + username); - } - } -}, function() { - shared.fired = []; - this.navigate('/a', function afunc() { - deepEqual(shared.fired, ['/a']); - this.finish(); - }); -}); - -createTest('should accept the root as a token.', { - '/:a': { - on: function root() { - shared.fired.push(location.hash); - } - } -}, function() { - shared.fired = []; - this.navigate('/a', function root() { - deepEqual(shared.fired, ['#/a']); - this.finish(); - }); -}); - -createTest('routes should allow wildcards.', { - '/:a/b*d': { - on: function() { - shared.fired.push(location.hash); - } - } -}, function() { - shared.fired = []; - this.navigate('/a/bcd', function root() { - deepEqual(shared.fired, ['#/a/bcd']); - this.finish(); - }); -}); - -createTest('functions should have |this| context of the router instance.', { - '/': { - on: function root() { - shared.fired.push(!!this.routes); - } - } -}, function() { - shared.fired = []; - this.navigate('/', function root() { - deepEqual(shared.fired, [true]); - this.finish(); - }); -}); - -createTest('setRoute with a single parameter should change location correctly', { - '/bonk': { - on: function() { - shared.fired.push(window.location.hash); - } - } -}, function() { - var self = this; - shared.fired = []; - this.router.setRoute('/bonk'); - setTimeout(function() { - deepEqual(shared.fired, ['#/bonk']); - self.finish(); - }, 14) -}); - -createTest('route should accept _ and . within parameters', { - '/:a': { - on: function root() { - shared.fired.push(location.hash); - } - } -}, function() { - shared.fired = []; - this.navigate('/a_complex_route.co.uk', function root() { - deepEqual(shared.fired, ['#/a_complex_route.co.uk']); - this.finish(); - }); -}); - diff --git a/node_modules/director/test/server/cli/dispatch-test.js b/node_modules/director/test/server/cli/dispatch-test.js deleted file mode 100644 index 7aead38..0000000 --- a/node_modules/director/test/server/cli/dispatch-test.js +++ /dev/null @@ -1,55 +0,0 @@ -/* - * dispatch-test.js: Tests for the core dispatch method. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - vows = require('vows'), - director = require('../../../lib/director'); - -vows.describe('director/cli/dispatch').addBatch({ - "An instance of director.cli.Router": { - topic: function () { - var router = new director.cli.Router(), - that = this; - - that.matched = {}; - that.matched['users'] = []; - that.matched['apps'] = [] - - router.on('users create', function () { - that.matched['users'].push('on users create'); - }); - - router.on(/apps (\w+\s\w+)/, function () { - assert.equal(arguments.length, 1); - that.matched['apps'].push('on apps (\\w+\\s\\w+)'); - }) - - return router; - }, - "should have the correct routing table": function (router) { - assert.isObject(router.routes.users); - assert.isObject(router.routes.users.create); - }, - "the dispatch() method": { - "users create": function (router) { - assert.isTrue(router.dispatch('on', 'users create')); - assert.equal(this.matched.users[0], 'on users create'); - }, - "apps foo bar": function (router) { - assert.isTrue(router.dispatch('on', 'apps foo bar')); - assert.equal(this.matched['apps'][0], 'on apps (\\w+\\s\\w+)'); - }, - "not here": function (router) { - assert.isFalse(router.dispatch('on', 'not here')); - }, - "still not here": function (router) { - assert.isFalse(router.dispatch('on', 'still not here')); - } - } - } -}).export(module); diff --git a/node_modules/director/test/server/cli/path-test.js b/node_modules/director/test/server/cli/path-test.js deleted file mode 100644 index 2094027..0000000 --- a/node_modules/director/test/server/cli/path-test.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * dispatch-test.js: Tests for the core dispatch method. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - vows = require('vows'), - director = require('../../../lib/director'); - -vows.describe('director/cli/path').addBatch({ - "An instance of director.cli.Router": { - topic: new director.cli.Router(), - "the path() method": { - "should create the correct nested routing table": function (router) { - function noop () {} - - router.path(/apps/, function () { - router.path(/foo/, function () { - router.on(/bar/, noop); - }); - - router.on(/list/, noop); - }); - - router.on(/users/, noop); - - assert.isObject(router.routes.apps); - assert.isFunction(router.routes.apps.list.on); - assert.isObject(router.routes.apps.foo); - assert.isFunction(router.routes.apps.foo.bar.on); - assert.isFunction(router.routes.users.on); - } - } - } -}).export(module); - diff --git a/node_modules/director/test/server/core/dispatch-test.js b/node_modules/director/test/server/core/dispatch-test.js deleted file mode 100644 index c05c746..0000000 --- a/node_modules/director/test/server/core/dispatch-test.js +++ /dev/null @@ -1,113 +0,0 @@ -/* - * dispatch-test.js: Tests for the core dispatch method. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - vows = require('vows'), - director = require('../../../lib/director'); - -vows.describe('director/router/dispatch').addBatch({ - "An instance of director.Router": { - topic: function () { - var that = this; - that.matched = {}; - that.matched['/'] = []; - that.matched['foo'] = []; - that.matched['f*'] = [] - - var router = new director.Router({ - '/': { - before: function () { that.matched['/'].push('before /') }, - on: function () { that.matched['/'].push('on /') }, - after: function () { that.matched['/'].push('after /') } - }, - '/foo': { - before: function () { that.matched.foo.push('before foo') }, - on: function () { that.matched.foo.push('on foo') }, - after: function () { that.matched.foo.push('after foo') }, - '/bar': { - before: function () { that.matched.foo.push('before foo bar') }, - on: function () { that.matched.foo.push('foo bar') }, - after: function () { that.matched.foo.push('after foo bar') }, - '/buzz': function () { that.matched.foo.push('foo bar buzz') } - } - }, - '/f*': { - '/barbie': function () { that.matched['f*'].push('f* barbie') } - } - }); - - router.configure({ - recurse: 'backward' - }); - - return router; - }, - "should have the correct routing table": function (router) { - assert.isObject(router.routes.foo); - assert.isObject(router.routes.foo.bar); - assert.isObject(router.routes.foo.bar.buzz); - assert.isFunction(router.routes.foo.bar.buzz.on); - }, - "the dispatch() method": { - "/": function (router) { - assert.isTrue(router.dispatch('on', '/')); - assert.isTrue(router.dispatch('on', '/')); - - assert.equal(this.matched['/'][0], 'before /'); - assert.equal(this.matched['/'][1], 'on /'); - assert.equal(this.matched['/'][2], 'after /'); - }, - "/foo/bar/buzz": function (router) { - assert.isTrue(router.dispatch('on', '/foo/bar/buzz')); - - assert.equal(this.matched.foo[0], 'foo bar buzz'); - assert.equal(this.matched.foo[1], 'before foo bar'); - assert.equal(this.matched.foo[2], 'foo bar'); - assert.equal(this.matched.foo[3], 'before foo'); - assert.equal(this.matched.foo[4], 'on foo'); - }, - "/foo/barbie": function (router) { - assert.isTrue(router.dispatch('on', '/foo/barbie')); - assert.equal(this.matched['f*'][0], 'f* barbie'); - }, - "/foo/barbie/": function (router) { - assert.isFalse(router.dispatch('on', '/foo/barbie/')); - }, - "/foo/BAD": function (router) { - assert.isFalse(router.dispatch('on', '/foo/BAD')); - }, - "/bar/bar": function (router) { - assert.isFalse(router.dispatch('on', '/bar/bar')); - }, - "with the strict option disabled": { - topic: function (router) { - return router.configure({ - recurse: 'backward', - strict: false - }); - }, - "should have the proper configuration set": function (router) { - assert.isFalse(router.strict); - }, - "/foo/barbie/": function (router) { - assert.isTrue(router.dispatch('on', '/foo/barbie/')); - assert.equal(this.matched['f*'][0], 'f* barbie'); - }, - "/foo/bar/buzz": function (router) { - assert.isTrue(router.dispatch('on', '/foo/bar/buzz')); - - assert.equal(this.matched.foo[0], 'foo bar buzz'); - assert.equal(this.matched.foo[1], 'before foo bar'); - assert.equal(this.matched.foo[2], 'foo bar'); - assert.equal(this.matched.foo[3], 'before foo'); - assert.equal(this.matched.foo[4], 'on foo'); - }, - } - } - } -}).export(module); diff --git a/node_modules/director/test/server/core/insert-test.js b/node_modules/director/test/server/core/insert-test.js deleted file mode 100644 index cd528ad..0000000 --- a/node_modules/director/test/server/core/insert-test.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * insert-test.js: Tests for inserting routes into a normalized routing table. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - vows = require('vows'), - director = require('../../../lib/director'); - -vows.describe('director/router/insert').addBatch({ - "An instance of director.Router": { - topic: new director.Router(), - "the insert() method": { - "'on', ['foo', 'bar']": function (router) { - function route () { } - - router.insert('on', ['foo', 'bar'], route); - assert.strictEqual(router.routes.foo.bar.on, route); - }, - "'on', ['foo', 'bar'] again": function (router) { - function route () { } - - router.insert('on', ['foo', 'bar'], route); - assert.isArray(router.routes.foo.bar.on); - assert.strictEqual(router.routes.foo.bar.on.length, 2); - }, - "'on', ['foo', 'bar'] a third time": function (router) { - function route () { } - - router.insert('on', ['foo', 'bar'], route); - assert.isArray(router.routes.foo.bar.on); - assert.strictEqual(router.routes.foo.bar.on.length, 3); - }, - "'get', ['fizz', 'buzz']": function (router) { - function route () { } - - router.insert('get', ['fizz', 'buzz'], route); - assert.strictEqual(router.routes.fizz.buzz.get, route); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/director/test/server/core/mount-test.js b/node_modules/director/test/server/core/mount-test.js deleted file mode 100644 index f409d8a..0000000 --- a/node_modules/director/test/server/core/mount-test.js +++ /dev/null @@ -1,104 +0,0 @@ -/* - * mount-test.js: Tests for mounting and normalizing routes into a Router instance. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - vows = require('vows'), - director = require('../../../lib/director'); - -function assertRoute (fn, path, route) { - if (path.length === 1) { - return assert.strictEqual(route[path.shift()], fn); - } - - route = route[path.shift()]; - assert.isObject(route); - assertRoute(fn, path, route); -} - -vows.describe('director/router/mount').addBatch({ - "An instance of director.Router": { - "with no preconfigured params": { - topic: new director.Router(), - "the mount() method": { - "should sanitize the routes correctly": function (router) { - function foobar () { } - function foostar () { } - function foobazzbuzz () { } - function foodog () { } - function root () {} - var fnArray = [foobar, foostar]; - - router.mount({ - '/': { - before: root, - on: root, - after: root, - '/nesting': { - on: foobar, - '/deep': foostar - } - }, - '/foo': { - '/bar': foobar, - '/*': foostar, - '/jitsu/then': { - before: foobar - } - }, - '/foo/bazz': { - '/buzz': foobazzbuzz - }, - '/foo/jitsu': { - '/then': fnArray - }, - '/foo/jitsu/then/now': foostar, - '/foo/:dog': foodog - }); - - assertRoute(root, ['on'], router.routes); - assertRoute(root, ['after'], router.routes); - assertRoute(root, ['before'], router.routes); - assertRoute(foobar, ['nesting', 'on'], router.routes); - assertRoute(foostar, ['nesting', 'deep', 'on'], router.routes); - assertRoute(foobar, [ 'foo', 'bar', 'on'], router.routes); - assertRoute(foostar, ['foo', '([_.()!\\ %@&a-zA-Z0-9-]+)', 'on'], router.routes); - assertRoute(fnArray, ['foo', 'jitsu', 'then', 'on'], router.routes); - assertRoute(foobar, ['foo', 'jitsu', 'then', 'before'], router.routes); - assertRoute(foobazzbuzz, ['foo', 'bazz', 'buzz', 'on'], router.routes); - assertRoute(foostar, ['foo', 'jitsu', 'then', 'now', 'on'], router.routes); - assertRoute(foodog, ['foo', '([._a-zA-Z0-9-]+)', 'on'], router.routes); - } - } - }, - "with preconfigured params": { - topic: function () { - var router = new director.Router(); - router.param('city', '([\\w\\-]+)'); - router.param(':country', /([A-Z][A-Za-z]+)/); - router.param(':zip', /([\d]{5})/); - return router; - }, - "should sanitize the routes correctly": function (router) { - function usaCityZip () { } - function countryCityZip () { } - - router.mount({ - '/usa/:city/:zip': usaCityZip, - '/world': { - '/:country': { - '/:city/:zip': countryCityZip - } - } - }); - - assertRoute(usaCityZip, ['usa', '([\\w\\-]+)', '([\\d]{5})', 'on'], router.routes); - assertRoute(countryCityZip, ['world', '([A-Z][A-Za-z]+)', '([\\w\\-]+)', '([\\d]{5})', 'on'], router.routes); - } - } - } -}).export(module); diff --git a/node_modules/director/test/server/core/path-test.js b/node_modules/director/test/server/core/path-test.js deleted file mode 100644 index 4418ff9..0000000 --- a/node_modules/director/test/server/core/path-test.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * path-test.js: Tests for the core dispatch method. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - vows = require('vows'), - director = require('../../../lib/director'); - -vows.describe('director/router/path').addBatch({ - "An instance of director.Router": { - topic: function () { - var that = this; - that.matched = {}; - that.matched['foo'] = []; - that.matched['newyork'] = []; - - var router = new director.Router({ - '/foo': function () { that.matched['foo'].push('foo'); } - }); - return router; - }, - "the path() method": { - "should create the correct nested routing table": function (router) { - var that = this; - router.path('/regions', function () { - this.on('/:state', function(country) { - that.matched['newyork'].push('new york'); - }); - }); - - assert.isFunction(router.routes.foo.on); - assert.isObject(router.routes.regions); - assert.isFunction(router.routes.regions['([._a-zA-Z0-9-]+)'].on); - }, - "should dispatch the function correctly": function (router) { - router.dispatch('on', '/regions/newyork') - router.dispatch('on', '/foo'); - assert.equal(this.matched['foo'].length, 1); - assert.equal(this.matched['newyork'].length, 1); - assert.equal(this.matched['foo'][0], 'foo'); - assert.equal(this.matched['newyork'][0], 'new york'); - } - } - } -}).export(module); diff --git a/node_modules/director/test/server/helpers/macros.js b/node_modules/director/test/server/helpers/macros.js deleted file mode 100644 index 657b991..0000000 --- a/node_modules/director/test/server/helpers/macros.js +++ /dev/null @@ -1,7 +0,0 @@ -/* - * macros.js: Test macros for director tests. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ \ No newline at end of file diff --git a/node_modules/director/test/server/http/http-test.js b/node_modules/director/test/server/http/http-test.js deleted file mode 100644 index 9ff4c9a..0000000 --- a/node_modules/director/test/server/http/http-test.js +++ /dev/null @@ -1,76 +0,0 @@ -/* - * http-test.js: Tests for basic HTTP server(s). - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - http = require('http'), - vows = require('vows'), - request = require('request'), - director = require('../../../lib/director'); - -function helloWorld(id) { - this.res.writeHead(200, { 'Content-Type': 'text/plain' }) - this.res.end('hello from (' + id + ')'); -} - -function createServer (router) { - return http.createServer(function (req, res) { - router.dispatch(req, res, function (err) { - if (err) { - res.writeHead(404); - res.end(); - } - }); - }); -} - -function assertGet (uri) { - return { - topic: function () { - request({ uri: 'http://localhost:9090/' + uri }, this.callback); - }, - "should respond with `hello from (bark)`": function (err, res, body) { - assert.isNull(err); - assert.equal(res.statusCode, 200); - assert.equal(body, 'hello from (bark)') - } - } -} - -vows.describe('director/server/http').addBatch({ - "An instance of director.http.Router": { - "instantiated with a Routing table": { - topic: new director.http.Router({ - '/hello': { - get: helloWorld - } - }), - "should have the correct routes defined": function (router) { - assert.isObject(router.routes.hello); - assert.isFunction(router.routes.hello.get); - }, - "when passed to an http.Server instance": { - topic: function (router) { - router.get(/foo\/bar\/(\w+)/, helloWorld); - router.get(/foo\/update\/(\w+)/, helloWorld); - router.path(/bar\/bazz\//, function () { - this.get(/(\w+)/, helloWorld) - }); - - var server = createServer(router), - that = this; - - server.listen(9090, this.callback); - }, - "a request to foo/bar/bark": assertGet('foo/bar/bark'), - "a request to foo/update/bark": assertGet('foo/update/bark'), - "a request to bar/bazz/bark": assertGet('bar/bazz/bark'), - "a request to foo/bar/bark?test=test": assertGet('foo/bar/bark?test=test') - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/director/test/server/http/insert-test.js b/node_modules/director/test/server/http/insert-test.js deleted file mode 100644 index e334bcf..0000000 --- a/node_modules/director/test/server/http/insert-test.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * insert-test.js: Tests for inserting routes into a normalized routing table. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - vows = require('vows'), - director = require('../../../lib/director'); - -vows.describe('director/router/http/insert').addBatch({ - "An instance of director.Router": { - topic: new director.http.Router(), - "the path() method": { - "/resource": { - "should insert nested routes correct": function (router) { - function getResource() {} - function modifyResource() {} - - router.path(/\/resource/, function () { - this.get(getResource); - - this.put(/\/update/, modifyResource); - this.post(/create/, modifyResource); - }); - - assert.equal(router.routes.resource.get, getResource); - assert.equal(router.routes.resource.update.put, modifyResource); - assert.equal(router.routes.resource.create.post, modifyResource); - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/director/test/server/http/methods-test.js b/node_modules/director/test/server/http/methods-test.js deleted file mode 100644 index 2e597fc..0000000 --- a/node_modules/director/test/server/http/methods-test.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * methods-test.js: Tests for HTTP methods. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - vows = require('vows'), - director = require('../../../lib/director'); - -vows.describe('director/http/methods').addBatch({ - "When using director": { - "an instance of director.http.Router should have all relevant RFC methods": function () { - var router = new director.http.Router(); - director.http.methods.forEach(function (method) { - assert.isFunction(router[method.toLowerCase()]); - }); - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/director/test/server/http/responses-test.js b/node_modules/director/test/server/http/responses-test.js deleted file mode 100644 index ad46e5c..0000000 --- a/node_modules/director/test/server/http/responses-test.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * responses-test.js: Tests for HTTP responses. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - vows = require('vows'), - director = require('../../../lib/director'); - -vows.describe('director/http/responses').addBatch({ - "When using director.http": { - "it should have the relevant responses defined": function () { - Object.keys(require('../../../lib/director/http/responses')).forEach(function (name) { - assert.isFunction(director.http[name]); - }); - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/.npmignore b/node_modules/flatiron/.npmignore deleted file mode 100644 index 5171c54..0000000 --- a/node_modules/flatiron/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -npm-debug.log \ No newline at end of file diff --git a/node_modules/flatiron/.travis.yml b/node_modules/flatiron/.travis.yml deleted file mode 100644 index c958222..0000000 --- a/node_modules/flatiron/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 - - 0.7 - -notifications: - email: - - travis@nodejitsu.com - irc: "irc.freenode.org#nodejitsu" - diff --git a/node_modules/flatiron/LICENSE b/node_modules/flatiron/LICENSE deleted file mode 100644 index 1f01e2b..0000000 --- a/node_modules/flatiron/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011 Nodejitsu Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/flatiron/README.md b/node_modules/flatiron/README.md deleted file mode 100644 index f6285e6..0000000 --- a/node_modules/flatiron/README.md +++ /dev/null @@ -1,417 +0,0 @@ -# [flatiron](http://flatironjs.org) [![Build Status](https://secure.travis-ci.org/flatiron/flatiron.png)](http://travis-ci.org/flatiron/flatiron) - -*An elegant blend of convention and configuration for building apps in Node.js and the browser* - -![](http://flatironjs.org/img/flatiron.png) - -# Example HTTP Server: - -```js -var flatiron = require('flatiron'), - app = flatiron.app; - -app.use(flatiron.plugins.http); - -app.router.get('/', function () { - this.res.writeHead(200, { 'Content-Type': 'text/plain' }); - this.res.end('Hello world!\n'); -}); - -app.start(8080); -``` - -# Example CLI Application: - -```js -// example.js - -var flatiron = require('flatiron'), - app = flatiron.app; - -app.use(flatiron.plugins.cli, { - dir: __dirname, - usage: [ - 'This is a basic flatiron cli application example!', - '', - 'hello - say hello to somebody.' - ] -}); - -app.cmd('hello', function () { - app.prompt.get('name', function (err, result) { - app.log.info('hello '+result.name+'!'); - }) -}) - -app.start(); -``` - -## Run It: - -``` -% node example.js hello -prompt: name: world -info: hello world! -``` - -## Installation - -### Installing NPM (Node Package Manager) -``` - curl http://npmjs.org/install.sh | sh -``` - -### Installing Flatiron -``` - [sudo] npm install flatiron -``` - -### Installing Union (Required for `flatiron.plugins.http`) -``` - npm install union -``` - -# Usage: - -## Start With `flatiron.app`: - -`flatiron.app` is a [broadway injection container](https://github.com/flatiron/broadway). To be brief, what it does is allow plugins to modify the `app` object directly: - -```js -var flatiron = require('flatiron'), - app = require('app'); - -var hello = { - attach: function (options) { - this.hello = options.message || 'Why hello!'; - } -}; - -app.use(hello, { - message: "Hi! How are you?" -}); - -// Will print, "Hi! How are you?" -console.log(app.hello); -``` - -Virtually all additional functionality in flatiron comes from broadway plugins, such as `flatiron.plugins.http` and `flatiron.plugins.cli`. - -`flatiron.app` comes with a [`config`](https://github.com/flatiron/broadway/blob/master/lib/broadway/plugins/config.js) plugin pre-loaded, which adds configuration management courtesy [nconf](https://github.com/flatiron/nconf). - -## Create An HTTP Server with `flatiron.plugins.http(options)`: - -This plugin adds http serving functionality to your flatiron app by attaching the following properties and methods: - -### Define Routes with `app.router`: - -This is a [director](https://github.com/flatiron/director) router configured to route http requests after the middlewares in `app.http.before` are applied. Example routes include: - -```js - -// GET / -app.router.get('/', function () { - this.res.writeHead(200, { 'Content-Type': 'text/plain' }); - this.res.end('Hello world!\n'); -}); - -// POST to / -app.router.post('/', function () { - this.res.writeHead(200, { 'Content-Type': 'text/plain' }); - this.res.write('Hey, you posted some cool data!\n'); - this.res.end(util.inspect(this.req.body, true, 2, true) + '\n'); -}); - -// Parameterized routes -app.router.get('/sandwich/:type', function (type) { - if (~['bacon', 'burger'].indexOf(type)) { - this.res.writeHead(200, { 'Content-Type': 'text/plain' }); - this.res.end('Serving ' + type + ' sandwich!\n'); - } - else { - this.res.writeHead(404, { 'Content-Type': 'text/plain' }); - this.res.end('No such sandwich, sorry!\n'); - } -}); -``` - -`app.router` can also route against regular expressions and more! To learn more about director's advanced functionality, visit director's [project page](https://github.com/flatiron/director#readme). - - -### Access The Server with `app.server`: - -This is a [union](https://github.com/flatiron/union) middleware kernel. - -### Modify the Server Options with `app.http`: - -This object contains options that are passed to the union server, including `app.http.before`, `app.http.after` and `app.http.headers`. - -These properties may be set by passing them through as options: - -```js -app.use(flatiron.plugins.http, { - before: [], - after: [] -}); -``` - -You can read more about these options on the [union project page](https://github.com/flatiron/union#readme). - -### Start The Server with `app.start(, port, )` - -This method will both call `app.init` (which will call any asynchronous initialization steps on loaded plugins) and start the http server with the given arguments. For example, the following will start your flatiron http server on port 8080: - -```js -app.start(8080); -``` - -## Create a CLI Application with `flatiron.plugins.cli(options)` - -This plugin turns your app into a cli application framework. For example, [jitsu] -(https://github.com/nodejitsu/jitsu) uses flatiron and the cli plugin. - -Valid options include: - -```js -{ - "argvOptions": {}, // A configuration hash passed to the cli argv parser. - "usage": [ "foo", "bar" ], // A message to show for cli usage. Joins arrays with `\n`. - "dir": require('path').join(__dirname, 'lib', 'commands') // A directory with commands to lazy-load -} -``` - -### Add lazy-loaded CLI commands with `options.dir` and `app.commands`: - - Flatiron CLI will automatically lazy-load modules defining commands in the directory specified by `options.dir`. For example: - -```js -// example2.js -var path = require('path'), - flatiron = require('./lib/flatiron'), - app = flatiron.app; - -app.use(flatiron.plugins.cli, { - dir: path.join(__dirname, 'cmds') -}); - -app.start(); -``` - -```js -// cmd/highfive.js -var highfive = module.exports = function highfive (person, cb) { - this.log.info('High five to ' + person + '!'); - cb(null); -}; -``` - -In the command, you expose a function of arguments and a callback. `this` is set to `app`, and the routing is taken care of automatically. - -Here it is in action: - -``` -% node example2.js highfive Flatiron -info: High five to Flatiron! -``` - -You can also define these commands by adding them directly to `app.commands` yourself: - -``` -// example2b.js -var flatiron = require('./lib/flatiron'), - app = flatiron.app; - -var path = require('path'), - flatiron = require('./lib/flatiron'), - app = flatiron.app; - -app.use(flatiron.plugins.cli); - -app.commands.highfive = function (person, cb) { - this.log.info('High five to ' + person + '!'); - cb(null); -}; - -app.start(); -``` - -``` -% node example2b.js highfive Flatiron -info: High five to Flatiron! -``` - -### Define Ad-Hoc Commands With `app.cmd(path, handler)`: - -This adds the cli routing path `path` to the app's CLI router, using the [director](https://github.com/flatiron/director) route handler `handler`, aliasing `app.router.on`. `cmd` routes are defined the same way as http routes, except that it uses ` ` (a space) for a delimiter instead of `/`. - -For example: - -```js -// example.js -var flatiron = require('./lib/flatiron'), - app = flatiron.app; - -app.use(flatiron.plugins.cli, { - usage: [ - 'usage: node test.js hello ', - '', - ' This will print "hello "' - ] -}); - -app.cmd('hello :person', function (person) { - app.log.info('hello ' + person + '!'); -}); - -app.start() -``` - -When you run this program correctly, it will say hello: - -``` -% node example.js hello person -info: hello person! -``` - -If not, you get a friendly usage message: - -``` -% node test.js hello -help: usage: node test.js hello -help: -help: This will print "hello " -``` - -### Check CLI Arguments with `app.argv`: - -Once your app is started, `app.argv` will contain the [optimist](http://github.com/substack/node-optimist)-parsed argv options hash, ready to go! - -Here's an example: - -```js -// example3.js -var flatiron = require('./lib/flatiron'), - app = flatiron.app; - -app.use(flatiron.plugins.cli); - -app.start(); - -app.log.info(JSON.stringify(app.argv)); -``` - -This prints: - -``` -% node example3.js -info: {"_":[], "$0": "node ./example3.js"} -``` - -Awesome! - -### Add a Default Help Command with `options.usage`: - -When attaching the CLI plugin, just specify options.usage to get a friendly default message for when there aren't any matching routes: - -```js -// example4.js -var flatiron = require('./lib/flatiron'), - app = flatiron.app; - -app.use(flatiron.plugins.cli, { - usage: [ - 'Welcome to my app!', - 'Your command didn\'t do anything.', - 'This is expected.' - ] -}); - -app.start(); -``` - -``` -% node example4.js -help: Welcome to my app! -help: Your command didn't do anything. -help: This is expected. -``` - -### Start The Application with `app.start(callback)`: - -As seen in these examples, starting your app is as easy as `app.start`! this method takes a callback, which is called when an `app.command` completes. Here's a complete example demonstrating this behavior and how it integrates with `options.usage`: - -```js -// example5.js -var path = require('path'), - flatiron = require('./lib/flatiron'), - app = flatiron.app; - -app.use(flatiron.plugins.cli, { - usage: [ - '`node example5.js error`: Throws an error.', - '`node example5.js friendly`: Does not throw an error.' - ] -}); - -app.commands.error = function (cb) { - cb(new Error('I\'m an error!')); -}; - -app.commands.friendly = function (cb) { - cb(null); -} - -app.start(function (err) { - if (err) { - app.log.error(err.message || 'You didn\'t call any commands!'); - app.log.warn('NOT OK.'); - return process.exit(1); - } - app.log.info('OK.'); -}); -``` - -Here's how our app behaves: - -``` -% node example5.js friendly -info: OK. - -% node example5.js error -error: I'm an error! -warn: NOT OK. - -% node example5.js -help: `node example2b.js error`: Throws an error. -help: `node example2b.js friendly`: Does not throw an error. -error: You didn't call any commands! -warn: NOT OK. -``` - -# Read More About Flatiron! - -## Articles - -* [Scaling Isomorphic Javascript Code](http://blog.nodejitsu.com/scaling-isomorphic-javascript-code) -* [Introducing Flatiron](http://blog.nodejitsu.com/introducing-flatiron) -* [Writing CLI Apps with Flatiron](http://blog.jit.su/writing-cli-apps-with-flatiron) - -## Sub-Projects - -* [Broadway](https://github.com/flatiron/broadway) -* [Union](https://github.com/flatiron/union) -* [Director](https://github.com/flatiron/director) -* [Plates](https://github.com/flatiron/plates) -* [Resourceful](https://github.com/flatiron/resourceful) -* [And More](https://github.com/flatiron)! - -# Tests - -Tests are written in vows: - -``` bash - $ npm test -``` - -#### Author: [Nodejitsu Inc.](http://nodejitsu.com) -#### License: MIT diff --git a/node_modules/flatiron/bin/flatiron b/node_modules/flatiron/bin/flatiron deleted file mode 100755 index 15552d3..0000000 --- a/node_modules/flatiron/bin/flatiron +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env node - -var flatiron = require('../lib/flatiron'), - path = require('path'), - app = flatiron.app; - -var actions = { - create: 'Creates an empty template for a flatiron application' -}; - -app.use(flatiron.plugins.cli, { - dir: path.join(__dirname, '..', 'lib', 'flatiron', 'cli'), - usage: [ - 'flatiron', - '', - 'Commands:' - ].concat(Object.keys(actions).map(function(key){ - return ' ' + key + ' - ' + actions[key]; - })) -}); - -// -// Alias `flatiron create` to `flatiron new`. -// -app.alias('new', 'create'); - -app.start(); diff --git a/node_modules/flatiron/examples/cli-sample/index.js b/node_modules/flatiron/examples/cli-sample/index.js deleted file mode 100644 index cd8bc8a..0000000 --- a/node_modules/flatiron/examples/cli-sample/index.js +++ /dev/null @@ -1,28 +0,0 @@ -console.time('start'); -var flatiron = require('../../lib/flatiron'), - app = flatiron.app; - -require('pkginfo')(module, 'version'); - -app.version = exports.version; - -app.use(flatiron.plugins.cli, { - dir: __dirname, - usage: [ - 'Simple app example for flatiron!', - '', - 'app start - print a prompt and arguments', - 'print - echo a message' - ], - version: true -}); - -app.cmd('app start', function () { - console.timeEnd('start'); - console.dir('it works!!!'); - app.prompt.get('name', function (err, name) { - console.dir(arguments); - }) -}) - -app.start(); diff --git a/node_modules/flatiron/examples/cli-sample/print.js b/node_modules/flatiron/examples/cli-sample/print.js deleted file mode 100644 index ea2d2be..0000000 --- a/node_modules/flatiron/examples/cli-sample/print.js +++ /dev/null @@ -1,5 +0,0 @@ -var print = module.exports = function print(msg) { - console.log(msg); -} -print.usage = 'Print out a '; - diff --git a/node_modules/flatiron/examples/http-sample.js b/node_modules/flatiron/examples/http-sample.js deleted file mode 100644 index be752e0..0000000 --- a/node_modules/flatiron/examples/http-sample.js +++ /dev/null @@ -1,30 +0,0 @@ -var util = require('util'), - flatiron = require('../lib/flatiron'), - app = flatiron.app; - -app.use(flatiron.plugins.http); - -app.router.get('/', function () { - this.res.writeHead(200, { 'Content-Type': 'text/plain' }); - this.res.end('Hello world!\n'); -}); - -app.router.post('/', function () { - this.res.writeHead(200, { 'Content-Type': 'text/plain' }); - this.res.write('Hey, you posted some cool data!\n'); - this.res.end(util.inspect(this.req.body, true, 2, true) + '\n'); -}); - -app.router.get('/sandwich/:type', function (type) { - if (~['bacon', 'burger'].indexOf(type)) { - this.res.writeHead(200, { 'Content-Type': 'text/plain' }); - this.res.end('Serving ' + type + ' sandwich!\n'); - } - else { - this.res.writeHead(404, { 'Content-Type': 'text/plain' }); - this.res.end('No such sandwich, sorry!\n'); - } -}); - -app.start(8080); - diff --git a/node_modules/flatiron/examples/socket.io/index.html b/node_modules/flatiron/examples/socket.io/index.html deleted file mode 100644 index 9798bb0..0000000 --- a/node_modules/flatiron/examples/socket.io/index.html +++ /dev/null @@ -1,8 +0,0 @@ - - diff --git a/node_modules/flatiron/examples/socket.io/server.js b/node_modules/flatiron/examples/socket.io/server.js deleted file mode 100644 index 6bf4147..0000000 --- a/node_modules/flatiron/examples/socket.io/server.js +++ /dev/null @@ -1,44 +0,0 @@ -// Socket.io configuration for Flatiron -// -------------------------------------------------- // - -var flatiron = require('../../lib/flatiron'), - fs = require("fs"), - app = flatiron.app; - -app.use(flatiron.plugins.http, { - - before: [function (req, res) { - - fs.readFile(__dirname + '/index.html', function (err, data) { - - if (err) { - res.writeHead(500); - return res.end('Error loading index.html'); - } - - res.writeHead(200); - res.end(data); - - }); - - }] -}); - - -// Set the server to listen on port `8080`. -// It is important to do this first, as app.server -// isn't actually created until you start() -app.start(8080); - - -// Socket.io -// -------------------------------------------------- // - -var io = require('socket.io').listen(app.server); - -io.sockets.on('connection', function(socket) { - socket.emit('news', { hello: 'world' }); - socket.on('my other event', function(data) { - console.log(data); - }); -}); diff --git a/node_modules/flatiron/lib/flatiron.js b/node_modules/flatiron/lib/flatiron.js deleted file mode 100644 index cc33b7f..0000000 --- a/node_modules/flatiron/lib/flatiron.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * flatiron.js: An elegant blend of convention and configuration for building apps in Node.js and the browser. - * - * Copyright(c) 2011 Nodejitsu Inc. - * MIT LICENCE - * - */ - -var fs = require('fs'), - path = require('path'), - broadway = require('broadway'); - -var flatiron = exports, - _app; - -// -// Expose version through `pkginfo` -// -require('pkginfo')(module, 'version'); - -// -// ### Export core `flatiron` modules -// -flatiron.common = require('./flatiron/common'); -flatiron.constants = require('./flatiron/constants'); -flatiron.formats = broadway.formats; -flatiron.App = require('./flatiron/app').App; - -// -// ### Expose core `flatiron` plugins -// Hoist those up from `broadway` and define each of -// the `flatiron` plugins as a lazy loaded `require` statement -// -flatiron.plugins = broadway.common.mixin( - {}, - broadway.plugins, - broadway.common.requireDirLazy(path.join(__dirname, 'flatiron', 'plugins')) -); - -// -// ### getter @app {flatiron.App} -// Gets the default top-level Application for `flatiron` -// -flatiron.__defineGetter__('app', function () { - if (!_app) { - _app = new flatiron.App(); - } - - return _app; -}); - -// -// ### setter @app {flatiron.App} -// Sets the default top-level Application for `flatiron` -// -flatiron.__defineSetter__('app', function (value) { - _app = value; -}); - -// -// ### function createApp (options) -// #### @options {Object} Options for the application to create -// Creates a new instance of `flatiron.App` with the -// specified `options`. -// -flatiron.createApp = function (options) { - return new flatiron.App(options); -}; - diff --git a/node_modules/flatiron/lib/flatiron/app.js b/node_modules/flatiron/lib/flatiron/app.js deleted file mode 100644 index 934e84c..0000000 --- a/node_modules/flatiron/lib/flatiron/app.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * app.js: Core Application object for managing plugins and features in broadway - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var fs = require('fs'), - path = require('path'), - util = require('util'), - broadway = require('broadway'), - directories = broadway.common.directories, - constants = require('./constants'); - -var App = exports.App = function (options) { - broadway.App.call(this, options); -}; - -// -// Inherit from `broadway.App`. -// -util.inherits(App, broadway.App); - -// -// ### function init (callback) -// #### @callback {function} Continuation to respond to when complete. -// Initializes this instance of `flatiron.App` -// -App.prototype.init = function () { - broadway.App.prototype.init.apply(this, Array.prototype.slice.call(arguments)); -}; - -// -// Helper function for generating default configuration -// settings for App instances. -// -function configSettings() { - var sources = [], - configDir = this.options.directories['config'], - envDir = this.options.directories['env']; - - tryReaddirSync(configDir).forEach(function (file) { - if (path.extname(file) === '.json') { - sources.push({ - file: path.join(configDir, file), - name: path.basename(file), - type: 'file' - }); - } - }); - - return sources; -} - -function tryReaddirSync(dir) { - try { return fs.readdirSync(dir) } - catch (err) { return [] } -} diff --git a/node_modules/flatiron/lib/flatiron/cli/create.js b/node_modules/flatiron/lib/flatiron/cli/create.js deleted file mode 100644 index 1475ea3..0000000 --- a/node_modules/flatiron/lib/flatiron/cli/create.js +++ /dev/null @@ -1,81 +0,0 @@ -var fs = require('fs'), - path = require('path'), - flatiron = require('../../flatiron'), - common = flatiron.common, - async = common.async, - directories = common.directories, - cpr = common.cpr, - app = flatiron.app; - -module.exports = function create(name, type, callback) { - name = name || 'flatiron-app'; - type = type || 'http'; - - var root = path.join(process.cwd(), name), - scaffold = path.join(__dirname, '..', '..', '..', 'scaffolds', type); - - // - // Creates directories specified in `/scaffolds/:type/directories.json`. - // - function createDirs(next) { - var dirs = directories.normalize(root, - JSON.parse(fs.readFileSync(path.join(scaffold, 'directories.json'), 'utf8')) - ); - - Object.keys(dirs).forEach(function (name) { - app.log.info('Creating directory ' + name.grey); - }); - - directories.create(dirs, next); - } - - // - // Creates a templated package.json from `/scaffolds/:type/package.json`. - // - function createPackage(next) { - var pkg = JSON.parse(fs.readFileSync(path.join(scaffold, 'package.json'), 'utf8')); - - pkg.name = name; - pkg.dependencies.flatiron = flatiron.version; - - app.log.info('Writing ' + 'package.json'.grey); - fs.writeFile(path.join(root, 'package.json'), JSON.stringify(pkg, null, 2) + '\n', next); - } - - // - // Writes the `app.js` - // - function writeApp(next) { - app.log.info('Writing ' + 'app.js'.grey); - cpr(path.join(scaffold, 'app.js'), path.join(root, 'app.js'), next); - } - - // - // Writes the top-level include for the app - // - function writeMain(next) { - app.log.info('Writing ' + ('lib/index.js').grey); - fs.writeFile(path.join(root, 'lib', 'index.js'), '', next); - } - - app.log.info('Creating application ' + name.magenta) - app.log.info('Using ' + type.yellow + ' scaffold.'); - async.series([ - createDirs, - createPackage, - writeApp, - writeMain - ], function onComplete(next) { - app.log.info('Application ' + name.magenta + ' is now ready'); - callback(); - } - ); -} - -module.exports.usage = [ - 'Generates a flatiron skeleton application. If no ', - 'is specified an HTTP application will be created.', - ' can currently be either cli or http', - '', - 'create ', -]; diff --git a/node_modules/flatiron/lib/flatiron/common.js b/node_modules/flatiron/lib/flatiron/common.js deleted file mode 100644 index f31883f..0000000 --- a/node_modules/flatiron/lib/flatiron/common.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * common.js: Common utility functions for flatiron. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var broadway = require('broadway'); - -// -// Hoist `broadway.common` to `flatiron.common`. -// -var common = module.exports = broadway.common.mixin({}, broadway.common); - -// -// ### function templateUsage (app, commands) -// Updates the references to `` to `app.name` in usage for the -// specified `commands`. -// -common.templateUsage = function (app, commands) { - if (!app.name) { - return commands; - } - - function templateUsage(usage) { - return usage.map(function (line) { - return line.replace(/\/ig, app.name); - }); - } - - Object.keys(commands).forEach(function (command) { - if (command === 'usage') { - commands.usage = templateUsage(commands.usage); - } - else if (commands[command].usage) { - commands[command].usage = templateUsage(commands[command].usage); - } - }); -}; \ No newline at end of file diff --git a/node_modules/flatiron/lib/flatiron/constants.js b/node_modules/flatiron/lib/flatiron/constants.js deleted file mode 100644 index 8a72b14..0000000 --- a/node_modules/flatiron/lib/flatiron/constants.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * constants.js: Constants within the Flatiron framework. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var constants = exports; - -constants.DIRECTORIES = { - "app": "#ROOT/app", - "config": "#ROOT/config", - "docs": "#ROOT/docs", - "env": "#ROOT/config/env", - "log": "#ROOT/log", - "test": "#ROOT/test" -}; \ No newline at end of file diff --git a/node_modules/flatiron/lib/flatiron/plugins/cli.js b/node_modules/flatiron/lib/flatiron/plugins/cli.js deleted file mode 100644 index bb36feb..0000000 --- a/node_modules/flatiron/lib/flatiron/plugins/cli.js +++ /dev/null @@ -1,434 +0,0 @@ -/* - * index.js: Top-level plugin exposing CLI features in flatiron - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var fs = require('fs'), - path = require('path'), - flatiron = require('../../flatiron'), - common = flatiron.common, - director = require('director'); - -// -// ### Name this plugin -// -exports.name = 'cli'; - -// -// ### function attach (options, done) -// #### @options {Object} Options for this plugin -// Initializes `this` (the application) with the core `cli` plugins consisting of: -// `argv`, `prompt`, `routing`, `commands` in that order. -// -exports.attach = function (options) { - var app = this; - options = options || {}; - - // - // Setup `this.argv` to use `optimist`. - // - exports.argv.call(this, options.argv); - app.use(flatiron.plugins.inspect); - - // - // If `options.version` is truthy, `app.version` is defined and `-v` or - // `--version` command line parameters were passed, print out `app.version` - // and exit. - // - if (options.version && app.version && (this.argv.v || this.argv.version)) { - console.log(app.version); - process.exit(0); - } - - // - // Setup `this.prompt`. - // - exports.prompt.call(this, options.prompt); - - // - // Setup `app.router` and associated core routing method. - // - app.cli = {} - app.router = new director.cli.Router().configure({ - async: app.async || options.async - }); - - app.start = function (options, callback) { - if (!callback && typeof options === 'function') { - callback = options; - options = {}; - } - - callback = callback || function () {}; - app.init(options, function (err) { - if (err) { - return callback(err); - } - - app.router.dispatch('on', app.argv._.join(' '), app.log, callback); - }); - }; - - app.cmd = function (path, handler) { - app.router.on(path, handler); - }; - - exports.commands.call(this, options); -}; - -// -// ### function init (done) -// #### @done {function} Continuation to respond to when complete -// Initializes this plugin by setting `winston.cli` (i.e. `app.log.cli`) -// to enable colors and padded levels. -// -exports.init = function (done) { - var app = this, - logger; - - if (!app.log.help) { - logger = app.log.get('default'); - logger.cli().extend(app.log); - } - - if (app.config) { - // - // Create a literal store for argv to - // avoid re-parsing CLI options. - // - app.config.use('argv', { - type: 'literal', - store: app.argv - }); - - app.config.env(); - } - - done(); -}; - -// -// ### function argv (options) -// #### @options {Object} Pass-thru options for optimist -// Sets up `app.argv` using `optimist` and the specified options. -// -exports.argv = function (options) { - var optimist; - - if (options && Object.keys(options).length) { - optimist = require('optimist').options(options); - this.showOptions = optimist.help; - this.argv = optimist.argv; - } - else { - optimist = require('optimist'); - this.showOptions = optimist.help; - this.argv = optimist.argv; - } -}; - -// -// ### function commands (options) -// #### @options {Object} Options for the application commands -// Configures the `app.commands` object which is lazy-loaded from disk -// along with some default logic for: `help` and `alias`. -// -exports.commands = function (options) { - var app = this; - - function showUsage(target) { - target = Array.isArray(target) ? target : target.split('\n'); - target.forEach(function (line) { - app.log.help(line); - }); - - var lines = app.showOptions().split('\n').filter(Boolean); - - if (lines.length) { - app.log.help(''); - lines.forEach(function (line) { - app.log.help(line); - }); - } - } - - // - // Setup any pass-thru options to the - // application instance but make them lazy - // - app.usage = options.usage; - app.cli.source = options.dir || options.source; - app.commands = app.commands || {}; - - // - // Helper function which loads the file for the - // specified `name` into `app.commands`. - // - function loadCommand(name, command, silent) { - var resource = app.commands[name]; - - if (resource && (!command || resource[command])) { - return true; - } - - if (app.cli.source) { - if (!app.cli.sourceDir) { - try { - var stats = fs.statSync(app.cli.source); - app.cli.sourceDir = stats.isDirectory(); - } - catch (ex) { - showUsage(app.usage || [ - 'Cannot find commands for ' + name.magenta - ]); - - return false; - } - } - - try { - if (app.cli.sourceDir) { - app.commands[name] = require(path.join(app.cli.source, name)); - } - else { - app.commands = common.mixin(app.commands, require(app.cli.source)); - } - return true; - } - catch (err) { - // If that file could not be found, error message should start with - // "Cannot find module" and contain the name of the file we tried requiring. - if (!err.message.match(/^Cannot find module/) || (name && err.message.indexOf(name) === -1)) { - throw err; - } - - if (!silent) { - showUsage(app.usage || [ - 'Cannot find commands for ' + name.magenta - ]); - } - - return false; - } - } - } - - // - // Helper function to ensure the user wishes to execute - // a destructive command. - // - function ensureDestroy(callback) { - app.prompt.get(['destroy'], function (err, result) { - if (result.destroy !== 'yes' && result.destroy !== 'y') { - app.log.warn('Destructive operation cancelled'); - return callback(true); - } - - callback(); - }); - } - - // - // Helper function which executes the command - // represented by the Array of `parts` passing - // control to the `callback`. - // - function executeCommand(parts, callback) { - var name, - shouldLoad = true, - command, - usage; - - if (typeof parts === 'undefined' || typeof parts === 'function') { - throw(new Error('parts is a required argument of type Array')); - } - - name = parts.shift(); - - if (app.cli.source || app.commands[name]) { - if (app.commands[name]) { - shouldLoad = false; - if (typeof app.commands[name] != 'function' && !app.commands[name][parts[0]]) { - shouldLoad = true; - } - } - - if (shouldLoad && !loadCommand(name, parts[0])) { - return callback(); - } - - command = app.commands[name]; - while (command) { - usage = command.usage; - - if (!app.argv.h && !app.argv.help && typeof command === 'function') { - while (parts.length + 1 < command.length) { - parts.push(null); - } - - if (command.destructive) { - return ensureDestroy(function (err) { - return err ? callback() : command.apply(app, parts.concat(callback)); - }) - } - - command.apply(app, parts.concat(callback)); - return; - } - - command = command[parts.shift()]; - } - - // - // Since we have not resolved a needle, try and print out a usage message - // - if (usage || options.usage) { - showUsage(usage || options.usage); - callback(false); - } - } - else if (app.usage) { - // - // If there's no directory we're supposed to search for modules, simply - // print out usage notice if it's provided. - // - showUsage(options.usage); - callback(true); - } - } - - // - // Expose the executeCommand method - // - exports.executeCommand = executeCommand; - - // - // Allow commands to be aliased to subcomponents. e.g. - // - // app.alias('list', { resource: 'apps', command: 'list' }); - // app.alias('new', { command: 'create' }); - // app.alias('new', 'create'); - // - app.alias = function (target, source) { - app.commands.__defineGetter__(target, function () { - - var resource = source.resource || source.command || source, - command = source.resource ? source.command : null; - - loadCommand(resource, command, true); - resource = app.commands[resource]; - - if (resource) { - return source.resource && source.command - ? resource[source.command] - : resource; - } - }); - }; - - // - // Set the `loadCommand` function to run - // whenever the router has not matched - // the CLI arguments, `process.argv`. - // - app.router.notfound = function (callback) { - executeCommand(app.argv._.slice(), callback); - }; - - // - // Setup default help command - // - app.cmd(/help ([^\s]+)?\s?([^\s]+)?/, app.showHelp = function showHelp() { - var args = Array.prototype.slice.call(arguments).filter(Boolean), - callback = typeof args[args.length - 1] === 'function' && args.pop(), - resource, - usage; - - function displayAndRespond(found) { - showUsage(usage || app.usage); - if (!found) { - app.log.warn('Cannot find help for ' + args.join(' ').magenta); - } - - if (callback) { - callback(); - } - } - - if (!loadCommand(args[0], args[1], true)) { - return displayAndRespond(false); - } - - resource = app.commands[args[0]]; - usage = resource.usage; - - for (var i = 1; i < args.length; i++) { - if (!resource[args[i]]) { - return displayAndRespond(false); - } - else if (resource[args[i]].usage) { - resource = resource[args[i]]; - usage = resource.usage; - } - } - - displayAndRespond(true); - }); -}; - -// -// ### function prompt (options) -// #### @options {Object} Options for the prompt. -// Sets up the application `prompt` property to be a lazy -// setting which loads the `prompt` module. -// -exports.prompt = function (options) { - options = options || {}; - - this.__defineGetter__('prompt', function () { - if (!this._prompt) { - // - // Pass-thru any prompt specific options that are supplied. - // - var prompt = require('prompt'), - self = this; - - prompt.allowEmpty = options.allowEmpty || prompt.allowEmpty; - prompt.message = options.message || prompt.message; - prompt.delimiter = options.delimiter || prompt.delimiter; - prompt.properties = options.properties || prompt.properties; - - // - // Setup `destroy` property for destructive commands - // - prompt.properties.destroy = { - name: 'destroy', - message: 'This operation cannot be undone, Would you like to proceed?', - default: 'yes' - }; - - // - // Hoist up any prompt specific events and re-emit them as - // `prompt::*` events. - // - ['start', 'pause', 'resume', 'prompt', 'invalid'].forEach(function (ev) { - prompt.on(ev, function () { - var args = Array.prototype.slice.call(arguments); - self.emit.apply(self, [['prompt', ev]].concat(args)); - }); - }); - - // - // Extend `this` (the application) with prompt functionality - // and open `stdin`. - // - this._prompt = prompt; - this._prompt.start().pause(); - } - - return this._prompt; - }); -}; diff --git a/node_modules/flatiron/lib/flatiron/plugins/http.js b/node_modules/flatiron/lib/flatiron/plugins/http.js deleted file mode 100644 index e48fd1e..0000000 --- a/node_modules/flatiron/lib/flatiron/plugins/http.js +++ /dev/null @@ -1,91 +0,0 @@ -/* - * http.js: Top-level plugin exposing HTTP features in flatiron - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var director = require('director'), - flatiron = require('../../flatiron'), - union; - -try { - // - // Attempt to require union. - // - union = require('union'); -} -catch (ex) { - // - // Do nothing since this is a progressive enhancement - // - console.warn('flatiron.plugins.http requires the `union` module from npm'); - console.warn('install using `npm install union`.'); - console.trace(); - process.exit(1); -} - -// -// Name this plugin. -// -exports.name = 'http'; - -exports.attach = function (options) { - var app = this; - - // - // Define the `http` namespace on the app for later use - // - app.http = app.http || options || {}; - app.http.before = app.http.before || []; - app.http.after = app.http.after || []; - app.http.headers = app.http.headers || { - 'x-powered-by': 'flatiron ' + flatiron.version - }; - - app.router = new director.http.Router().configure({ - async: true - }); - - app.start = function (port, host, callback) { - if (!callback && typeof host === 'function') { - callback = host; - host = null; - } - - app.init(function (err) { - if (err) { - if (callback) { - return callback(err); - } - - throw err; - } - - app.listen(port, host, callback); - }); - }; - - app.listen = function (port, host, callback) { - if (!callback && typeof host === 'function') { - callback = host; - host = null; - } - - app.server = union.createServer({ - after: app.http.after, - before: app.http.before.concat(function (req, res) { - if (!app.router.dispatch(req, res, app.http.onError || union.errorHandler)) { - if (!app.http.onError) res.emit('next'); - } - }), - headers: app.http.headers, - limit: app.http.limit - }); - - return host - ? app.server.listen(port, host, callback) - : app.server.listen(port, callback); - }; -}; diff --git a/node_modules/flatiron/node_modules/broadway/.npmignore b/node_modules/flatiron/node_modules/broadway/.npmignore deleted file mode 100644 index d567f61..0000000 --- a/node_modules/flatiron/node_modules/broadway/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -npm-debug.log -.DS_Store - diff --git a/node_modules/flatiron/node_modules/broadway/.travis.yml b/node_modules/flatiron/node_modules/broadway/.travis.yml deleted file mode 100644 index c958222..0000000 --- a/node_modules/flatiron/node_modules/broadway/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 - - 0.7 - -notifications: - email: - - travis@nodejitsu.com - irc: "irc.freenode.org#nodejitsu" - diff --git a/node_modules/flatiron/node_modules/broadway/LICENSE b/node_modules/flatiron/node_modules/broadway/LICENSE deleted file mode 100644 index 1f01e2b..0000000 --- a/node_modules/flatiron/node_modules/broadway/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011 Nodejitsu Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/README.md b/node_modules/flatiron/node_modules/broadway/README.md deleted file mode 100644 index 478ce50..0000000 --- a/node_modules/flatiron/node_modules/broadway/README.md +++ /dev/null @@ -1,124 +0,0 @@ -# broadway [![Build Status](https://secure.travis-ci.org/flatiron/broadway.png)](http://travis-ci.org/flatiron/broadway) - -*Lightweight application extensibility and composition with a twist of feature -reflection.* - -## Example - -### app.js -```js -var broadway = require("broadway"); - -var app = new broadway.App(); - -// Passes the second argument to `helloworld.attach`. -app.use(require("./plugins/helloworld"), { "delimiter": "!" } ); - -app.init(function (err) { - if (err) { - console.log(err); - } -}); - -app.hello("world"); -``` - -### plugins/helloworld.js - -```js -// `exports.attach` gets called by broadway on `app.use` -exports.attach = function (options) { - - this.hello = function (world) { - console.log("Hello "+ world + options.delimiter || "."); - } - -}; - -// `exports.init` gets called by broadway on `app.init`. -exports.init = function (done) { - - // This plugin doesn't require any initialization step. - return done(); - -}; -``` - -### run it! - -```bash -josh@onix:~/dev/broadway/examples$ node simple/app.js -Hello world! -josh@onix:~/dev/broadway/examples$ -``` - -## Installation - -### Installing npm (node package manager) -``` bash - $ curl http://npmjs.org/install.sh | sh -``` - -### Installing broadway -``` bash - $ [sudo] npm install broadway -``` - -## API - -### App#init(callback) - -Initialize application and it's plugins, `callback` will be called with null or -initialization error as first argument. - -### App#use(plugin, options) - -Attach plugin to application. `plugin` should conform to following interface: - -```javascript -var plugin = { - "name": "example-plugin", // Plugin's name - - "attach": function attach(options) { - // Called with plugin options once plugin attached to application - // `this` - is a reference to application - }, - - "detach": function detach() { - // Called when plugin detached from application - // (Only if plugin with same name was attached) - // `this` - is a reference to application - } - - "init": function init(callback) { - // Called on application initialization - // App#init(callback) will be called once every plugin will call `callback` - // `this` - is a reference to application - } -}; -``` - -### App#on(event, callback) and App#emit(event, data) - -App inherits from [EventEmitter2][2], and many plugins build on this -functionality. - -#### Built-In Events: - -* `error:init`: Broadway emits this event when it throws an error while attempting to initialize. - -Read the [EventEmitter2][2] documentation for more information. - -## Tests -All tests are written with [vows][0] and should be run with [npm][1]: - -``` bash - $ npm test -``` - -#### [Charlie Robbins](http://nodejitsu.com) -#### License: MIT - -[0]: http://vowsjs.org -[1]: http://npmjs.org -[2]: https://github.com/hij1nx/EventEmitter2 diff --git a/node_modules/flatiron/node_modules/broadway/bin/build b/node_modules/flatiron/node_modules/broadway/bin/build deleted file mode 100755 index ca128ba..0000000 --- a/node_modules/flatiron/node_modules/broadway/bin/build +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env node - -var Codesurgeon = require('codesurgeon').Codesurgeon; -var surgeon = new Codesurgeon; - -var path = require('path'); - -var root = path.join(__dirname, '..'); -var lib = path.join(root, 'lib', 'broadway'); - -// -// Distill and package the browser version. -// -surgeon - // - .configure({ - package: root + '/package.json', - owner: 'Nodejitsu, Inc (Using Codesurgeon).' - }) - .read( - path.join(root, 'node_modules', 'eventemitter2', 'lib', 'eventemitter2.js'), - path.join(lib, 'browser.js') - ) - // - // we want everything so far. specify extract with no - // parameters to get everything into the output buffer. - // - .extract() - // - // clear the input so far, but don't clear the output. - // - .clear('inputs') - // - // read the `app.js` file - // - .read( - path.join(lib, 'app.js') - ) - // - // the current input buffer contains stuff that we dont - // want in the browser build, so let's cherry pick from - // the buffer. - // - .extract( - 'App.prototype.init', - 'App.prototype.use', - 'App.prototype.remove', - 'App.prototype.inspect' - ) - // - // wrap everything that is in the current buffer with a - // closure so that we dont get any collisions with other - // libraries - // - .wrap() - // - // write the debuggable version of the file. This file will - // get renamed to include the version from the package.json - // - .write(root + '/build/broadway.js') - // - // now lets make a minified version for production use. - // - .uglify() - .write(root + '/build/broadway.min.js') -; diff --git a/node_modules/flatiron/node_modules/broadway/examples/browser/app.js b/node_modules/flatiron/node_modules/broadway/examples/browser/app.js deleted file mode 100644 index 7851df3..0000000 --- a/node_modules/flatiron/node_modules/broadway/examples/browser/app.js +++ /dev/null @@ -1,12 +0,0 @@ - -var app = new App(); - -app.use(HelloWorld, { "delimiter": "!" } ); - -app.init(function (err) { - if (err) { - console.log(err); - } -}); - -app.hello("world"); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/examples/browser/index.html b/node_modules/flatiron/node_modules/broadway/examples/browser/index.html deleted file mode 100644 index 4a88d9a..0000000 --- a/node_modules/flatiron/node_modules/broadway/examples/browser/index.html +++ /dev/null @@ -1,11 +0,0 @@ - - - Example - - - - - - - - diff --git a/node_modules/flatiron/node_modules/broadway/examples/browser/plugins/helloworld.js b/node_modules/flatiron/node_modules/broadway/examples/browser/plugins/helloworld.js deleted file mode 100644 index 7c9afbe..0000000 --- a/node_modules/flatiron/node_modules/broadway/examples/browser/plugins/helloworld.js +++ /dev/null @@ -1,23 +0,0 @@ - -window.HelloWorld = {}; - -// -// `exports.attach` gets called by broadway on `app.use` -// -HelloWorld.attach = function (options) { - - this.hello = function (world) { - console.log("Hello "+ world + options.delimiter || "."); - } -}; - -// -// `exports.init` gets called by broadway on `app.init`. -// -HelloWorld.init = function (done) { - - // - // This plugin doesn't require any initialization step. - // - return done(); -}; diff --git a/node_modules/flatiron/node_modules/broadway/examples/nodejs/app.js b/node_modules/flatiron/node_modules/broadway/examples/nodejs/app.js deleted file mode 100644 index 2c1dd3e..0000000 --- a/node_modules/flatiron/node_modules/broadway/examples/nodejs/app.js +++ /dev/null @@ -1,13 +0,0 @@ - -var app = new (require("broadway").App)(); - -// Passes the second argument to `helloworld.attach`. -app.use(require("./plugins/helloworld"), { "delimiter": "!" } ); - -app.init(function (err) { - if (err) { - console.log(err); - } -}); - -app.hello("world"); diff --git a/node_modules/flatiron/node_modules/broadway/examples/nodejs/plugins/helloworld.js b/node_modules/flatiron/node_modules/broadway/examples/nodejs/plugins/helloworld.js deleted file mode 100644 index ed0738d..0000000 --- a/node_modules/flatiron/node_modules/broadway/examples/nodejs/plugins/helloworld.js +++ /dev/null @@ -1,23 +0,0 @@ - -var HelloWorld = exports; - -// -// `exports.attach` gets called by broadway on `app.use` -// -HelloWorld.attach = function (options) { - - this.hello = function (world) { - console.log("Hello "+ world + options.delimiter || "."); - } -}; - -// -// `exports.init` gets called by broadway on `app.init`. -// -HelloWorld.init = function (done) { - - // - // This plugin doesn't require any initialization step. - // - return done(); -}; diff --git a/node_modules/flatiron/node_modules/broadway/lib/broadway.js b/node_modules/flatiron/node_modules/broadway/lib/broadway.js deleted file mode 100644 index 14cabe9..0000000 --- a/node_modules/flatiron/node_modules/broadway/lib/broadway.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * broadway.js: Top-level include for the broadway module. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var path = require('path'), - utile = require('utile'); - -var broadway = exports; - -broadway.App = require('./broadway/app').App; -broadway.common = require('./broadway/common'); -broadway.features = require('./broadway/features'); -broadway.formats = require('nconf').formats; -broadway.plugins = utile.requireDirLazy(path.join(__dirname, 'broadway', 'plugins')); - diff --git a/node_modules/flatiron/node_modules/broadway/lib/broadway/app.js b/node_modules/flatiron/node_modules/broadway/lib/broadway/app.js deleted file mode 100644 index 06aa712..0000000 --- a/node_modules/flatiron/node_modules/broadway/lib/broadway/app.js +++ /dev/null @@ -1,215 +0,0 @@ -/* - * app.js: Core Application object for managing plugins and features in broadway - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var utile = require('utile'), - async = utile.async, - events = require('eventemitter2'), - bootstrapper = require('./bootstrapper'), - common = require('./common'), - constants = require('./constants'), - features = require('./features'); - -var App = exports.App = function (options) { - // - // Setup options and `App` constants. - // - var self = this; - options = options || {}; - this.root = options.root; - this.delimiter = options.delimiter || constants.DELIMITER; - - // - // Inherit from `EventEmitter2` - // - events.EventEmitter2.call(this, { - delimiter: this.delimiter, - wildcard: true - }); - - // - // Setup other relevant options such as the plugins - // for this instance. - // - this.options = options; - this.env = options.env || process.env['NODE_ENV'] || 'development' - this.plugins = options.plugins || {}; - this.initialized = false; - this.bootstrapper = options.bootstrapper || bootstrapper; - this.initializers = {}; - - // - // Bootstrap this instance - // - this.bootstrapper.bootstrap(this); -}; - -// -// Inherit from `EventEmitter2`. -// -utile.inherits(App, events.EventEmitter2); - -// -// ### function init (options, callback) -// #### @options {Object} **Optional** Additional options to initialize with. -// #### @callback {function} Continuation to respond to when complete. -// Initializes this instance by the following procedure: -// -// 1. Initializes all plugins (starting with `core`). -// 2. Creates all directories in `this.config.directories` (if any). -// 3. Ensures the files in the core directory structure conform to the -// features required by this application. -// -App.prototype.init = function (options, callback) { - if (!callback && typeof options === 'function') { - callback = options; - options = {}; - } - - if (this.initialized) { - return callback(); - } - - var self = this; - options = options || {}; - callback = callback || function () {}; - this.env = options.env || this.env; - this.options = common.mixin({}, this.options, options); - - function onComplete() { - self.initialized = true; - self.emit('init'); - callback(); - } - - function ensureFeatures (err) { - return err - ? onError(err) - : features.ensure(this, onComplete); - } - - function initPlugin(plugin, next) { - if (typeof self.initializers[plugin] === 'function') { - return self.initializers[plugin].call(self, function (err) { - if (err) { - return next(err); - } - - self.emit(['plugin', plugin, 'init']); - self.initializers[plugin] = true; - next(); - }); - } - - next(); - } - - function initPlugins() { - async.forEach(Object.keys(self.initializers), initPlugin, ensureFeatures); - } - - // - // Emit and respond with any errors that may short - // circuit the process. - // - function onError(err) { - self.emit(['error', 'init'], err); - callback(err); - } - - // - // Run the bootstrapper, initialize plugins, and - // ensure features for this instance. - // - this.bootstrapper.init(this, initPlugins); -}; - -// -// ### function use(plugin, callback) -// Attachs the plugin with the specific name to this `App` instance. -// -App.prototype.use = function (plugin, options, callback) { - options = options || {}; - - var name = plugin.name, - self = this; - - // If the plugin doesn't have a name, use itself as an identifier for the plugins hash. - if (name == null) { - name = common.uuid(); - } - - if (this.plugins[name] && this.plugins[name].detach) { - this.plugins[name].detach(this); - } - - // - // Setup state on this instance for the specified plugin - // - this.plugins[name] = plugin; - this.options[name] = common.mixin({}, options, this.options[name] || {}); - - // - // Attach the specified plugin to this instance, extending - // the `App` with new functionality. - // - if (this.plugins[name].attach && options.attach !== false) { - this.plugins[name].attach.call(this, options); - } - - // - // Setup the initializer only if `options.init` is - // not false. This allows for some plugins to be lazy-loaded - // - if (options.init === false) { - return; - } - - if (!this.initialized) { - this.initializers[name] = plugin.init || true; - } - else if (plugin.init) { - plugin.init.call(this, function (err) { - var args = err - ? [['plugin', name, 'error'], err] - : [['plugin', name, 'init']]; - - self.emit.apply(self, args); - if (callback) { - return err ? callback(err) : callback(); - } - }); - } -}; - -// -// ### function remove(name) -// Detaches the plugin with the specific name from this `App` instance. -// -App.prototype.remove = function (name) { - // if this is a plugin object set the name to the plugins name - if (name.name) { - name = name.name; - } - - if (this.plugins[name] && this.plugins[name].detach) { - this.plugins[name].detach.call(this); - } - - delete this.plugins[name]; - delete this.options[name]; - delete this.initializers[name]; -} - -// -// ### function inspect () -// Inspects the modules and features used by the current -// application directory structure -// -App.prototype.inspect = function () { - -}; diff --git a/node_modules/flatiron/node_modules/broadway/lib/broadway/bootstrapper.js b/node_modules/flatiron/node_modules/broadway/lib/broadway/bootstrapper.js deleted file mode 100644 index 1841bea..0000000 --- a/node_modules/flatiron/node_modules/broadway/lib/broadway/bootstrapper.js +++ /dev/null @@ -1,51 +0,0 @@ -/* - * bootstrapper.js: Default logic for bootstrapping broadway applications. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var broadway = require('../broadway'); - -// -// ### bootstrap (app, callback) -// #### @app {broadway.App} Application to bootstrap -// #### @callback {function} Continuation to respond to when complete. -// Bootstraps the specified `app`. -// -exports.bootstrap = function (app) { - app.options['config'] = app.options['config'] || {}; - app.options['config'].init = false; - app.use(broadway.plugins.config); - - // - // Remove initializers run by the bootstrapper. - // - delete app.initializers['config']; - - // - // Set the current environment in the config - // - app.config.set('env', app.env); -}; - -// -// ### bootstrap (app, callback) -// #### @app {broadway.App} Application to bootstrap -// #### @callback {function} Continuation to respond to when complete. -// Runs the initialization step of the bootstrapping process -// for the specified `app`. -// -exports.init = function (app, callback) { - broadway.plugins.config.init.call(app, function (err) { - if (err) { - return callback(err); - } - - app.use(broadway.plugins.exceptions, app.options['exceptions'] || {}); - app.use(broadway.plugins.directories, app.options['directories'] || {}); - app.use(broadway.plugins.log, app.options['log'] || {}); - callback(); - }); -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/lib/broadway/browser.js b/node_modules/flatiron/node_modules/broadway/lib/broadway/browser.js deleted file mode 100644 index 9065045..0000000 --- a/node_modules/flatiron/node_modules/broadway/lib/broadway/browser.js +++ /dev/null @@ -1,70 +0,0 @@ - -/* - * browser.js: Browser specific functionality for broadway. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var common = { - mixin: function (target) { - var objs = Array.prototype.slice.call(arguments, 1); - objs.forEach(function (o) { - Object.keys(o).forEach(function (attr) { - var getter = o.__lookupGetter__(attr); - if (!getter) { - target[attr] = o[attr]; - } - else { - target.__defineGetter__(attr, getter); - } - }); - }); - - return target; - } -}; - -var App = exports.App = function (options) { - // - // Setup options and `App` constants. - // - var self = this; - options = options || {}; - this.root = options.root; - this.delimiter = options.delimiter || '::'; - - // - // Inherit from `EventEmitter2` - // - exports.EventEmitter2.call(this, { - delimiter: this.delimiter, - wildcard: true - }); - - // - // Setup other relevant options such as the plugins - // for this instance. - // - this.options = options; - this.plugins = options.plugins || {}; - this.initialized = false; - this.bootstrapper = { init: function (app, func) {} }; - this.initializers = {}; -}; - -var inherit = function (ctor, superCtor) { - ctor.super_ = superCtor; - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); -} - -inherit(exports.App, exports.EventEmitter2); - diff --git a/node_modules/flatiron/node_modules/broadway/lib/broadway/common/directories.js b/node_modules/flatiron/node_modules/broadway/lib/broadway/common/directories.js deleted file mode 100644 index c82ef0c..0000000 --- a/node_modules/flatiron/node_modules/broadway/lib/broadway/common/directories.js +++ /dev/null @@ -1,76 +0,0 @@ -/* - * app.js: Common utility functions for working with directories - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var utile = require('utile'), - async = utile.async, - mkdirp = utile.mkdirp, - rimraf = utile.rimraf, - constants = require('../constants'); - -var directories = exports; - -// -// ### function create (dirs, callback) -// #### @dirs {Object} Directories to create -// #### @callback {function} Continuation to respond to when complete -// Creates all of the specified `directories` in the current environment. -// -directories.create = function (dirs, callback) { - function createDir(dir, next) { - mkdirp(dir, 0755, function () { - next(null, dir); - }); - } - - if (!dirs) { - return callback(); - } - - async.mapSeries(Object.keys(dirs).map(function (key) { - return dirs[key] - }), createDir, callback); -}; - -// -// ### function remove (dirs, callback) -// #### @dirs {Object} Directories to remove -// #### @callback {function} Continuation to respond to when complete -// Removes all of the specified `directories` in the current environment. -// -directories.remove = function (dirs, callback) { - function removeDir (dir, next) { - rimraf(dir, function () { - next(null, dir); - }); - } - - if (!dirs) { - return callback(); - } - - async.mapSeries(Object.keys(dirs).map(function (key) { - return dirs[key] - }), removeDir, callback); -}; - -// -// ### function normalize (root, dirs) -// #### @root {string} Relative root of the application -// #### @dirs {Object} Set of directories to normalize. -// Normalizes the specified `dirs` against the relative -// `root` of the application. -// -directories.normalize = function (root, dirs) { - var normalized = {}; - - Object.keys(dirs).forEach(function (key) { - normalized[key] = dirs[key].replace(constants.ROOT, root); - }); - - return normalized; -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/lib/broadway/common/index.js b/node_modules/flatiron/node_modules/broadway/lib/broadway/common/index.js deleted file mode 100644 index 1d2a41d..0000000 --- a/node_modules/flatiron/node_modules/broadway/lib/broadway/common/index.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - * common.js: Top-level include for the `common` module. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var common = module.exports = require('utile'); - -common.directories = require('./directories'); - -// A naive shared "unique ID" generator for cases where `plugin.name` is -// undefined. -var id = 0; -common.uuid = function () { - return String(id++); -} diff --git a/node_modules/flatiron/node_modules/broadway/lib/broadway/constants.js b/node_modules/flatiron/node_modules/broadway/lib/broadway/constants.js deleted file mode 100644 index 7e2cb6b..0000000 --- a/node_modules/flatiron/node_modules/broadway/lib/broadway/constants.js +++ /dev/null @@ -1,14 +0,0 @@ -/* - * constants.js: Constants used by broadway - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -exports.DELIMITER = '::'; - -exports.ROOT = '#ROOT'; -exports.CONFIG = '#CONFIG'; -exports.LOG = '#LOG'; -exports.TEST = '#TEST'; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/lib/broadway/features/index.js b/node_modules/flatiron/node_modules/broadway/lib/broadway/features/index.js deleted file mode 100644 index 8395e36..0000000 --- a/node_modules/flatiron/node_modules/broadway/lib/broadway/features/index.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * index.js: Top-level include for the features module. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -exports.ensure = function (app, callback) { - return callback(); -} - -exports.all = [ - { - name: 'Entry Point', - test: function (target, name) { - return typeof target.start === 'function' || - typeof target.createServer === 'function'; - }, - allExports: ['start', 'createServer', 'init', 'getRoutes'] - }, - { - name: 'Resource', - test: function (target, name) { - var methods = ['create', 'get', 'update', 'destroy'], - resource = target[capitalize(name)]; - - if (typeof resource !== 'function') { - return false; - } - - for (var i = 0; i < methods.length; i++) { - if (typeof resource[method] !== 'function') { - return false; - } - } - }, - allExports: ['addRoutes', 'init'] - }, - { - name: 'Configurator', - exports: ['config'], - }, - { - name: 'Serve Files', - exports: 'serve' - } -]; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/lib/broadway/plugins/config.js b/node_modules/flatiron/node_modules/broadway/lib/broadway/plugins/config.js deleted file mode 100644 index 51adb9a..0000000 --- a/node_modules/flatiron/node_modules/broadway/lib/broadway/plugins/config.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * config.js: Default configuration management plugin which attachs nconf to App instances - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var nconf = require('nconf'); - -// -// ### Name this plugin -// -exports.name = 'config'; - -// -// ### function attach (options) -// #### @options {Object} Options for this plugin -// Extends `this` (the application) with configuration functionality -// from `nconf`. -// -exports.attach = function (options) { - options = options || {}; - this.config = new nconf.Provider(options); - - // - // Setup a default store - // - this.config.use('literal'); - this.config.stores.literal.readOnly = false; -}; - -// -// ### function init (done) -// #### @done {function} Continuation to respond to when complete. -// Initalizes the `nconf.Provider` associated with this instance. -// -exports.init = function (done) { - // - // Remark: There should be code here for automated remote - // seeding and loading - // - this.config.load(function (err) { - return err ? done(err) : done(); - }); -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/lib/broadway/plugins/directories.js b/node_modules/flatiron/node_modules/broadway/lib/broadway/plugins/directories.js deleted file mode 100644 index 439bcff..0000000 --- a/node_modules/flatiron/node_modules/broadway/lib/broadway/plugins/directories.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * directories.js: Plugin for creating directories for a required for a broadway App. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var common = require('../common'); - -// -// ### Name this plugin -// -exports.name = 'directories'; - -// -// ### function attach (options) -// #### @options {Object} Options for this plugin -// #### @done {function} Continuation to respond to when complete. -// Prepopulates the directory structure of `this` (the application). -// -exports.attach = function (options) { - options = options || {}; - - if (this.config) { - // - // Merge options with any pre-existing application config. - // - options = common.mixin({}, options, this.config.get('directories') || {}); - } - - options = common.directories.normalize(this.root, options); - this.options['directories'] = options; - - if (this.config) { - this.config.merge('directories', options); - } -}; - -// -// ### function init (done) -// #### @done {function} Continuation to respond to when complete. -// Creates the directories associated with this instance. -// -exports.init = function (done) { - common.directories.create(this.options['directories'], function (err) { - return err ? done(err) : done(); - }); -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/lib/broadway/plugins/exceptions.js b/node_modules/flatiron/node_modules/broadway/lib/broadway/plugins/exceptions.js deleted file mode 100644 index 4d6ed5e..0000000 --- a/node_modules/flatiron/node_modules/broadway/lib/broadway/plugins/exceptions.js +++ /dev/null @@ -1,70 +0,0 @@ -/* - * exceptions.js: Plugin responsible for logging all uncaughtExceptions in a flatiron App. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var winston = require('winston'), - common = require('../common'); - -var exceptions = exports; - -// -// ### Setup default state for the exceptions plugin -// -exceptions.name = 'exceptions'; -exceptions.initalized = false; - -var defaultConfig = exceptions.defaultConfig = { - console: { - colorize: false, - json: true, - level: 'silly' - } -}; - -// -// ### function attach (options) -// #### @options {Object} Options for this plugin -// Extends `this` the application with exception handling -// functionality from `winston`. -// -exceptions.attach = function (options) { - options = options || {}; - - if (this.config) { - options = common.mixin({}, options, this.config.get('exceptions') || {}); - } - - if (exceptions.initalized) { - return; - } - - var exceptionHandlers = []; - - // - // Create the exceptionHandlers defaulting to Console and Loggly. - // - exceptionHandlers.push(new winston.transports.Console(options.console || defaultConfig.console)); - - Object.keys(options).forEach(function (name) { - if (name === 'console') { - return; - } - - exceptionHandlers.push(new (winston.transports[common.capitalize(name)])(options[name])); - }); - - // - // Update the state of the plugin with the logger. - // - exceptions.logger = new winston.Logger({ exceptionHandlers: exceptionHandlers }); - exceptions.initalized = true; - - // - // Have the logger handle uncaught exceptions. - // - exceptions.logger.handleExceptions(); -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/lib/broadway/plugins/inspect.js b/node_modules/flatiron/node_modules/broadway/lib/broadway/plugins/inspect.js deleted file mode 100644 index acca933..0000000 --- a/node_modules/flatiron/node_modules/broadway/lib/broadway/plugins/inspect.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * inspect.js: Plugin responsible for attaching inspection behavior using `cliff` and `eyes`. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -// -// ### Name this plugin -// -exports.name = 'inspect'; - -// -// ### function init (done) -// #### @done {function} Continuation to respond to when complete. -// Attaches inspection behavior through `cliff` and `eyes`. -// -exports.init = function (done) { - var namespace = 'default', - app = this; - - if (app.options['inspect'] && app.options['inspect'].namespace) { - namespace = app.options['inspect'].namespace; - } - - app.inspect = require('cliff'); - app.inspect.logger = app.log.get('namespace'); - done(); -}; - -// -// ### function detact() -// Removes inspection behavior exposed by this plugin. -// -exports.detach = function () { - if (this.inspect) { - delete this.inspect; - } -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/lib/broadway/plugins/log.js b/node_modules/flatiron/node_modules/broadway/lib/broadway/plugins/log.js deleted file mode 100644 index 363dd3c..0000000 --- a/node_modules/flatiron/node_modules/broadway/lib/broadway/plugins/log.js +++ /dev/null @@ -1,197 +0,0 @@ -/* - * log.js: Default logging plugin which attachs winston to App instances - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var winston = require('winston'), - common = require('../common'), - constants = require('../constants'); - -var log = exports; - -// -// ### Setup default state for the exceptions plugin -// -log.name = 'log'; -log.ignore = ['broadway']; - -// -// ### function attach (options) -// #### @options {Object} Options for this plugin -// Extends `this` (the application) with logging functionality from `winston`. -// -log.attach = function (options) { - options = options || {}; - - var app = this, - namespaces, - logAll; - - if (this.config) { - // - // Merge options with any pre-existing application config. - // - options = common.mixin({}, options, this.config.get('log') || {}); - } - - // - // Setup namespaces and then remove them from - // `options` so they are not caught by `winston`. - // - namespaces = options.namespaces || {}; - delete options.namespaces; - - logAll = options.logAll || false; - if (options.logAll) { - delete options.logAll; - } - - // - // Hoist up relelvant logging functions onto the app - // if requested. - // - this.log = new winston.Container(options); - this.log.namespaces = namespaces; - this.log.get('default').extend(this.log); - - // - // Set the default console loglevel to options.level - // - this.log.get('default').transports.console.level = options.level || 'info'; - - Object.defineProperty(this.log, 'logAll', { - get: function () { - return this._logAll; - }, - set: function (val) { - if (val === this._logAll) { - // - // If the value is identical return - // - return; - } - - if (val) { - app.onAny(log.logEvent); - app.off(['log'], log.logEvent); - app.off(['log', '*'], log.logEvent); - app.off(['log', '*', '*'], log.logEvent); - } - else { - app.offAny(log.logEvent); - app.on(['log'], log.logEvent); - app.on(['log', '*'], log.logEvent); - app.on(['log', '*', '*'], log.logEvent); - } - - this._logAll = val; - } - }); - - // - // Listen to relevant `app` events and - // log them appropriately. - // - this.log.logAll = logAll; - - // - // Add any namespaced containers to this App instance. - // - Object.keys(this.log.namespaces).forEach(function (namespace) { - app.log.add(app.log.namespaces[namespace]); - }); -}; - -// -// ### function logEvent ([level], msg, meta) -// #### @msg {string} Message to log -// #### @meta {Object} **Optional** Metadata to log -// Logs the specified `msg` and `meta` according to -// the following conditions: -// -// #### `log` events -// 1. `log` - Logs to the default logger and level. -// 2. `log::[level]` - Logs to the default logger. -// 3. `log::[level]::[namespace]` - Logs to a namespaced logger. -// -// ### `[namespaced]` events -// If `app.log.logAll` is set, then find a logger at `namespace`, -// otherwise the default logger is used. -// -// 1. `[namespace]::**(level, msg, meta)` - Logs the event as the -// message to the logger for the specified namespace and level. -// 2. `[namespace]::[level]::**(msg, meta)` - Logs the event and -// the message to the logger for the specified namespace and level. -// -log.logEvent = function (/* level, msg, meta */) { - var parts = Array.isArray(this.event) ? this.event : this.event.split(this.delimiter), - ev = parts[0], - namespace, - logger, - level, - meta, - msg; - - if (log.ignore.indexOf(ev) !== -1) { - return; - } - - // - // Determine the `namespace` to log the event to - // - if (ev === 'log') { - namespace = parts[2] || 'default'; - logger = this.log.get('default'); - } - else if (this.log.logAll) { - namespace = this.log.namespaces[ev] ? this.log.namespaces[ev] : 'default'; - logger = this.log.get(namespace); - } - else { - return; - } - - // - // Parse arguments now that we have the logger. - // - Array.prototype.slice.call(arguments).forEach(function (a) { - switch (typeof a) { - case 'object': { - meta = a; - break; - } - case 'string': { - if (logger[a]) { - level = a; - } - else { - msg = a; - } - } - } - }); - - if (ev === 'log') { - level = parts[1] || level || 'info'; - } - else if (this.log.logAll) { - if (logger[parts[1]]) { - level = parts[1]; - parts.splice(1, 1); - } - } - - if (level in logger.levels === false) { - level = 'info'; - } - - parts = parts.join(this.delimiter); - meta = meta || {}; - meta.event = parts; - msg = msg || parts; - logger.log(level, msg, meta); - this.emit(['broadway', 'logged'], level, msg, meta); -}; diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/.npmignore b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/.npmignore deleted file mode 100644 index 5171c54..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -npm-debug.log \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/LICENSE b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/LICENSE deleted file mode 100644 index 56217ca..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010 Nodejitsu Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/README.md b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/README.md deleted file mode 100644 index a0f0cd8..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/README.md +++ /dev/null @@ -1,227 +0,0 @@ -# cliff - -CLI output formatting tools: "Your CLI Formatting Friend". - -## Installation - -### Installing npm (node package manager) -``` - curl http://npmjs.org/install.sh | sh -``` - -### Installing cliff -``` - [sudo] npm install cliff -``` - -## Usage -There are a number of methods available in Cliff for common logging tasks in command-line tools. If you're looking for more usage, checkout the [examples in this repository][3]: - -1. Logging rows of data -2. Inspecting Objects - -### Logging rows of data - -**cliff.stringifyRows(rows[, colors])** - -Takes a set of Arrays and row headers and returns properly formatted and padded rows. Here's a sample: - -``` js - var cliff = require('../lib/cliff'); - - var rows = [ - ['Name', 'Flavor', 'Dessert'], - ['Alice', 'cherry', 'yogurt'], - ['Bob', 'carmel', 'apples'], - ['Joe', 'chocolate', 'cake'], - ['Nick', 'vanilla', 'ice cream'] - ]; - - console.log(cliff.stringifyRows(rows, ['red', 'blue', 'green'])); -``` - -![output from string-rows.js][string-rows] - -**cliff.putRows(level, rows[, colors])** - -The `putRows` method is a simple helper that takes a set of Arrays and row headers and logs properly formatted and padded rows (logs `stringifyRows` to [winston][0]). Here's a quick sample: - -``` js - var cliff = require('../lib/cliff'); - - var rows = [ - ['Name', 'Flavor', 'Dessert'], - ['Alice', 'cherry', 'yogurt'], - ['Bob', 'carmel', 'apples'], - ['Joe', 'chocolate', 'cake'], - ['Nick', 'vanilla', 'ice cream'] - ]; - - cliff.putRows('data', rows, ['red', 'blue', 'green']); -``` - -The resulting output on the command-line would be: - -![output from put-rows.js][put-rows] - -**cliff.stringifyObjectRows(objs, properties[, colors])** -*used to be: cliff.rowifyObjects(objs, properties, colors)* - -Takes a set of Objects and the properties to extract from them and returns properly formatted and padded rows. Here's a sample: - -``` js - var cliff = require('../lib/cliff'); - - var objs = [], obj = { - name: "bazz", - address: "1234 Nowhere Dr.", - }; - - for (var i = 0; i < 10; i++) { - objs.push({ - name: obj.name, - address: obj.address, - id: Math.random().toString() - }); - } - - console.log(cliff.stringifyObjectRows(objs, ['id', 'name', 'address'], ['red', 'blue', 'green'])); -``` - -![output from string-object-rows.js][string-object-rows] - -**cliff.putObjectRows(level, objs, properties[, colors])** - -Takes a set of Objects and the properties to extract from them and it will log to the console. (it prints `stringifyObjectRows` with [winston][0]). Here's a sample: - -``` js - var cliff = require('../lib/cliff'); - - var objs = [], obj = { - name: "bazz", - address: "1234 Nowhere Dr.", - }; - - for (var i = 0; i < 10; i++) { - objs.push({ - name: obj.name, - address: obj.address, - id: Math.random().toString() - }); - } - - cliff.putObjectRows('data', objs, ['id', 'name', 'address']); -``` - -![output from string-object-rows.js][string-object-rows] - -**Colors Parameter** - -The `colors` parameter is an array that colors the first row. It uses the [colors.js][2]. You can use any of those. - -``` js - var cliff = require('../lib/cliff'); - - var rows = [ - ['Name', 'Flavor', 'Dessert'], - ['Alice'.grey, 'cherry'.cyan, 'yogurt'.yellow], - ['Bob'.magenta, 'carmel'.rainbow, 'apples'.white], - ['Joe'.italic, 'chocolate'.underline, 'cake'.inverse], - ['Nick'.bold, 'vanilla', 'ice cream'] - ]; - - cliff.putRows('data', rows, ['red', 'blue', 'green']); -``` - -The resulting output on the command-line would be: - -![output from puts-rows-colors.js][put-rows-colors] - -### Inspecting Objects - -**cliff.inspect(obj)** - -The `inspect` method is a lightweight wrapper to a pre-configured [eyes][1] inspector. If you wish to change the coloring of objects that are logged using `cliff` you only need to override `cliff.inspect` with a new [eyes][1] inspector. Here is how to use it: - -``` js - var cliff = require('../lib/cliff'); - - console.log(cliff.inspect({ - literal: "bazz", - arr: [ - "one", - 2, - ], - obj: { - host: "localhost", - port: 5984, - auth: { - username: "admin", - password: "password" - } - } - })); -``` - -![output from inspect.js][inspect] - -**cliff.putObject(obj, [rewriters, padding])** - -The `putObject` method is a simple helper function for prefixing and styling inspected object output from [eyes][1]. Here's a quick sample: - -``` js -var cliff = require('cliff'); - -cliff.putObject({ - literal: "bazz", - arr: [ - "one", - 2, - ], - obj: { - host: "localhost", - port: 5984, - auth: { - username: "admin", - password: "password" - } - } -}); -``` - -The resulting output on the command-line would be: - -![output from put-object.js][put-object] - -## Run Tests - -All of the cliff tests are written in [vows][4], and cover all of the use cases described above. - -``` - npm test -``` - -## Motivation - -Cliff is the swiss army knife of CLI formatting tools. It is based on highly flexible and powerful libraries: - -* [winston][0]: A multi-transport async logging library for node.js -* [eyes][1]: A customizable value inspector for node.js -* [colors][2]: Get colors in your node.js console like what - - -#### Author: [Charlie Robbins](http://twitter.com/indexzero) - -[0]: http://github.com/indexzero/winston -[1]: http://github.com/cloudhead/eyes.js -[2]: http://github.com/marak/colors.js -[3]: http://github.com/flatiron/cliff/tree/master/examples -[4]: http://vowsjs.org - -[inspect]: https://github.com/flatiron/cliff/raw/master/assets/inspect.png -[put-object-rows]: https://github.com/flatiron/cliff/raw/master/assets/put-object-rows.png -[put-object]: https://github.com/flatiron/cliff/raw/master/assets/put-object.png -[put-rows-colors]: https://github.com/flatiron/cliff/raw/master/assets/put-rows-colors.png -[put-rows]: https://github.com/flatiron/cliff/raw/master/assets/put-rows.png -[string-object-rows]: https://github.com/flatiron/cliff/raw/master/assets/string-object-rows.png -[string-rows]: https://github.com/flatiron/cliff/raw/master/assets/string-rows.png \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/assets/inspect.png b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/assets/inspect.png deleted file mode 100755 index 15f0eb0..0000000 Binary files a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/assets/inspect.png and /dev/null differ diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/assets/put-object-rows.png b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/assets/put-object-rows.png deleted file mode 100755 index 044270f..0000000 Binary files a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/assets/put-object-rows.png and /dev/null differ diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/assets/put-object.png b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/assets/put-object.png deleted file mode 100755 index 1138854..0000000 Binary files a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/assets/put-object.png and /dev/null differ diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/assets/put-rows-colors.png b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/assets/put-rows-colors.png deleted file mode 100755 index 93252ff..0000000 Binary files a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/assets/put-rows-colors.png and /dev/null differ diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/assets/put-rows.png b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/assets/put-rows.png deleted file mode 100755 index 6f045d7..0000000 Binary files a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/assets/put-rows.png and /dev/null differ diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/assets/string-object-rows.png b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/assets/string-object-rows.png deleted file mode 100755 index 0d383a2..0000000 Binary files a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/assets/string-object-rows.png and /dev/null differ diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/assets/string-rows.png b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/assets/string-rows.png deleted file mode 100755 index 9260507..0000000 Binary files a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/assets/string-rows.png and /dev/null differ diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/examples/inspect.js b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/examples/inspect.js deleted file mode 100644 index eb45927..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/examples/inspect.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * put-object.js: Example usage for `cliff.putObject`. - * - * (C) 2010, Nodejitsu Inc. - * - */ - -var cliff = require('../lib/cliff'); - -console.log(cliff.inspect({ - literal: "bazz", - arr: [ - "one", - 2, - ], - obj: { - host: "localhost", - port: 5984, - auth: { - username: "admin", - password: "password" - } - } -})); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/examples/put-object-rows.js b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/examples/put-object-rows.js deleted file mode 100644 index d7e8a80..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/examples/put-object-rows.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * put-object-rows.js: Example usage for `cliff.putObjectRows`. - * - * (C) 2010, Nodejitsu Inc. - * - */ - -var cliff = require('../lib/cliff'); - -var objs = [], obj = { - name: "bazz", - address: "1234 Nowhere Dr.", -}; - -for (var i = 0; i < 10; i++) { - objs.push({ - name: obj.name, - address: obj.address, - id: Math.random().toString() - }); -} - -cliff.putObjectRows('data', objs, ['id', 'name', 'address']); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/examples/put-object.js b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/examples/put-object.js deleted file mode 100644 index 7821514..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/examples/put-object.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * put-object.js: Example usage for `cliff.putObject`. - * - * (C) 2010, Nodejitsu Inc. - * - */ - -var cliff = require('../lib/cliff'); - -cliff.putObject({ - literal: "bazz", - arr: [ - "one", - 2, - ], - obj: { - host: "localhost", - port: 5984, - auth: { - username: "admin", - password: "password" - } - } -}); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/examples/put-rows-colors.js b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/examples/put-rows-colors.js deleted file mode 100644 index ac46d84..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/examples/put-rows-colors.js +++ /dev/null @@ -1,12 +0,0 @@ -var cliff = require('../lib/cliff'); - -var rows = [ - ['Name', 'Flavor', 'Dessert'], - ['Alice'.grey, 'cherry'.cyan, 'yogurt'.yellow], - ['Bob'.magenta, 'carmel'.rainbow, 'apples'.white], - ['Joe'.italic, 'chocolate'.underline, 'cake'.inverse], - ['Nick'.bold, 'vanilla', 'ice cream'] -]; - -cliff.putRows('data', rows, ['red', 'blue', 'green']); - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/examples/put-rows.js b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/examples/put-rows.js deleted file mode 100644 index 4de1038..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/examples/put-rows.js +++ /dev/null @@ -1,11 +0,0 @@ -var cliff = require('../lib/cliff'); - -var rows = [ - ['Name', 'Flavor', 'Dessert'], - ['Alice', 'cherry', 'yogurt'], - ['Bob', 'carmel', 'apples'], - ['Joe', 'chocolate', 'cake'], - ['Nick', 'vanilla', 'ice cream'] -]; - -cliff.putRows('data', rows, ['red', 'blue', 'green']); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/examples/string-object-rows.js b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/examples/string-object-rows.js deleted file mode 100644 index 7f1bd9b..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/examples/string-object-rows.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * put-object-rows.js: Example usage for `cliff.putObjectRows`. - * - * (C) 2010, Nodejitsu Inc. - * - */ - -var cliff = require('../lib/cliff'); - -var objs = [], obj = { - name: "bazz", - address: "1234 Nowhere Dr.", -}; - -for (var i = 0; i < 10; i++) { - objs.push({ - name: obj.name, - address: obj.address, - id: Math.random().toString() - }); -} - -console.log(cliff.stringifyObjectRows(objs, ['id', 'name', 'address'], ['red', 'blue', 'green'])); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/examples/string-rows.js b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/examples/string-rows.js deleted file mode 100644 index a4aaa81..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/examples/string-rows.js +++ /dev/null @@ -1,11 +0,0 @@ -var cliff = require('../lib/cliff'); - -var rows = [ - ['Name', 'Flavor', 'Dessert'], - ['Alice', 'cherry', 'yogurt'], - ['Bob', 'carmel', 'apples'], - ['Joe', 'chocolate', 'cake'], - ['Nick', 'vanilla', 'ice cream'] -]; - -console.log(cliff.stringifyRows(rows, ['red', 'blue', 'green'])); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/lib/cliff.js b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/lib/cliff.js deleted file mode 100644 index 822040c..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/lib/cliff.js +++ /dev/null @@ -1,279 +0,0 @@ -/* - * cliff.js: CLI output formatting tools: "Your CLI Formatting Friend". - * - * (C) 2010, Nodejitsu Inc. - * - */ - -var colors = require('colors'), - eyes = require('eyes'), - winston = require('winston'); - -var cliff = exports, - logger; - -cliff.__defineGetter__('logger', function () { - return logger; -}); - -cliff.__defineSetter__('logger', function (val) { - logger = val; - - // - // Setup winston to use the `cli` formats - // - if (logger.cli) { - logger.cli(); - } -}); - -// -// Set the default logger for cliff. -// -cliff.logger = new winston.Logger({ - transports: [new winston.transports.Console()] -}); - -// -// Expose a default `eyes` inspector. -// -cliff.inspector = eyes.inspector; -cliff.inspect = eyes.inspector({ stream: null, - styles: { // Styles applied to stdout - all: null, // Overall style applied to everything - label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]` - other: 'inverted', // Objects which don't have a literal representation, such as functions - key: 'grey', // The keys in object literals, like 'a' in `{a: 1}` - special: 'grey', // null, undefined... - number: 'blue', // 0, 1, 2... - bool: 'magenta', // true false - regexp: 'green' // /\d+/ - } -}); - -// -// ### function extractFrom (obj, properties) -// #### @obj {Object} Object to extract properties from. -// #### @properties {Array} List of properties to output. -// Creates an array representing the values for `properties` in `obj`. -// -cliff.extractFrom = function (obj, properties) { - return properties.map(function (p) { - return obj[p]; - }); -}; - -// -// ### function columnMajor (rows) -// #### @rows {ArrayxArray} Row-major Matrix to transpose -// Transposes the row-major Matrix, represented as an array of rows, -// into column major form (i.e. an array of columns). -// -cliff.columnMajor = function (rows) { - var columns = []; - - rows.forEach(function (row) { - for (var i = 0; i < row.length; i += 1) { - if (!columns[i]) { - columns[i] = []; - } - - columns[i].push(row[i]); - } - }); - - return columns; -}; - -// -// ### arrayLengths (arrs) -// #### @arrs {ArrayxArray} Arrays to calculate lengths for -// Creates an array with values each representing the length -// of an array in the set provided. -// -cliff.arrayLengths = function (arrs) { - var i, lengths = []; - for (i = 0; i < arrs.length; i += 1) { - lengths.push(longestElement(arrs[i].map(cliff.stringifyLiteral))); - } - return lengths; -}; - -// -// ### function stringifyRows (rows, colors) -// #### @rows {ArrayxArray} Matrix of properties to output in row major form -// #### @colors {Array} Set of colors to use for the headers -// Outputs the specified `rows` as fixed-width columns, adding -// colorized headers if `colors` are supplied. -// -cliff.stringifyRows = function (rows, colors) { - var lengths, columns, output = [], headers; - - columns = cliff.columnMajor(rows); - lengths = cliff.arrayLengths(columns); - - function stringifyRow(row, colorize) { - var rowtext = '', padding, item, i, length; - for (i = 0; i < row.length; i += 1) { - item = cliff.stringifyLiteral(row[i]); - item = colorize ? item[colors[i]] : item; - length = realLength(item); - padding = length < lengths[i] ? lengths[i] - length + 2 : 2; - rowtext += item + new Array(padding).join(' '); - } - - output.push(rowtext); - } - - // If we were passed colors, then assume the first row - // is the headers for the rows - if (colors) { - headers = rows.splice(0, 1)[0]; - stringifyRow(headers, true); - } - - rows.forEach(function (row) { - stringifyRow(row, false); - }); - - return output.join('\n'); -}; - -// -// ### function rowifyObjects (objs, properties, colors) -// #### @objs {Array} List of objects to create output for -// #### @properties {Array} List of properties to output -// #### @colors {Array} Set of colors to use for the headers -// Extracts the lists of `properties` from the specified `objs` -// and formats them according to `cliff.stringifyRows`. -// -cliff.stringifyObjectRows = cliff.rowifyObjects = function (objs, properties, colors) { - var rows = [properties].concat(objs.map(function (obj) { - return cliff.extractFrom(obj, properties); - })); - - return cliff.stringifyRows(rows, colors); -}; - -// -// ### function putRows (level, rows, colors) -// #### @level {String} Log-level to use -// #### @rows {Array} Array of rows to log at the specified level -// #### @colors {Array} Set of colors to use for the specified row(s) headers. -// Logs the stringified table result from `rows` at the appropriate `level` using -// `cliff.logger`. If `colors` are supplied then use those when stringifying `rows`. -// -cliff.putRows = function (level, rows, colors) { - cliff.stringifyRows(rows, colors).split('\n').forEach(function (str) { - logger.log(level, str); - }); -}; - -// -// ### function putObjectRows (level, rows, colors) -// #### @level {String} Log-level to use -// #### @objs {Array} List of objects to create output for -// #### @properties {Array} List of properties to output -// #### @colors {Array} Set of colors to use for the headers -// Logs the stringified table result from `objs` at the appropriate `level` using -// `cliff.logger`. If `colors` are supplied then use those when stringifying `objs`. -// -cliff.putObjectRows = function (level, objs, properties, colors) { - cliff.rowifyObjects(objs, properties, colors).split('\n').forEach(function (str) { - logger.log(level, str); - }); -}; - -// -// ### function putObject (obj, [rewriters, padding]) -// #### @obj {Object} Object to log to the command line -// #### @rewriters {Object} **Optional** Set of methods to rewrite certain object keys -// #### @padding {Number} **Optional** Length of padding to put around the output. -// Inspects the object `obj` on the command line rewriting any properties which match -// keys in `rewriters` if any. Adds additional `padding` if supplied. -// -cliff.putObject = function (/*obj, [rewriters, padding] */) { - var args = Array.prototype.slice.call(arguments), - obj = args.shift(), - padding = typeof args[args.length - 1] === 'number' && args.pop(), - rewriters = typeof args[args.length -1] === 'object' && args.pop(), - keys = Object.keys(obj).sort(), - sorted = {}, - matchers = {}, - inspected; - - padding = padding || 0; - rewriters = rewriters || {}; - - function pad () { - for (var i = 0; i < padding / 2; i++) { - logger.data(''); - } - } - - keys.forEach(function (key) { - sorted[key] = obj[key]; - }); - - inspected = cliff.inspect(sorted); - - Object.keys(rewriters).forEach(function (key) { - matchers[key] = new RegExp(key); - }); - - pad(); - inspected.split('\n').forEach(function (line) { - Object.keys(rewriters).forEach(function (key) { - if (matchers[key].test(line)) { - line = rewriters[key](line); - } - }); - logger.data(line); - }); - pad(); -}; - -cliff.stringifyLiteral = function stringifyLiteral (literal) { - switch (cliff.typeOf(literal)) { - case 'number' : return literal + ''; - case 'null' : return 'null'; - case 'undefined': return 'undefined'; - case 'boolean' : return literal + ''; - default : return literal; - } -}; - -cliff.typeOf = function typeOf(value) { - var s = typeof(value), - types = [Object, Array, String, RegExp, Number, Function, Boolean, Date]; - - if (s === 'object' || s === 'function') { - if (value) { - types.forEach(function (t) { - if (value instanceof t) { - s = t.name.toLowerCase(); - } - }); - } else { - s = 'null'; - } - } - - return s; -}; - -function realLength(str) { - return ("" + str).replace(/\u001b\[\d+m/g,'').length; -} - -function longestElement(a) { - var l = 0; - for (var i = 0; i < a.length; i++) { - var new_l = realLength(a[i]); - if (l < new_l) { - l = new_l; - } - } - - return l; -} \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/node_modules/eyes/LICENSE b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/node_modules/eyes/LICENSE deleted file mode 100644 index a1edd93..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/node_modules/eyes/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2009 cloudhead - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/node_modules/eyes/Makefile b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/node_modules/eyes/Makefile deleted file mode 100644 index a121dea..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/node_modules/eyes/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -test: - @@node test/eyes-test.js - -.PHONY: test diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/node_modules/eyes/README.md b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/node_modules/eyes/README.md deleted file mode 100644 index 7a92158..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/node_modules/eyes/README.md +++ /dev/null @@ -1,72 +0,0 @@ -eyes -==== - -a customizable value inspector for Node.js - -synopsis --------- - -I was tired of looking at cluttered output in the console -- something needed to be done, -`sys.inspect()` didn't display regexps correctly, and was too verbose, and I had an hour or two to spare. -So I decided to have some fun. _eyes_ were born. - -![eyes-ss](http://dl.dropbox.com/u/251849/eyes-js-ss.gif) - -_example of the output of a user-customized eyes.js inspector_ - -*eyes* also deals with circular objects in an intelligent way, and can pretty-print object literals. - -usage ------ - - var inspect = require('eyes').inspector({styles: {all: 'magenta'}}); - - inspect(something); // inspect with the settings passed to `inspector` - -or - - var eyes = require('eyes'); - - eyes.inspect(something); // inspect with the default settings - -you can pass a _label_ to `inspect()`, to keep track of your inspections: - - eyes.inspect(something, "a random value"); - -If you want to return the output of eyes without printing it, you can set it up this way: - - var inspect = require('eyes').inspector({ stream: null }); - - sys.puts(inspect({ something: 42 })); - -customization -------------- - -These are the default styles and settings used by _eyes_. - styles: { // Styles applied to stdout - all: 'cyan', // Overall style applied to everything - label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]` - other: 'inverted', // Objects which don't have a literal representation, such as functions - key: 'bold', // The keys in object literals, like 'a' in `{a: 1}` - - special: 'grey', // null, undefined... - string: 'green', - number: 'magenta', - bool: 'blue', // true false - regexp: 'green', // /\d+/ - }, - pretty: true, // Indent object literals - hideFunctions: false, // Don't output functions at all - stream: process.stdout, // Stream to write to, or null - maxLength: 2048 // Truncate output if longer - -You can overwrite them with your own, by passing a similar object to `inspector()` or `inspect()`. - - var inspect = require('eyes').inspector({ - styles: { - all: 'magenta', - special: 'bold' - }, - maxLength: 512 - }); - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/node_modules/eyes/lib/eyes.js b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/node_modules/eyes/lib/eyes.js deleted file mode 100644 index 10d964b..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/node_modules/eyes/lib/eyes.js +++ /dev/null @@ -1,236 +0,0 @@ -// -// Eyes.js - a customizable value inspector for Node.js -// -// usage: -// -// var inspect = require('eyes').inspector({styles: {all: 'magenta'}}); -// inspect(something); // inspect with the settings passed to `inspector` -// -// or -// -// var eyes = require('eyes'); -// eyes.inspect(something); // inspect with the default settings -// -var eyes = exports, - stack = []; - -eyes.defaults = { - styles: { // Styles applied to stdout - all: 'cyan', // Overall style applied to everything - label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]` - other: 'inverted', // Objects which don't have a literal representation, such as functions - key: 'bold', // The keys in object literals, like 'a' in `{a: 1}` - special: 'grey', // null, undefined... - string: 'green', - number: 'magenta', - bool: 'blue', // true false - regexp: 'green', // /\d+/ - }, - pretty: true, // Indent object literals - hideFunctions: false, - showHidden: false, - stream: process.stdout, - maxLength: 2048 // Truncate output if longer -}; - -// Return a curried inspect() function, with the `options` argument filled in. -eyes.inspector = function (options) { - var that = this; - return function (obj, label, opts) { - return that.inspect.call(that, obj, label, - merge(options || {}, opts || {})); - }; -}; - -// If we have a `stream` defined, use it to print a styled string, -// if not, we just return the stringified object. -eyes.inspect = function (obj, label, options) { - options = merge(this.defaults, options || {}); - - if (options.stream) { - return this.print(stringify(obj, options), label, options); - } else { - return stringify(obj, options) + (options.styles ? '\033[39m' : ''); - } -}; - -// Output using the 'stream', and an optional label -// Loop through `str`, and truncate it after `options.maxLength` has been reached. -// Because escape sequences are, at this point embeded within -// the output string, we can't measure the length of the string -// in a useful way, without separating what is an escape sequence, -// versus a printable character (`c`). So we resort to counting the -// length manually. -eyes.print = function (str, label, options) { - for (var c = 0, i = 0; i < str.length; i++) { - if (str.charAt(i) === '\033') { i += 4 } // `4` because '\033[25m'.length + 1 == 5 - else if (c === options.maxLength) { - str = str.slice(0, i - 1) + '…'; - break; - } else { c++ } - } - return options.stream.write.call(options.stream, (label ? - this.stylize(label, options.styles.label, options.styles) + ': ' : '') + - this.stylize(str, options.styles.all, options.styles) + '\033[0m' + "\n"); -}; - -// Apply a style to a string, eventually, -// I'd like this to support passing multiple -// styles. -eyes.stylize = function (str, style, styles) { - var codes = { - 'bold' : [1, 22], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'cyan' : [36, 39], - 'magenta' : [35, 39], - 'blue' : [34, 39], - 'yellow' : [33, 39], - 'green' : [32, 39], - 'red' : [31, 39], - 'grey' : [90, 39] - }, endCode; - - if (style && codes[style]) { - endCode = (codes[style][1] === 39 && styles.all) ? codes[styles.all][0] - : codes[style][1]; - return '\033[' + codes[style][0] + 'm' + str + - '\033[' + endCode + 'm'; - } else { return str } -}; - -// Convert any object to a string, ready for output. -// When an 'array' or an 'object' are encountered, they are -// passed to specialized functions, which can then recursively call -// stringify(). -function stringify(obj, options) { - var that = this, stylize = function (str, style) { - return eyes.stylize(str, options.styles[style], options.styles) - }, index, result; - - if ((index = stack.indexOf(obj)) !== -1) { - return stylize(new(Array)(stack.length - index + 1).join('.'), 'special'); - } - stack.push(obj); - - result = (function (obj) { - switch (typeOf(obj)) { - case "string" : obj = stringifyString(obj.indexOf("'") === -1 ? "'" + obj + "'" - : '"' + obj + '"'); - return stylize(obj, 'string'); - case "regexp" : return stylize('/' + obj.source + '/', 'regexp'); - case "number" : return stylize(obj + '', 'number'); - case "function" : return options.stream ? stylize("Function", 'other') : '[Function]'; - case "null" : return stylize("null", 'special'); - case "undefined": return stylize("undefined", 'special'); - case "boolean" : return stylize(obj + '', 'bool'); - case "date" : return stylize(obj.toUTCString()); - case "array" : return stringifyArray(obj, options, stack.length); - case "object" : return stringifyObject(obj, options, stack.length); - } - })(obj); - - stack.pop(); - return result; -}; - -// Escape invisible characters in a string -function stringifyString (str, options) { - return str.replace(/\\/g, '\\\\') - .replace(/\n/g, '\\n') - .replace(/[\u0001-\u001F]/g, function (match) { - return '\\0' + match[0].charCodeAt(0).toString(8); - }); -} - -// Convert an array to a string, such as [1, 2, 3]. -// This function calls stringify() for each of the elements -// in the array. -function stringifyArray(ary, options, level) { - var out = []; - var pretty = options.pretty && (ary.length > 4 || ary.some(function (o) { - return (o !== null && typeof(o) === 'object' && Object.keys(o).length > 0) || - (Array.isArray(o) && o.length > 0); - })); - var ws = pretty ? '\n' + new(Array)(level * 4 + 1).join(' ') : ' '; - - for (var i = 0; i < ary.length; i++) { - out.push(stringify(ary[i], options)); - } - - if (out.length === 0) { - return '[]'; - } else { - return '[' + ws - + out.join(',' + (pretty ? ws : ' ')) - + (pretty ? ws.slice(0, -4) : ws) + - ']'; - } -}; - -// Convert an object to a string, such as {a: 1}. -// This function calls stringify() for each of its values, -// and does not output functions or prototype values. -function stringifyObject(obj, options, level) { - var out = []; - var pretty = options.pretty && (Object.keys(obj).length > 2 || - Object.keys(obj).some(function (k) { return typeof(obj[k]) === 'object' })); - var ws = pretty ? '\n' + new(Array)(level * 4 + 1).join(' ') : ' '; - - var keys = options.showHidden ? Object.keys(obj) : Object.getOwnPropertyNames(obj); - keys.forEach(function (k) { - if (Object.prototype.hasOwnProperty.call(obj, k) - && !(obj[k] instanceof Function && options.hideFunctions)) { - out.push(eyes.stylize(k, options.styles.key, options.styles) + ': ' + - stringify(obj[k], options)); - } - }); - - if (out.length === 0) { - return '{}'; - } else { - return "{" + ws - + out.join(',' + (pretty ? ws : ' ')) - + (pretty ? ws.slice(0, -4) : ws) + - "}"; - } -}; - -// A better `typeof` -function typeOf(value) { - var s = typeof(value), - types = [Object, Array, String, RegExp, Number, Function, Boolean, Date]; - - if (s === 'object' || s === 'function') { - if (value) { - types.forEach(function (t) { - if (value instanceof t) { s = t.name.toLowerCase() } - }); - } else { s = 'null' } - } - return s; -} - -function merge(/* variable args */) { - var objs = Array.prototype.slice.call(arguments); - var target = {}; - - objs.forEach(function (o) { - Object.keys(o).forEach(function (k) { - if (k === 'styles') { - if (! o.styles) { - target.styles = false; - } else { - target.styles = {} - for (var s in o.styles) { - target.styles[s] = o.styles[s]; - } - } - } else { - target[k] = o[k]; - } - }); - }); - return target; -} - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/node_modules/eyes/package.json b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/node_modules/eyes/package.json deleted file mode 100644 index ad90430..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/node_modules/eyes/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "eyes", - "description": "a customizable value inspector", - "url": "http://github.com/cloudhead/eyes.js", - "keywords": [ - "inspector", - "debug", - "inspect", - "print" - ], - "author": { - "name": "Alexis Sellier", - "email": "self@cloudhead.net" - }, - "contributors": [ - { - "name": "Charlie Robbins", - "email": "charlie@nodejitsu.com" - } - ], - "licenses": [ - "MIT" - ], - "dependencies": {}, - "main": "./lib/eyes", - "version": "0.1.7", - "scripts": { - "test": "node test/*-test.js" - }, - "directories": { - "lib": "./lib", - "test": "./test" - }, - "engines": { - "node": "> 0.1.90" - }, - "_id": "eyes@0.1.7", - "devDependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "eyes@0.1.x" -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/node_modules/eyes/test/eyes-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/node_modules/eyes/test/eyes-test.js deleted file mode 100644 index 1f9606a..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/node_modules/eyes/test/eyes-test.js +++ /dev/null @@ -1,56 +0,0 @@ -var util = require('util'); -var eyes = require('../lib/eyes'); - -eyes.inspect({ - number: 42, - string: "John Galt", - regexp: /[a-z]+/, - array: [99, 168, 'x', {}], - func: function () {}, - bool: false, - nil: null, - undef: undefined, - object: {attr: []} -}, "native types"); - -eyes.inspect({ - number: new(Number)(42), - string: new(String)("John Galt"), - regexp: new(RegExp)(/[a-z]+/), - array: new(Array)(99, 168, 'x', {}), - bool: new(Boolean)(false), - object: new(Object)({attr: []}), - date: new(Date) -}, "wrapped types"); - -var obj = {}; -obj.that = { self: obj }; -obj.self = obj; - -eyes.inspect(obj, "circular object"); -eyes.inspect({hello: 'moto'}, "small object"); -eyes.inspect({hello: new(Array)(6) }, "big object"); -eyes.inspect(["hello 'world'", 'hello "world"'], "quotes"); -eyes.inspect({ - recommendations: [{ - id: 'a7a6576c2c822c8e2bd81a27e41437d8', - key: [ 'spree', 3.764316258020699 ], - value: { - _id: 'a7a6576c2c822c8e2bd81a27e41437d8', - _rev: '1-2e2d2f7fd858c4a5984bcf809d22ed98', - type: 'domain', - domain: 'spree', - weight: 3.764316258020699, - product_id: 30 - } - }] -}, 'complex'); - -eyes.inspect([null], "null in array"); - -var inspect = eyes.inspector({ stream: null }); - -util.puts(inspect('something', "something")); -util.puts(inspect("something else")); - -util.puts(inspect(["no color"], null, { styles: false })); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/package.json b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/package.json deleted file mode 100644 index e06697d..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "cliff", - "description": "Your CLI formatting friend.", - "version": "0.1.7", - "author": { - "name": "Nodejitsu", - "email": "info@nodejitsu.com" - }, - "repository": { - "type": "git", - "url": "git://github.com/flatiron/cliff.git" - }, - "keywords": [ - "cli", - "logging", - "tools", - "winston" - ], - "dependencies": { - "colors": "0.x.x", - "eyes": "0.1.x", - "winston": "0.5.x" - }, - "devDependencies": { - "vows": "0.5.x" - }, - "main": "./lib/cliff", - "scripts": { - "test": "vows test/*-test.js --spec" - }, - "engines": { - "node": ">= 0.4.0" - }, - "_id": "cliff@0.1.7", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "cliff@0.1.7" -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/test/cliff-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/cliff/test/cliff-test.js deleted file mode 100644 index 17c5952..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/cliff/test/cliff-test.js +++ /dev/null @@ -1,79 +0,0 @@ -/* - * log-test.js: Tests for cliff. - * - * (C) 2010, Nodejitsu Inc. - * - */ - -var assert = require('assert'), - vows = require('vows'), - eyes = require('eyes'), - cliff = require('../lib/cliff'); - -vows.describe('cliff').addBatch({ - "When using cliff module": { - "the columnMajor() method": { - "should respond with rows in column major form": function () { - var columns, rows = [ - ["1a", "2a", "3a", "4a"], - ["1b", "2b", "3b", "4b"], - ["1c", "2c", "3c", "4c"] - ]; - - columns = cliff.columnMajor(rows); - for (var i = 0; i < columns.length; i++) { - columns[i].forEach(function (val) { - assert.isTrue(val.indexOf(i + 1) !== -1); - }); - } - } - }, - "the arrayLengths() method": { - "with a set of strings": { - "should respond with a list of the longest elements": function () { - var lengths, rows = [ - ["1a", "2a", "3a", "4a"], - ["1b", "2bb", "3b", "4b"], - ["1c", "2c", "3ccc", "4c"], - ["1d", "2d", "3dd", "4dddd"] - ]; - - lengths = cliff.arrayLengths(rows); - assert.equal(lengths[0], 2); - assert.equal(lengths[1], 3); - assert.equal(lengths[2], 4); - assert.equal(lengths[3], 5); - } - }, - "with a set of numbers and strings": { - "should respond with a list of the longest elements": function () { - var lengths, rows = [ - [11, "2a", "3a", "4a"], - ["1b", 222, "3b", "4b"], - ["1c", "2c", 3333, "4c"], - ["1d", "2d", "3dd", 44444] - ]; - - lengths = cliff.arrayLengths(rows); - assert.equal(lengths[0], 2); - assert.equal(lengths[1], 3); - assert.equal(lengths[2], 4); - assert.equal(lengths[3], 5); - } - } - }, - "the stringifyRows() method": { - "should calculate padding correctly for numbers": function() { - var rows = [ - ['a', 'b'], - [12345, 1] - ]; - - assert.equal( - cliff.stringifyRows(rows), - 'a b \n12345 1 ' - ); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/colors/MIT-LICENSE.txt b/node_modules/flatiron/node_modules/broadway/node_modules/colors/MIT-LICENSE.txt deleted file mode 100644 index 7dca107..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/colors/MIT-LICENSE.txt +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2010 - -Marak Squires -Alexis Sellier (cloudhead) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/colors/ReadMe.md b/node_modules/flatiron/node_modules/broadway/node_modules/colors/ReadMe.md deleted file mode 100644 index 1c6b0d0..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/colors/ReadMe.md +++ /dev/null @@ -1,77 +0,0 @@ -# colors.js - get color and style in your node.js console ( and browser ) like what - - - - -## Installation - - npm install colors - -## colors and styles! - -- bold -- italic -- underline -- inverse -- yellow -- cyan -- white -- magenta -- green -- red -- grey -- blue -- rainbow -- zebra -- random - -## Usage - -``` js -var colors = require('./colors'); - -console.log('hello'.green); // outputs green text -console.log('i like cake and pies'.underline.red) // outputs red underlined text -console.log('inverse the color'.inverse); // inverses the color -console.log('OMG Rainbows!'.rainbow); // rainbow (ignores spaces) -``` - -# Creating Custom themes - -```js - -var require('colors'); - -colors.setTheme({ - silly: 'rainbow', - input: 'grey', - verbose: 'cyan', - prompt: 'grey', - info: 'green', - data: 'grey', - help: 'cyan', - warn: 'yellow', - debug: 'blue', - error: 'red' -}); - -// outputs red text -console.log("this is an error".error); - -// outputs yellow text -console.log("this is a warning".warn); -``` - - -### Contributors - -Marak (Marak Squires) -Alexis Sellier (cloudhead) -mmalecki (Maciej Małecki) -nicoreed (Nico Reed) -morganrallen (Morgan Allen) -JustinCampbell (Justin Campbell) -ded (Dustin Diaz) - - -#### , Marak Squires , Justin Campbell, Dustin Diaz (@ded) diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/colors/colors.js b/node_modules/flatiron/node_modules/broadway/node_modules/colors/colors.js deleted file mode 100644 index a7198f1..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/colors/colors.js +++ /dev/null @@ -1,269 +0,0 @@ -/* -colors.js - -Copyright (c) 2010 - -Marak Squires -Alexis Sellier (cloudhead) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -*/ - -var isHeadless = false; - -if (typeof module !== 'undefined') { - isHeadless = true; -} - -if (!isHeadless) { - var exports = {}; - var module = {}; - var colors = exports; - exports.mode = "browser"; -} else { - exports.mode = "console"; -} - -// -// Prototypes the string object to have additional method calls that add terminal colors -// -var addProperty = function (color, func) { - var allowOverride = ['bold']; - exports[color] = function(str) { - return func.apply(str); - }; - String.prototype.__defineGetter__(color, func); -} - -// -// Iterate through all default styles and colors -// - -var x = ['bold', 'underline', 'italic', 'inverse', 'grey', 'black', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta']; -x.forEach(function (style) { - - // __defineGetter__ at the least works in more browsers - // http://robertnyman.com/javascript/javascript-getters-setters.html - // Object.defineProperty only works in Chrome - addProperty(style, function () { - return stylize(this, style); - }); -}); - -function sequencer(map) { - return function () { - if (!isHeadless) { - return this.replace(/( )/, '$1'); - } - var exploded = this.split(""); - var i = 0; - exploded = exploded.map(map); - return exploded.join(""); - } -} - -var rainbowMap = (function () { - var rainbowColors = ['red','yellow','green','blue','magenta']; //RoY G BiV - return function (letter, i, exploded) { - if (letter == " ") { - return letter; - } else { - return stylize(letter, rainbowColors[i++ % rainbowColors.length]); - } - } -})(); - -exports.addSequencer = function (name, map) { - addProperty(name, sequencer(map)); -} - -exports.addSequencer('rainbow', rainbowMap); -exports.addSequencer('zebra', function (letter, i, exploded) { - return i % 2 === 0 ? letter : letter.inverse; -}); - -exports.setTheme = function (theme) { - Object.keys(theme).forEach(function(prop){ - addProperty(prop, function(){ - return exports[theme[prop]](this); - }); - }); -} - -function stylize(str, style) { - - if (exports.mode == 'console') { - var styles = { - //styles - 'bold' : ['\033[1m', '\033[22m'], - 'italic' : ['\033[3m', '\033[23m'], - 'underline' : ['\033[4m', '\033[24m'], - 'inverse' : ['\033[7m', '\033[27m'], - //grayscale - 'white' : ['\033[37m', '\033[39m'], - 'grey' : ['\033[90m', '\033[39m'], - 'black' : ['\033[30m', '\033[39m'], - //colors - 'blue' : ['\033[34m', '\033[39m'], - 'cyan' : ['\033[36m', '\033[39m'], - 'green' : ['\033[32m', '\033[39m'], - 'magenta' : ['\033[35m', '\033[39m'], - 'red' : ['\033[31m', '\033[39m'], - 'yellow' : ['\033[33m', '\033[39m'] - }; - } else if (exports.mode == 'browser') { - var styles = { - //styles - 'bold' : ['', ''], - 'italic' : ['', ''], - 'underline' : ['', ''], - 'inverse' : ['', ''], - //grayscale - 'white' : ['', ''], - 'grey' : ['', ''], - 'black' : ['', ''], - //colors - 'blue' : ['', ''], - 'cyan' : ['', ''], - 'green' : ['', ''], - 'magenta' : ['', ''], - 'red' : ['', ''], - 'yellow' : ['', ''] - }; - } else if (exports.mode == 'none') { - return str; - } else { - console.log('unsupported mode, try "browser", "console" or "none"'); - } - return styles[style][0] + str + styles[style][1]; -}; - -// don't summon zalgo -addProperty('zalgo', function () { - return zalgo(this); -}); - -// please no -function zalgo(text, options) { - var soul = { - "up" : [ - '̍','̎','̄','̅', - '̿','̑','̆','̐', - '͒','͗','͑','̇', - '̈','̊','͂','̓', - '̈','͊','͋','͌', - '̃','̂','̌','͐', - '̀','́','̋','̏', - '̒','̓','̔','̽', - '̉','ͣ','ͤ','ͥ', - 'ͦ','ͧ','ͨ','ͩ', - 'ͪ','ͫ','ͬ','ͭ', - 'ͮ','ͯ','̾','͛', - '͆','̚' - ], - "down" : [ - '̖','̗','̘','̙', - '̜','̝','̞','̟', - '̠','̤','̥','̦', - '̩','̪','̫','̬', - '̭','̮','̯','̰', - '̱','̲','̳','̹', - '̺','̻','̼','ͅ', - '͇','͈','͉','͍', - '͎','͓','͔','͕', - '͖','͙','͚','̣' - ], - "mid" : [ - '̕','̛','̀','́', - '͘','̡','̢','̧', - '̨','̴','̵','̶', - '͜','͝','͞', - '͟','͠','͢','̸', - '̷','͡',' ҉' - ] - }, - all = [].concat(soul.up, soul.down, soul.mid), - zalgo = {}; - - function randomNumber(range) { - r = Math.floor(Math.random()*range); - return r; - }; - - function is_char(character) { - var bool = false; - all.filter(function(i){ - bool = (i == character); - }); - return bool; - } - - function heComes(text, options){ - result = ''; - options = options || {}; - options["up"] = options["up"] || true; - options["mid"] = options["mid"] || true; - options["down"] = options["down"] || true; - options["size"] = options["size"] || "maxi"; - var counts; - text = text.split(''); - for(var l in text){ - if(is_char(l)) { continue; } - result = result + text[l]; - - counts = {"up" : 0, "down" : 0, "mid" : 0}; - - switch(options.size) { - case 'mini': - counts.up = randomNumber(8); - counts.min= randomNumber(2); - counts.down = randomNumber(8); - break; - case 'maxi': - counts.up = randomNumber(16) + 3; - counts.min = randomNumber(4) + 1; - counts.down = randomNumber(64) + 3; - break; - default: - counts.up = randomNumber(8) + 1; - counts.mid = randomNumber(6) / 2; - counts.down= randomNumber(8) + 1; - break; - } - - var arr = ["up", "mid", "down"]; - for(var d in arr){ - var index = arr[d]; - for (var i = 0 ; i <= counts[index]; i++) - { - if(options[index]) { - result = result + soul[index][randomNumber(soul[index].length)]; - } - } - } - } - return result; - }; - return heComes(text); -} - -addProperty('stripColors', function() { - return ("" + this).replace(/\u001b\[\d+m/g,''); -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/colors/example.html b/node_modules/flatiron/node_modules/broadway/node_modules/colors/example.html deleted file mode 100644 index ab95649..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/colors/example.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - - Colors Example - - - - - - \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/colors/example.js b/node_modules/flatiron/node_modules/broadway/node_modules/colors/example.js deleted file mode 100644 index 3da2986..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/colors/example.js +++ /dev/null @@ -1,65 +0,0 @@ -var colors = require('./colors'); - -//colors.mode = "browser"; - -var test = colors.red("hopefully colorless output"); -console.log('Rainbows are fun!'.rainbow); -console.log('So '.italic + 'are'.underline + ' styles! '.bold + 'inverse'.inverse); // styles not widely supported -console.log('Chains are also cool.'.bold.italic.underline.red); // styles not widely supported -//console.log('zalgo time!'.zalgo); -console.log(test.stripColors); -console.log("a".grey + " b".black); - -console.log("Zebras are so fun!".zebra); - -console.log(colors.rainbow('Rainbows are fun!')); -console.log(colors.italic('So ') + colors.underline('are') + colors.bold(' styles! ') + colors.inverse('inverse')); // styles not widely supported -console.log(colors.bold(colors.italic(colors.underline(colors.red('Chains are also cool.'))))); // styles not widely supported -//console.log(colors.zalgo('zalgo time!')); -console.log(colors.stripColors(test)); -console.log(colors.grey("a") + colors.black(" b")); - -colors.addSequencer("america", function(letter, i, exploded) { - if(letter === " ") return letter; - switch(i%3) { - case 0: return letter.red; - case 1: return letter.white; - case 2: return letter.blue; - } -}); - -colors.addSequencer("random", (function() { - var available = ['bold', 'underline', 'italic', 'inverse', 'grey', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta']; - - return function(letter, i, exploded) { - return letter === " " ? letter : letter[available[Math.round(Math.random() * (available.length - 1))]]; - }; -})()); - -console.log("AMERICA! F--K YEAH!".america); -console.log("So apparently I've been to Mars, with all the little green men. But you know, I don't recall.".random); - -// -// Custom themes -// - -colors.setTheme({ - silly: 'rainbow', - input: 'grey', - verbose: 'cyan', - prompt: 'grey', - info: 'green', - data: 'grey', - help: 'cyan', - warn: 'yellow', - debug: 'blue', - error: 'red' -}); - -// outputs red text -console.log("this is an error".error); - -// outputs yellow text -console.log("this is a warning".warn); - - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/colors/package.json b/node_modules/flatiron/node_modules/broadway/node_modules/colors/package.json deleted file mode 100644 index a9261ae..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/colors/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "colors", - "description": "get colors in your node.js console like what", - "version": "0.6.0-1", - "author": { - "name": "Marak Squires" - }, - "repository": { - "type": "git", - "url": "git://github.com/Marak/colors.js.git" - }, - "engines": { - "node": ">=0.1.90" - }, - "main": "colors", - "_id": "colors@0.6.0-1", - "dependencies": {}, - "devDependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "colors@0.6.0-1", - "scripts": {} -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/colors/test.js b/node_modules/flatiron/node_modules/broadway/node_modules/colors/test.js deleted file mode 100644 index 1c03d65..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/colors/test.js +++ /dev/null @@ -1,65 +0,0 @@ -var assert = require('assert'), - colors = require('./colors'); - -// -// This is a pretty nice example on how tests shouldn't be written. However, -// it's more about API stability than about really testing it (although it's -// a pretty complete test suite). -// - -var s = 'string'; - -function a(s, code) { - return '\033[' + code.toString() + 'm' + s + '\033[39m'; -} - -function aE(s, color, code) { - assert.equal(s[color], a(s, code)); - assert.equal(colors[color](s), a(s, code)); - assert.equal(s[color], colors[color](s)); - assert.equal(s[color].stripColors, s); - assert.equal(s[color].stripColors, colors.stripColors(s)); -} - -function h(s, color) { - return '' + s + ''; - // that's pretty dumb approach to testing it -} - -var stylesColors = ['white', 'grey', 'black', 'blue', 'cyan', 'green', 'magenta', 'red', 'yellow']; -var stylesAll = stylesColors.concat(['bold', 'italic', 'underline', 'inverse', 'rainbow']); - -colors.mode = 'console'; -assert.equal(s.bold, '\033[1m' + s + '\033[22m'); -assert.equal(s.italic, '\033[3m' + s + '\033[23m'); -assert.equal(s.underline, '\033[4m' + s + '\033[24m'); -assert.equal(s.inverse, '\033[7m' + s + '\033[27m'); -assert.ok(s.rainbow); -aE(s, 'white', 37); -aE(s, 'grey', 90); -aE(s, 'black', 30); -aE(s, 'blue', 34); -aE(s, 'cyan', 36); -aE(s, 'green', 32); -aE(s, 'magenta', 35); -aE(s, 'red', 31); -aE(s, 'yellow', 33); -assert.equal(s, 'string'); - -colors.mode = 'browser'; -assert.equal(s.bold, '' + s + ''); -assert.equal(s.italic, '' + s + ''); -assert.equal(s.underline, '' + s + ''); -assert.equal(s.inverse, '' + s + ''); -assert.ok(s.rainbow); -stylesColors.forEach(function (color) { - assert.equal(s[color], h(s, color)); - assert.equal(colors[color](s), h(s, color)); -}); - -colors.mode = 'none'; -stylesAll.forEach(function (style) { - assert.equal(s[style], s); - assert.equal(colors[style](s), s); -}); - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/.npmignore b/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/.npmignore deleted file mode 100644 index dbed671..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/.npmignore +++ /dev/null @@ -1,13 +0,0 @@ -#ignore these files -*.swp -*~ -*.lock -*.DS_Store -node_modules -npm-debug.log -*.out -*.o -*.tmp - - - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/README.md b/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/README.md deleted file mode 100644 index f70c014..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/README.md +++ /dev/null @@ -1,203 +0,0 @@ -# EventEmitter2 - -EventEmitter2 is a an implementation of the EventEmitter found in Node.js - -## Features - - - Namespaces/Wildcards. - - Times To Listen (TTL), extends the `once` concept with `many`. - - Browser environment compatibility. - - ~2x faster than Node.js event emitter for non-namespaced events. - -## Differences (Non breaking, compatible with existing EventEmitter) - - - The constructor takes a configuration object. - -```javascript - var EventEmitter2 = require('eventemitter2').EventEmitter2; - var server = new EventEmitter2({ - wildcard: true, // should the event emitter use wildcards. - delimiter: '::', // the delimiter used to segment namespaces, defaults to `.`. - maxListeners: 20, // the max number of listeners that can be assigned to an event, defaults to 10. - }); -``` - - - Getting the actual event that fired. - -```javascript - server.on('foo.*', function(value1, value2) { - console.log(this.event, value1, value2); - }); -``` - - - Fire an event N times and then remove it, an extension of the `once` concept. - -```javascript - server.many('foo', 4, function() { - console.log('hello'); - }); -``` - - - Pass in a namespaced event as an array rather than a delimited string. - -```javascript - server.many(['foo', 'bar', 'bazz'], function() { - console.log('hello'); - }); -``` - - -## API - -When an `EventEmitter` instance experiences an error, the typical action is -to emit an `error` event. Error events are treated as a special case. -If there is no listener for it, then the default action is to print a stack -trace and exit the program. - -All EventEmitters emit the event `newListener` when new listeners are -added. - - -**Namespaces** with **Wildcards** -To use namespaces/wildcards, pass the `wildcard` option into the EventEmitter constructor. -When namespaces/wildcards are enabled, events can either be strings (`foo.bar`) separated -by a delimiter or arrays (`['foo', 'bar']`). The delimiter is also configurable as a -constructor option. - -An event name passed to any event emitter method can contain a wild card (the `*` character). -If the event name is a string, a wildcard may appear as `foo.*`. If the event name is an array, -the wildcard may appear as `['foo', '*']`. - -If either of the above described events were passed to the `on` method, subsequent emits such -as the following would be observed... - -```javascript - emitter.emit(['foo.bazz']); - emitter.emit(['foo', 'bar']); -``` - - -#### emitter.addListener(event, listener) -#### emitter.on(event, listener) - -Adds a listener to the end of the listeners array for the specified event. - -```javascript - server.on('data', function(value1, value2, value3 /* accepts any number of expected values... */) { - console.log('The event was raised!'); - }); -``` - -```javascript - server.on('data', function(value) { - console.log('This event will be listened to exactly four times.'); - }); -``` - -#### emitter.onAny(listener) - -Adds a listener that will be fired when any event is emitted. - -```javascript - server.onAny(function(value) { - console.log('This event will be listened to exactly four times.'); - }); -``` - -#### emitter.offAny(listener) - -Removes the listener that will be fired when any event is emitted. - -```javascript - server.offAny(function(value) { - console.log('This event will be listened to exactly four times.'); - }); -``` - -#### emitter.once(event, listener) - -Adds a **one time** listener for the event. The listener is invoked only the first time the event is fired, after which it is removed. - -```javascript - server.once('get', function (value) { - console.log('Ah, we have our first value!'); - }); -``` - -#### emitter.many(event, timesToListen, listener) - -Adds a listener that will execute **n times** for the event before being removed. The listener is invoked only the first time the event is fired, after which it is removed. - -```javascript - server.many('get', 4, function (value) { - console.log('Ah, we have our first value!'); - }); -``` - - -#### emitter.removeListener(event, listener) -#### emitter.off(event, listener) - -Remove a listener from the listener array for the specified event. **Caution**: changes array indices in the listener array behind the listener. - -```javascript - var callback = function(value) { - console.log('someone connected!'); - }; - server.on('get', callback); - // ... - server.removeListener('get', callback); -``` - - -#### emitter.removeAllListeners([event]) - -Removes all listeners, or those of the specified event. - - -#### emitter.setMaxListeners(n) - -By default EventEmitters will print a warning if more than 10 listeners are added to it. This is a useful default which helps finding memory leaks. Obviously not all Emitters should be limited to 10. This function allows that to be increased. Set to zero for unlimited. - - -#### emitter.listeners(event) - -Returns an array of listeners for the specified event. This array can be manipulated, e.g. to remove listeners. - -```javascript - server.on('get', function(value) { - console.log('someone connected!'); - }); - console.log(console.log(server.listeners('get')); // [ [Function] ] -``` - -#### emitter.listenersAny(event) - -Returns an array of listeners that are listening for any event that is specified. This array can be manipulated, e.g. to remove listeners. - -```javascript - server.onAny(function(value) { - console.log('someone connected!'); - }); - console.log(console.log(server.listenersAny()[0]); // [ [Function] ] // someone connected! -``` - -#### emitter.emit(event, [arg1], [arg2], [...]) - -Execute each of the listeners that may be listening for the specified event name in order with the list of arguments. - -## Test coverage - -There is a test suite that tries to cover each use case, it can be found here. - -## Licence - -(The MIT License) - -Copyright (c) 2011 hij1nx - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/index.js b/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/index.js deleted file mode 100644 index 6f583b5..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./lib/eventemitter2'); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/lib/eventemitter2.js b/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/lib/eventemitter2.js deleted file mode 100644 index c66c1ad..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/lib/eventemitter2.js +++ /dev/null @@ -1,547 +0,0 @@ -;!function(exports, undefined) { - - var isArray = Array.isArray ? Array.isArray : function _isArray(obj) { - return Object.prototype.toString.call(obj) === "[object Array]"; - }; - var defaultMaxListeners = 10; - - function init() { - this._events = new Object; - } - - function configure(conf) { - if (conf) { - conf.delimiter && (this.delimiter = conf.delimiter); - conf.wildcard && (this.wildcard = conf.wildcard); - if (this.wildcard) { - this.listenerTree = new Object; - } - } - } - - function EventEmitter(conf) { - this._events = new Object; - configure.call(this, conf); - } - - // - // Attention, function return type now is array, always ! - // It has zero elements if no any matches found and one or more - // elements (leafs) if there are matches - // - function searchListenerTree(handlers, type, tree, i) { - if (!tree) { - return []; - } - var listeners=[], leaf, len, branch, xTree, xxTree, isolatedBranch, endReached, - typeLength = type.length, currentType = type[i], nextType = type[i+1]; - if (i === typeLength && tree._listeners) { - // - // If at the end of the event(s) list and the tree has listeners - // invoke those listeners. - // - if (typeof tree._listeners === 'function') { - handlers && handlers.push(tree._listeners); - return [tree]; - } else { - for (leaf = 0, len = tree._listeners.length; leaf < len; leaf++) { - handlers && handlers.push(tree._listeners[leaf]); - } - return [tree]; - } - } - - if ((currentType === '*' || currentType === '**') || tree[currentType]) { - // - // If the event emitted is '*' at this part - // or there is a concrete match at this patch - // - if (currentType === '*') { - for (branch in tree) { - if (branch !== '_listeners' && tree.hasOwnProperty(branch)) { - listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+1)); - } - } - return listeners; - } else if(currentType === '**') { - endReached = (i+1 === typeLength || (i+2 === typeLength && nextType === '*')); - if(endReached && tree._listeners) { - // The next element has a _listeners, add it to the handlers. - listeners = listeners.concat(searchListenerTree(handlers, type, tree, typeLength)); - } - - for (branch in tree) { - if (branch !== '_listeners' && tree.hasOwnProperty(branch)) { - if(branch === '*' || branch === '**') { - if(tree[branch]._listeners && !endReached) { - listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], typeLength)); - } - listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i)); - } else if(branch === nextType) { - listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+2)); - } else { - // No match on this one, shift into the tree but not in the type array. - listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i)); - } - } - } - return listeners; - } - - listeners = listeners.concat(searchListenerTree(handlers, type, tree[currentType], i+1)); - } - - xTree = tree['*']; - if (xTree) { - // - // If the listener tree will allow any match for this part, - // then recursively explore all branches of the tree - // - searchListenerTree(handlers, type, xTree, i+1); - } - - xxTree = tree['**']; - if(xxTree) { - if(i < typeLength) { - if(xxTree._listeners) { - // If we have a listener on a '**', it will catch all, so add its handler. - searchListenerTree(handlers, type, xxTree, typeLength); - } - - // Build arrays of matching next branches and others. - for(branch in xxTree) { - if(branch !== '_listeners' && xxTree.hasOwnProperty(branch)) { - if(branch === nextType) { - // We know the next element will match, so jump twice. - searchListenerTree(handlers, type, xxTree[branch], i+2); - } else if(branch === currentType) { - // Current node matches, move into the tree. - searchListenerTree(handlers, type, xxTree[branch], i+1); - } else { - isolatedBranch = {}; - isolatedBranch[branch] = xxTree[branch]; - searchListenerTree(handlers, type, { '**': isolatedBranch }, i+1); - } - } - } - } else if(xxTree._listeners) { - // We have reached the end and still on a '**' - searchListenerTree(handlers, type, xxTree, typeLength); - } else if(xxTree['*'] && xxTree['*']._listeners) { - searchListenerTree(handlers, type, xxTree['*'], typeLength); - } - } - - return listeners; - } - - function growListenerTree(type, listener) { - - type = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); - - // - // Looks for two consecutive '**', if so, don't add the event at all. - // - for(var i = 0, len = type.length; i+1 < len; i++) { - if(type[i] === '**' && type[i+1] === '**') { - return; - } - } - - var tree = this.listenerTree; - var name = type.shift(); - - while (name) { - - if (!tree[name]) { - tree[name] = new Object; - } - - tree = tree[name]; - - if (type.length === 0) { - - if (!tree._listeners) { - tree._listeners = listener; - } - else if(typeof tree._listeners === 'function') { - tree._listeners = [tree._listeners, listener]; - } - else if (isArray(tree._listeners)) { - - tree._listeners.push(listener); - - if (!tree._listeners.warned) { - - var m = defaultMaxListeners; - - if (typeof this._events.maxListeners !== 'undefined') { - m = this._events.maxListeners; - } - - if (m > 0 && tree._listeners.length > m) { - - tree._listeners.warned = true; - console.error('(node) warning: possible EventEmitter memory ' + - 'leak detected. %d listeners added. ' + - 'Use emitter.setMaxListeners() to increase limit.', - tree._listeners.length); - console.trace(); - } - } - } - return true; - } - name = type.shift(); - } - return true; - }; - - // By default EventEmitters will print a warning if more than - // 10 listeners are added to it. This is a useful default which - // helps finding memory leaks. - // - // Obviously not all Emitters should be limited to 10. This function allows - // that to be increased. Set to zero for unlimited. - - EventEmitter.prototype.delimiter = '.'; - - EventEmitter.prototype.setMaxListeners = function(n) { - this._events || init.call(this); - this._events.maxListeners = n; - }; - - EventEmitter.prototype.event = ''; - - EventEmitter.prototype.once = function(event, fn) { - this.many(event, 1, fn); - return this; - }; - - EventEmitter.prototype.many = function(event, ttl, fn) { - var self = this; - - if (typeof fn !== 'function') { - throw new Error('many only accepts instances of Function'); - } - - function listener() { - if (--ttl === 0) { - self.off(event, listener); - } - fn.apply(this, arguments); - }; - - listener._origin = fn; - - this.on(event, listener); - - return self; - }; - - EventEmitter.prototype.emit = function() { - this._events || init.call(this); - - var type = arguments[0]; - - if (type === 'newListener') { - if (!this._events.newListener) { return false; } - } - - // Loop through the *_all* functions and invoke them. - if (this._all) { - var l = arguments.length; - var args = new Array(l - 1); - for (var i = 1; i < l; i++) args[i - 1] = arguments[i]; - for (i = 0, l = this._all.length; i < l; i++) { - this.event = type; - this._all[i].apply(this, args); - } - } - - // If there is no 'error' event listener then throw. - if (type === 'error') { - - if (!this._all && - !this._events.error && - !(this.wildcard && this.listenerTree.error)) { - - if (arguments[1] instanceof Error) { - throw arguments[1]; // Unhandled 'error' event - } else { - throw new Error("Uncaught, unspecified 'error' event."); - } - return false; - } - } - - var handler; - - if(this.wildcard) { - handler = []; - var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); - searchListenerTree.call(this, handler, ns, this.listenerTree, 0); - } - else { - handler = this._events[type]; - } - - if (typeof handler === 'function') { - this.event = type; - if (arguments.length === 1) { - handler.call(this); - } - else if (arguments.length > 1) - switch (arguments.length) { - case 2: - handler.call(this, arguments[1]); - break; - case 3: - handler.call(this, arguments[1], arguments[2]); - break; - // slower - default: - var l = arguments.length; - var args = new Array(l - 1); - for (var i = 1; i < l; i++) args[i - 1] = arguments[i]; - handler.apply(this, args); - } - return true; - } - else if (handler) { - var l = arguments.length; - var args = new Array(l - 1); - for (var i = 1; i < l; i++) args[i - 1] = arguments[i]; - - var listeners = handler.slice(); - for (var i = 0, l = listeners.length; i < l; i++) { - this.event = type; - listeners[i].apply(this, args); - } - return (listeners.length > 0) || this._all; - } - else { - return this._all; - } - - }; - - EventEmitter.prototype.on = function(type, listener) { - - if (typeof type === 'function') { - this.onAny(type); - return this; - } - - if (typeof listener !== 'function') { - throw new Error('on only accepts instances of Function'); - } - this._events || init.call(this); - - // To avoid recursion in the case that type == "newListeners"! Before - // adding it to the listeners, first emit "newListeners". - this.emit('newListener', type, listener); - - if(this.wildcard) { - growListenerTree.call(this, type, listener); - return this; - } - - if (!this._events[type]) { - // Optimize the case of one listener. Don't need the extra array object. - this._events[type] = listener; - } - else if(typeof this._events[type] === 'function') { - // Adding the second element, need to change to array. - this._events[type] = [this._events[type], listener]; - } - else if (isArray(this._events[type])) { - // If we've already got an array, just append. - this._events[type].push(listener); - - // Check for listener leak - if (!this._events[type].warned) { - - var m = defaultMaxListeners; - - if (typeof this._events.maxListeners !== 'undefined') { - m = this._events.maxListeners; - } - - if (m > 0 && this._events[type].length > m) { - - this._events[type].warned = true; - console.error('(node) warning: possible EventEmitter memory ' + - 'leak detected. %d listeners added. ' + - 'Use emitter.setMaxListeners() to increase limit.', - this._events[type].length); - console.trace(); - } - } - } - return this; - }; - - EventEmitter.prototype.onAny = function(fn) { - - if(!this._all) { - this._all = []; - } - - if (typeof fn !== 'function') { - throw new Error('onAny only accepts instances of Function'); - } - - // Add the function to the event listener collection. - this._all.push(fn); - return this; - }; - - EventEmitter.prototype.addListener = EventEmitter.prototype.on; - - EventEmitter.prototype.off = function(type, listener) { - if (typeof listener !== 'function') { - throw new Error('removeListener only takes instances of Function'); - } - - var handlers,leafs=[]; - - if(this.wildcard) { - var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); - leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0); - } - else { - // does not use listeners(), so no side effect of creating _events[type] - if (!this._events[type]) return this; - handlers = this._events[type]; - leafs.push({_listeners:handlers}); - } - - for (var iLeaf=0; iLeaf 0) { - fns = this._all; - for(i = 0, l = fns.length; i < l; i++) { - if(fn === fns[i]) { - fns.splice(i, 1); - return this; - } - } - } else { - this._all = []; - } - return this; - }; - - EventEmitter.prototype.removeListener = EventEmitter.prototype.off; - - EventEmitter.prototype.removeAllListeners = function(type) { - if (arguments.length === 0) { - !this._events || init.call(this); - return this; - } - - if(this.wildcard) { - var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); - var leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0); - - for (var iLeaf=0; iLeaf= 0.2.2" - }, - "engines": [ - "node" - ], - "main": "./lib/eventemitter2.js", - "scripts": { - "test": "nodeunit test/simple/* && nodeunit test/wildcardEvents/*", - "benchmark": "node test/perf/benchmark.js" - }, - "_id": "eventemitter2@0.4.9", - "dependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "eventemitter2@0.4.9" -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/common.js b/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/common.js deleted file mode 100644 index ee077a8..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/common.js +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var path = require('path'); -var assert = require('assert'); - -exports.testDir = path.dirname(__filename); -exports.fixturesDir = path.join(exports.testDir, 'fixtures'); -exports.libDir = path.join(exports.testDir, '../lib'); -exports.tmpDir = path.join(exports.testDir, 'tmp'); -exports.PORT = 12346; - -if (process.platform == 'win32') { - exports.PIPE = '\\\\.\\pipe\\libuv-test'; -} else { - exports.PIPE = exports.tmpDir + '/test.sock'; -} - -var util = require('util'); -for (var i in util) exports[i] = util[i]; -//for (var i in exports) global[i] = exports[i]; - -function protoCtrChain(o) { - var result = []; - for (; o; o = o.__proto__) { result.push(o.constructor); } - return result.join(); -} - -exports.indirectInstanceOf = function(obj, cls) { - if (obj instanceof cls) { return true; } - var clsChain = protoCtrChain(cls.prototype); - var objChain = protoCtrChain(obj); - return objChain.slice(-clsChain.length) === clsChain; -}; - - -// Turn this off if the test should not check for global leaks. -exports.globalCheck = true; - -process.on('exit', function() { - if (!exports.globalCheck) return; - var knownGlobals = [setTimeout, - setInterval, - clearTimeout, - clearInterval, - console, - Buffer, - process, - global.ArrayBuffer!==undefined?ArrayBuffer:null, - global.Int8Array!==undefined?Int8Array:null, - global.Uint8Array!==undefined?Uint8Array:null, - global.Int16Array!==undefined?Int16Array:null, - global.Uint16Array!==undefined?Uint16Array:null, - global.Int32Array!==undefined?Int32Array:null, - global.Uint32Array!==undefined?Uint32Array:null, - global.Float32Array!==undefined?Float32Array:null, - global.Float64Array!==undefined?Float64Array:null, - global.DataView!==undefined?DataView:null, - AssertionError, - global, - events - ]; - - if (global.errno) { - knownGlobals.push(errno); - } - - if (global.gc) { - knownGlobals.push(gc); - } - - if (global.DTRACE_HTTP_SERVER_RESPONSE) { - knownGlobals.push(DTRACE_HTTP_SERVER_RESPONSE); - knownGlobals.push(DTRACE_HTTP_SERVER_REQUEST); - knownGlobals.push(DTRACE_HTTP_CLIENT_RESPONSE); - knownGlobals.push(DTRACE_HTTP_CLIENT_REQUEST); - knownGlobals.push(DTRACE_NET_STREAM_END); - knownGlobals.push(DTRACE_NET_SERVER_CONNECTION); - knownGlobals.push(DTRACE_NET_SOCKET_READ); - knownGlobals.push(DTRACE_NET_SOCKET_WRITE); - } - - for (var x in global) { - var found = false; - - for (var y in knownGlobals) { - if (global[x] === knownGlobals[y]) { - found = true; - break; - } - } - - if (!found) { - console.error('Unknown global: %s', x); - assert.ok(false, 'Unknown global founded'); - } - } -}); - - -// This function allows one two run an HTTP test agaist both HTTPS and -// normal HTTP modules. This ensures they fit the same API. -exports.httpTest = function httpTest(cb) { -}; - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/perf/benchmark.js b/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/perf/benchmark.js deleted file mode 100644 index 5383654..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/perf/benchmark.js +++ /dev/null @@ -1,53 +0,0 @@ - -var Benchmark = require('benchmark'); -var suite = new Benchmark.Suite(); - -var EventEmitter = require('events').EventEmitter; -var emitter = new EventEmitter; - -var EventEmitter2 = require('../../lib/eventemitter2').EventEmitter2; -var emitter2 = new EventEmitter2; - -var EventEmitter3 = require('events').EventEmitter; -var emitter3 = new EventEmitter3; - -suite - - .add('EventEmitterHeatUp', function() { - - emitter3.on('test3', function () { 1==1; }); - emitter3.emit('test3'); - emitter3.removeAllListeners('test3'); - - }) - .add('EventEmitter', function() { - - emitter.on('test1', function () { 1==1; }); - emitter.emit('test1'); - emitter.removeAllListeners('test1'); - - }) - .add('EventEmitter2', function() { - - emitter2.on('test2', function () { 1==1; }); - emitter2.emit('test2'); - emitter2.removeAllListeners('test2'); - - }) - - .add('EventEmitter2 (wild)', function() { - - emitter2.on('test2.foo', function () { 1==1; }); - emitter2.emit('test2.foo'); - emitter2.removeAllListeners('test2.foo'); - - }) - - .on('cycle', function(event, bench) { - console.log(String(bench)); - }) - .on('complete', function() { - console.log('Fastest is ' + this.filter('fastest').pluck('name')); - }) - - .run(true); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/simple/addListener.js b/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/simple/addListener.js deleted file mode 100644 index b318522..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/simple/addListener.js +++ /dev/null @@ -1,192 +0,0 @@ -var simpleEvents = require('nodeunit').testCase; - -var file = '../../lib/eventemitter2'; - -module.exports = simpleEvents({ - - setUp: function (callback) { - var EventEmitter2; - - if(typeof require !== 'undefined') { - EventEmitter2 = require(file).EventEmitter2; - } - else { - EventEmitter2 = window.EventEmitter2; - } - - this.emitter = new EventEmitter2({ verbose: true }); - callback(); - }, - - tearDown: function (callback) { - //clean up? - callback(); - }, - - '1. Add a single listener on a single event.': function (test) { - - var emitter = this.emitter; - - emitter.on('test1', function () { - test.ok(true, 'The event was raised'); - }); - - test.equal(emitter.listeners('test1').length, 1, 'There are three emitters'); - - test.expect(1); - test.done(); - - }, - '2. Add two listeners on a single event.': function (test) { - - var emitter = this.emitter; - - emitter.on('test1', function () { - test.ok(true, 'The event was raised'); - }); - - emitter.on('test1', function () { - test.ok(true, 'The event was raised'); - }); - - test.equal(emitter.listeners('test1').length, 2, 'There are three emitters'); - - test.expect(1); - test.done(); - - }, - '3. Add three listeners on a single event.': function (test) { - - var emitter = this.emitter; - - emitter.on('test1', function () { - test.ok(true, 'The event was raised'); - }); - - emitter.on('test1', function () { - test.ok(true, 'The event was raised'); - }); - - emitter.on('test1', function () { - test.ok(true, 'The event was raised'); - }); - - test.equal(emitter.listeners('test1').length, 3, 'There are three emitters'); - - test.expect(1); - test.done(); - - }, - '4. Add two listeners to two different events.': function (test) { - - var emitter = this.emitter; - - emitter.on('test1', function () { - test.ok(true, 'The event was raised'); - }); - - emitter.on('test1', function () { - test.ok(true, 'The event was raised'); - }); - - emitter.on('test2', function () { - test.ok(true, 'The event was raised'); - }); - - emitter.on('test2', function () { - test.ok(true, 'The event was raised'); - }); - - test.equal(emitter.listeners('test1').length, 2, 'There are two emitters'); - test.equal(emitter.listeners('test2').length, 2, 'There are two emitters'); - - test.expect(2); - test.done(); - - }, - '5. Never adding any listeners should yield a listeners array with the length of 0.': function (test) { - - var emitter = this.emitter; - - emitter.on('test1', function () { - test.ok(true, 'The event was raised'); - }); - - test.equal(emitter.listeners('test2').length, 0, 'There are no emitters'); - - test.expect(1); - test.done(); - }, - - '6. the listener added should be the right listener.': function (test) { - - var emitter = this.emitter; - var type = 'somelistenerbar'; - var f = function () {}; - - emitter.on(type, f); - test.equal(emitter.listeners(type).length, 1, 'There are is one emitters'); - test.equal(emitter.listeners(type)[0], f, 'The function should be f'); - - test.expect(2); - test.done(); - - }, - - '7. should be able to listen on any event' : function (test) { - - var emitter = this.emitter; - var type = 'somelistenerbar'; - var f = function () { - test.ok(true, 'the event was fired') - }; - - emitter.onAny(f); - emitter.emit('test23.ns5.ns5', 'someData'); //1 - emitter.offAny(f); - emitter.emit('test21'); //0 - emitter.onAny(f); - emitter.onAny(f); - emitter.emit('test23.ns5.ns5', 'someData'); //3 - - test.expect(3); - test.done(); - - }, - - '8. should be able to listen on any event (should cause an error)' : function (test) { - - var emitter = this.emitter; - var type = 'somelistenerbar'; - var f = function () { - test.ok(true, 'the event was fired') - }; - emitter.onAny(f); - - emitter.emit('error'); - - test.expect(1); - test.done(); - - }, - - '9. onAny alias' : function (test) { - - var emitter = this.emitter; - var type = 'somelistenerbar'; - - var f = function () { - test.ok(true, 'the event was fired'); - }; - - emitter.on(f); - - emitter.emit('foo'); - emitter.emit('bar'); - - test.expect(2); - test.done(); - - } - -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/simple/emit.js b/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/simple/emit.js deleted file mode 100644 index 58d0302..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/simple/emit.js +++ /dev/null @@ -1,153 +0,0 @@ -var simpleEvents = require('nodeunit').testCase; - -var file = '../../lib/eventemitter2'; - -module.exports = simpleEvents({ - - setUp: function (callback) { - var EventEmitter2; - - if(typeof require !== 'undefined') { - EventEmitter2 = require(file).EventEmitter2; - } - else { - EventEmitter2 = window.EventEmitter2; - } - - this.emitter = new EventEmitter2({ verbose: true }); - callback(); - }, - - tearDown: function (callback) { - //clean up? - callback(); - }, - - '1. Add two listeners on a single event and emit the event.': function (test) { - - var emitter = this.emitter; - - function functionA() { test.ok(true, 'The event was raised'); } - function functionB() { test.ok(true, 'The event was raised'); } - - emitter.on('test2', functionA); - emitter.on('test2', functionB); - - emitter.emit('test2'); - - test.expect(2); - test.done(); - - }, - '2. Add two listeners on a single event and emit the event twice.': function (test) { - - var emitter = this.emitter; - - function functionA() { test.ok(true, 'The event was raised'); } - function functionB() { test.ok(true, 'The event was raised'); } - - emitter.on('test2', functionA); - emitter.on('test2', functionB); - - emitter.emit('test2'); - emitter.emit('test2'); - - test.expect(4); - test.done(); - - }, - '3. Add two listeners on a single event and emit the event with a parameter.': function (test) { - - var emitter = this.emitter; - - function functionA(value1) { - test.ok(true, 'The event was raised'); - test.equal(typeof value1, 'string', 'The event was raised'); - } - - function functionB(value1) { - test.ok(true, 'The event was raised'); - test.equal(typeof value1, 'string', 'The event was raised'); - } - - emitter.on('test2', functionA); - emitter.on('test2', functionB); - - emitter.emit('test2', 'Hello, Node'); - - test.expect(4); - test.done(); - - }, - '4. Add two listeners on an single event and emit the event twice with a parameter.': function (test) { - - var emitter = this.emitter; - - function functionA(value1) { - test.ok(true, 'The event was raised'); - test.equal(typeof value1, 'string', 'The event was raised'); - } - - function functionB(value1) { - test.ok(true, 'The event was raised'); - test.equal(typeof value1, 'string', 'The event was raised'); - } - - emitter.on('test2', functionA); - emitter.on('test2', functionB); - - emitter.emit('test2', 'Hello, Node1'); - emitter.emit('test2', 'Hello, Node2'); - - test.expect(8); - test.done(); - - }, - '5. Add two listeners on an single event and emit the event twice with multiple parameters.': function (test) { - - var emitter = this.emitter; - - function functionA(value1, value2, value3) { - test.ok(true, 'The event was raised'); - test.equal(typeof value1, 'string', 'The value named "value1" is OK'); - test.equal(typeof value2, 'string', 'The value named "value2" is OK'); - test.equal(typeof value3, 'string', 'The value named "value3" is OK'); - } - - function functionB(value1, value2, value3) { - test.ok(true, 'The event was raised'); - test.equal(typeof value1, 'string', 'The value named "value1" is OK'); - test.equal(typeof value2, 'string', 'The value named "value2" is OK'); - test.equal(typeof value3, 'string', 'The value named "value3" is OK'); - } - - emitter.on('test2', functionA); - emitter.on('test2', functionB); - - emitter.emit('test2', 'Hello, Node1', 'Hello, Node2', 'Hello, Node3'); - emitter.emit('test2', 'Hello, Node1', 'Hello, Node2', 'Hello, Node3'); - - test.expect(16); - test.done(); - - }, - '6. Check return values of emit.': function (test) { - - var emitter = this.emitter; - - function functionA() { test.ok(true, 'The event was raised'); } - - emitter.on('test6', functionA); - - test.ok(emitter.emit('test6'), 'emit should return true after calling a listener'); - test.ok(!emitter.emit('other'), 'emit should return false when no listener was called'); - - emitter.onAny(functionA); - test.ok(emitter.emit('other'), 'emit should return true after calling an onAny() listener'); - - test.expect(5); - test.done(); - }, - -}); - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/simple/removeListener.js b/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/simple/removeListener.js deleted file mode 100644 index d4558fd..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/simple/removeListener.js +++ /dev/null @@ -1,199 +0,0 @@ -var simpleEvents= require('nodeunit').testCase; - -var file = '../../lib/eventemitter2'; - -module.exports = simpleEvents({ - - setUp: function (callback) { - var EventEmitter2; - - if(typeof require !== 'undefined') { - EventEmitter2 = require(file).EventEmitter2; - } - else { - EventEmitter2 = window.EventEmitter2; - } - - this.emitter = new EventEmitter2; - callback(); - }, - - tearDown: function (callback) { - //clean up? - callback(); - }, - - 'removeListener1. adding 1, removing 1' : function (test) { - var emitter = this.emitter, - type = 'remove', - listeners; - - var f = function f() { - test.ok(true, 'event was raised'); - }; - - emitter.on(type, f); - listeners = emitter.listeners(type); - test.equal(listeners.length, 1, 'should only have 1'); - - //remove - emitter.removeListener(type, f); - listeners = emitter.listeners(type); - test.equal(listeners.length, 0, 'should be 0'); - - test.expect(2); - test.done(); - }, - - 'removeListener2. adding 2, removing 1' : function (test) { - var emitter = this.emitter, - type = 'remove', - listeners; - - var f = function f() { - test.ok(true, 'event was raised'); - }; - - emitter.on(type, f); - emitter.on(type, f); - listeners = emitter.listeners(type); - test.equal(listeners.length, 2, 'should only have 2'); - - //remove - emitter.removeListener(type, f); - listeners = emitter.listeners(type); - test.equal(listeners.length, 1, 'should be 1'); - - test.expect(2); - test.done(); - }, - - 'removeListener3. adding 3, removing 1' : function (test) { - var emitter = this.emitter, - type = 'remove', - listeners; - - var f = function f() { - test.ok(true, 'event was raised'); - }; - - emitter.on(type, f); - emitter.on(type, f); - emitter.on(type, f); - listeners = emitter.listeners(type); - test.equal(listeners.length, 3, 'should only have 3'); - - //remove - emitter.removeListener(type, f); - listeners = emitter.listeners(type); - test.equal(listeners.length, 2, 'should be 2'); - - test.expect(2); - test.done(); - }, - - 'removeListener4. should error if we don\'t pass in a function' : function (test) { - var emitter = this.emitter, - type = 'remove', - listeners; - - var f = function f() { - test.ok(true, 'event was raised'); - }; - - emitter.on(type, f); - listeners = emitter.listeners(type); - test.equal(listeners.length, 1, 'should only have 1'); - - //remove - test.throws(function () {emitter.removeListener(type, type)}, Error, 'should throw an Error'); - listeners = emitter.listeners(type); - test.equal(listeners.length, 1, 'should be 1'); - - test.expect(3); - test.done(); - }, - - 'removeListener5. removing a different function, should not remove' : function (test) { - var emitter = this.emitter, - type = 'remove', - listeners; - - var f = function f() { - test.ok(true, 'event was raised'); - }; - var g = function g() { - test.ok(true, 'event was raised'); - }; - - emitter.on(type, f); - listeners = emitter.listeners(type); - test.equal(listeners.length, 1, 'should only have 1'); - - //remove - emitter.removeListener(type, g); - listeners = emitter.listeners(type); - test.equal(listeners.length, 1, 'should be 1'); - - test.expect(2); - test.done(); - }, - - 'removeListener6. removing all functions' : function (test) { - var emitter = this.emitter, - type = 'remove', - listeners; - - var f = function f() { - test.ok(true, 'event was raised'); - }; - for (var i = 0; i < 10; i++) { - emitter.on(type, f); - } - listeners = emitter.listeners(type); - test.equal(listeners.length, 10, 'should only have 10'); - - emitter.removeListener(type, f); - listeners = emitter.listeners(type); - test.equal(listeners.length, 9, 'should be 9'); - emitter.removeAllListeners(type); - listeners = emitter.listeners(type); - test.equal(listeners.length, 0, 'should be 0'); - - test.expect(3); - test.done(); - }, - - 'removeListener7. removing different event, should not remove' : function (test) { - var emitter = this.emitter, - type = 'remove', - listeners; - - var f = function f() { - test.ok(true, 'event was raised'); - }; - - for (var i = 0; i < 10; i++) { - emitter.on(type, f); - } - listeners = emitter.listeners(type); - test.equal(listeners.length, 10, 'should only have 10'); - - emitter.removeListener(type+type, f); - listeners = emitter.listeners(type); - test.equal(listeners.length, 10, 'should be 10'); - - emitter.removeAllListeners(type+type); - listeners = emitter.listeners(type); - test.equal(listeners.length, 10, 'should be 10'); - - emitter.removeAllListeners(type); - listeners = emitter.listeners(type); - test.equal(listeners.length, 0, 'should be 0'); - - test.expect(4); - test.done(); - }, - - -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/simple/setMax.js b/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/simple/setMax.js deleted file mode 100644 index 1d8784e..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/simple/setMax.js +++ /dev/null @@ -1,133 +0,0 @@ -var simpleEvents= require('nodeunit').testCase; - -var file = '../../lib/eventemitter2'; - -module.exports = simpleEvents({ - - setUp: function (callback) { - var EventEmitter2; - - if(typeof require !== 'undefined') { - EventEmitter2 = require(file).EventEmitter2; - } - else { - EventEmitter2 = window.EventEmitter2; - } - - this.emitter = new EventEmitter2; - callback(); - }, - - tearDown: function (callback) { - //clean up? - callback(); - }, - - 'setMaxListener1. default behavior of 10 listeners.' : function (test) { - var emitter = this.emitter; - - for (var i = 0; i < 10; i++) { - emitter.on('foobar', function () { - test.ok(true, 'event was raised'); - }); - } - - var listeners = emitter.listeners('foobar'); - test.equal(listeners.length, 10, 'should only have 10'); - - test.expect(1); - test.done(); - }, - - 'setMaxListener2. If we added more than 10, should not see them' : function (test) { - var emitter = this.emitter; - - for (var i = 0; i < 10 ; i++) { - emitter.on('foobar2', function () { - test.ok(true, 'event was raised'); - }); - } - console.log('should see EE2 complaining:'); - emitter.on('foobar2', function () { - test.ok(true, 'event was raised'); - }); - console.log('move on'); - - var listeners = emitter.listeners('foobar2'); - test.equal(listeners.length, 11, 'should have 11'); - test.ok(emitter._events['foobar2'].warned, 'should have been warned'); - - test.expect(2); - test.done(); - }, - - 'setMaxListener3. if we set maxListener to be greater before adding' : function (test) { - var emitter = this.emitter; - var type = 'foobar3'; - - // set to 20 - emitter.setMaxListeners(20); - - for (var i = 0; i < 15 ; i++) { - emitter.on(type, function () { - test.ok(true, 'event was raised'); - }); - } - -// require('eyes').inspect(emitter._events); - - var listeners = emitter.listeners(type); - test.equal(listeners.length, 15, 'should have 15'); - test.ok(!(emitter._events[type].warned), 'should not have been set'); - - test.expect(2); - test.done(); - }, - - 'setMaxListener4. should be able to change it right at 10' : function (test) { - var emitter = this.emitter; - var type = 'foobar4'; - - for (var i = 0; i < 10 ; i++) { - emitter.on(type, function () { - test.ok(true, 'event was raised'); - }); - } - - emitter.setMaxListeners(9001); - emitter.on(type, function () { - test.ok(true, 'event was raised'); - }); - -// require('eyes').inspect(emitter._events); - - var listeners = emitter.listeners(type); - test.equal(listeners.length, 11, 'should have 11'); - test.ok(!(emitter._events[type].warned), 'should not have been set'); - - test.expect(2); - test.done(); - }, - - 'setMaxListener5. if we set maxListener to be 0 should add endlessly' : function (test) { - var emitter = this.emitter; - var type = 'foobar'; - - // set to 0 - emitter.setMaxListeners(0); - - for (var i = 0; i < 25 ; i++) { - emitter.on(type, function () { - test.ok(true, 'event was raised'); - }); - } - - var listeners = emitter.listeners(type); - test.equal(listeners.length, 25, 'should have 25'); - test.ok(!(emitter._events[type].warned), 'should not have been set'); - - test.expect(2); - test.done(); - }, - -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/simple/ttl.js b/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/simple/ttl.js deleted file mode 100644 index cf8281b..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/simple/ttl.js +++ /dev/null @@ -1,126 +0,0 @@ -var simpleEvents = require('nodeunit').testCase; - -var file = '../../lib/eventemitter2'; - -module.exports = simpleEvents({ - - setUp: function (callback) { - var EventEmitter2; - - if(typeof require !== 'undefined') { - EventEmitter2 = require(file).EventEmitter2; - } - else { - EventEmitter2 = window.EventEmitter2; - } - - this.emitter = new EventEmitter2(); - callback(); - }, - - tearDown: function (callback) { - //clean up? - callback(); - }, - - '1. A listener added with `once` should only listen once and then be removed.': function (test) { - - var emitter = this.emitter; - - emitter.once('test1', function () { - test.ok(true, 'The event was raised once'); - }); - - emitter.emit('test1'); - emitter.emit('test1'); - - test.expect(1); - test.done(); - - }, - '2. A listener with a TTL of 4 should only listen 4 times.': function (test) { - - var emitter = this.emitter; - - emitter.many('test1', 4, function (value1) { - test.ok(true, 'The event was raised 4 times.'); - }); - - emitter.emit('test1', 1); - emitter.emit('test1', 2); - emitter.emit('test1', 3); - emitter.emit('test1', 4); - emitter.emit('test1', 5); - - test.expect(4); - test.done(); - - }, - '3. A listener with a TTL of 4 should only listen 4 times and pass parameters.': function (test) { - - var emitter = this.emitter; - - emitter.many('test1', 4, function (value1, value2, value3) { - test.ok(typeof value1 !== 'undefined', 'got value 1'); - test.ok(typeof value2 !== 'undefined', 'got value 2'); - test.ok(typeof value3 !== 'undefined', 'got value 3'); - }); - - emitter.emit('test1', 1, 'A', false); - emitter.emit('test1', 2, 'A', false); - emitter.emit('test1', 3, 'A', false); - emitter.emit('test1', 4, 'A', false); - emitter.emit('test1', 5, 'A', false); - - test.done(); - - }, - '4. Remove an event listener by signature.': function (test) { - - var emitter = this.emitter; - var count = 0; - - function f1(event) { - "event A"; - test.ok(true, 'The event was raised less than 3 times.'); - } - - emitter.on('test1', f1); - - function f2(event) { - "event B"; - test.ok(true, 'The event was raised less than 3 times.'); - } - - emitter.on('test1', f2); - - function f3(event) { - "event C"; - test.ok(true, 'The event was raised less than 3 times.'); - } - - emitter.on('test1', f3); - - emitter.removeListener('test1', f2); - - emitter.emit('test1'); - - test.expect(2); - test.done(); - - }, - '5. `removeListener` and `once`': function(test) { - - var emitter = this.emitter; - var functionA = function() { test.ok(true, 'Event was fired'); }; - - emitter.once('testA', functionA); - emitter.removeListener('testA', functionA); - - emitter.emit('testA'); - - test.expect(0); - test.done(); - } - -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/wildcardEvents/addListener.js b/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/wildcardEvents/addListener.js deleted file mode 100644 index fbc1105..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/wildcardEvents/addListener.js +++ /dev/null @@ -1,307 +0,0 @@ - -var simpleEvents = require('nodeunit').testCase; -var file = '../../lib/eventemitter2'; - -module.exports = simpleEvents({ - - setUp: function (callback) { - var EventEmitter2; - - if(typeof require !== 'undefined') { - EventEmitter2 = require(file).EventEmitter2; - } - else { - EventEmitter2 = window.EventEmitter2; - } - - this.emitter = new EventEmitter2({ - wildcard: true - }); - callback(); - }, - - tearDown: function (callback) { - //clean up? - callback(); - }, - - '1. Add a single listener on a single event.': function (test) { - - var emitter = this.emitter; - var type = 'some.listener.bar'; - - emitter.on(type, function () { - test.ok(true, 'The event was raised'); - }); - - test.equal(emitter.listeners(type).length, 1, 'There are three emitters'); - - test.expect(1); - test.done(); - - }, - - '1a. Add a single listener on a single event (using an array).': function (test) { - - var emitter = this.emitter; - var type = ['some', 'listener', 'bar']; - - emitter.on(type, function () { - test.ok(true, 'The event was raised'); - }); - - test.equal(emitter.listeners(type).length, 1, 'There are three emitters'); - - test.expect(1); - test.done(); - - }, - - '2. Add two listeners on a single event.': function (test) { - - var emitter = this.emitter; - var type = 'some.listener.bar'; - - emitter.on(type, function () { - test.ok(true, 'The event was raised'); - }); - - emitter.on(type, function () { - test.ok(true, 'The event was raised'); - }); - - test.equal(emitter.listeners(type).length, 2, 'There are three emitters'); - - test.expect(1); - test.done(); - - }, - - '2a. Add two listeners on a single event (using an array).': function (test) { - - var emitter = this.emitter; - var type = ['some', 'listener', 'bar']; - - emitter.on(type, function () { - test.ok(true, 'The event was raised'); - }); - - emitter.on(type, function () { - test.ok(true, 'The event was raised'); - }); - - test.equal(emitter.listeners(type).length, 2, 'There are three emitters'); - - test.expect(1); - test.done(); - - }, - - '3. Add three listeners on a single event.': function (test) { - - var emitter = this.emitter; - var type = 'some.listener.bar'; - - emitter.on(type, function () { - test.ok(true, 'The event was raised'); - }); - - emitter.on(type, function () { - test.ok(true, 'The event was raised'); - }); - - emitter.on(type, function () { - test.ok(true, 'The event was raised'); - }); - - test.equal(emitter.listeners(type).length, 3, 'There are three emitters'); - - test.expect(1); - test.done(); - - }, - - '4. Add two listeners to two different events.': function (test) { - - var emitter = this.emitter; - var type = 'some.listener.bar'; - - emitter.on(type, function () { - test.ok(true, 'The event was raised'); - }); - - emitter.on(type, function () { - test.ok(true, 'The event was raised'); - }); - - emitter.on('test2', function () { - test.ok(true, 'The event was raised'); - }); - - emitter.on('test2', function () { - test.ok(true, 'The event was raised'); - }); - - test.equal(emitter.listeners(type).length, 2, 'There are two emitters'); - test.equal(emitter.listeners('test2').length, 2, 'There are two emitters'); - - test.expect(2); - test.done(); - }, - - '5. Never adding any listeners should yield a listeners array with the length of 0.': function (test) { - var emitter = this.emitter; - var type = 'some.listener.bar'; - - emitter.on(type, function () { - test.ok(true, 'The event was raised'); - }); - - test.equal(emitter.listeners('test2').length, 0, 'There are no emitters'); - - test.expect(1); - test.done(); - }, - - '6. the listener added should be the right listener.': function (test) { - var emitter = this.emitter; - var type = 'some.listener.bar'; - var f = function () {}; - - emitter.on(type, f); - test.equal(emitter.listeners(type).length, 1, 'There are is one emitters'); - test.equal(emitter.listeners(type)[0], f, 'The function should be f'); - - test.expect(2); - test.done(); - - }, - - '7. Listeners on `*`, `*.*`, `*.test` with emissions from `foo.test` and `other.emit`': function (test) { - var emitter = this.emitter; - var f = function () { - test.ok(true, 'the event was fired') - }; - - emitter.on('*.test', f); - emitter.on('*.*', f); - emitter.on('*', f); - - emitter.emit('other.emit'); - emitter.emit('foo.test'); - - test.expect(3); - test.done(); - }, - - '8. Listeners on `*`, `*.*`, foo.test with emissions from `*`, `*.*` and `foo.test`': function (test) { - var emitter = this.emitter; - var f = function () { - test.ok(true, 'the event was fired') - }; - - emitter.on('foo.test', f); - emitter.on('*.*', f); - emitter.on('*', f); - - emitter.emit('*.*'); - emitter.emit('foo.test'); - emitter.emit('*') - - test.expect(5); - test.done(); - }, - - '9. Listeners on `*`. (using an array)': function (test) { - - var emitter = this.emitter; - var f = function () { - test.ok(true, 'the event was fired') - }; - - emitter.on(['*'], f); - emitter.emit('*') - - test.expect(1); - test.done(); - }, - - '10. actual event name': function(test) { - - var emitter = this.emitter; - - emitter.on('foo', function() { - emitter.emit('bar'); // changes the current event, passes the old one in as a parameter. - }); - - emitter.on('*', function() { - console.log(this.event); - }); - - - - emitter.emit('foo'); - - test.done(); - }, - - '11. Listeners with multi-level wildcards': function (test) { - var emitter = this.emitter; - var i = 0; - var f = function (n) { - return function() { - //console.log('Event', n, 'fired by', this.event); - test.ok(true, 'the event was fired'); - }; - }; - - emitter.on('**.test', f(i++)); // 0: 0 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 - emitter.on('**.bar.**', f(i++)); // 1: 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + 1 + 1 - emitter.on('**.*', f(i++)); // 2: 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - emitter.on('*.**', f(i++)); // 3: 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - emitter.on('**', f(i++)); // 4: 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 - emitter.on('other.**', f(i++)); // 5: 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 1 + 1 - emitter.on('foo.**.test', f(i++)); // 6: 0 + 1 + 0 + 0 + 1 + 0 + 1 + 1 + 1 + 1 - emitter.on('test.**', f(i++)); // 7: 0 + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 1 + 1 - // Add forbidden patterns for safety purpose. - emitter.on('**.**', f(i++)); - emitter.on('a.b.**.**', f(i++)); - emitter.on('**.**.a.b', f(i++)); - emitter.on('a.b.**.**.a.b', f(i++)); - - emitter.emit('other.emit'); // 4 - emitter.emit('foo.bar.test'); // 6 - emitter.emit('foo.bar.test.bar.foo.test.foo'); // 4 - emitter.emit('bar.bar.bar.bar.bar.bar'); // 4 - emitter.emit('**.*'); // 8 - emitter.emit('test'); // 5 - emitter.emit('foo.test'); // 5 - emitter.emit('foo.**.*'); // 6 - emitter.emit('**.test'); // 8 - emitter.emit('**.test.**'); // 8 - //emitter.emit('*.**.test.**.a'); // 0 - - test.expect(58); - test.done(); - }, - - '12. Check return values of emit for wildcard emitter.': function (test) { - - var emitter = this.emitter; - - emitter.on('foo.*', function () { - test.ok(true, 'The event was raised'); - }); - - emitter.onAny(function () { - test.ok(true, 'The event was raised'); - }); - - test.ok(emitter.emit('foo.blah'), 'emit should return true after calling a listener'); - test.ok(emitter.emit('bar'), 'emit should return true after calling a listener'); - - test.expect(5); - test.done(); - } - -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/wildcardEvents/all.js b/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/wildcardEvents/all.js deleted file mode 100644 index 7094f03..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/wildcardEvents/all.js +++ /dev/null @@ -1,829 +0,0 @@ -var basicEvents = require('nodeunit').testCase; - -/////helper/////// -function setHelper (emitter, test, testName){ - var eventNames = [ - testName, - testName + '.*', - testName + '.ns1', - testName + '.ns1.ns2', - testName + '.ns2.*' - ]; - - for (var i = 0; i < eventNames.length; i++) { - emitter.on(eventNames[i], function () { - test.ok(true, eventNames[i] + 'has fired'); - }); - } - - return eventNames; -}; - -module.exports = basicEvents({ - - setUp: function (callback) { - var EventEmitter2; - - if(typeof require !== 'undefined') { - EventEmitter2 = require('../../lib/eventemitter2').EventEmitter2; - } - else { - EventEmitter2 = window.EventEmitter2; - } - - this.emitter = new EventEmitter2({ - wildcard: true, - verbose: true - }); - - callback(); - }, - - tearDown: function (callback) { - //clean up? - callback(); - }, - - '1. An event can be namespaced.': function (test) { - - var emitter = this.emitter; - - emitter.on('test1.ns1', function () { - test.ok(true, 'The event was raised'); - }); - - emitter.emit('test1.ns1'); - - test.expect(1); - test.done(); - - }, - '2. An event can be namespaced and accept values.': function (test) { - - var emitter = this.emitter; - - emitter.on('test2.ns1', function(value1) { - test.ok(true, 'The event was raised'); - test.ok(typeof value1 !== 'undefined', 'The event was raised with the value `' + value1 + '`.'); - }); - - emitter.emit('test2.ns1', 1); - - test.expect(2); - test.done(); - - }, - '3. A namespaced event can be raised multiple times and accept values.': function (test) { - - var emitter = this.emitter; - - emitter.on('test3.ns1', function (value1, value2, value3) { - test.ok(true, 'The event was raised'); - test.ok(arguments.length === 3, 'The event was raised with the correct number of arguments'); - test.ok(value1 === 1 || value1 === 4, 'The event was raised with the value `' + value1 + '`.'); - test.ok(value2 === 2 || value2 === 5, 'The event was raised with the value `' + value2 + '`.'); - test.ok(value3 === 3 || value3 === 6, 'The event was raised with the value `' + value3 + '`.'); - }); - - emitter.emit('test3.ns1', 1, 2, 3); - emitter.emit('test3.ns1', 4, 5, 6); - - test.expect(10); - test.done(); - }, - '4. A listener should support wild cards.': function (test) { - - var emitter = this.emitter; - - emitter.on('test4.*', function () { - test.ok(true, 'The event was raised'); - }); - - emitter.emit('test4.ns1'); - - test.expect(1); - test.done(); - - }, - '5. Emitting an event should support wildcards.': function (test) { - - var emitter = this.emitter; - - emitter.on('test5A.test5B', function () { - test.ok(true, 'The event was raised'); - }); - - emitter.emit('test5A.*'); - - test.expect(1); - test.done(); - - }, - '6. A listener should support complex wild cards.': function (test) { - - var emitter = this.emitter; - - emitter.on('test10.*.foo', function () { - test.ok(true, 'The event was raised'); - }); - - emitter.emit('test10.ns1.foo'); - - test.expect(1); - test.done(); - - }, - '7. Emitting an event should support complex wildcards.': function (test) { - - var emitter = this.emitter; - - emitter.on('test11.ns1.foo', function () { - test.ok(true, 'The event was raised'); - }); - - emitter.emit('test11.*.foo'); - - test.expect(1); - test.done(); - - }, - '8. Emitting an event should support complex wildcards multiple times, a valid listener should accept values.': function (test) { - - var emitter = this.emitter; - - emitter.on('test12.ns1.ns2', function (value1, value2, value3) { - test.ok(true, 'The event was raised'); - test.ok(arguments.length === 3, 'The event was raised with the correct number of arguments'); - test.ok(value1 === 1 || value1 === 4, 'The event was raised with the value `' + value1 + '`.'); - test.ok(value2 === 2 || value2 === 5, 'The event was raised with the value `' + value1 + '`.'); - test.ok(value3 === 3 || value3 === 6, 'The event was raised with the value `' + value1 + '`.'); - }); - - emitter.emit('test12.*.ns2', 1, 2, 3); - emitter.emit('test12.*.ns2', 4, 5, 6); - - test.expect(10); - test.done(); - - }, - '9. List all the listeners for a particular event.': function(test) { - - var emitter = this.emitter; - - emitter.on('test13', function (event) { - test.ok(true,'raised one'); - }); - - emitter.on('test13', function (event) { - test.ok(true,'raised two'); - }); - - var listeners = emitter.listeners('test13'); - - test.ok(listeners.length === 2, 'The event `test13` should have 2 listeners'); - test.expect(1); - test.done(); - - }, - '10. should be able to listen on any event' : function (test) { - - var emitter = this.emitter; - - var fn = function (foo, bar) { - test.equal(this.event, 'test23.ns5.ns5') - test.equal(foo, 'foo'); - test.equal(bar, 1); - test.ok(true, 'raised test23.ns5.ns5'); - } - - emitter.onAny(fn); - emitter.emit('test23.ns5.ns5', 'foo', 1); - test.expect(4); - test.done(); - - }, - /*, - '11. A listener should support total wild card.': function (test) { - - var emitter = this.emitter; - - emitter.on('*', function () { - test.ok(true, 'The event was raised'); - }); - - emitter.emit('test14'); - emitter.emit('test14.ns1'); - emitter.emit('test14.ns1.ns2'); - - test.expect(1); - test.done(); - - }, - - '12. A listener should support complex total wild card.': function (test) { - - var emitter = this.emitter; - - emitter.on('*', function () { - test.ok(true, 'The event was raised'); - }); - - emitter.emit('test15.*'); - emitter.emit('test15.*.ns2') - emitter.emit('*'); - - test.expect(1); - test.done(); - - }, - '13. Should be able to fire with wildcard start.' : function (test) { - var emitter = this.emitter; - - emitter.on('test16', function () { - test.ok(true, 'The event test15 was raised'); - }); - emitter.on('test16.ns1', function () { - test.ok(true, 'The event test15.ns1 was raised'); - }); - - emitter.emit('*'); - emitter.emit('*.ns1'); - - test.expect(2); - test.done(); - }, - '14. Should fail if delimiter is used to start or end event name.' : function (test) { - var emitter = this.emitter; - - //nothing should emit, so here is a all-listener - emitter.on('*.*.*', function () { - test.ok(false, 'an event was raised!'); - }); - emitter.on('*.*', function () { - test.ok(false, 'an event was raised!'); - }); - emitter.on('*', function () { - test.ok(false, 'an event was raised!'); - }); - - try { - emitter.on('.ns4', function () { - test.ok(false, 'The event .ns4 was raised'); - }); - - emitter.emit('.ns4'); - } - catch(ex) { - test.ok(true, 'The event .ns4 was not raised'); - } - - try { - - emitter.on('ns4.', function () { - test.ok(false, 'The event .ns4 was raised'); - }); - - emitter.emit('ns4.'); - } - catch(ex) { - test.ok(true, 'The event .ns4 was not raised'); - } - - try { - - emitter.on('.ns4', function () { - test.ok(false, 'The event .ns4 was raised'); - }); - - emitter.emit('ns4.'); - } - catch(ex) { - test.ok(true, 'The event .ns4 was not raised'); - } - - try { - - emitter.on('.ns4', function () { - test.ok(false, 'The event .ns4 was raised'); - }); - - } - catch(ex) { - test.ok(true, 'The event .ns4 was not raised'); - } - - try { - - emitter.emit('ns4.'); - - } - catch(ex) { - test.ok(true, 'The event .ns4 was not raised'); - } - - try { - emitter.emit('some..bad'); - } - catch (ex) { - test.ok(true, 'error was raised'); - } - - try { - emitter.on('some..bad', function () { - test.ok(false, 'a bad event was raised'); - }); - } - catch (ex){ - test.ok(true,'error was raised'); - } - - test.expect(7); - test.done(); - }, - - '15. Should provide case sensitive option.' : function (test) { - var emitter = this.emitter; - - emitter.on('test18', function () { - test.ok(false, 'The event test18 was raised'); - }); - emitter.on('test18.ns1', function () { - test.ok(false, 'The event test18.ns1 was raised'); - }); - - emitter.emit('Test18'); - - test.expect(0); - test.done(); - }, - - '16. one emit should be able to fire on multiple namespaces.' : function (test) { - var emitter = this.emitter; - - emitter.on('test19.*', function () { - test.ok(true, 'test19.* was raised'); - }); - emitter.on('test19.foo', function () { - test.ok(true, 'test19.foo was raised'); - }); - - emitter.emit('test19.foo'); - test.expect(2); - test.done(); - }, - - '17. should support case insensitivty (complex).' : function (test) { - if(typeof require !== 'undefined') { - EventEmitter2 = require('../lib/ee2').EventEmitter2; - } - else { - EventEmitter2 = window.EventEmitter2; - } - - var emitter = new EventEmitter2({ caseSensitive : false}); - - emitter.on('test20', function () { - test.ok(true, 'The event test20 was raised'); - }); - emitter.on('test20.ns1', function () { - test.ok(true, 'The event test20.ns1 was raised'); - }); - emitter.on('*.ns1', function () { - test.ok(true, 'The event *.ns1 was raised'); - }); - emitter.on('*.ns2', function () { - test.ok(false, 'The event *.ns2 was raised'); - }); - - emitter.emit('Test20'); - emitter.emit('TeSt20.nS1'); - - test.expect(3); - test.done(); - }, - - '18. should be able to removeListeners' : function (test) { - var emitter = this.emitter; - - var someFun = function () { - test.ok(true, 'someFunc was raised'); - } - - emitter.on('test21', someFun); - emitter.on('test21.*', someFun); - emitter.on('test21.ns1', someFun); - emitter.on('test21.ns1.ns2', someFun); - - emitter.emit('test21'); //1 - emitter.emit('test21.ns2'); //1 - emitter.emit('test21.ns1'); //2 - - var listeners = emitter.listeners('test21'); - test.ok(listeners.length === 1, 'there should be 1 listener'); - - emitter.removeListener('test21', someFun); - listeners = emitter.listeners('test21'); - test.ok(listeners.length === 0, 'there should be 0 listener (empty array)'); - - // should be able to add more listeners after removing - emitter.on('test21', someFun); - emitter.on('test21', someFun); - listeners = emitter.listeners('test21'); - test.ok(listeners.length === 2, 'there should be 2 listeners'); //1 - - emitter.emit('test21'); //2 - - emitter.removeListener('test21', someFun); //this removes all listeners - listeners = emitter.listeners('test21'); - test.ok(listeners.length === 1, 'there should be 1 listeners'); //1 - emitter.removeListener('test21', someFun); //this removes all listeners - listeners = emitter.listeners('test21'); - test.ok(listeners.length === 0, 'there should be 0 listeners'); //1 - - emitter.emit('test21'); //0 - - listeners = emitter.listeners('test21.ns1'); - test.ok(listeners.length === 1, 'there should be 1 listeners'); //1 - - emitter.removeListener('test21.ns1', someFun); // remove one - listeners = emitter.listeners('test21.ns1'); - test.ok(listeners.length === 0, 'there should be 0 listeners'); //1 - - listeners = emitter.listeners('test21.*'); - test.ok(listeners.length === 1, 'there should be 1 listeners'); //1 - emitter.removeListener('test21.*', someFun); // remove one - listeners = emitter.listeners('test21.*'); - test.ok(listeners.length === 0, 'there should be 0 listeners'); //1 - - test.expect(15); - test.done(); - }, - - '19. should be able to remove all listeners' : function (test) { - - var emitter = this.emitter, - addedEvents = setHelper(emitter, test, 'test22'); - - emitter.emit('test22'); //1 - - var listeners = emitter.listeners('test22'); - test.ok(listeners.length === 1, 'there should be 1 listener'); //1 - - emitter.removeAllListeners('test22'); - listeners = emitter.listeners('test22'); - test.ok(listeners.length === 0, 'there should be 0 listener'); //1 - - emitter.removeAllListeners('test22.ns1'); - listeners = emitter.listeners('test22.ns1'); - test.ok(listeners.length === 0, 'there should be 0 listener'); //1 - - emitter.removeAllListeners(); //removing all possible - for (var i = 0; i < addedEvents.length; i++) { - listeners = emitter.listeners(addedEvents[i]); - test.ok(listeners.length === 0, 'there shouldn\'t be at a listener'); - } - - test.expect(addedEvents.length + 4 ); - test.done(); - }, - - '19. should be able to fire once and done' : function (test) { - var emitter = this.emitter, - addedEvents = setHelper(emitter,test,'test24'); - - emitter.once('test24once', function () { - test.ok(true, 'fired once'); - }); - - emitter.emit('test24'); - emitter.emit('test24once'); - emitter.emit('test24once'); - - test.expect(2); - test.done(); - }, - - '20. should be able to fire many and done' : function (test) { - - var emitter = this.emitter, - addedEvents = setHelper(emitter,test,'test25'); - - emitter.many('test25many', 5, function () { - test.ok(true, 'test25many pewpew'); - }); - - emitter.emit('test25'); //1 - for (var i= 0; i < 5; i++) { - emitter.emit('test25many'); //1 - } - emitter.emit('test25many'); //0 - - test.expect(6); - test.done(); - }, - - '21. should be able to list all onAny listeners' : function (test) { - var emitter = this.emitter, - addedEvents = setHelper(emitter, test, 'test26'), - fn = function (tag) { - if (tag !== 'addListener') { - test.equals(tag, 'test26.ns5.ns5', 'emitted tag, and raised tag should match'); - test.ok(true, 'something happened somewhere'); - } - }; - - emitter.onAny(fn); - emitter.emit('test26.ns5.ns5'); //2 - var listeners = emitter.listenersAny(); - test.equals(listeners.length, 1, 'should be one any listeners'); - - emitter.offAny(fn); - listeners = emitter.listenersAny(); - test.ok(listeners.length === 0, 'should be no any listeners'); - - emitter.onAny(fn); - emitter.onAny(fn); - listeners = emitter.listenersAny(); - test.equals(listeners.length, 2, 'should be two any listeners'); - - emitter.offAny(); - listeners = emitter.listenersAny(); - test.ok(listeners.length === 0, 'should be no any listeners'); - - test.expect(6); - test.done(); - }, - - '22. should not expand beyond the namespace' : function (test) { - var emitter = this.emitter, - addedEvents = setHelper(emitter,test,'test27'); - - emitter.emit('test27.ns2.ns3'); //1 - emitter.emit('test27.ns2.ns3.ns4'); //0 - - test.expect(1); - test.done(); - }, - - '23. should raise errors, if error is emitted and not caught' : function (test) { - var emitter = this.emitter, - error = new Error('Something Funny Happened'); - - try { - emitter.emit('error'); - } - catch (ex) { - test.ok(ex instanceof Error, 'should be an Error'); - } - - try { - emitter.emit('error', error); - } - catch (ex) { - test.equal(error, ex, 'should have passed up the argument'); - } - - emitter.on('error', function (event, err) { - test.ok(true, 'error event was raised'); - test.equal(err, error, 'of the error'); - }); - - emitter.emit('error',error); - - test.expect(4); - test.done(); - }, - - '24. should raise errors on namespaces, if error is emitted and not caught' : function (test) { - var emitter = this.emitter, - error = new Error('Something Funny Happened'); - - emitter.on('foo.bar', function(){}); - - try { - emitter.emit('foo.error'); - } - catch (ex) { - test.ok(ex instanceof Error, 'should be an Error'); - } - - try { - emitter.emit('foo.error', error); - } - catch (ex) { - test.equal(error, ex, 'should have passed up the argument'); - } - - emitter.on('error', function (event, err) { - test.ok(true, 'error event was raised'); - test.equal(err, error, 'of the error'); - }); - - emitter.emit('error',error); - - test.expect(4); - test.done(); - }, - - '25. should support old config for EE2' : function (test) { - if(typeof require !== 'undefined') { - EventEmitter2 = require('../lib/ee2').EventEmitter2; - } - else { - EventEmitter2 = window.EventEmitter2; - } - var emitter = new EventEmitter2({ - caseSensitive : true, - delimiter : '?' - }); - - emitter.on('test30?a?b', function () { - test.ok(true, 'test30?a?b did emit'); - }); - - emitter.emit('test30?a?b'); - - test.expect(1); - test.done(); - }, - - '26. should reject bad wildcard inputs' : function (test) { - var emitter = this.emitter; - addedEvents = setHelper(emitter,test,'test31'); - - emitter.onAny(function () { - test.ok(false, 'no event should be emitted, ever'); - }); - - // try listening on a bad - try { - emitter.on('test31*', function () { - test.ok(false, 'should never registered'); - }); - } - catch (ex) { - test.ok(ex instanceof Error, 'expected an error'); - } - // bad wildcard at the front - try { - emitter.on('*test31', function () { - test.ok(false, 'should never registered'); - }); - } - catch (ex) { - test.ok(ex instanceof Error, 'expected an error'); - } - // bad wildcard at the front - try { - emitter.on('test*31', function () { - test.ok(false, 'should never registered'); - }); - } - catch (ex) { - test.ok(ex instanceof Error, 'expected an error'); - } - // bad wildcard at the front - try { - emitter.on('test31.*a', function () { - test.ok(false, 'should never registered'); - }); - } - catch (ex) { - test.ok(ex instanceof Error, 'expected an error'); - } - // bad wildcard at the front - try { - emitter.on('*test31.a*', function () { - test.ok(false, 'should never registered'); - }); - } - catch (ex) { - test.ok(ex instanceof Error, 'expected an error'); - } - // bad wildcard at the front - try { - emitter.on('*test31.a*a', function () { - test.ok(false, 'should never registered'); - }); - } - catch (ex) { - test.ok(ex instanceof Error, 'expected an error'); - } - - //now try emittering with a bad wildcard - try { - emitter.emit('test31*') - } - catch (ex) { - test.ok(ex instanceof Error, 'expected an error'); - } - // bad wildcard at the front - try { - emitter.on('*test31'); - } - catch (ex) { - test.ok(ex instanceof Error, 'expected an error'); - } - // bad wildcard at the front - try { - emitter.on('test*31'); - } - catch (ex) { - test.ok(ex instanceof Error, 'expected an error'); - } - // bad wildcard at the front - try { - emitter.on('test31.*a'); - } - catch (ex) { - test.ok(ex instanceof Error, 'expected an error'); - } - // bad wildcard at the front - try { - emitter.on('*test31.a*'); - } - catch (ex) { - test.ok(ex instanceof Error, 'expected an error'); - } - // bad wildcard at the front - try { - emitter.on('*test31.a*a'); - } - catch (ex) { - test.ok(ex instanceof Error, 'expected an error'); - } - - test.expect(12); - test.done(); - }, - - '27. Should be able to start with 0 max listeners' : function (test) { - - if(typeof require !== 'undefined') { - EventEmitter2 = require('../lib/ee2').EventEmitter2; - } - else { - EventEmitter2 = window.EventEmitter2; - } - try { - var emitter = new EventEmitter2({ - maxListeners : 0 - }); - emitter.on('no listeners', function () { - test.ok(false, 'no listener was raised'); - }); - test.ok(true, 'was able to make something'); - } - catch (ex) { - test.ok(false, 'Error was raised'); - } - - test.expect(1); - test.done(); - }, - - '28. should raise maxListeners when too many are registerd' : function (test) { - var emitter = this.emitter; - - emitter.on('maxListeners', function () { - test.ok(true, 'maxListeners fired'); - }); - - for (var i = 0; i < 11 ; i++){ - emitter.on('test33', function () { - test.ok(false, 'event was raised'); - }); - } - - var listeners = emitter.listeners('test33'); - test.equal(listeners.length, 10, '10 listeners in total'); - - test.expect(2); - test.done(); - } */ - - '29. No warning should be raised if we set maxListener to be greater before adding' : function (test) { - var emitter = this.emitter; - var type = 'test29.*'; - - // set to 20 - emitter.setMaxListeners(20); - - for (var i = 0; i < 15 ; i++) { - emitter.on(type, function () { - test.ok(true, 'event was raised'); - }); - } - -// require('eyes').inspect(emitter._events); - - var listeners = emitter.listeners(type); - test.equal(listeners.length, 15, 'should have 15'); - test.ok(!(emitter.listenerTree[ 'test29' ]['*']._listeners.warned), 'should not have been set'); - - test.expect(2); - test.done(); - } - - -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/wildcardEvents/customDelimiter.js b/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/wildcardEvents/customDelimiter.js deleted file mode 100644 index 8e68b00..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/wildcardEvents/customDelimiter.js +++ /dev/null @@ -1,216 +0,0 @@ -var simpleEvents = require('nodeunit').testCase; - -var file = '../../lib/eventemitter2'; - -module.exports = simpleEvents({ - - setUp: function (callback) { - var EventEmitter2; - - if(typeof require !== 'undefined') { - EventEmitter2 = require(file).EventEmitter2; - } - else { - EventEmitter2 = window.EventEmitter2; - } - - this.emitter = new EventEmitter2({ - wildcard: true, - delimiter: '::' - }); - callback(); - }, - - tearDown: function (callback) { - //clean up? - callback(); - }, - - '1. Add a single listener on a single event.': function (test) { - - var emitter = this.emitter; - var type = 'some::listener::bar'; - - emitter.on(type, function () { - test.ok(true, 'The event was raised'); - }); - - test.equal(emitter.listeners(type).length, 1, 'There are three emitters'); - - test.expect(1); - test.done(); - - }, - - '2. Add two listeners on a single event.': function (test) { - - var emitter = this.emitter; - var type = 'some::listener::bar'; - - emitter.on(type, function () { - test.ok(true, 'The event was raised'); - }); - - emitter.on(type, function () { - test.ok(true, 'The event was raised'); - }); - - test.equal(emitter.listeners(type).length, 2, 'There are three emitters'); - - test.expect(1); - test.done(); - - }, - '3. Add three listeners on a single event.': function (test) { - - var emitter = this.emitter; - var type = 'some::listener::bar'; - - emitter.on(type, function () { - test.ok(true, 'The event was raised'); - }); - - emitter.on(type, function () { - test.ok(true, 'The event was raised'); - }); - - emitter.on(type, function () { - test.ok(true, 'The event was raised'); - }); - - test.equal(emitter.listeners(type).length, 3, 'There are three emitters'); - - test.expect(1); - test.done(); - - }, - '4. Add two listeners to two different events.': function (test) { - - var emitter = this.emitter; - var type = 'some::listener::bar'; - - emitter.on(type, function () { - test.ok(true, 'The event was raised'); - }); - - emitter.on(type, function () { - test.ok(true, 'The event was raised'); - }); - - emitter.on('test2', function () { - test.ok(true, 'The event was raised'); - }); - - emitter.on('test2', function () { - test.ok(true, 'The event was raised'); - }); - - test.equal(emitter.listeners(type).length, 2, 'There are two emitters'); - test.equal(emitter.listeners('test2').length, 2, 'There are two emitters'); - - test.expect(2); - test.done(); - }, - - '5. Never adding any listeners should yield a listeners array with the length of 0.': function (test) { - var emitter = this.emitter; - var type = 'some::listener::bar'; - - emitter.on(type, function () { - test.ok(true, 'The event was raised'); - }); - - test.equal(emitter.listeners('test2').length, 0, 'There are no emitters'); - - test.expect(1); - test.done(); - }, - - '6. the listener added should be the right listener.': function (test) { - var emitter = this.emitter; - var type = 'some::listener::bar'; - var f = function () {}; - - emitter.on(type, f); - test.equal(emitter.listeners(type).length, 1, 'There are is one emitters'); - test.equal(emitter.listeners(type)[0], f, 'The function should be f'); - - test.expect(2); - test.done(); - - }, - - '7. Listeners on *, *::*, *::test with emissions from foo::test and other::emit': function (test) { - var emitter = this.emitter; - var f = function () { - test.ok(true, 'the event was fired') - }; - - emitter.on('*::test', f); - emitter.on('*::*', f); - emitter.on('*', f); - - emitter.emit('other::emit'); - emitter.emit('foo::test'); - - test.expect(3); - test.done(); - }, - - '8. Listeners on *, *::*, foo.test with emissions from *, *::* and foo.test': function (test) { - var emitter = this.emitter; - var f = function () { - test.ok(true, 'the event was fired') - }; - - emitter.on('foo::test', f); - emitter.on('*::*', f); - emitter.on('*', f); - - emitter.emit('*::*'); - emitter.emit('foo::test'); - emitter.emit('*') - - test.expect(5); - test.done(); - }, - - '9. Listeners on **, **::*, **::test with emissions from foo::test and other::emit': function (test) { - var emitter = this.emitter; - var f = function () { - test.ok(true, 'the event was fired'); - }; - - emitter.on('**::test', f); - emitter.on('**::*', f); - emitter.on('**', f); - - emitter.emit('other::emit'); // 2 - emitter.emit('foo::test'); // 3 - - test.expect(5); - test.done(); - }, - - '10. Listeners on **, **::*, foo.test with emissions from **, **::* and foo.test': function (test) { - var emitter = this.emitter, i = 0; - var f = function (n) { - return function() { - //console.log(n, this.event); - test.ok(true, 'the event was fired'); - }; - }; - - emitter.on('foo::test', f(i++)); - emitter.on('**::*', f(i++)); - emitter.on('**', f(i++)); - - emitter.emit('**::*'); // 3 - emitter.emit('foo::test'); // 3 - emitter.emit('**'); // 3 - - test.expect(9); - test.done(); - } - -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/wildcardEvents/k1.js b/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/wildcardEvents/k1.js deleted file mode 100644 index 5b6ef8c..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/wildcardEvents/k1.js +++ /dev/null @@ -1,56 +0,0 @@ - -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -var common = require('../common'); -var assert = require('assert'); -var EventEmitter = require('../../lib/eventemitter2').EventEmitter2; - -var e = new EventEmitter({wildcard: true}); -var countWildcard = 0; -var counMultiLevelWildcard = 0; -var countAny = 0; - -e.on('foo', function() { - e.emit('bar', 'bar'); -}); -e.on('*', function(name) { - ++countWildcard; - console.log(this.event, name); - assert.equal(this.event, name); -}); -e.on('**', function(name) { - ++counMultiLevelWildcard; - console.log(this.event, name); - assert.equal(this.event, name); -}); -e.onAny(function(name) { - ++countAny; - assert.equal(this.event, name); -}); - -e.emit('foo', 'foo'); - -process.on('exit', function() { - assert.equal(countWildcard, 2); - assert.equal(counMultiLevelWildcard, 2); - assert.equal(countAny, 2); -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/wildcardEvents/options.js b/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/wildcardEvents/options.js deleted file mode 100644 index 4d98abd..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/wildcardEvents/options.js +++ /dev/null @@ -1,79 +0,0 @@ -var basicEvents = require('nodeunit').testCase; -var lib = '../../lib/eventemitter2'; - -/////helper/////// -function setHelper (emitter, test, testName){ - var eventNames = [ - testName, - testName + '.*', - testName + '.ns1', - testName + '.ns1.ns2', - testName + '.ns2.*', - testName + '.**', - testName = '.ns2.**' - ]; - - for (var i = 0; i < eventNames.length; i++) { - emitter.on(eventNames[i], function () { - test.ok(true, eventNames[i] + 'has fired'); - }); - } - - return eventNames; -} - -module.exports = basicEvents({ - - setUp: function (callback) { - var EventEmitter2; - - if(typeof require !== 'undefined') { - EventEmitter2 = require(lib).EventEmitter2; - } - else { - EventEmitter2 = window.EventEmitter2; - } - - this.emitter = new EventEmitter2({ - wildcard: true, - verbose: true - }); - this.emitterDefault = new EventEmitter2({ - }); - - callback(); - }, - - tearDown: function (callback) { - //clean up? - callback(); - }, - - 'intialize 1. Configuration Flags Test.': function (test) { - // lazy - var emitter = this.emitter, - emitterDefault = this.emitterDefault; - - test.ok(!emitterDefault.wildcard, 'default .wildcard should be false'); - test.ok(emitter.wildcard, '.wildcard should be true when set'); - - test.expect(2); - test.done(); - - }, - 'initialize 2. creating a wildcard EE should have listenerTree.': function (test) { - - var emitter = this.emitter, - emitterDefault = this.emitterDefault; - - test.ok(emitter.listenerTree, 'listenerTree should exist'); - test.equal(typeof emitter.listenerTree, 'object', 'listenerTree should be an Object'); - - test.ok(!emitterDefault.listenerTree, 'listenerTree should not exist'); - // check the tree to be empty? - - test.expect(3); - test.done(); - - }, -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/wildcardEvents/removeListener.js b/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/wildcardEvents/removeListener.js deleted file mode 100644 index 105f1bc..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/wildcardEvents/removeListener.js +++ /dev/null @@ -1,284 +0,0 @@ -var simpleEvents= require('nodeunit').testCase; - -var file = '../../lib/eventemitter2'; - -module.exports = simpleEvents({ - - setUp: function (callback) { - var EventEmitter2; - - if(typeof require !== 'undefined') { - EventEmitter2 = require(file).EventEmitter2; - } - else { - EventEmitter2 = window.EventEmitter2; - } - - this.emitter = new EventEmitter2({ - wildcard : true, - verbose : true - }); - callback(); - }, - - tearDown: function (callback) { - //clean up? - callback(); - }, - - '1. add a single event and then remove the event.' : function (test) { - var emitter = this.emitter, - type = 'remove.foo.bar', - listeners; - - var f = function () { - test.ok(true, 'event was raised'); - }; - - emitter.on(type, f); - listeners = emitter.listeners(type); - test.equal(listeners.length, 1, 'should only have 1'); - - //remove - emitter.removeListener(type, f); - listeners = emitter.listeners(type); - test.equal(listeners.length, 0, 'should be 0'); - - test.expect(2); - test.done(); - }, - - '2. Add two events and then remove only one of those events.' : function (test) { - var emitter = this.emitter, - type = 'remove.foo.bar', - listeners; - - var f = function f() { - test.ok(true, 'event was raised'); - }; - - emitter.on(type, f); - emitter.on(type, f); - - listeners = emitter.listeners(type); - test.equal(listeners.length, 2, 'should only have 2'); - - emitter.removeListener(type, f); - - listeners = emitter.listeners(type); - test.equal(listeners.length, 1, 'should be 1'); - - test.expect(2); - test.done(); - }, - - '3. Add three events and remove only one of the events that was added.' : function (test) { - var emitter = this.emitter, - type = 'remove.foo.bar', - listeners; - - var f = function () { - test.ok(true, 'event was raised'); - }; - - emitter.on(type, f); - emitter.on(type, f); - emitter.on(type, f); - listeners = emitter.listeners(type); - test.equal(listeners.length, 3, 'should only have 3'); - - //remove - emitter.removeListener(type, f); - listeners = emitter.listeners(type); - test.equal(listeners.length, 2, 'should be 2'); - - test.expect(2); - test.done(); - }, - - '4. Should error if we don\'t pass a function to the emit method.' : function (test) { - var emitter = this.emitter, - type = 'remove.foo.bar', - listeners; - - var f = function () { - test.ok(true, 'event was raised'); - }; - - emitter.on(type, f); - listeners = emitter.listeners(type); - test.equal(listeners.length, 1, 'should only have 1'); - - //remove - test.throws(function () {emitter.removeListener(type, type)}, Error, 'should throw an Error'); - listeners = emitter.listeners(type); - test.equal(listeners.length, 1, 'should be 1'); - - test.expect(3); - test.done(); - }, - - '5. Removing one listener should not affect another listener.' : function (test) { - var emitter = this.emitter, - type = 'remove.foo.bar', - listeners; - - var f = function () { - test.ok(true, 'event was raised'); - }; - var g = function () { - test.ok(true, 'event was raised'); - }; - - emitter.on(type, f); - listeners = emitter.listeners(type); - test.equal(listeners.length, 1, 'should only have 1'); - - //remove - emitter.removeListener(type, g); - listeners = emitter.listeners(type); - test.equal(listeners.length, 1, 'should be 1'); - - test.expect(2); - test.done(); - }, - - '6. Remove all listener functions.' : function (test) { - - var emitter = this.emitter, - type = 'remove.foo.bar', - listeners; - - var f = function () { - test.ok(true, 'event was raised'); - }; - for (var i = 0; i < 10; i++) { - emitter.on(type, f); - } - - listeners = emitter.listeners(type); - test.equal(listeners.length, 10, 'should only have 10'); - - emitter.removeListener(type, f); - listeners = emitter.listeners(type); - test.equal(listeners.length, 9, 'should be 9'); - emitter.removeAllListeners(type); - listeners = emitter.listeners(type); - test.equal(listeners.length, 0, 'should be 0'); - - test.expect(3); - test.done(); - }, - - '7. Removing listeners for one event should not affect another event\'s listeners.' : function (test) { - - var emitter = this.emitter; - - var type = 'remove.foo.bar'; - - var listeners; - - var f = function () { - test.ok(true, 'event was raised'); - }; - - for (var i = 0; i < 10; i++) { - emitter.on(type, f); - } - - listeners = emitter.listeners(type); - test.equal(listeners.length, 10, 'should only have 10'); - - emitter.removeListener(type+type, f); - - listeners = emitter.listeners(type); - test.equal(listeners.length, 10, 'should be 10'); - - emitter.removeAllListeners(type+type); - listeners = emitter.listeners(type); - test.equal(listeners.length, 10, 'should be 10'); - - emitter.removeAllListeners(type+'.'+type); - listeners = emitter.listeners(type); - test.equal(listeners.length, 10, 'should be 10'); - - emitter.removeAllListeners(type); - listeners = emitter.listeners(type); - test.equal(listeners.length, 0, 'should be 0'); - - test.expect(5); - test.done(); - }, - - '8. Its ok to listen on wildcard, so it is ok to remove it.' : function (test) { - var emitter = this.emitter, - type1 = '*.wild.card', - type2 = 'just.another.event', - listeners; - - var f = function () { - test.ok(true, 'event was raised'); - }; - - emitter.on(type2, f); - emitter.on(type1, f); - - //remove - emitter.removeListener(type1, f); - listeners = emitter.listeners(type1); - test.equal(listeners.length, 0, 'should be 0'); - - test.expect(1); - test.done(); - }, - - '9. And (8) should not depend on order of listening.' : function (test) { - var emitter = this.emitter, - type1 = '*.wild.card', - type2 = 'just.another.event', - listeners; - - var f = function () { - test.ok(true, 'event was raised'); - }; - - emitter.on(type1, f); - emitter.on(type2, f); - - //remove - emitter.removeListener(type1, f); - listeners = emitter.listeners(type1); - test.equal(listeners.length, 0, 'should be 0'); - - test.expect(1); - test.done(); - }, - - '10. Reporting many listeners on wildcard all should removed.' : function (test) { - var emitter = this.emitter, - type1 = '*.wild.card', - type2 = 'exact.wild.card', - listeners; - - var f = function () { - test.ok(true, 'event was raised'); - }; - - emitter.on(type1, f); - emitter.on(type2, f); - - // check number of listeners by wild card - listeners = emitter.listeners(type1); - test.equal(listeners.length, 2, 'should only have 2'); - - // remove by wild card should remove both - emitter.removeListener(type1, f); - listeners = emitter.listeners(type1); - test.equal(listeners.length, 0, 'should be 0'); - - test.expect(2); - test.done(); - } - - -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/wildcardEvents/ttl.js b/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/wildcardEvents/ttl.js deleted file mode 100644 index d7679b0..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/eventemitter2/test/wildcardEvents/ttl.js +++ /dev/null @@ -1,196 +0,0 @@ -var simpleEvents = require('nodeunit').testCase; - -var file = '../../lib/eventemitter2'; - -module.exports = simpleEvents({ - - setUp: function (callback) { - var EventEmitter2; - - if(typeof require !== 'undefined') { - EventEmitter2 = require(file).EventEmitter2; - } - else { - EventEmitter2 = window.EventEmitter2; - } - - this.emitter = new EventEmitter2({ - wildcard : true, - verbose : true - }); - callback(); - }, - - tearDown: function (callback) { - //clean up? - callback(); - }, - - '1. A listener added with `once` should only listen once and then be removed.': function (test) { - - var emitter = this.emitter; - var type = 'test1.foo.bar'; - - emitter.once(type, function () { - test.ok(true, 'The event was raised once'); - }); - - emitter.emit(type); - emitter.emit(type); - - test.expect(1); - test.done(); - - }, - '2. A listener with a TTL of 4 should only listen 4 times.': function (test) { - - var emitter = this.emitter; - var type = 'test1.foo.bar'; - - emitter.many(type, 4, function (value1) { - test.ok(true, 'The event was raised 4 times.'); - }); - - emitter.emit(type, 1); - emitter.emit(type, 2); - emitter.emit(type, 3); - emitter.emit(type, 4); - emitter.emit(type, 5); - - test.expect(4); - test.done(); - - }, - '3. A listener with a TTL of 4 should only listen 4 times and pass parameters.': function (test) { - - var emitter = this.emitter; - var type = 'test1.foo.bar'; - - emitter.many(type, 4, function (value1, value2, value3) { - test.ok(typeof value1 !== 'undefined', 'got value 1'); - test.ok(typeof value2 !== 'undefined', 'got value 2'); - test.ok(typeof value3 !== 'undefined', 'got value 3'); - }); - - emitter.emit(type, 1, 'A', false); - emitter.emit(type, 2, 'A', false); - emitter.emit(type, 3, 'A', false); - emitter.emit(type, 4, 'A', false); - emitter.emit(type, 5, 'A', false); - - test.done(); - - }, - '4. Remove an event listener by signature.': function (test) { - - var emitter = this.emitter; - var type = 'test1.foo.bar'; - var count = 0; - - function f1(event) { - "event A"; - test.ok(true, 'The event was raised less than 3 times.'); - } - - emitter.on(type, f1); - - function f2(event) { - "event B"; - test.ok(true, 'The event was raised less than 3 times.'); - } - - emitter.on(type, f2); - - function f3(event) { - "event C"; - test.ok(true, 'The event was raised less than 3 times.'); - } - - emitter.on(type, f3); - - emitter.removeListener(type, f2); - - emitter.emit(type); - - test.expect(2); - test.done(); - - }, - '5. `removeListener` and `once`': function(test) { - - var emitter = this.emitter; - var type = 'test1.foo.bar'; - var functionA = function() { test.ok(true, 'Event was fired'); }; - - emitter.once(type, functionA); - emitter.removeListener(type, functionA); - - emitter.emit(type); - - test.expect(0); - test.done(); - }, - - '6. Listening with a wildcard on once' : function (test) { - var emitter = this.emitter; - var type = 'test1.foo.*'; - var functionA = function() { test.ok(true, 'Event was fired'); }; - - emitter.once(type, functionA); - emitter.on(type,functionA); - - emitter.emit(type); //2 - emitter.emit(type); //1 - - test.expect(3); - test.done(); - }, - - '7. Emitting with a wildcard targeted at once' : function (test) { - var emitter = this.emitter; - var type = 'test1.foo.bar'; - var type2 = 'test1.foo.*'; - var functionA = function() { test.ok(true, 'Event was fired'); }; - - emitter.once(type, functionA); - emitter.emit(type2); - emitter.emit(type2); - - test.expect(1); - test.done(); - }, - - '8. Emitting with a multi-level wildcard on once': function(test) { - var emitter = this.emitter, i = 0; - var type = 'test1.**'; - var functionA = function(n) { - return function() { - //console.log(n, this.event); - test.ok(true, 'Event was fired'); - }; - } - - emitter.once(type, functionA(i++)); - emitter.on(type,functionA(i++)); - emitter.emit(type); //2 - emitter.emit(type); //1 - - test.expect(3); - test.done(); - }, - - '9. Emitting with a multi-level wildcard targeted at once' : function (test) { - var emitter = this.emitter; - var type = 'test1.foo.bar'; - var type2 = 'test1.**'; - var functionA = function() { test.ok(true, 'Event was fired'); }; - - emitter.once(type, functionA); - emitter.emit(type2); - emitter.emit(type2); - - test.expect(1); - test.done(); - } - -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/.npmignore b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/.npmignore deleted file mode 100644 index 1a52174..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/.npmignore +++ /dev/null @@ -1,7 +0,0 @@ -.DS_Store -config.json -test/fixtures/*.json -!test/fixtures/malformed.json -node_modules/ -node_modules/* -npm-debug.log \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/.travis.yml b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/.travis.yml deleted file mode 100644 index 63e4183..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 - -notifications: - email: - - travis@nodejitsu.com - irc: "irc.freenode.org#nodejitsu" - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/CHANGELOG.md b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/CHANGELOG.md deleted file mode 100644 index 34c1576..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/CHANGELOG.md +++ /dev/null @@ -1,9 +0,0 @@ -# CHANGELOG - -### Version 0.5.0 - -* `nconf.stores.*` is now `nconf.*` -* `nconf.stores` now represents the set of nconf.* Store instances on the nconf object. -* Added `nconf.argv()`, `nconf.env()`, `nconf.file()`, `nconf.overrides()`, `nconf.defaults()`. -* `nconf.system` no longer exists. The `nconf.System` store has been broken into `nconf.Argv`, `nconf.Env` and `nconf.Literal` -* Fixed bugs in hierarchical configuration loading. \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/LICENSE b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/LICENSE deleted file mode 100644 index 1f01e2b..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011 Nodejitsu Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/README.md b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/README.md deleted file mode 100644 index 10a63fb..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/README.md +++ /dev/null @@ -1,233 +0,0 @@ -# nconf [![Build Status](https://secure.travis-ci.org/flatiron/nconf.png)](http://travis-ci.org/flatiron/nconf) - -Hierarchical node.js configuration with files, environment variables, command-line arguments, and atomic object merging. - -## Example -Using nconf is easy; it is designed to be a simple key-value store with support for both local and remote storage. Keys are namespaced and delimited by `:`. Lets dive right into sample usage: - -``` js - var fs = require('fs'), - nconf = require('nconf'); - - // - // Setup nconf to use (in-order): - // 1. Command-line arguments - // 2. Environment variables - // 3. A file located at 'path/to/config.json' - // - nconf.argv() - .env() - .file({ file: 'path/to/config.json' }); - - // - // Set a few variables on `nconf`. - // - nconf.set('database:host', '127.0.0.1'); - nconf.set('database:port', 5984); - - // - // Get the entire database object from nconf. This will output - // { host: '127.0.0.1', port: 5984 } - // - console.log('foo: ' + nconf.get('foo')); - console.log('NODE_ENV: ' + nconf.get('NODE_ENV')); - console.log('database: ' + nconf.get('database')); - - // - // Save the configuration object to disk - // - nconf.save(function (err) { - fs.readFile('path/to/your/config.json', function (err, data) { - console.dir(JSON.parse(data.toString())) - }); - }); -``` - -If you run the above script: - -``` bash - $ NODE_ENV=production sample.js --foo bar -``` - -The output will be: - -``` - foo: bar - NODE_ENV: production - database: { host: '127.0.0.1', port: 5984 } -``` - -## Hierarchical configuration - -Configuration management can get complicated very quickly for even trivial applications running in production. `nconf` addresses this problem by enabling you to setup a hierarchy for different sources of configuration with no defaults. **The order in which you attach these configuration sources determines their priority in the hierarchy.** Lets take a look at the options available to you - - 1. **nconf.argv(options)** Loads `process.argv` using optimist. If `options` is supplied it is passed along to optimist. - 2. **nconf.env(options)** Loads `process.env` into the hierarchy. - 3. **nconf.file(options)** Loads the configuration data at options.file into the hierarchy. - 4. **nconf.defaults(options)** Loads the data in options.store into the hierarchy. - 5. **nconf.overrides(options)** Loads the data in options.store into the hierarchy. - -A sane default for this could be: - -``` js - var nconf = require('nconf'); - - // - // 1. any overrides - // - nconf.overrides({ - 'always': 'be this value' - }); - - // - // 2. `process.env` - // 3. `process.argv` - // - nconf.env().argv(); - - // - // 4. Values in `config.json` - // - nconf.file({ file: 'config.json' }); - - // - // 5. Any default values - // - nconf.defaults({ - 'if nothing else': 'use this value' - }); -``` - -## API Documentation - -The top-level of `nconf` is an instance of the `nconf.Provider` abstracts this all for you into a simple API. - -### nconf.add(name, options) -Adds a new store with the specified `name` and `options`. If `options.type` is not set, then `name` will be used instead: - -``` js - nconf.add('user', { type: 'file', file: '/path/to/userconf.json' }); - nconf.add('global', { type: 'file', file: '/path/to/globalconf.json' }); -``` - -### nconf.use(name, options) -Similar to `nconf.add`, except that it can replace an existing store if new options are provided - -``` js - // - // Load a file store onto nconf with the specified settings - // - nconf.use('file', { file: '/path/to/some/config-file.json' }); - - // - // Replace the file store with new settings - // - nconf.use('file', { file: 'path/to/a-new/config-file.json' }); -``` - -### nconf.remove(name) -Removes the store with the specified `name.` The configuration stored at that level will no longer be used for lookup(s). - -``` js - nconf.remove('file'); -``` - -## Storage Engines - -### Memory -A simple in-memory storage engine that stores a nested JSON representation of the configuration. To use this engine, just call `.use()` with the appropriate arguments. All calls to `.get()`, `.set()`, `.clear()`, `.reset()` methods are synchronous since we are only dealing with an in-memory object. - -``` js - nconf.use('memory'); -``` - -### Argv -Responsible for loading the values parsed from `process.argv` by `optimist` into the configuration hierarchy. - -``` js - // - // Can optionally also be an object literal to pass to `optimist`. - // - nconf.argv(options); -``` - -### Env -Responsible for loading the values parsed from `process.env` into the configuration hierarchy. - -``` js - // - // Can optionally also be an Array of values to limit process.env to. - // - nconf.env(['only', 'load', 'these', 'values', 'from', 'process.env']); -``` - -### Literal -Loads a given object literal into the configuration hierarchy. Both `nconf.defaults()` and `nconf.overrides()` use the Literal store. - -``` js - nconf.defaults({ - 'some': 'default value' - }); -``` - -### File -Based on the Memory store, but provides additional methods `.save()` and `.load()` which allow you to read your configuration to and from file. As with the Memory store, all method calls are synchronous with the exception of `.save()` and `.load()` which take callback functions. It is important to note that setting keys in the File engine will not be persisted to disk until a call to `.save()` is made. - -``` js - nconf.file({ file: 'path/to/your/config.json' }); -``` - -The file store is also extensible for multiple file formats, defaulting to `JSON`. To use a custom format, simply pass a format object to the `.use()` method. This object must have `.parse()` and `.stringify()` methods just like the native `JSON` object. - -### Redis -There is a separate Redis-based store available through [nconf-redis][0]. To install and use this store simply: - -``` bash - $ npm install nconf - $ npm install nconf-redis -``` - -Once installing both `nconf` and `nconf-redis`, you must require both modules to use the Redis store: - -``` js - var nconf = require('nconf'); - - // - // Requiring `nconf-redis` will extend the `nconf` - // module. - // - require('nconf-redis'); - - nconf.use('redis', { host: 'localhost', port: 6379, ttl: 60 * 60 * 1000 }); -``` - -## Installation - -### Installing npm (node package manager) -``` - curl http://npmjs.org/install.sh | sh -``` - -### Installing nconf -``` - [sudo] npm install nconf -``` - -## More Documentation -There is more documentation available through docco. I haven't gotten around to making a gh-pages branch so in the meantime if you clone the repository you can view the docs: - -``` - open docs/nconf.html -``` - -## Run Tests -Tests are written in vows and give complete coverage of all APIs and storage engines. - -``` bash - $ npm test -``` - -#### Author: [Charlie Robbins](http://nodejitsu.com) -#### License: MIT - -[0]: http://github.com/indexzero/nconf-redis diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/docco.css b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/docco.css deleted file mode 100644 index bd54134..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/docco.css +++ /dev/null @@ -1,194 +0,0 @@ -/*--------------------- Layout and Typography ----------------------------*/ -body { - font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; - font-size: 15px; - line-height: 22px; - color: #252519; - margin: 0; padding: 0; -} -a { - color: #261a3b; -} - a:visited { - color: #261a3b; - } -p { - margin: 0 0 15px 0; -} -h4, h5, h6 { - color: #333; - margin: 6px 0 6px 0; - font-size: 13px; -} - h2, h3 { - margin-bottom: 0; - color: #000; - } - h1 { - margin-top: 40px; - margin-bottom: 15px; - color: #000; - } -#container { - position: relative; -} -#background { - position: fixed; - top: 0; left: 525px; right: 0; bottom: 0; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - z-index: -1; -} -#jump_to, #jump_page { - background: white; - -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; - -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; - font: 10px Arial; - text-transform: uppercase; - cursor: pointer; - text-align: right; -} -#jump_to, #jump_wrapper { - position: fixed; - right: 0; top: 0; - padding: 5px 10px; -} - #jump_wrapper { - padding: 0; - display: none; - } - #jump_to:hover #jump_wrapper { - display: block; - } - #jump_page { - padding: 5px 0 3px; - margin: 0 0 25px 25px; - } - #jump_page .source { - display: block; - padding: 5px 10px; - text-decoration: none; - border-top: 1px solid #eee; - } - #jump_page .source:hover { - background: #f5f5ff; - } - #jump_page .source:first-child { - } -table td { - border: 0; - outline: 0; -} - td.docs, th.docs { - max-width: 450px; - min-width: 450px; - min-height: 5px; - padding: 10px 25px 1px 50px; - overflow-x: hidden; - vertical-align: top; - text-align: left; - } - .docs pre { - margin: 15px 0 15px; - padding-left: 15px; - } - .docs p tt, .docs p code { - background: #f8f8ff; - border: 1px solid #dedede; - font-size: 12px; - padding: 0 0.2em; - } - .pilwrap { - position: relative; - } - .pilcrow { - font: 12px Arial; - text-decoration: none; - color: #454545; - position: absolute; - top: 3px; left: -20px; - padding: 1px 2px; - opacity: 0; - -webkit-transition: opacity 0.2s linear; - } - td.docs:hover .pilcrow { - opacity: 1; - } - td.code, th.code { - padding: 14px 15px 16px 25px; - width: 100%; - vertical-align: top; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - } - pre, tt, code { - font-size: 12px; line-height: 18px; - font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; - margin: 0; padding: 0; - } - - -/*---------------------- Syntax Highlighting -----------------------------*/ -td.linenos { background-color: #f0f0f0; padding-right: 10px; } -span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } -body .hll { background-color: #ffffcc } -body .c { color: #408080; font-style: italic } /* Comment */ -body .err { border: 1px solid #FF0000 } /* Error */ -body .k { color: #954121 } /* Keyword */ -body .o { color: #666666 } /* Operator */ -body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ -body .cp { color: #BC7A00 } /* Comment.Preproc */ -body .c1 { color: #408080; font-style: italic } /* Comment.Single */ -body .cs { color: #408080; font-style: italic } /* Comment.Special */ -body .gd { color: #A00000 } /* Generic.Deleted */ -body .ge { font-style: italic } /* Generic.Emph */ -body .gr { color: #FF0000 } /* Generic.Error */ -body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -body .gi { color: #00A000 } /* Generic.Inserted */ -body .go { color: #808080 } /* Generic.Output */ -body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -body .gs { font-weight: bold } /* Generic.Strong */ -body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -body .gt { color: #0040D0 } /* Generic.Traceback */ -body .kc { color: #954121 } /* Keyword.Constant */ -body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ -body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ -body .kp { color: #954121 } /* Keyword.Pseudo */ -body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ -body .kt { color: #B00040 } /* Keyword.Type */ -body .m { color: #666666 } /* Literal.Number */ -body .s { color: #219161 } /* Literal.String */ -body .na { color: #7D9029 } /* Name.Attribute */ -body .nb { color: #954121 } /* Name.Builtin */ -body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ -body .no { color: #880000 } /* Name.Constant */ -body .nd { color: #AA22FF } /* Name.Decorator */ -body .ni { color: #999999; font-weight: bold } /* Name.Entity */ -body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -body .nf { color: #0000FF } /* Name.Function */ -body .nl { color: #A0A000 } /* Name.Label */ -body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -body .nt { color: #954121; font-weight: bold } /* Name.Tag */ -body .nv { color: #19469D } /* Name.Variable */ -body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -body .w { color: #bbbbbb } /* Text.Whitespace */ -body .mf { color: #666666 } /* Literal.Number.Float */ -body .mh { color: #666666 } /* Literal.Number.Hex */ -body .mi { color: #666666 } /* Literal.Number.Integer */ -body .mo { color: #666666 } /* Literal.Number.Oct */ -body .sb { color: #219161 } /* Literal.String.Backtick */ -body .sc { color: #219161 } /* Literal.String.Char */ -body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ -body .s2 { color: #219161 } /* Literal.String.Double */ -body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -body .sh { color: #219161 } /* Literal.String.Heredoc */ -body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -body .sx { color: #954121 } /* Literal.String.Other */ -body .sr { color: #BB6688 } /* Literal.String.Regex */ -body .s1 { color: #219161 } /* Literal.String.Single */ -body .ss { color: #19469D } /* Literal.String.Symbol */ -body .bp { color: #954121 } /* Name.Builtin.Pseudo */ -body .vc { color: #19469D } /* Name.Variable.Class */ -body .vg { color: #19469D } /* Name.Variable.Global */ -body .vi { color: #19469D } /* Name.Variable.Instance */ -body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf.html b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf.html deleted file mode 100644 index cb9a1f9..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf.html +++ /dev/null @@ -1,20 +0,0 @@ - nconf.js

      nconf.js

      /*
      - * nconf.js: Top-level include for the nconf module
      - *
      - * (C) 2011, Charlie Robbins
      - *
      - */
      -
      -var fs = require('fs'),
      -    async = require('async'),
      -    common = require('./nconf/common'),
      -    Provider = require('./nconf/provider').Provider,
      -    nconf = module.exports = new Provider();

      Expose the version from the package.json using pkginfo.

      require('pkginfo')(module, 'version');

      Expose the various components included with nconf

      nconf.key           = common.key;
      -nconf.path          = common.path;
      -nconf.loadFiles     = common.loadFiles;
      -nconf.loadFilesSync = common.loadFilesSync;
      -nconf.formats       = require('./nconf/formats');
      -nconf.stores        = require('./nconf/stores');
      -nconf.Provider      = Provider;
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf/common.html b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf/common.html deleted file mode 100644 index 5c359ce..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf/common.html +++ /dev/null @@ -1,85 +0,0 @@ - common.js

      common.js

      /*
      - * utils.js: Utility functions for the nconf module.
      - *
      - * (C) 2011, Charlie Robbins
      - *
      - */
      - 
      -var fs = require('fs'),
      -    async = require('async'),
      -    formats = require('./formats'),
      -    Memory = require('./stores/Memory').Memory;
      -
      -var common = exports;

      function path (key)

      - -

      @key {string} The ':' delimited key to split

      - -

      Returns a fully-qualified path to a nested nconf key.

      common.path = function (key) {
      -  return key.split(':');
      -};

      function key (arguments)

      - -

      Returns a : joined string from the arguments.

      common.key = function () {
      -  return Array.prototype.slice.call(arguments).join(':');
      -};

      function loadFiles (files, callback)

      - -

      @files {Object|Array} List of files (or settings object) to load.

      - -

      @callback {function} Continuation to respond to when complete.

      - -

      Loads all the data in the specified files.

      common.loadFiles = function (files, callback) {
      -  if (!files) {
      -    return callback(null, {});
      -  }
      -
      -  var options = Array.isArray(files) ? { files: files } : files;

      Set the default JSON format if not already -specified

        options.format = options.format || formats.json;
      -
      -  function parseFile (file, next) {
      -    fs.readFile(file, function (err, data) {
      -      return !err 
      -        ? next(null, options.format.parse(data.toString()))
      -        : next(err);
      -    });
      -  }
      -
      -  async.map(files, parseFile, function (err, objs) {
      -    return err ? callback(err) : callback(null, common.merge(objs));
      -  });
      -};

      function loadFilesSync (files)

      - -

      @files {Object|Array} List of files (or settings object) to load.

      - -

      Loads all the data in the specified files synchronously.

      common.loadFilesSync = function (files) {
      -  if (!files) {
      -    return;
      -  }

      Set the default JSON format if not already -specified

        var options = Array.isArray(files) ? { files: files } : files;
      -  options.format = options.format || formats.json;
      -
      -  return common.merge(files.map(function (file) {
      -    return options.format.parse(fs.readFileSync(file, 'utf8'));
      -  }));
      -};

      function merge (objs)

      - -

      @objs {Array} Array of object literals to merge

      - -

      Merges the specified objs using a temporary instance -of stores.Memory.

      common.merge = function (objs) {
      -  var store = new Memory();
      -  
      -  objs.forEach(function (obj) {
      -    Object.keys(obj).forEach(function (key) {
      -      store.merge(key, obj[key]);
      -    });
      -  });
      -  
      -  return store.store;
      -};

      function capitalize (str)

      - -

      @str {string} String to capitalize

      - -

      Capitalizes the specified str.

      common.capitalize = function (str) {
      -  return str && str[0].toUpperCase() + str.slice(1);
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf/formats.html b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf/formats.html deleted file mode 100644 index a2ab2f5..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf/formats.html +++ /dev/null @@ -1,22 +0,0 @@ - formats.js

      formats.js

      /*
      - * formats.js: Default formats supported by nconf
      - *
      - * (C) 2011, Charlie Robbins
      - *
      - */
      -
      -var ini = require('ini');
      -
      -var formats = exports;

      @json

      - -

      Standard JSON format which pretty prints .stringify().

      formats.json = {
      -  stringify: function (obj) {
      -    return JSON.stringify(obj, null, 2)
      -  },
      -  parse: JSON.parse
      -};

      @ini

      - -

      Standard INI format supplied from the ini module -http://en.wikipedia.org/wiki/INI_file

      formats.ini = ini;
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf/provider.html b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf/provider.html deleted file mode 100644 index 66c6718..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf/provider.html +++ /dev/null @@ -1,378 +0,0 @@ - provider.js

      provider.js

      /*
      - * provider.js: Abstraction providing an interface into pluggable configuration storage.
      - *
      - * (C) 2011, Charlie Robbins
      - *
      - */
      -
      -var async = require('async'),
      -    common = require('./common'),
      -    stores = require('./stores');

      function Provider (options)

      - -

      @options {Object} Options for this instance.

      - -

      Constructor function for the Provider object responsible -for exposing the pluggable storage features of nconf.

      var Provider = exports.Provider = function (options) {
      -  var self = this;  
      -  

      Setup default options for working with stores, -overrides, process.env and process.argv.

        options         = options           || {};
      -  this._overrides = options.overrides || null;
      -  this._argv      = options.argv      || false;
      -  this._env       = options.env       || false;
      -  this._reserved  = Object.keys(Provider.prototype);
      -  this._stores    = [];
      -  

      Add the default system store for working with -overrides, process.env, process.argv and -a simple in-memory objects.

        this.add('system', options);
      -  
      -  if (options.type) {
      -    this.add(options.type, options);
      -  }
      -  else if (options.store) {
      -    this.add(options.store.name || options.store.type, options.store);
      -  }
      -  else if (options.stores) {
      -    Object.keys(options.stores).forEach(function (store) {
      -      self.add(store.name || store.type, store);
      -    });
      -  }
      -};

      function use (name, options)

      - -

      @type {string} Type of the nconf store to use.

      - -

      @options {Object} Options for the store instance.

      - -

      Adds (or replaces) a new store with the specified name -and options. If options.type is not set, then name -will be used instead:

      - -

      provider.use('file'); - provider.use('file', { type: 'file', filename: '/path/to/userconf' })

      Provider.prototype.use = function (name, options) {
      -  if (name === 'system') {
      -    return;
      -  }
      -  else if (this._reserved.indexOf(name) !== -1) {
      -    throw new Error('Cannot use reserved name: ' + name);
      -  }
      -  
      -  options  = options      || {};
      -  var type = options.type || name;
      -
      -  function sameOptions (store) {
      -    return Object.keys(options).every(function (key) {
      -      return options[key] === store[key];
      -    });
      -  }
      -  
      -  var store = this[name],
      -      update = store && !sameOptions(store);
      -  
      -  if (!store || update) {
      -    if (update) {
      -      this.remove(name);
      -    }
      -    
      -    this.add(name, options);
      -  }
      -  
      -  return this;
      -};

      function add (name, options)

      - -

      @name {string} Name of the store to add to this instance

      - -

      @options {Object} Options for the store to create

      - -

      Adds a new store with the specified name and options. If options.type -is not set, then name will be used instead:

      - -

      provider.add('memory'); - provider.add('userconf', { type: 'file', filename: '/path/to/userconf' })

      Provider.prototype.add = function (name, options) {
      -  if (this._reserved.indexOf(name) !== -1) {
      -    throw new Error('Cannot use reserved name: ' + name);
      -  }
      -  
      -  options  = options      || {};
      -  var type = options.type || name;
      -  
      -  if (Object.keys(stores).indexOf(common.capitalize(type)) === -1) {
      -    throw new Error('Cannot add store with unknown type: ' + type);
      -  }
      -  
      -  this[name] = this.create(type, options);
      -  this._stores.push(name);
      -  
      -  if (this[name].loadSync) {
      -    this[name].loadSync();
      -  }
      -};

      function remove (name)

      - -

      @name {string} Name of the store to remove from this instance

      - -

      Removes a store with the specified name from this instance. Users -are allowed to pass in a type argument (e.g. memory) as name if -this was used in the call to .add().

      Provider.prototype.remove = function (name) {
      -  if (this._reserved.indexOf(name) !== -1) {
      -    throw new Error('Cannot use reserved name: ' + name);
      -  }
      -  else if (!this[name]) {
      -    throw new Error('Cannot remove store that does not exist: ' + name);
      -  }
      -  
      -  delete this[name];
      -  this._stores.splice(this._stores.indexOf(name), 1);
      -};

      function create (type, options)

      - -

      @type {string} Type of the nconf store to use.

      - -

      @options {Object} Options for the store instance.

      - -

      Creates a store of the specified type using the -specified options.

      Provider.prototype.create = function (type, options) {
      -  return new stores[common.capitalize(type.toLowerCase())](options);
      -};

      function get (key, callback)

      - -

      @key {string} Key to retrieve for this instance.

      - -

      @callback {function} Optional Continuation to respond to when complete.

      - -

      Retrieves the value for the specified key (if any).

      Provider.prototype.get = function (key, callback) {

      If there is no callback we can short-circuit into the default -logic for traversing stores.

        if (!callback) {
      -    return this._execute('get', 1, key, callback);
      -  }
      -  

      Otherwise the asynchronous, hierarchical get is -slightly more complicated because we do not need to traverse -the entire set of stores, but up until there is a defined value.

        var current = 0,
      -      self = this,
      -      response;
      -      
      -  async.whilst(function () {
      -    return typeof response === 'undefined' && current < self._stores.length;
      -  }, function (next) {
      -    var store = self[self._stores[current]];
      -    current++;
      -    
      -    if (store.get.length >= 2) {
      -      return store.get(key, function (err, value) {
      -        if (err) {
      -          return next(err);
      -        }
      -        
      -        response = value;
      -        next();
      -      });
      -    }
      -    
      -    response = store.get(key);
      -    next();
      -  }, function (err) {
      -    return err ? callback(err) : callback(null, response);
      -  });
      -};

      function set (key, value, callback)

      - -

      @key {string} Key to set in this instance

      - -

      @value {literal|Object} Value for the specified key

      - -

      @callback {function} Optional Continuation to respond to when complete.

      - -

      Sets the value for the specified key in this instance.

      Provider.prototype.set = function (key, value, callback) {
      -  return this._execute('set', 2, key, value, callback);
      -};

      function reset (callback)

      - -

      @callback {function} Optional Continuation to respond to when complete.

      - -

      Clears all keys associated with this instance.

      Provider.prototype.reset = function (callback) {
      -  return this._execute('reset', 0, callback);  
      -};

      function clear (key, callback)

      - -

      @key {string} Key to remove from this instance

      - -

      @callback {function} Optional Continuation to respond to when complete.

      - -

      Removes the value for the specified key from this instance.

      Provider.prototype.clear = function (key, callback) {
      -  return this._execute('clear', 1, key, callback);
      -};

      function merge ([key,] value [, callback])

      - -

      @key {string} Key to merge the value into

      - -

      @value {literal|Object} Value to merge into the key

      - -

      @callback {function} Optional Continuation to respond to when complete.

      - -

      Merges the properties in value into the existing object value at key.

      - -
        -
      1. If the existing value key is not an Object, it will be completely overwritten.
      2. -
      3. If key is not supplied, then the value will be merged into the root.
      4. -
      Provider.prototype.merge = function () {
      -  var self = this,
      -      args = Array.prototype.slice.call(arguments),
      -      callback = typeof args[args.length - 1] === 'function' && args.pop(),
      -      value = args.pop(),
      -      key = args.pop();
      -      
      -  function mergeProperty (prop, next) {
      -    return self._execute('merge', 2, prop, value[prop], next);
      -  }
      -      
      -  if (!key) {
      -    if (Array.isArray(value) || typeof value !== 'object') {
      -      return onError(new Error('Cannot merge non-Object into top-level.'), callback);
      -    }
      -    
      -    return async.forEach(Object.keys(value), mergeProperty, callback || function () { })
      -  }
      -  
      -  return this._execute('merge', 2, key, value, callback);
      -};

      function load (callback)

      - -

      @callback {function} Continuation to respond to when complete.

      - -

      Responds with an Object representing all keys associated in this instance.

      Provider.prototype.load = function (callback) {
      -  var self = this;
      -  
      -  function loadStoreSync(name) {
      -    var store = self[name];
      -    
      -    if (!store.loadSync) {
      -      throw new Error('nconf store ' + store.type + ' has no loadSync() method');
      -    }
      -    
      -    return store.loadSync();
      -  }
      -  
      -  function loadStore(name, next) {
      -    var store = self[name];
      -    
      -    if (!store.load && !store.loadSync) {
      -      return next(new Error('nconf store ' + store.type + ' has no load() method'));
      -    }
      -    
      -    return store.loadSync
      -      ? next(null, store.loadSync())
      -      : store.load(next);
      -  }
      -  

      If we don't have a callback and the current -store is capable of loading synchronously -then do so.

        if (!callback) {
      -    return common.merge(this._stores.map(loadStoreSync));
      -  }
      -  
      -  async.map(this._stores, loadStore, function (err, objs) {
      -    return err ? callback(err) : callback(null, common.merge(objs));
      -  });
      -};

      function save (value, callback)

      - -

      @value {Object} Optional Config object to set for this instance

      - -

      @callback {function} Continuation to respond to when complete.

      - -

      Removes any existing configuration settings that may exist in this -instance and then adds all key-value pairs in value.

      Provider.prototype.save = function (value, callback) {
      -  if (!callback && typeof value === 'function') {
      -    callback = value;
      -    value = null;
      -  }
      -  
      -  var self = this;
      -  
      -  function saveStoreSync(name) {
      -    var store = self[name];
      -    
      -    if (!store.saveSync) {
      -      throw new Error('nconf store ' + store.type + ' has no saveSync() method');
      -    }
      -    
      -    return store.saveSync();
      -  }
      -  
      -  function saveStore(name, next) {
      -    var store = self[name];
      -    
      -    if (!store.save && !store.saveSync) {
      -      return next(new Error('nconf store ' + store.type + ' has no save() method'));
      -    }
      -    
      -    return store.saveSync
      -      ? next(null, store.saveSync())
      -      : store.save(next);
      -  }
      -  

      If we don't have a callback and the current -store is capable of saving synchronously -then do so.

        if (!callback) {
      -    return common.merge(this._stores.map(saveStoreSync));
      -  }
      -  
      -  async.map(this._stores, saveStore, function (err, objs) {
      -    return err ? callback(err) : callback();
      -  });  
      -};

      @private function _execute (action, syncLength, [arguments])

      - -

      @action {string} Action to execute on this.store.

      - -

      @syncLength {number} Function length of the sync version.

      - -

      @arguments {Array} Arguments array to apply to the action

      - -

      Executes the specified action on all stores for this instance, ensuring a callback supplied -to a synchronous store function is still invoked.

      Provider.prototype._execute = function (action, syncLength /* [arguments] */) {
      -  var args = Array.prototype.slice.call(arguments, 2),
      -      callback = typeof args[args.length - 1] === 'function' && args.pop(),
      -      self = this,
      -      response;
      -  
      -  function runAction (name, next) {
      -    var store = self[name]
      -    
      -    return store[action].length > syncLength
      -      ? store[action].apply(store, args.concat(next))
      -      : next(null, store[action].apply(store, args));
      -  }
      -  
      -  if (callback) {
      -    return async.forEach(self._stores, runAction, function (err) {
      -      return err ? callback(err) : callback();
      -    });
      -  }
      -
      -  this._stores.forEach(function (name) {
      -    var store = self[name];
      -    response = store[action].apply(store, args);
      -  });
      -    
      -  return response;
      -}

      @argv {boolean}

      - -

      Gets or sets a property representing overrides which supercede all -other values for this instance.

      Provider.prototype.__defineSetter__('overrides', function (val) { updateSystem.call(this, 'overrides', val) });
      -Provider.prototype.__defineGetter__('overrides', function () { return this._argv });

      @argv {boolean}

      - -

      Gets or sets a property indicating if we should wrap calls to .get -by checking optimist.argv. Can be a boolean or the pass-thru -options for optimist.

      Provider.prototype.__defineSetter__('argv', function (val) { updateSystem.call(this, 'argv', val) });
      -Provider.prototype.__defineGetter__('argv', function () { return this._argv });

      @env {boolean}

      - -

      Gets or sets a property indicating if we should wrap calls to .get -by checking process.env. Can be a boolean or an Array of -environment variables to extract.

      Provider.prototype.__defineSetter__('env', function (val) { updateSystem.call(this, 'env', val) });
      -Provider.prototype.__defineGetter__('env', function () { return this._env });

      Throw the err if a callback is not supplied

      function onError(err, callback) {
      -  if (callback) {
      -    return callback(err);
      -  }
      -  
      -  throw err;
      -}

      Helper function for working with the -default system store for providers.

      function updateSystem(prop, value) {
      -  var system = this['system'];
      -  
      -  if (system[prop] === value) {
      -    return;
      -  }
      -  
      -  value = value || false;
      -  this['_' + prop] = value;
      -  system[prop] = value;
      -  system.loadSync();
      -}
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf/stores.html b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf/stores.html deleted file mode 100644 index d799966..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf/stores.html +++ /dev/null @@ -1,19 +0,0 @@ - stores.js

      stores.js

      /*
      - * stores.js: Top-level include for all nconf stores
      - *
      - * (C) 2011, Charlie Robbins
      - *
      - */
      - 
      -var fs = require('fs'),
      -    common = require('./common'),
      -    stores = exports;

      Setup all stores as lazy-loaded getters.

      fs.readdirSync(__dirname + '/stores').forEach(function (file) {
      -  var store = file.replace('.js', ''),
      -      name  = common.capitalize(store);
      -      
      -  stores.__defineGetter__(name, function () {
      -    return require('./stores/' + store)[name];
      -  });
      -});
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf/stores/file.html b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf/stores/file.html deleted file mode 100644 index 7a00765..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf/stores/file.html +++ /dev/null @@ -1,170 +0,0 @@ - file.js

      file.js

      /*
      - * file.js: Simple file storage engine for nconf files
      - *
      - * (C) 2011, Charlie Robbins
      - *
      - */
      -
      -var fs = require('fs'),
      -    path = require('path'),
      -    util = require('util'),
      -    formats = require('../formats'),
      -    Memory = require('./memory').Memory;
      - 

      function File (options)

      - -

      @options {Object} Options for this instance

      - -

      Constructor function for the File nconf store, a simple abstraction -around the Memory store that can persist configuration to disk.

      var File = exports.File = function (options) {
      -  if (!options || !options.file) {
      -    throw new Error ('Missing required option `files`');
      -  }
      -
      -  Memory.call(this, options);
      -
      -  this.type   = 'file';
      -  this.file   = options.file;
      -  this.dir    = options.dir    || process.cwd();
      -  this.format = options.format || formats.json;
      -};

      Inherit from the Memory store

      util.inherits(File, Memory);

      function save (value, callback)

      - -

      @value {Object} Ignored Left here for consistency

      - -

      @callback {function} Continuation to respond to when complete.

      - -

      Saves the current configuration object to disk at this.file -using the format specified by this.format.

      File.prototype.save = function (value, callback) {
      -  if (!callback) {
      -    callback = value;
      -    value = null;
      -  }
      -  
      -  fs.writeFile(this.file, this.format.stringify(this.store), function (err) {
      -    return err ? callback(err) : callback();
      -  });
      -};

      function saveSync (value, callback)

      - -

      @value {Object} Ignored Left here for consistency

      - -

      @callback {function} Optional Continuation to respond to when complete.

      - -

      Saves the current configuration object to disk at this.file -using the format specified by this.format synchronously.

      File.prototype.saveSync = function (value) {
      -  try {
      -    fs.writeFileSync(this.file, this.format.stringify(this.store));
      -  }
      -  catch (ex) {
      -    throw(ex);
      -  }
      -};

      function load (callback)

      - -

      @callback {function} Continuation to respond to when complete.

      - -

      Responds with an Object representing all keys associated in this instance.

      File.prototype.load = function (callback) {
      -  var self = this;
      -
      -  path.exists(self.file, function (exists) {
      -    if (!exists) {

      If the path we are attempting to load doesn't exist, create it

            self.save({}, function (err) {
      -        self.store = {};
      -        return callback(err, self.store);
      -      });
      -    }
      -    else {

      Else, the path exists, read it from disk

            fs.readFile(self.file, function (err, data) {
      -        if (err) {
      -          return callback(err);
      -        }
      -        
      -        try {
      -          self.store = self.format.parse(data.toString());
      -        }
      -        catch (ex) {
      -          return callback(new Error("Error parsing your JSON configuration file."));
      -        }
      -        
      -        callback(null, self.store);
      -      });
      -    }
      -  });
      -};

      function load (callback)

      - -

      @callback {function} Optional Continuation to respond to when complete.

      - -

      Attempts to load the data stored in this.file synchronously and responds appropriately.

      File.prototype.loadSync = function () {
      -  var data, self = this;
      -
      -  if (!path.existsSync(self.file)) {

      If the path we are attempting to load doesn't exist, create it

          self.saveSync({});
      -    self.store = {};
      -    data = {};
      -  }
      -  else {

      Else, the path exists, read it from disk

          try {
      -      data = this.format.parse(fs.readFileSync(this.file, 'utf8'));
      -      this.store = data;
      -    }
      -    catch (ex) {
      -      throw new Error("Error parsing your JSON configuration file.")
      -    }
      -  }
      -
      -  return data;
      -};

      function search (base)

      - -

      @base {string} Base directory (or file) to begin searching for the target file.

      - -

      Attempts to find this.file by iteratively searching up the -directory structure

      File.prototype.search = function (base) {
      -  var looking = true,
      -      fullpath,
      -      previous,
      -      stats;
      -
      -  base = base || process.cwd();
      -
      -  if (this.file[0] === '/') {

      If filename for this instance is a fully qualified path -(i.e. it starts with a '/') then check if it exists

          try {
      -      stats = fs.statSync(fs.realpathSync(this.file));
      -      if (stats.isFile()) {
      -        fullpath = this.file;
      -        looking = false;
      -      }
      -    }
      -    catch (ex) {

      Ignore errors

          }
      -  }
      -
      -  if (looking && base) {

      Attempt to stat the realpath located at base -if the directory does not exist then return false.

          try {
      -      var stat = fs.statSync(fs.realpathSync(base));
      -      looking = stat.isDirectory();
      -    }
      -    catch (ex) {
      -      return false;
      -    }
      -  }
      -  
      -  while (looking) {

      Iteratively look up the directory structure from base

          try {
      -      stats = fs.statSync(fs.realpathSync(fullpath = path.join(base, this.file)));
      -      looking = stats.isDirectory();
      -    }
      -    catch (ex) {
      -      previous = base;
      -      base = path.dirname(base);
      -
      -      if (previous === base) {

      If we've reached the top of the directory structure then simply use -the default file path.

              try {
      -          stats = fs.statSync(fs.realpathSync(fullpath = path.join(this.dir, this.file)));
      -          if (stats.isDirectory()) {
      -            fullpath = undefined;
      -          }
      -        }
      -        catch (ex) {

      Ignore errors

              }
      -        
      -        looking = false;
      -      }
      -    }
      -  }

      Set the file for this instance to the fullpath -that we have found during the search. In the event that -the search was unsuccessful use the original value for this.file.

        this.file = fullpath || this.file;
      -  
      -  return fullpath;
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf/stores/memory.html b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf/stores/memory.html deleted file mode 100644 index 8867394..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf/stores/memory.html +++ /dev/null @@ -1,143 +0,0 @@ - memory.js

      memory.js

      /*
      - * memory.js: Simple memory storage engine for nconf configuration(s)
      - *
      - * (C) 2011, Charlie Robbins
      - *
      - */
      -
      -var common = require('../common');

      function Memory (options)

      - -

      @options {Object} Options for this instance

      - -

      Constructor function for the Memory nconf store which maintains -a nested json structure based on key delimiters :.

      - -

      e.g. my:nested:key ==> { my: { nested: { key: } } }

      var Memory = exports.Memory = function (options) {
      -  options       = options || {};
      -  this.type     = 'memory';
      -  this.store    = {};
      -  this.mtimes   = {};
      -  this.readOnly = false;
      -  this.loadFrom = options.loadFrom || null;
      -  
      -  if (this.loadFrom) {
      -    this.store = common.loadFilesSync(this.loadFrom);
      -  }
      -};

      function get (key)

      - -

      @key {string} Key to retrieve for this instance.

      - -

      Retrieves the value for the specified key (if any).

      Memory.prototype.get = function (key) {
      -  var target = this.store, 
      -      path   = common.path(key);

      Scope into the object to get the appropriate nested context

        while (path.length > 0) {
      -    key = path.shift();
      -    if (!(target && key in target)) {
      -      return;
      -    }
      -    
      -    target = target[key];
      -    if (path.length === 0) {
      -      return target;
      -    }
      -  }
      -};

      function set (key, value)

      - -

      @key {string} Key to set in this instance

      - -

      @value {literal|Object} Value for the specified key

      - -

      Sets the value for the specified key in this instance.

      Memory.prototype.set = function (key, value) {
      -  if (this.readOnly) {
      -    return false;
      -  }
      -  
      -  var target = this.store, 
      -      path   = common.path(key);
      -  

      Update the mtime (modified time) of the key

        this.mtimes[key] = Date.now();
      -  

      Scope into the object to get the appropriate nested context

        while (path.length > 1) {
      -    key = path.shift();
      -    if (!target[key] || typeof target[key] !== 'object') {
      -      target[key] = {};
      -    }
      -    
      -    target = target[key];
      -  }
      -  

      Set the specified value in the nested JSON structure

        key = path.shift();
      -  target[key] = value;
      -  return true;
      -};

      function clear (key)

      - -

      @key {string} Key to remove from this instance

      - -

      Removes the value for the specified key from this instance.

      Memory.prototype.clear = function (key) {
      -  if (this.readOnly) {
      -    return false;
      -  }
      -  
      -  var target = this.store, 
      -      path   = common.path(key);
      -  

      Remove the key from the set of mtimes (modified times)

        delete this.mtimes[key];
      -  

      Scope into the object to get the appropriate nested context

        while (path.length > 1) {
      -    key = path.shift();
      -    if (!target[key]) {
      -      return;
      -    }
      -    
      -    target = target[key];
      -  }
      -  

      Delete the key from the nested JSON structure

        key = path.shift();
      -  delete target[key];
      -  return true;
      -};

      function merge (key, value)

      - -

      @key {string} Key to merge the value into

      - -

      @value {literal|Object} Value to merge into the key

      - -

      Merges the properties in value into the existing object value -at key. If the existing value key is not an Object, it will be -completely overwritten.

      Memory.prototype.merge = function (key, value) {
      -  if (this.readOnly) {
      -    return false;
      -  }
      -  

      If the key is not an Object or is an Array, -then simply set it. Merging is for Objects.

        if (typeof value !== 'object' || Array.isArray(value)) {
      -    return this.set(key, value);
      -  }
      -  
      -  var self    = this,
      -      target  = this.store, 
      -      path    = common.path(key),
      -      fullKey = key;
      -  

      Update the mtime (modified time) of the key

        this.mtimes[key] = Date.now();
      -  

      Scope into the object to get the appropriate nested context

        while (path.length > 1) {
      -    key = path.shift();
      -    if (!target[key]) {
      -      target[key] = {};
      -    }
      -    
      -    target = target[key];
      -  }

      Set the specified value in the nested JSON structure

        key = path.shift();
      -  

      If the current value at the key target is not an Object, -or is an Array then simply override it because the new value -is an Object.

        if (typeof target[key] !== 'object' || Array.isArray(target[key])) {
      -    target[key] = value;
      -    return true;
      -  }
      -  
      -  return Object.keys(value).every(function (nested) {
      -    return self.merge(fullKey + ':' + nested, value[nested]);
      -  });
      -};

      function reset (callback)

      - -

      Clears all keys associated with this instance.

      Memory.prototype.reset = function () {
      -  if (this.readOnly) {
      -    return false;
      -  }
      -  
      -  this.mtimes = {};
      -  this.store  = {};
      -  return true;
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf/stores/system.html b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf/stores/system.html deleted file mode 100644 index 9e89544..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/docs/nconf/stores/system.html +++ /dev/null @@ -1,98 +0,0 @@ - system.js

      system.js

      /*
      - * system.js: Simple memory-based store for process environment variables and
      - *            command-line arguments.
      - *
      - * (C) 2011, Charlie Robbins
      - *
      - */
      - 
      -var util = require('util'),
      -    Memory = require('./memory').Memory;
      - 

      function System (options)

      - -

      @options {Object} Options for this instance.

      - -

      Constructor function for the System nconf store, a simple abstraction -around the Memory store that can read process environment variables -and command-line arguments.

      var System = exports.System = function (options) {
      -  options = options || {};
      -  Memory.call(this, options);
      -
      -  this.type      = 'system';
      -  this.overrides = options.overrides || null;
      -  this.env       = options.env       || false;
      -  this.argv      = options.argv      || false;
      -};

      Inherit from the Memory store

      util.inherits(System, Memory);

      function loadSync ()

      - -

      Loads the data passed in from process.env into this instance.

      System.prototype.loadSync = function () {
      -  if (this.env) {
      -    this.loadEnv();
      -  }
      -  
      -  if (this.argv) {
      -    this.loadArgv();
      -  }
      -  
      -  if (this.overrides) {
      -    this.loadOverrides();
      -  }
      -  
      -  return this.store;
      -};

      function loadOverrides ()

      - -

      Loads any overrides set on this instance into -the underlying managed Memory store.

      System.prototype.loadOverrides = function () {
      -  if (!this.overrides) {
      -    return;
      -  }
      -  
      -  var self = this,
      -      keys = Object.keys(this.overrides);
      -  
      -  keys.forEach(function (key) {
      -    self.set(key, self.overrides[key]);
      -  });
      -  
      -  return this.store;
      -};

      function loadArgv ()

      - -

      Loads the data passed in from the command-line arguments -into this instance.

      System.prototype.loadArgv = function () {
      -  var self = this, 
      -      argv;
      -  
      -  if (typeof this.argv === 'object') {
      -    argv = require('optimist').options(this.argv).argv;
      -  }
      -  else if (this.argv) {
      -    argv = require('optimist').argv;
      -  }
      -  
      -  if (!argv) {
      -    return;
      -  }
      -  
      -  Object.keys(argv).forEach(function (key) {
      -    self.set(key, argv[key]);
      -  });
      -  
      -  return this.store;
      -};

      function loadEnv ()

      - -

      Loads the data passed in from process.env into this instance.

      System.prototype.loadEnv = function () {
      -  var self = this;
      -  
      -  if (!this.env) {
      -    return;
      -  }
      -  
      -  Object.keys(process.env).filter(function (key) {
      -    return !self.env.length || self.env.indexOf(key) !== -1;
      -  }).forEach(function (key) {
      -    self.set(key, process.env[key]);
      -  });
      -    
      -  return this.store;
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf.js deleted file mode 100644 index 503b52d..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * nconf.js: Top-level include for the nconf module - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var fs = require('fs'), - async = require('async'), - common = require('./nconf/common'), - Provider = require('./nconf/provider').Provider, - nconf = module.exports = new Provider(); - -// -// Expose the version from the package.json using `pkginfo`. -// -require('pkginfo')(module, 'version'); - -// -// Setup all stores as lazy-loaded getters. -// -fs.readdirSync(__dirname + '/nconf/stores').forEach(function (file) { - var store = file.replace('.js', ''), - name = common.capitalize(store); - - nconf.__defineGetter__(name, function () { - return require('./nconf/stores/' + store)[name]; - }); -}); - -// -// Expose the various components included with nconf -// -nconf.key = common.key; -nconf.path = common.path; -nconf.loadFiles = common.loadFiles; -nconf.loadFilesSync = common.loadFilesSync; -nconf.formats = require('./nconf/formats'); -nconf.Provider = Provider; diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/common.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/common.js deleted file mode 100644 index 50efb3a..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/common.js +++ /dev/null @@ -1,111 +0,0 @@ -/* - * utils.js: Utility functions for the nconf module. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var fs = require('fs'), - async = require('async'), - formats = require('./formats'), - Memory = require('./stores/memory').Memory; - -var common = exports; - -// -// ### function path (key) -// #### @key {string} The ':' delimited key to split -// Returns a fully-qualified path to a nested nconf key. -// -common.path = function (key) { - return key.split(':'); -}; - -// -// ### function key (arguments) -// Returns a `:` joined string from the `arguments`. -// -common.key = function () { - return Array.prototype.slice.call(arguments).join(':'); -}; - -// -// ### function loadFiles (files, callback) -// #### @files {Object|Array} List of files (or settings object) to load. -// #### @callback {function} Continuation to respond to when complete. -// Loads all the data in the specified `files`. -// -common.loadFiles = function (files, callback) { - if (!files) { - return callback(null, {}); - } - - var options = Array.isArray(files) ? { files: files } : files; - - // - // Set the default JSON format if not already - // specified - // - options.format = options.format || formats.json; - - function parseFile (file, next) { - fs.readFile(file, function (err, data) { - return !err - ? next(null, options.format.parse(data.toString())) - : next(err); - }); - } - - async.map(files, parseFile, function (err, objs) { - return err ? callback(err) : callback(null, common.merge(objs)); - }); -}; - -// -// ### function loadFilesSync (files) -// #### @files {Object|Array} List of files (or settings object) to load. -// Loads all the data in the specified `files` synchronously. -// -common.loadFilesSync = function (files) { - if (!files) { - return; - } - - // - // Set the default JSON format if not already - // specified - // - var options = Array.isArray(files) ? { files: files } : files; - options.format = options.format || formats.json; - - return common.merge(files.map(function (file) { - return options.format.parse(fs.readFileSync(file, 'utf8')); - })); -}; - -// -// ### function merge (objs) -// #### @objs {Array} Array of object literals to merge -// Merges the specified `objs` using a temporary instance -// of `stores.Memory`. -// -common.merge = function (objs) { - var store = new Memory(); - - objs.forEach(function (obj) { - Object.keys(obj).forEach(function (key) { - store.merge(key, obj[key]); - }); - }); - - return store.store; -}; - -// -// ### function capitalize (str) -// #### @str {string} String to capitalize -// Capitalizes the specified `str`. -// -common.capitalize = function (str) { - return str && str[0].toUpperCase() + str.slice(1); -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/formats.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/formats.js deleted file mode 100644 index df7783f..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/formats.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - * formats.js: Default formats supported by nconf - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var ini = require('ini'); - -var formats = exports; - -// -// ### @json -// Standard JSON format which pretty prints `.stringify()`. -// -formats.json = { - stringify: function (obj) { - return JSON.stringify(obj, null, 2) - }, - parse: JSON.parse -}; - -// -// ### @ini -// Standard INI format supplied from the `ini` module -// http://en.wikipedia.org/wiki/INI_file -// -formats.ini = ini; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/provider.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/provider.js deleted file mode 100644 index fdb0d7b..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/provider.js +++ /dev/null @@ -1,491 +0,0 @@ -/* - * provider.js: Abstraction providing an interface into pluggable configuration storage. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var async = require('async'), - common = require('./common'); - -// -// ### function Provider (options) -// #### @options {Object} Options for this instance. -// Constructor function for the Provider object responsible -// for exposing the pluggable storage features of `nconf`. -// -var Provider = exports.Provider = function (options) { - // - // Setup default options for working with `stores`, - // `overrides`, `process.env` and `process.argv`. - // - options = options || {}; - this.stores = {}; - this.sources = []; - this.init(options); -}; - -// -// Define wrapper functions for using basic stores -// in this instance -// -['argv', 'env', 'file'].forEach(function (type) { - Provider.prototype[type] = function (options) { - return this.add(type, options); - }; -}); - -// -// Define wrapper functions for using -// overrides and defaults -// -['defaults', 'overrides'].forEach(function (type) { - Provider.prototype[type] = function (options) { - options = options || {}; - if (!options.type) { - options.type = 'literal'; - } - - return this.add(type, options); - }; -}); - -// -// ### function use (name, options) -// #### @type {string} Type of the nconf store to use. -// #### @options {Object} Options for the store instance. -// Adds (or replaces) a new store with the specified `name` -// and `options`. If `options.type` is not set, then `name` -// will be used instead: -// -// provider.use('file'); -// provider.use('file', { type: 'file', filename: '/path/to/userconf' }) -// -Provider.prototype.use = function (name, options) { - options = options || {}; - var type = options.type || name; - - function sameOptions (store) { - return Object.keys(options).every(function (key) { - return options[key] === store[key]; - }); - } - - var store = this.stores[name], - update = store && !sameOptions(store); - - if (!store || update) { - if (update) { - this.remove(name); - } - - this.add(name, options); - } - - return this; -}; - -// -// ### function add (name, options) -// #### @name {string} Name of the store to add to this instance -// #### @options {Object} Options for the store to create -// Adds a new store with the specified `name` and `options`. If `options.type` -// is not set, then `name` will be used instead: -// -// provider.add('memory'); -// provider.add('userconf', { type: 'file', filename: '/path/to/userconf' }) -// -Provider.prototype.add = function (name, options) { - options = options || {}; - var type = options.type || name; - - if (!require('../nconf')[common.capitalize(type)]) { - throw new Error('Cannot add store with unknown type: ' + type); - } - - this.stores[name] = this.create(type, options); - - if (this.stores[name].loadSync) { - this.stores[name].loadSync(); - } - - return this; -}; - -// -// ### function remove (name) -// #### @name {string} Name of the store to remove from this instance -// Removes a store with the specified `name` from this instance. Users -// are allowed to pass in a type argument (e.g. `memory`) as name if -// this was used in the call to `.add()`. -// -Provider.prototype.remove = function (name) { - delete this.stores[name]; - return this; -}; - -// -// ### function create (type, options) -// #### @type {string} Type of the nconf store to use. -// #### @options {Object} Options for the store instance. -// Creates a store of the specified `type` using the -// specified `options`. -// -Provider.prototype.create = function (type, options) { - return new (require('../nconf')[common.capitalize(type.toLowerCase())])(options); -}; - -// -// ### function init (options) -// #### @options {Object} Options to initialize this instance with. -// Initializes this instance with additional `stores` or `sources` in the -// `options` supplied. -// -Provider.prototype.init = function (options) { - var self = this; - - // - // Add any stores passed in through the options - // to this instance. - // - if (options.type) { - this.add(options.type, options); - } - else if (options.store) { - this.add(options.store.name || options.store.type, options.store); - } - else if (options.stores) { - Object.keys(options.stores).forEach(function (name) { - var store = options.stores[name]; - self.add(store.name || name || store.type, store); - }); - } - - // - // Add any read-only sources to this instance - // - if (options.source) { - this.sources.push(this.create(options.source.type || options.source.name, options.source)); - } - else if (options.sources) { - Object.keys(options.sources).forEach(function (name) { - var source = options.sources[name]; - self.sources.push(self.create(source.type || source.name || name, source)); - }); - } -}; - -// -// ### function get (key, callback) -// #### @key {string} Key to retrieve for this instance. -// #### @callback {function} **Optional** Continuation to respond to when complete. -// Retrieves the value for the specified key (if any). -// -Provider.prototype.get = function (key, callback) { - // - // If there is no callback we can short-circuit into the default - // logic for traversing stores. - // - if (!callback) { - return this._execute('get', 1, key, callback); - } - - // - // Otherwise the asynchronous, hierarchical `get` is - // slightly more complicated because we do not need to traverse - // the entire set of stores, but up until there is a defined value. - // - var current = 0, - names = Object.keys(this.stores), - self = this, - response; - - async.whilst(function () { - return typeof response === 'undefined' && current < names.length; - }, function (next) { - var store = self.stores[names[current]]; - current++; - - if (store.get.length >= 2) { - return store.get(key, function (err, value) { - if (err) { - return next(err); - } - - response = value; - next(); - }); - } - - response = store.get(key); - next(); - }, function (err) { - return err ? callback(err) : callback(null, response); - }); -}; - -// -// ### function set (key, value, callback) -// #### @key {string} Key to set in this instance -// #### @value {literal|Object} Value for the specified key -// #### @callback {function} **Optional** Continuation to respond to when complete. -// Sets the `value` for the specified `key` in this instance. -// -Provider.prototype.set = function (key, value, callback) { - return this._execute('set', 2, key, value, callback); -}; - -// -// ### function reset (callback) -// #### @callback {function} **Optional** Continuation to respond to when complete. -// Clears all keys associated with this instance. -// -Provider.prototype.reset = function (callback) { - return this._execute('reset', 0, callback); -}; - -// -// ### function clear (key, callback) -// #### @key {string} Key to remove from this instance -// #### @callback {function} **Optional** Continuation to respond to when complete. -// Removes the value for the specified `key` from this instance. -// -Provider.prototype.clear = function (key, callback) { - return this._execute('clear', 1, key, callback); -}; - -// -// ### function merge ([key,] value [, callback]) -// #### @key {string} Key to merge the value into -// #### @value {literal|Object} Value to merge into the key -// #### @callback {function} **Optional** Continuation to respond to when complete. -// Merges the properties in `value` into the existing object value at `key`. -// -// 1. If the existing value `key` is not an Object, it will be completely overwritten. -// 2. If `key` is not supplied, then the `value` will be merged into the root. -// -Provider.prototype.merge = function () { - var self = this, - args = Array.prototype.slice.call(arguments), - callback = typeof args[args.length - 1] === 'function' && args.pop(), - value = args.pop(), - key = args.pop(); - - function mergeProperty (prop, next) { - return self._execute('merge', 2, prop, value[prop], next); - } - - if (!key) { - if (Array.isArray(value) || typeof value !== 'object') { - return onError(new Error('Cannot merge non-Object into top-level.'), callback); - } - - return async.forEach(Object.keys(value), mergeProperty, callback || function () { }) - } - - return this._execute('merge', 2, key, value, callback); -}; - -// -// ### function load (callback) -// #### @callback {function} Continuation to respond to when complete. -// Responds with an Object representing all keys associated in this instance. -// -Provider.prototype.load = function (callback) { - var self = this; - - function getStores () { - var stores = Object.keys(self.stores); - stores.reverse(); - return stores.map(function (name) { - return self.stores[name]; - }); - } - - function loadStoreSync(store) { - if (!store.loadSync) { - throw new Error('nconf store ' + store.type + ' has no loadSync() method'); - } - - return store.loadSync(); - } - - function loadStore(store, next) { - if (!store.load && !store.loadSync) { - return next(new Error('nconf store ' + store.type + ' has no load() method')); - } - - return store.loadSync - ? next(null, store.loadSync()) - : store.load(next); - } - - function loadBatch (targets, done) { - if (!done) { - return common.merge(targets.map(loadStoreSync)); - } - - async.map(targets, loadStore, function (err, objs) { - return err ? done(err) : done(null, common.merge(objs)); - }); - } - - function mergeSources (data) { - // - // If `data` was returned then merge it into - // the system store. - // - if (data && typeof data === 'object') { - self.use('sources', { - type: 'literal', - store: data - }); - } - } - - function loadSources () { - var sourceHierarchy = self.sources.splice(0); - sourceHierarchy.reverse(); - - // - // If we don't have a callback and the current - // store is capable of loading synchronously - // then do so. - // - if (!callback) { - mergeSources(loadBatch(sourceHierarchy)); - return loadBatch(getStores()); - } - - loadBatch(sourceHierarchy, function (err, data) { - if (err) { - return callback(err); - } - - mergeSources(data); - return loadBatch(getStores(), callback); - }); - } - - return self.sources.length - ? loadSources() - : loadBatch(getStores(), callback); -}; - -// -// ### function save (value, callback) -// #### @value {Object} **Optional** Config object to set for this instance -// #### @callback {function} Continuation to respond to when complete. -// Removes any existing configuration settings that may exist in this -// instance and then adds all key-value pairs in `value`. -// -Provider.prototype.save = function (value, callback) { - if (!callback && typeof value === 'function') { - callback = value; - value = null; - } - - var self = this, - names = Object.keys(this.stores); - - function saveStoreSync(name) { - var store = self.stores[name]; - - // - // If the `store` doesn't have a `saveSync` method, - // just ignore it and continue. - // - return store.saveSync - ? store.saveSync() - : null; - } - - function saveStore(name, next) { - var store = self.stores[name]; - - // - // If the `store` doesn't have a `save` or saveSync` - // method(s), just ignore it and continue. - // - if (!store.save && !store.saveSync) { - return next(); - } - - return store.saveSync - ? next(null, store.saveSync()) - : store.save(next); - } - - // - // If we don't have a callback and the current - // store is capable of saving synchronously - // then do so. - // - if (!callback) { - return common.merge(names.map(saveStoreSync)); - } - - async.map(names, saveStore, function (err, objs) { - return err ? callback(err) : callback(); - }); -}; - -// -// ### @private function _execute (action, syncLength, [arguments]) -// #### @action {string} Action to execute on `this.store`. -// #### @syncLength {number} Function length of the sync version. -// #### @arguments {Array} Arguments array to apply to the action -// Executes the specified `action` on all stores for this instance, ensuring a callback supplied -// to a synchronous store function is still invoked. -// -Provider.prototype._execute = function (action, syncLength /* [arguments] */) { - var args = Array.prototype.slice.call(arguments, 2), - callback = typeof args[args.length - 1] === 'function' && args.pop(), - destructive = ['set', 'clear', 'merge'].indexOf(action) !== -1, - self = this, - response; - - function runAction (name, next) { - var store = self.stores[name]; - - if (destructive && store.readOnly) { - return next(); - } - - return store[action].length > syncLength - ? store[action].apply(store, args.concat(next)) - : next(null, store[action].apply(store, args)); - } - - if (callback) { - return async.forEach(Object.keys(this.stores), runAction, function (err) { - return err ? callback(err) : callback(); - }); - } - - - Object.keys(this.stores).forEach(function (name) { - if (typeof response === 'undefined') { - var store = self.stores[name]; - - if (destructive && store.readOnly) { - return; - } - - response = store[action].apply(store, args); - } - }); - - return response; -} - -// -// Throw the `err` if a callback is not supplied -// -function onError(err, callback) { - if (callback) { - return callback(err); - } - - throw err; -} \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/stores/argv.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/stores/argv.js deleted file mode 100644 index befad1d..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/stores/argv.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * argv.js: Simple memory-based store for command-line arguments. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var util = require('util'), - Memory = require('./memory').Memory; - -// -// ### function Argv (options) -// #### @options {Object} Options for this instance. -// Constructor function for the Argv nconf store, a simple abstraction -// around the Memory store that can read command-line arguments. -// -var Argv = exports.Argv = function (options) { - Memory.call(this, options); - - this.type = 'argv'; - this.readOnly = true; - this.options = options || false; -}; - -// Inherit from the Memory store -util.inherits(Argv, Memory); - -// -// ### function loadSync () -// Loads the data passed in from `process.argv` into this instance. -// -Argv.prototype.loadSync = function () { - this.loadArgv(); - return this.store; -}; - -// -// ### function loadArgv () -// Loads the data passed in from the command-line arguments -// into this instance. -// -Argv.prototype.loadArgv = function () { - var self = this, - argv; - - argv = typeof this.options === 'object' - ? require('optimist')(process.argv.slice(2)).options(this.options).argv - : require('optimist')(process.argv.slice(2)).argv; - - if (!argv) { - return; - } - - this.readOnly = false; - Object.keys(argv).forEach(function (key) { - self.set(key, argv[key]); - }); - - this.readOnly = true; - return this.store; -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/stores/env.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/stores/env.js deleted file mode 100644 index cae922b..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/stores/env.js +++ /dev/null @@ -1,54 +0,0 @@ -/* - * env.js: Simple memory-based store for environment variables - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var util = require('util'), - Memory = require('./memory').Memory; - -// -// ### function Env (options) -// #### @options {Object} Options for this instance. -// Constructor function for the Env nconf store, a simple abstraction -// around the Memory store that can read process environment variables. -// -var Env = exports.Env = function (options) { - Memory.call(this, options); - - this.type = 'env'; - this.readOnly = true; - this.options = options || []; -}; - -// Inherit from the Memory store -util.inherits(Env, Memory); - -// -// ### function loadSync () -// Loads the data passed in from `process.env` into this instance. -// -Env.prototype.loadSync = function () { - this.loadEnv(); - return this.store; -}; - -// -// ### function loadEnv () -// Loads the data passed in from `process.env` into this instance. -// -Env.prototype.loadEnv = function () { - var self = this; - - this.readOnly = false; - Object.keys(process.env).filter(function (key) { - return !self.options.length || self.options.indexOf(key) !== -1; - }).forEach(function (key) { - self.set(key, process.env[key]); - }); - - this.readOnly = true; - return this.store; -}; - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/stores/file.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/stores/file.js deleted file mode 100644 index 87449af..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/stores/file.js +++ /dev/null @@ -1,226 +0,0 @@ -/* - * file.js: Simple file storage engine for nconf files - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var fs = require('fs'), - path = require('path'), - util = require('util'), - formats = require('../formats'), - Memory = require('./memory').Memory; - -// -// ### function File (options) -// #### @options {Object} Options for this instance -// Constructor function for the File nconf store, a simple abstraction -// around the Memory store that can persist configuration to disk. -// -var File = exports.File = function (options) { - if (!options || !options.file) { - throw new Error ('Missing required option `files`'); - } - - Memory.call(this, options); - - this.type = 'file'; - this.file = options.file; - this.dir = options.dir || process.cwd(); - this.format = options.format || formats.json; - - if (options.search) { - this.search(this.dir); - } -}; - -// Inherit from the Memory store -util.inherits(File, Memory); - -// -// ### function save (value, callback) -// #### @value {Object} _Ignored_ Left here for consistency -// #### @callback {function} Continuation to respond to when complete. -// Saves the current configuration object to disk at `this.file` -// using the format specified by `this.format`. -// -File.prototype.save = function (value, callback) { - if (!callback) { - callback = value; - value = null; - } - - fs.writeFile(this.file, this.format.stringify(this.store), function (err) { - return err ? callback(err) : callback(); - }); -}; - -// -// ### function saveSync (value, callback) -// #### @value {Object} _Ignored_ Left here for consistency -// #### @callback {function} **Optional** Continuation to respond to when complete. -// Saves the current configuration object to disk at `this.file` -// using the format specified by `this.format` synchronously. -// -File.prototype.saveSync = function (value) { - try { - fs.writeFileSync(this.file, this.format.stringify(this.store)); - } - catch (ex) { - throw(ex); - } - return this.store; -}; - -// -// ### function load (callback) -// #### @callback {function} Continuation to respond to when complete. -// Responds with an Object representing all keys associated in this instance. -// -File.prototype.load = function (callback) { - var self = this; - - path.exists(self.file, function (exists) { - if (!exists) { - return callback(null, {}); - } - - // - // Else, the path exists, read it from disk - // - fs.readFile(self.file, function (err, data) { - if (err) { - return callback(err); - } - - try { - self.store = self.format.parse(data.toString()); - } - catch (ex) { - return callback(new Error("Error parsing your JSON configuration file.")); - } - - callback(null, self.store); - }); - }); -}; - -// -// ### function loadSync (callback) -// Attempts to load the data stored in `this.file` synchronously -// and responds appropriately. -// -File.prototype.loadSync = function () { - var data, self = this; - - if (!path.existsSync(self.file)) { - self.store = {}; - data = {}; - } - else { - // - // Else, the path exists, read it from disk - // - try { - data = this.format.parse(fs.readFileSync(this.file, 'utf8')); - this.store = data; - } - catch (ex) { - throw new Error("Error parsing your JSON configuration file.") - } - } - - return data; -}; - -// -// ### function search (base) -// #### @base {string} Base directory (or file) to begin searching for the target file. -// Attempts to find `this.file` by iteratively searching up the -// directory structure -// -File.prototype.search = function (base) { - var looking = true, - fullpath, - previous, - stats; - - base = base || process.cwd(); - - if (this.file[0] === '/') { - // - // If filename for this instance is a fully qualified path - // (i.e. it starts with a `'/'`) then check if it exists - // - try { - stats = fs.statSync(fs.realpathSync(this.file)); - if (stats.isFile()) { - fullpath = this.file; - looking = false; - } - } - catch (ex) { - // - // Ignore errors - // - } - } - - if (looking && base) { - // - // Attempt to stat the realpath located at `base` - // if the directory does not exist then return false. - // - try { - var stat = fs.statSync(fs.realpathSync(base)); - looking = stat.isDirectory(); - } - catch (ex) { - return false; - } - } - - while (looking) { - // - // Iteratively look up the directory structure from `base` - // - try { - stats = fs.statSync(fs.realpathSync(fullpath = path.join(base, this.file))); - looking = stats.isDirectory(); - } - catch (ex) { - previous = base; - base = path.dirname(base); - - if (previous === base) { - // - // If we've reached the top of the directory structure then simply use - // the default file path. - // - try { - stats = fs.statSync(fs.realpathSync(fullpath = path.join(this.dir, this.file))); - if (stats.isDirectory()) { - fullpath = undefined; - } - } - catch (ex) { - // - // Ignore errors - // - } - - looking = false; - } - } - } - - // - // Set the file for this instance to the fullpath - // that we have found during the search. In the event that - // the search was unsuccessful use the original value for `this.file`. - // - this.file = fullpath || this.file; - - return fullpath; -}; - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/stores/literal.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/stores/literal.js deleted file mode 100644 index 55c64cc..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/stores/literal.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * literal.js: Simple literal Object store for nconf. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var util = require('util'), - Memory = require('./memory').Memory - -var Literal = exports.Literal = function Literal (options) { - Memory.call(this, options); - - options = options || {} - this.type = 'literal'; - this.readOnly = true; - this.store = options.store || options; -}; - -// Inherit from Memory store. -util.inherits(Literal, Memory); - -// -// ### function loadSync (callback) -// Returns the data stored in `this.store` synchronously. -// -Literal.prototype.loadSync = function () { - return this.store; -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/stores/memory.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/stores/memory.js deleted file mode 100644 index 1d25cd3..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/lib/nconf/stores/memory.js +++ /dev/null @@ -1,210 +0,0 @@ -/* - * memory.js: Simple memory storage engine for nconf configuration(s) - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var common = require('../common'); - -// -// ### function Memory (options) -// #### @options {Object} Options for this instance -// Constructor function for the Memory nconf store which maintains -// a nested json structure based on key delimiters `:`. -// -// e.g. `my:nested:key` ==> `{ my: { nested: { key: } } }` -// -var Memory = exports.Memory = function (options) { - options = options || {}; - this.type = 'memory'; - this.store = {}; - this.mtimes = {}; - this.readOnly = false; - this.loadFrom = options.loadFrom || null; - - if (this.loadFrom) { - this.store = common.loadFilesSync(this.loadFrom); - } -}; - -// -// ### function get (key) -// #### @key {string} Key to retrieve for this instance. -// Retrieves the value for the specified key (if any). -// -Memory.prototype.get = function (key) { - var target = this.store, - path = common.path(key); - - // - // Scope into the object to get the appropriate nested context - // - while (path.length > 0) { - key = path.shift(); - if (!(target && key in target)) { - return; - } - - target = target[key]; - if (path.length === 0) { - return target; - } - } -}; - -// -// ### function set (key, value) -// #### @key {string} Key to set in this instance -// #### @value {literal|Object} Value for the specified key -// Sets the `value` for the specified `key` in this instance. -// -Memory.prototype.set = function (key, value) { - if (this.readOnly) { - return false; - } - - var target = this.store, - path = common.path(key); - - // - // Update the `mtime` (modified time) of the key - // - this.mtimes[key] = Date.now(); - - // - // Scope into the object to get the appropriate nested context - // - while (path.length > 1) { - key = path.shift(); - if (!target[key] || typeof target[key] !== 'object') { - target[key] = {}; - } - - target = target[key]; - } - - // Set the specified value in the nested JSON structure - key = path.shift(); - target[key] = value; - return true; -}; - -// -// ### function clear (key) -// #### @key {string} Key to remove from this instance -// Removes the value for the specified `key` from this instance. -// -Memory.prototype.clear = function (key) { - if (this.readOnly) { - return false; - } - - var target = this.store, - path = common.path(key); - - // - // Remove the key from the set of `mtimes` (modified times) - // - delete this.mtimes[key]; - - // - // Scope into the object to get the appropriate nested context - // - while (path.length > 1) { - key = path.shift(); - if (!target[key]) { - return; - } - - target = target[key]; - } - - // Delete the key from the nested JSON structure - key = path.shift(); - delete target[key]; - return true; -}; - -// -// ### function merge (key, value) -// #### @key {string} Key to merge the value into -// #### @value {literal|Object} Value to merge into the key -// Merges the properties in `value` into the existing object value -// at `key`. If the existing value `key` is not an Object, it will be -// completely overwritten. -// -Memory.prototype.merge = function (key, value) { - if (this.readOnly) { - return false; - } - - // - // If the key is not an `Object` or is an `Array`, - // then simply set it. Merging is for Objects. - // - if (typeof value !== 'object' || Array.isArray(value)) { - return this.set(key, value); - } - - var self = this, - target = this.store, - path = common.path(key), - fullKey = key; - - // - // Update the `mtime` (modified time) of the key - // - this.mtimes[key] = Date.now(); - - // - // Scope into the object to get the appropriate nested context - // - while (path.length > 1) { - key = path.shift(); - if (!target[key]) { - target[key] = {}; - } - - target = target[key]; - } - - // Set the specified value in the nested JSON structure - key = path.shift(); - - // - // If the current value at the key target is not an `Object`, - // or is an `Array` then simply override it because the new value - // is an Object. - // - if (typeof target[key] !== 'object' || Array.isArray(target[key])) { - target[key] = value; - return true; - } - - return Object.keys(value).every(function (nested) { - return self.merge(fullKey + ':' + nested, value[nested]); - }); -}; - -// -// ### function reset (callback) -// Clears all keys associated with this instance. -// -Memory.prototype.reset = function () { - if (this.readOnly) { - return false; - } - - this.mtimes = {}; - this.store = {}; - return true; -}; - -// -// ### function loadSync -// Returns the store managed by this instance -// -Memory.prototype.loadSync = function () { - return this.store || {}; -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/.gitmodules b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/.gitmodules deleted file mode 100644 index a9aae98..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/.gitmodules +++ /dev/null @@ -1,9 +0,0 @@ -[submodule "deps/nodeunit"] - path = deps/nodeunit - url = git://github.com/caolan/nodeunit.git -[submodule "deps/UglifyJS"] - path = deps/UglifyJS - url = https://github.com/mishoo/UglifyJS.git -[submodule "deps/nodelint"] - path = deps/nodelint - url = https://github.com/tav/nodelint.git diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/.npmignore b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/.npmignore deleted file mode 100644 index 9bdfc97..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -deps -dist -test -nodelint.cfg \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/LICENSE b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/LICENSE deleted file mode 100644 index b7f9d50..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010 Caolan McMahon - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/Makefile b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/Makefile deleted file mode 100644 index bad647c..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -PACKAGE = asyncjs -NODEJS = $(if $(shell test -f /usr/bin/nodejs && echo "true"),nodejs,node) -CWD := $(shell pwd) -NODEUNIT = $(CWD)/node_modules/nodeunit/bin/nodeunit -UGLIFY = $(CWD)/node_modules/uglify-js/bin/uglifyjs -NODELINT = $(CWD)/node_modules/nodelint/nodelint - -BUILDDIR = dist - -all: clean test build - -build: $(wildcard lib/*.js) - mkdir -p $(BUILDDIR) - $(UGLIFY) lib/async.js > $(BUILDDIR)/async.min.js - -test: - $(NODEUNIT) test - -clean: - rm -rf $(BUILDDIR) - -lint: - $(NODELINT) --config nodelint.cfg lib/async.js - -.PHONY: test build all diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/README.md b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/README.md deleted file mode 100644 index 0cf7fc9..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/README.md +++ /dev/null @@ -1,1022 +0,0 @@ -# Async.js - -Async is a utility module which provides straight-forward, powerful functions -for working with asynchronous JavaScript. Although originally designed for -use with [node.js](http://nodejs.org), it can also be used directly in the -browser. - -Async provides around 20 functions that include the usual 'functional' -suspects (map, reduce, filter, forEach…) as well as some common patterns -for asynchronous control flow (parallel, series, waterfall…). All these -functions assume you follow the node.js convention of providing a single -callback as the last argument of your async function. - - -## Quick Examples - - async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file - }); - - async.filter(['file1','file2','file3'], path.exists, function(results){ - // results now equals an array of the existing files - }); - - async.parallel([ - function(){ ... }, - function(){ ... } - ], callback); - - async.series([ - function(){ ... }, - function(){ ... } - ]); - -There are many more functions available so take a look at the docs below for a -full list. This module aims to be comprehensive, so if you feel anything is -missing please create a GitHub issue for it. - - -## Download - -Releases are available for download from -[GitHub](http://github.com/caolan/async/downloads). -Alternatively, you can install using Node Package Manager (npm): - - npm install async - - -__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 17.5kb Uncompressed - -__Production:__ [async.min.js](https://github.com/caolan/async/raw/master/dist/async.min.js) - 1.7kb Packed and Gzipped - - -## In the Browser - -So far its been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage: - - - - - -## Documentation - -### Collections - -* [forEach](#forEach) -* [map](#map) -* [filter](#filter) -* [reject](#reject) -* [reduce](#reduce) -* [detect](#detect) -* [sortBy](#sortBy) -* [some](#some) -* [every](#every) -* [concat](#concat) - -### Control Flow - -* [series](#series) -* [parallel](#parallel) -* [whilst](#whilst) -* [until](#until) -* [waterfall](#waterfall) -* [queue](#queue) -* [auto](#auto) -* [iterator](#iterator) -* [apply](#apply) -* [nextTick](#nextTick) - -### Utils - -* [memoize](#memoize) -* [unmemoize](#unmemoize) -* [log](#log) -* [dir](#dir) -* [noConflict](#noConflict) - - -## Collections - - -### forEach(arr, iterator, callback) - -Applies an iterator function to each item in an array, in parallel. -The iterator is called with an item from the list and a callback for when it -has finished. If the iterator passes an error to this callback, the main -callback for the forEach function is immediately called with the error. - -Note, that since this function applies the iterator to each item in parallel -there is no guarantee that the iterator functions will complete in order. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(err) - A callback which is called after all the iterator functions - have finished, or an error has occurred. - -__Example__ - - // assuming openFiles is an array of file names and saveFile is a function - // to save the modified contents of that file: - - async.forEach(openFiles, saveFile, function(err){ - // if any of the saves produced an error, err would equal that error - }); - ---------------------------------------- - - -### forEachSeries(arr, iterator, callback) - -The same as forEach only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. This means the iterator functions will complete in order. - - ---------------------------------------- - - -### forEachLimit(arr, limit, iterator, callback) - -The same as forEach only the iterator is applied to batches of items in the -array, in series. The next batch of iterators is only called once the current -one has completed processing. - -__Arguments__ - -* arr - An array to iterate over. -* limit - How many items should be in each batch. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(err) - A callback which is called after all the iterator functions - have finished, or an error has occurred. - -__Example__ - - // Assume documents is an array of JSON objects and requestApi is a - // function that interacts with a rate-limited REST api. - - async.forEachLimit(documents, 20, requestApi, function(err){ - // if any of the saves produced an error, err would equal that error - }); ---------------------------------------- - - -### map(arr, iterator, callback) - -Produces a new array of values by mapping each value in the given array through -the iterator function. The iterator is called with an item from the array and a -callback for when it has finished processing. The callback takes 2 arguments, -an error and the transformed item from the array. If the iterator passes an -error to this callback, the main callback for the map function is immediately -called with the error. - -Note, that since this function applies the iterator to each item in parallel -there is no guarantee that the iterator functions will complete in order, however -the results array will be in the same order as the original array. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed - with an error (which can be null) and a transformed item. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is an array of the - transformed items from the original array. - -__Example__ - - async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file - }); - ---------------------------------------- - - -### mapSeries(arr, iterator, callback) - -The same as map only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. The results array will be in the same order as the original. - - ---------------------------------------- - - -### filter(arr, iterator, callback) - -__Alias:__ select - -Returns a new array of all the values which pass an async truth test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like path.exists. This operation is -performed in parallel, but the results array will be in the same order as the -original. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(results) - A callback which is called after all the iterator - functions have finished. - -__Example__ - - async.filter(['file1','file2','file3'], path.exists, function(results){ - // results now equals an array of the existing files - }); - ---------------------------------------- - - -### filterSeries(arr, iterator, callback) - -__alias:__ selectSeries - -The same as filter only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. The results array will be in the same order as the original. - ---------------------------------------- - - -### reject(arr, iterator, callback) - -The opposite of filter. Removes values that pass an async truth test. - ---------------------------------------- - - -### rejectSeries(arr, iterator, callback) - -The same as filter, only the iterator is applied to each item in the array -in series. - - ---------------------------------------- - - -### reduce(arr, memo, iterator, callback) - -__aliases:__ inject, foldl - -Reduces a list of values into a single value using an async iterator to return -each successive step. Memo is the initial state of the reduction. This -function only operates in series. For performance reasons, it may make sense to -split a call to this function into a parallel map, then use the normal -Array.prototype.reduce on the results. This function is for situations where -each step in the reduction needs to be async, if you can get the data before -reducing it then its probably a good idea to do so. - -__Arguments__ - -* arr - An array to iterate over. -* memo - The initial state of the reduction. -* iterator(memo, item, callback) - A function applied to each item in the - array to produce the next step in the reduction. The iterator is passed a - callback which accepts an optional error as its first argument, and the state - of the reduction as the second. If an error is passed to the callback, the - reduction is stopped and the main callback is immediately called with the - error. -* callback(err, result) - A callback which is called after all the iterator - functions have finished. Result is the reduced value. - -__Example__ - - async.reduce([1,2,3], 0, function(memo, item, callback){ - // pointless async: - process.nextTick(function(){ - callback(null, memo + item) - }); - }, function(err, result){ - // result is now equal to the last value of memo, which is 6 - }); - ---------------------------------------- - - -### reduceRight(arr, memo, iterator, callback) - -__Alias:__ foldr - -Same as reduce, only operates on the items in the array in reverse order. - - ---------------------------------------- - - -### detect(arr, iterator, callback) - -Returns the first value in a list that passes an async truth test. The -iterator is applied in parallel, meaning the first iterator to return true will -fire the detect callback with that result. That means the result might not be -the first item in the original array (in terms of order) that passes the test. - -If order within the original array is important then look at detectSeries. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(result) - A callback which is called as soon as any iterator returns - true, or after all the iterator functions have finished. Result will be - the first item in the array that passes the truth test (iterator) or the - value undefined if none passed. - -__Example__ - - async.detect(['file1','file2','file3'], path.exists, function(result){ - // result now equals the first file in the list that exists - }); - ---------------------------------------- - - -### detectSeries(arr, iterator, callback) - -The same as detect, only the iterator is applied to each item in the array -in series. This means the result is always the first in the original array (in -terms of array order) that passes the truth test. - - ---------------------------------------- - - -### sortBy(arr, iterator, callback) - -Sorts a list by the results of running each value through an async iterator. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed - with an error (which can be null) and a value to use as the sort criteria. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is the items from - the original array sorted by the values returned by the iterator calls. - -__Example__ - - async.sortBy(['file1','file2','file3'], function(file, callback){ - fs.stat(file, function(err, stats){ - callback(err, stats.mtime); - }); - }, function(err, results){ - // results is now the original array of files sorted by - // modified date - }); - - ---------------------------------------- - - -### some(arr, iterator, callback) - -__Alias:__ any - -Returns true if at least one element in the array satisfies an async test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like path.exists. Once any iterator -call returns true, the main callback is immediately called. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(result) - A callback which is called as soon as any iterator returns - true, or after all the iterator functions have finished. Result will be - either true or false depending on the values of the async tests. - -__Example__ - - async.some(['file1','file2','file3'], path.exists, function(result){ - // if result is true then at least one of the files exists - }); - ---------------------------------------- - - -### every(arr, iterator, callback) - -__Alias:__ all - -Returns true if every element in the array satisfies an async test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like path.exists. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(result) - A callback which is called after all the iterator - functions have finished. Result will be either true or false depending on - the values of the async tests. - -__Example__ - - async.every(['file1','file2','file3'], path.exists, function(result){ - // if result is true then every file exists - }); - ---------------------------------------- - - -### concat(arr, iterator, callback) - -Applies an iterator to each item in a list, concatenating the results. Returns the -concatenated list. The iterators are called in parallel, and the results are -concatenated as they return. There is no guarantee that the results array will -be returned in the original order of the arguments passed to the iterator function. - -__Arguments__ - -* arr - An array to iterate over -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed - with an error (which can be null) and an array of results. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is an array containing - the concatenated results of the iterator function. - -__Example__ - - async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){ - // files is now a list of filenames that exist in the 3 directories - }); - ---------------------------------------- - - -### concatSeries(arr, iterator, callback) - -Same as async.concat, but executes in series instead of parallel. - - -## Control Flow - - -### series(tasks, [callback]) - -Run an array of functions in series, each one running once the previous -function has completed. If any functions in the series pass an error to its -callback, no more functions are run and the callback for the series is -immediately called with the value of the error. Once the tasks have completed, -the results are passed to the final callback as an array. - -It is also possible to use an object instead of an array. Each property will be -run as a function and the results will be passed to the final callback as an object -instead of an array. This can be a more readable way of handling results from -async.series. - - -__Arguments__ - -* tasks - An array or object containing functions to run, each function is passed - a callback it must call on completion. -* callback(err, results) - An optional callback to run once all the functions - have completed. This function gets an array of all the arguments passed to - the callbacks used in the array. - -__Example__ - - async.series([ - function(callback){ - // do some stuff ... - callback(null, 'one'); - }, - function(callback){ - // do some more stuff ... - callback(null, 'two'); - }, - ], - // optional callback - function(err, results){ - // results is now equal to ['one', 'two'] - }); - - - // an example using an object instead of an array - async.series({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - }, - }, - function(err, results) { - // results is now equal to: {one: 1, two: 2} - }); - - ---------------------------------------- - - -### parallel(tasks, [callback]) - -Run an array of functions in parallel, without waiting until the previous -function has completed. If any of the functions pass an error to its -callback, the main callback is immediately called with the value of the error. -Once the tasks have completed, the results are passed to the final callback as an -array. - -It is also possible to use an object instead of an array. Each property will be -run as a function and the results will be passed to the final callback as an object -instead of an array. This can be a more readable way of handling results from -async.parallel. - - -__Arguments__ - -* tasks - An array or object containing functions to run, each function is passed a - callback it must call on completion. -* callback(err, results) - An optional callback to run once all the functions - have completed. This function gets an array of all the arguments passed to - the callbacks used in the array. - -__Example__ - - async.parallel([ - function(callback){ - setTimeout(function(){ - callback(null, 'one'); - }, 200); - }, - function(callback){ - setTimeout(function(){ - callback(null, 'two'); - }, 100); - }, - ], - // optional callback - function(err, results){ - // in this case, the results array will equal ['two','one'] - // because the functions were run in parallel and the second - // function had a shorter timeout before calling the callback. - }); - - - // an example using an object instead of an array - async.parallel({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - }, - }, - function(err, results) { - // results is now equals to: {one: 1, two: 2} - }); - - ---------------------------------------- - - -### whilst(test, fn, callback) - -Repeatedly call fn, while test returns true. Calls the callback when stopped, -or an error occurs. - -__Arguments__ - -* test() - synchronous truth test to perform before each execution of fn. -* fn(callback) - A function to call each time the test passes. The function is - passed a callback which must be called once it has completed with an optional - error as the first argument. -* callback(err) - A callback which is called after the test fails and repeated - execution of fn has stopped. - -__Example__ - - var count = 0; - - async.whilst( - function () { return count < 5; }, - function (callback) { - count++; - setTimeout(callback, 1000); - }, - function (err) { - // 5 seconds have passed - } - ); - - ---------------------------------------- - - -### until(test, fn, callback) - -Repeatedly call fn, until test returns true. Calls the callback when stopped, -or an error occurs. - -The inverse of async.whilst. - - ---------------------------------------- - - -### waterfall(tasks, [callback]) - -Runs an array of functions in series, each passing their results to the next in -the array. However, if any of the functions pass an error to the callback, the -next function is not executed and the main callback is immediately called with -the error. - -__Arguments__ - -* tasks - An array of functions to run, each function is passed a callback it - must call on completion. -* callback(err, [results]) - An optional callback to run once all the functions - have completed. This will be passed the results of the last task's callback. - - - -__Example__ - - async.waterfall([ - function(callback){ - callback(null, 'one', 'two'); - }, - function(arg1, arg2, callback){ - callback(null, 'three'); - }, - function(arg1, callback){ - // arg1 now equals 'three' - callback(null, 'done'); - } - ], function (err, result) { - // result now equals 'done' - }); - - ---------------------------------------- - - -### queue(worker, concurrency) - -Creates a queue object with the specified concurrency. Tasks added to the -queue will be processed in parallel (up to the concurrency limit). If all -workers are in progress, the task is queued until one is available. Once -a worker has completed a task, the task's callback is called. - -__Arguments__ - -* worker(task, callback) - An asynchronous function for processing a queued - task. -* concurrency - An integer for determining how many worker functions should be - run in parallel. - -__Queue objects__ - -The queue object returned by this function has the following properties and -methods: - -* length() - a function returning the number of items waiting to be processed. -* concurrency - an integer for determining how many worker functions should be - run in parallel. This property can be changed after a queue is created to - alter the concurrency on-the-fly. -* push(task, [callback]) - add a new task to the queue, the callback is called - once the worker has finished processing the task. - instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list. -* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued -* empty - a callback that is called when the last item from the queue is given to a worker -* drain - a callback that is called when the last item from the queue has returned from the worker - -__Example__ - - // create a queue object with concurrency 2 - - var q = async.queue(function (task, callback) { - console.log('hello ' + task.name); - callback(); - }, 2); - - - // assign a callback - q.drain = function() { - console.log('all items have been processed'); - } - - // add some items to the queue - - q.push({name: 'foo'}, function (err) { - console.log('finished processing foo'); - }); - q.push({name: 'bar'}, function (err) { - console.log('finished processing bar'); - }); - - // add some items to the queue (batch-wise) - - q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) { - console.log('finished processing bar'); - }); - - ---------------------------------------- - - -### auto(tasks, [callback]) - -Determines the best order for running functions based on their requirements. -Each function can optionally depend on other functions being completed first, -and each function is run as soon as its requirements are satisfied. If any of -the functions pass an error to their callback, that function will not complete -(so any other functions depending on it will not run) and the main callback -will be called immediately with the error. Functions also receive an object -containing the results of functions which have completed so far. - -__Arguments__ - -* tasks - An object literal containing named functions or an array of - requirements, with the function itself the last item in the array. The key - used for each function or array is used when specifying requirements. The - syntax is easier to understand by looking at the example. -* callback(err, results) - An optional callback which is called when all the - tasks have been completed. The callback will receive an error as an argument - if any tasks pass an error to their callback. If all tasks complete - successfully, it will receive an object containing their results. - -__Example__ - - async.auto({ - get_data: function(callback){ - // async code to get some data - }, - make_folder: function(callback){ - // async code to create a directory to store a file in - // this is run at the same time as getting the data - }, - write_file: ['get_data', 'make_folder', function(callback){ - // once there is some data and the directory exists, - // write the data to a file in the directory - callback(null, filename); - }], - email_link: ['write_file', function(callback, results){ - // once the file is written let's email a link to it... - // results.write_file contains the filename returned by write_file. - }] - }); - -This is a fairly trivial example, but to do this using the basic parallel and -series functions would look like this: - - async.parallel([ - function(callback){ - // async code to get some data - }, - function(callback){ - // async code to create a directory to store a file in - // this is run at the same time as getting the data - } - ], - function(results){ - async.series([ - function(callback){ - // once there is some data and the directory exists, - // write the data to a file in the directory - }, - email_link: function(callback){ - // once the file is written let's email a link to it... - } - ]); - }); - -For a complicated series of async tasks using the auto function makes adding -new tasks much easier and makes the code more readable. - - ---------------------------------------- - - -### iterator(tasks) - -Creates an iterator function which calls the next function in the array, -returning a continuation to call the next one after that. Its also possible to -'peek' the next iterator by doing iterator.next(). - -This function is used internally by the async module but can be useful when -you want to manually control the flow of functions in series. - -__Arguments__ - -* tasks - An array of functions to run, each function is passed a callback it - must call on completion. - -__Example__ - - var iterator = async.iterator([ - function(){ sys.p('one'); }, - function(){ sys.p('two'); }, - function(){ sys.p('three'); } - ]); - - node> var iterator2 = iterator(); - 'one' - node> var iterator3 = iterator2(); - 'two' - node> iterator3(); - 'three' - node> var nextfn = iterator2.next(); - node> nextfn(); - 'three' - - ---------------------------------------- - - -### apply(function, arguments..) - -Creates a continuation function with some arguments already applied, a useful -shorthand when combined with other control flow functions. Any arguments -passed to the returned function are added to the arguments originally passed -to apply. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to automatically apply when the - continuation is called. - -__Example__ - - // using apply - - async.parallel([ - async.apply(fs.writeFile, 'testfile1', 'test1'), - async.apply(fs.writeFile, 'testfile2', 'test2'), - ]); - - - // the same process without using apply - - async.parallel([ - function(callback){ - fs.writeFile('testfile1', 'test1', callback); - }, - function(callback){ - fs.writeFile('testfile2', 'test2', callback); - }, - ]); - -It's possible to pass any number of additional arguments when calling the -continuation: - - node> var fn = async.apply(sys.puts, 'one'); - node> fn('two', 'three'); - one - two - three - ---------------------------------------- - - -### nextTick(callback) - -Calls the callback on a later loop around the event loop. In node.js this just -calls process.nextTick, in the browser it falls back to setTimeout(callback, 0), -which means other higher priority events may precede the execution of the callback. - -This is used internally for browser-compatibility purposes. - -__Arguments__ - -* callback - The function to call on a later loop around the event loop. - -__Example__ - - var call_order = []; - async.nextTick(function(){ - call_order.push('two'); - // call_order now equals ['one','two] - }); - call_order.push('one') - - -## Utils - - -### memoize(fn, [hasher]) - -Caches the results of an async function. When creating a hash to store function -results against, the callback is omitted from the hash and an optional hash -function can be used. - -__Arguments__ - -* fn - the function you to proxy and cache results from. -* hasher - an optional function for generating a custom hash for storing - results, it has all the arguments applied to it apart from the callback, and - must be synchronous. - -__Example__ - - var slow_fn = function (name, callback) { - // do something - callback(null, result); - }; - var fn = async.memoize(slow_fn); - - // fn can now be used as if it were slow_fn - fn('some name', function () { - // callback - }); - - -### unmemoize(fn) - -Undoes a memoized function, reverting it to the original, unmemoized -form. Comes handy in tests. - -__Arguments__ - -* fn - the memoized function - - -### log(function, arguments) - -Logs the result of an async function to the console. Only works in node.js or -in browsers that support console.log and console.error (such as FF and Chrome). -If multiple arguments are returned from the async function, console.log is -called on each argument in order. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to apply to the function. - -__Example__ - - var hello = function(name, callback){ - setTimeout(function(){ - callback(null, 'hello ' + name); - }, 1000); - }; - - node> async.log(hello, 'world'); - 'hello world' - - ---------------------------------------- - - -### dir(function, arguments) - -Logs the result of an async function to the console using console.dir to -display the properties of the resulting object. Only works in node.js or -in browsers that support console.dir and console.error (such as FF and Chrome). -If multiple arguments are returned from the async function, console.dir is -called on each argument in order. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to apply to the function. - -__Example__ - - var hello = function(name, callback){ - setTimeout(function(){ - callback(null, {hello: name}); - }, 1000); - }; - - node> async.dir(hello, 'world'); - {hello: 'world'} - - ---------------------------------------- - - -### noConflict() - -Changes the value of async back to its original value, returning a reference to the -async object. diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/index.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/index.js deleted file mode 100644 index 8e23845..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// This file is just added for convenience so this repository can be -// directly checked out into a project's deps folder -module.exports = require('./lib/async'); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/lib/async.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/lib/async.js deleted file mode 100644 index 52276d6..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/lib/async.js +++ /dev/null @@ -1,692 +0,0 @@ -/*global setTimeout: false, console: false */ -(function () { - - var async = {}; - - // global on the server, window in the browser - var root = this, - previous_async = root.async; - - if (typeof module !== 'undefined' && module.exports) { - module.exports = async; - } - else { - root.async = async; - } - - async.noConflict = function () { - root.async = previous_async; - return async; - }; - - //// cross-browser compatiblity functions //// - - var _forEach = function (arr, iterator) { - if (arr.forEach) { - return arr.forEach(iterator); - } - for (var i = 0; i < arr.length; i += 1) { - iterator(arr[i], i, arr); - } - }; - - var _map = function (arr, iterator) { - if (arr.map) { - return arr.map(iterator); - } - var results = []; - _forEach(arr, function (x, i, a) { - results.push(iterator(x, i, a)); - }); - return results; - }; - - var _reduce = function (arr, iterator, memo) { - if (arr.reduce) { - return arr.reduce(iterator, memo); - } - _forEach(arr, function (x, i, a) { - memo = iterator(memo, x, i, a); - }); - return memo; - }; - - var _keys = function (obj) { - if (Object.keys) { - return Object.keys(obj); - } - var keys = []; - for (var k in obj) { - if (obj.hasOwnProperty(k)) { - keys.push(k); - } - } - return keys; - }; - - //// exported async module functions //// - - //// nextTick implementation with browser-compatible fallback //// - if (typeof process === 'undefined' || !(process.nextTick)) { - async.nextTick = function (fn) { - setTimeout(fn, 0); - }; - } - else { - async.nextTick = process.nextTick; - } - - async.forEach = function (arr, iterator, callback) { - callback = callback || function () {}; - if (!arr.length) { - return callback(); - } - var completed = 0; - _forEach(arr, function (x) { - iterator(x, function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - if (completed === arr.length) { - callback(); - } - } - }); - }); - }; - - async.forEachSeries = function (arr, iterator, callback) { - callback = callback || function () {}; - if (!arr.length) { - return callback(); - } - var completed = 0; - var iterate = function () { - iterator(arr[completed], function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - if (completed === arr.length) { - callback(); - } - else { - iterate(); - } - } - }); - }; - iterate(); - }; - - async.forEachLimit = function (arr, limit, iterator, callback) { - callback = callback || function () {}; - if (!arr.length || limit <= 0) { - return callback(); - } - var completed = 0; - var started = 0; - var running = 0; - - (function replenish () { - if (completed === arr.length) { - return callback(); - } - - while (running < limit && started < arr.length) { - iterator(arr[started], function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - running -= 1; - if (completed === arr.length) { - callback(); - } - else { - replenish(); - } - } - }); - started += 1; - running += 1; - } - })(); - }; - - - var doParallel = function (fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [async.forEach].concat(args)); - }; - }; - var doSeries = function (fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [async.forEachSeries].concat(args)); - }; - }; - - - var _asyncMap = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (err, v) { - results[x.index] = v; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - }; - async.map = doParallel(_asyncMap); - async.mapSeries = doSeries(_asyncMap); - - - // reduce only has a series version, as doing reduce in parallel won't - // work in many situations. - async.reduce = function (arr, memo, iterator, callback) { - async.forEachSeries(arr, function (x, callback) { - iterator(memo, x, function (err, v) { - memo = v; - callback(err); - }); - }, function (err) { - callback(err, memo); - }); - }; - // inject alias - async.inject = async.reduce; - // foldl alias - async.foldl = async.reduce; - - async.reduceRight = function (arr, memo, iterator, callback) { - var reversed = _map(arr, function (x) { - return x; - }).reverse(); - async.reduce(reversed, memo, iterator, callback); - }; - // foldr alias - async.foldr = async.reduceRight; - - var _filter = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (v) { - if (v) { - results.push(x); - } - callback(); - }); - }, function (err) { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - }; - async.filter = doParallel(_filter); - async.filterSeries = doSeries(_filter); - // select alias - async.select = async.filter; - async.selectSeries = async.filterSeries; - - var _reject = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (v) { - if (!v) { - results.push(x); - } - callback(); - }); - }, function (err) { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - }; - async.reject = doParallel(_reject); - async.rejectSeries = doSeries(_reject); - - var _detect = function (eachfn, arr, iterator, main_callback) { - eachfn(arr, function (x, callback) { - iterator(x, function (result) { - if (result) { - main_callback(x); - main_callback = function () {}; - } - else { - callback(); - } - }); - }, function (err) { - main_callback(); - }); - }; - async.detect = doParallel(_detect); - async.detectSeries = doSeries(_detect); - - async.some = function (arr, iterator, main_callback) { - async.forEach(arr, function (x, callback) { - iterator(x, function (v) { - if (v) { - main_callback(true); - main_callback = function () {}; - } - callback(); - }); - }, function (err) { - main_callback(false); - }); - }; - // any alias - async.any = async.some; - - async.every = function (arr, iterator, main_callback) { - async.forEach(arr, function (x, callback) { - iterator(x, function (v) { - if (!v) { - main_callback(false); - main_callback = function () {}; - } - callback(); - }); - }, function (err) { - main_callback(true); - }); - }; - // all alias - async.all = async.every; - - async.sortBy = function (arr, iterator, callback) { - async.map(arr, function (x, callback) { - iterator(x, function (err, criteria) { - if (err) { - callback(err); - } - else { - callback(null, {value: x, criteria: criteria}); - } - }); - }, function (err, results) { - if (err) { - return callback(err); - } - else { - var fn = function (left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - }; - callback(null, _map(results.sort(fn), function (x) { - return x.value; - })); - } - }); - }; - - async.auto = function (tasks, callback) { - callback = callback || function () {}; - var keys = _keys(tasks); - if (!keys.length) { - return callback(null); - } - - var results = {}; - - var listeners = []; - var addListener = function (fn) { - listeners.unshift(fn); - }; - var removeListener = function (fn) { - for (var i = 0; i < listeners.length; i += 1) { - if (listeners[i] === fn) { - listeners.splice(i, 1); - return; - } - } - }; - var taskComplete = function () { - _forEach(listeners.slice(0), function (fn) { - fn(); - }); - }; - - addListener(function () { - if (_keys(results).length === keys.length) { - callback(null, results); - callback = function () {}; - } - }); - - _forEach(keys, function (k) { - var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k]; - var taskCallback = function (err) { - if (err) { - callback(err); - // stop subsequent errors hitting callback multiple times - callback = function () {}; - } - else { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - taskComplete(); - } - }; - var requires = task.slice(0, Math.abs(task.length - 1)) || []; - var ready = function () { - return _reduce(requires, function (a, x) { - return (a && results.hasOwnProperty(x)); - }, true); - }; - if (ready()) { - task[task.length - 1](taskCallback, results); - } - else { - var listener = function () { - if (ready()) { - removeListener(listener); - task[task.length - 1](taskCallback, results); - } - }; - addListener(listener); - } - }); - }; - - async.waterfall = function (tasks, callback) { - callback = callback || function () {}; - if (!tasks.length) { - return callback(); - } - var wrapIterator = function (iterator) { - return function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - var args = Array.prototype.slice.call(arguments, 1); - var next = iterator.next(); - if (next) { - args.push(wrapIterator(next)); - } - else { - args.push(callback); - } - async.nextTick(function () { - iterator.apply(null, args); - }); - } - }; - }; - wrapIterator(async.iterator(tasks))(); - }; - - async.parallel = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - async.map(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args); - }); - } - }, callback); - } - else { - var results = {}; - async.forEach(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.series = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - async.mapSeries(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args); - }); - } - }, callback); - } - else { - var results = {}; - async.forEachSeries(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.iterator = function (tasks) { - var makeCallback = function (index) { - var fn = function () { - if (tasks.length) { - tasks[index].apply(null, arguments); - } - return fn.next(); - }; - fn.next = function () { - return (index < tasks.length - 1) ? makeCallback(index + 1): null; - }; - return fn; - }; - return makeCallback(0); - }; - - async.apply = function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - return function () { - return fn.apply( - null, args.concat(Array.prototype.slice.call(arguments)) - ); - }; - }; - - var _concat = function (eachfn, arr, fn, callback) { - var r = []; - eachfn(arr, function (x, cb) { - fn(x, function (err, y) { - r = r.concat(y || []); - cb(err); - }); - }, function (err) { - callback(err, r); - }); - }; - async.concat = doParallel(_concat); - async.concatSeries = doSeries(_concat); - - async.whilst = function (test, iterator, callback) { - if (test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.whilst(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.until = function (test, iterator, callback) { - if (!test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.until(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.queue = function (worker, concurrency) { - var workers = 0; - var q = { - tasks: [], - concurrency: concurrency, - saturated: null, - empty: null, - drain: null, - push: function (data, callback) { - if(data.constructor !== Array) { - data = [data]; - } - _forEach(data, function(task) { - q.tasks.push({ - data: task, - callback: typeof callback === 'function' ? callback : null - }); - if (q.saturated && q.tasks.length == concurrency) { - q.saturated(); - } - async.nextTick(q.process); - }); - }, - process: function () { - if (workers < q.concurrency && q.tasks.length) { - var task = q.tasks.shift(); - if(q.empty && q.tasks.length == 0) q.empty(); - workers += 1; - worker(task.data, function () { - workers -= 1; - if (task.callback) { - task.callback.apply(task, arguments); - } - if(q.drain && q.tasks.length + workers == 0) q.drain(); - q.process(); - }); - } - }, - length: function () { - return q.tasks.length; - }, - running: function () { - return workers; - } - }; - return q; - }; - - var _console_fn = function (name) { - return function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - fn.apply(null, args.concat([function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (typeof console !== 'undefined') { - if (err) { - if (console.error) { - console.error(err); - } - } - else if (console[name]) { - _forEach(args, function (x) { - console[name](x); - }); - } - } - }])); - }; - }; - async.log = _console_fn('log'); - async.dir = _console_fn('dir'); - /*async.info = _console_fn('info'); - async.warn = _console_fn('warn'); - async.error = _console_fn('error');*/ - - async.memoize = function (fn, hasher) { - var memo = {}; - var queues = {}; - hasher = hasher || function (x) { - return x; - }; - var memoized = function () { - var args = Array.prototype.slice.call(arguments); - var callback = args.pop(); - var key = hasher.apply(null, args); - if (key in memo) { - callback.apply(null, memo[key]); - } - else if (key in queues) { - queues[key].push(callback); - } - else { - queues[key] = [callback]; - fn.apply(null, args.concat([function () { - memo[key] = arguments; - var q = queues[key]; - delete queues[key]; - for (var i = 0, l = q.length; i < l; i++) { - q[i].apply(null, arguments); - } - }])); - } - }; - memoized.unmemoized = fn; - return memoized; - }; - - async.unmemoize = function (fn) { - return function () { - return (fn.unmemoized || fn).apply(null, arguments); - } - }; - -}()); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/package.json b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/package.json deleted file mode 100644 index bf89264..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/async/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "async", - "description": "Higher-order functions and common patterns for asynchronous code", - "main": "./index", - "author": { - "name": "Caolan McMahon" - }, - "version": "0.1.18", - "repository": { - "type": "git", - "url": "git://github.com/caolan/async.git" - }, - "bugs": { - "url": "http://github.com/caolan/async/issues" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://github.com/caolan/async/raw/master/LICENSE" - } - ], - "devDependencies": { - "nodeunit": ">0.0.0", - "uglify-js": "1.2.x", - "nodelint": ">0.0.0" - }, - "_id": "async@0.1.18", - "dependencies": {}, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "async@0.1.x", - "scripts": {} -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/ini/LICENSE b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/ini/LICENSE deleted file mode 100644 index 05a4010..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/ini/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Copyright 2009, 2010, 2011 Isaac Z. Schlueter. -All rights reserved. - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/ini/README.md b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/ini/README.md deleted file mode 100644 index 9f82a76..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/ini/README.md +++ /dev/null @@ -1,71 +0,0 @@ -An ini format parser and serializer for node. - -Sections are treated as nested objects. Items before the first heading -are saved on the object directly. - -## Usage - -Consider an ini-file `config.ini` that looks like this: - - ; this comment is being ignored - scope = global - - [database] - user = dbuser - password = dbpassword - database = use_this_database - - [paths.default] - datadir = /var/lib/data - -You can read, manipulate and write the ini-file like so: - - var fs = require('fs') - , ini = require('ini') - - var config = ini.parse(fs.readFileSync('./config.ini', 'utf-8')) - - config.scope = 'local' - config.database.database = 'use_another_database' - config.paths.default.tmpdir = '/tmp' - delete config.paths.default.datadir - - fs.writeFileSync('./config_modified.ini', ini.stringify(config, 'section')) - -This will result in a file called `config_modified.ini` being written to the filesystem with the following content: - - [section] - scope = local - [section.database] - user = dbuser - password = dbpassword - database = use_another_database - [section.paths.default] - tmpdir = /tmp - -## API - -### decode(inistring) -Decode the ini-style formatted `inistring` into a nested object. - -### parse(inistring) -Alias for `decode(inistring)` - -### encode(object, [section]) -Encode the object `object` into an ini-style formatted string. If the optional parameter `section` is given, then all top-level properties of the object are put into this section and the `section`-string is prepended to all sub-sections, see the usage example above. - -### stringify(object, [section]) -Alias for `encode(object, [section])` - -### safe(val) -Escapes the string `val` such that it is safe to be used as a key or value in an ini-file. Basically escapes quotes. For example - - ini.safe('"unsafe string"') - -would result in - - "\"unsafe string\"" - -### unsafe(val) -Unescapes the string `val` - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/ini/ini.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/ini/ini.js deleted file mode 100644 index e8a949f..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/ini/ini.js +++ /dev/null @@ -1,102 +0,0 @@ - -exports.parse = exports.decode = decode -exports.stringify = exports.encode = encode - -exports.safe = safe -exports.unsafe = unsafe - -function encode (obj, section) { - var children = [] - , out = "" - - Object.keys(obj).forEach(function (k, _, __) { - var val = obj[k] - if (val && typeof val === "object") { - children.push(k) - } else { - out += safe(k) + " = " + safe(val) + "\n" - } - }) - - if (section && out.length) { - out = "[" + safe(section) + "]" + "\n" + out - } - - children.forEach(function (k, _, __) { - var child = encode(obj[k], (section ? section + "." : "") + k) - if (out.length && child.length) { - out += "\n" - } - out += child - }) - - return out -} - -function decode (str) { - var out = {} - , p = out - , section = null - , state = "START" - // section |key = value - , re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i - , lines = str.split(/[\r\n]+/g) - , section = null - - lines.forEach(function (line, _, __) { - //line = line - var rem = line.indexOf(";") - if (rem !== -1) line = line.substr(0, rem)//.trim() - if (!line) return - var match = line.match(re) - if (!match) return - if (match[1] !== undefined) { - section = unsafe(match[1]) - p = out[section] = out[section] || {} - return - } - var key = unsafe(match[2]) - , value = match[3] ? unsafe((match[4] || "")) : true - p[key] = value - }) - - // {a:{y:1},"a.b":{x:2}} --> {a:{y:1,b:{x:2}}} - // use a filter to return the keys that have to be deleted. - Object.keys(out).filter(function (k, _, __) { - if (!out[k] || typeof out[k] !== "object") return false - // see if the parent section is also an object. - // if so, add it to that, and mark this one for deletion - var parts = k.split(".") - , p = out - , l = parts.pop() - parts.forEach(function (part, _, __) { - if (!p[part] || typeof p[part] !== "object") p[part] = {} - p = p[part] - }) - if (p === out) return false - p[l] = out[k] - return true - }).forEach(function (del, _, __) { - delete out[del] - }) - - return out -} - -function safe (val) { - return ( typeof val !== "string" - || val.match(/[\r\n]/) - || val.match(/^\[/) - || (val.length > 1 - && val.charAt(0) === "\"" - && val.slice(-1) === "\"") - || val !== val.trim() ) ? JSON.stringify(val) : val -} - -function unsafe (val) { - val = (val || "").trim() - if (val.charAt(0) === "\"" && val.slice(-1) === "\"") { - try { val = JSON.parse(val) } catch (_) {} - } - return val -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/ini/package.json b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/ini/package.json deleted file mode 100644 index feed212..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/ini/package.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "name": "ini", - "description": "An ini encoder/decoder for node", - "version": "1.0.2", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/ini.git" - }, - "main": "ini.js", - "scripts": { - "test": "tap test/*.js" - }, - "engines": { - "node": "*" - }, - "dependencies": {}, - "devDependencies": { - "tap": "~0.0.9" - }, - "_id": "ini@1.0.2", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "ini@1.x.x" -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/ini/test/fixtures/foo.ini b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/ini/test/fixtures/foo.ini deleted file mode 100644 index d4ba402..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/ini/test/fixtures/foo.ini +++ /dev/null @@ -1,22 +0,0 @@ -o = p - - a with spaces = b c - -; wrap in quotes to JSON-decode and preserve spaces -" xa n p " = "\"\r\nyoyoyo\r\r\n" - -; wrap in quotes to get a key with a bracket, not a section. -"[disturbing]" = hey you never know - -; a section -[a] -av = a val -e = { o: p, a: { av: a val, b: { c: { e: "this [value]" } } } } -j = "{ o: "p", a: { av: "a val", b: { c: { e: "this [value]" } } } }" -"[]" = a square? - -; nested child without middle parent -; should create otherwise-empty a.b -[a.b.c] -e = 1 -j = 2 diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/ini/test/foo.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/ini/test/foo.js deleted file mode 100644 index 7c8a7a2..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/node_modules/ini/test/foo.js +++ /dev/null @@ -1,50 +0,0 @@ -var i = require("../") - , tap = require("tap") - , test = tap.test - , fs = require("fs") - , path = require("path") - , fixture = path.resolve(__dirname, "./fixtures/foo.ini") - , data = fs.readFileSync(fixture, "utf8") - , d - , expectE = 'o = p\n' - + 'a with spaces = b c\n' - + '" xa n p " = "\\"\\r\\nyoyoyo\\r\\r\\n"\n' - + '"[disturbing]" = hey you never know\n' - + '\n' - + '[a]\n' - + 'av = a val\n' - + 'e = { o: p, a: ' - + '{ av: a val, b: { c: { e: "this [value]" ' - + '} } } }\nj = "\\"{ o: \\"p\\", a: { av:' - + ' \\"a val\\", b: { c: { e: \\"this [value]' - + '\\" } } } }\\""\n"[]" = a square?\n\n[a.b.c]\ne = 1\nj = 2\n' - , expectD = - { o: 'p', - 'a with spaces': 'b c', - " xa n p ":'"\r\nyoyoyo\r\r\n', - '[disturbing]': 'hey you never know', - a: - { av: 'a val', - e: '{ o: p, a: { av: a val, b: { c: { e: "this [value]" } } } }', - j: '"{ o: "p", a: { av: "a val", b: { c: { e: "this [value]" } } } }"', - "[]": "a square?", - b: { c: { e: '1', j: '2' } } } - } - -test("decode from file", function (t) { - var d = i.decode(data) - t.deepEqual(d, expectD) - t.end() -}) - -test("encode from data", function (t) { - var e = i.encode(expectD) - t.deepEqual(e, expectE) - - var obj = {log: { type:'file', level: {label:'debug', value:10} } } - e = i.encode(obj) - t.notEqual(e.slice(0, 1), '\n', 'Never a blank first line') - t.notEqual(e.slice(-2), '\n\n', 'Never a blank final line') - - t.end() -}) diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/package.json b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/package.json deleted file mode 100644 index a1031e2..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "nconf", - "description": "Hierarchical node.js configuration with files, environment variables, command-line arguments, and atomic object merging.", - "version": "0.5.1", - "author": { - "name": "Nodejitsu Inc.", - "email": "info@nodejitsu.com" - }, - "contributors": [ - { - "name": "Charlie Robbins", - "email": "charlie@nodejitsu.com" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/flatiron/nconf.git" - }, - "keywords": [ - "configuration", - "key value store", - "plugabble" - ], - "dependencies": { - "async": "0.1.x", - "ini": "1.x.x", - "optimist": "0.3.x", - "pkginfo": "0.2.x" - }, - "devDependencies": { - "vows": "0.6.x" - }, - "main": "./lib/nconf", - "scripts": { - "test": "vows test/*-test.js test/**/*-test.js --spec" - }, - "engines": { - "node": ">= 0.4.0" - }, - "_id": "nconf@0.5.1", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "nconf@0.5.1" -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/common-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/common-test.js deleted file mode 100644 index 9924372..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/common-test.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * common.js: Tests for common utility function in nconf. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var fs = require('fs'), - path = require('path'), - vows = require('vows'), - assert = require('assert'), - helpers = require('./helpers'), - nconf = require('../lib/nconf'); - -var mergeDir = path.join(__dirname, 'fixtures', 'merge'), - files = fs.readdirSync(mergeDir).map(function (f) { return path.join(mergeDir, f) }); - -vows.describe('nconf/common').addBatch({ - "Using nconf.common module": { - "the loadFiles() method": { - topic: function () { - nconf.loadFiles(files, this.callback); - }, - "should merge the files correctly": helpers.assertMerged - }, - "the loadFilesSync() method": { - "should merge the files correctly": function () { - helpers.assertMerged(null, nconf.loadFilesSync(files)); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/data.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/data.js deleted file mode 100644 index 604dc05..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/data.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * data.js: Simple data fixture for configuration test. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -exports.data = { - literal: 'bazz', - arr: ['one', 2, true, { value: 'foo' }], - obj: { - host: 'localhost', - port: 5984, - array: ['one', 2, true, { foo: 'bar' }], - auth: { - username: 'admin', - password: 'password' - } - } -}; - -exports.merge = { - prop1: 1, - prop2: [1, 2, 3], - prop3: { - foo: 'bar', - bar: 'foo' - } -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/hierarchy/global.json b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/hierarchy/global.json deleted file mode 100644 index 4ac5a6e..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/hierarchy/global.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "title": "My generic title", - "color": "red", - "movie": "Kill Bill" -} \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/hierarchy/hierarchical.json b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/hierarchy/hierarchical.json deleted file mode 100644 index 1385be3..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/hierarchy/hierarchical.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "test": "empty" -} \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/hierarchy/user.json b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/hierarchy/user.json deleted file mode 100644 index 45a3aac..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/hierarchy/user.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "title": "My specific title", - "color": "green" -} \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/malformed.json b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/malformed.json deleted file mode 100644 index fffa155..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/malformed.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "literal": "bazz", -} \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/merge/file1.json b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/merge/file1.json deleted file mode 100644 index 8005a30..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/merge/file1.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "apples": true, - "bananas": true, - "foo": { - "bar": "boo" - }, - "candy": { - "something": "file1", - "something1": true, - "something2": true - } -} \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/merge/file2.json b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/merge/file2.json deleted file mode 100644 index 815779c..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/merge/file2.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "candy": { - "something": "file2", - "something3": true, - "something4": true - }, - "dates": true, - "elderberries": true -} \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/scripts/nconf-argv.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/scripts/nconf-argv.js deleted file mode 100644 index 65de175..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/scripts/nconf-argv.js +++ /dev/null @@ -1,10 +0,0 @@ -/* - * default-argv.js: Test fixture for using optimist defaults with nconf. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var nconf = require('../../../lib/nconf').argv().env(); - -process.stdout.write(nconf.get('something')); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/scripts/nconf-change-argv.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/scripts/nconf-change-argv.js deleted file mode 100644 index 7b2e7a0..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/scripts/nconf-change-argv.js +++ /dev/null @@ -1,16 +0,0 @@ -/* - * nconf-change-argv.js: Test fixture for changing argv on the fly - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var nconf = require('../../../lib/nconf').argv(); - -// -// Remove 'badValue', 'evenWorse' and 'OHNOEZ' -// -process.argv.splice(3, 3); -nconf.stores['argv'].loadArgv(); -process.stdout.write(nconf.get('something')); - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/scripts/nconf-env.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/scripts/nconf-env.js deleted file mode 100644 index e8032de..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/scripts/nconf-env.js +++ /dev/null @@ -1,10 +0,0 @@ -/* - * nconf-env.js: Test fixture for using process.env defaults with nconf. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var nconf = require('../../../lib/nconf').env(); - -process.stdout.write(nconf.get('SOMETHING')); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/scripts/nconf-hierarchical-file-argv.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/scripts/nconf-hierarchical-file-argv.js deleted file mode 100644 index 54e58b0..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/scripts/nconf-hierarchical-file-argv.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - * nconf-hierarchical-file-argv.js: Test fixture for using optimist defaults and a file store with nconf. - * - * (C) 2011, Nodejitsu Inc. - * (C) 2011, Sander Tolsma - * - */ - -var path = require('path'), - nconf = require('../../../lib/nconf'); - -nconf.argv(); -nconf.add('file', { - file: path.join(__dirname, '../hierarchy/hierarchical.json') -}); - -process.stdout.write(nconf.get('something') || 'undefined'); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/scripts/nconf-hierarchical-load-save.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/scripts/nconf-hierarchical-load-save.js deleted file mode 100644 index ae2771e..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/scripts/nconf-hierarchical-load-save.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * nconf-hierarchical-load-save.js: Test fixture for using optimist, envvars and a file store with nconf. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var fs = require('fs'), - path = require('path'), - nconf = require('../../../lib/nconf'); - -// -// Setup nconf to use (in-order): -// 1. Command-line arguments -// 2. Environment variables -// 3. A file located at 'path/to/config.json' -// -nconf.argv() - .env() - .file({ file: path.join(__dirname, '..', 'load-save.json') }); - -// -// Set a few variables on `nconf`. -// -nconf.set('database:host', '127.0.0.1'); -nconf.set('database:port', 5984); - -process.stdout.write(nconf.get('foo')); -// -// Save the configuration object to disk -// -nconf.save(); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/scripts/provider-argv.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/scripts/provider-argv.js deleted file mode 100644 index 0492474..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/scripts/provider-argv.js +++ /dev/null @@ -1,12 +0,0 @@ -/* - * provider-argv.js: Test fixture for using optimist defaults with nconf. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var nconf = require('../../../lib/nconf'); - -var provider = new (nconf.Provider)().argv(); - -process.stdout.write(provider.get('something')); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/scripts/provider-env.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/scripts/provider-env.js deleted file mode 100644 index e5027b4..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/fixtures/scripts/provider-env.js +++ /dev/null @@ -1,12 +0,0 @@ -/* - * provider-argv.js: Test fixture for using process.env defaults with nconf. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var nconf = require('../../../lib/nconf'); - -var provider = new (nconf.Provider)().env(); - -process.stdout.write(provider.get('SOMETHING')); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/helpers.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/helpers.js deleted file mode 100644 index c1ac598..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/helpers.js +++ /dev/null @@ -1,54 +0,0 @@ -/* - * helpers.js: Test helpers for nconf. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var assert = require('assert'), - spawn = require('child_process').spawn, - nconf = require('../lib/nconf'); - -exports.assertMerged = function (err, merged) { - merged = merged instanceof nconf.Provider - ? merged.store.store - : merged; - - assert.isNull(err); - assert.isObject(merged); - assert.isTrue(merged.apples); - assert.isTrue(merged.bananas); - assert.isObject(merged.candy); - assert.isTrue(merged.candy.something1); - assert.isTrue(merged.candy.something2); - assert.isTrue(merged.candy.something3); - assert.isTrue(merged.candy.something4); - assert.isTrue(merged.dates); - assert.isTrue(merged.elderberries); -}; - -exports.assertSystemConf = function (options) { - return { - topic: function () { - var env = null; - - if (options.env) { - env = {} - Object.keys(process.env).forEach(function (key) { - env[key] = process.env[key]; - }); - - Object.keys(options.env).forEach(function (key) { - env[key] = options.env[key]; - }); - } - - var child = spawn('node', [options.script].concat(options.argv), { env: env }); - child.stdout.once('data', this.callback.bind(this, null)); - }, - "should respond with the value passed into the script": function (_, data) { - assert.equal(data.toString(), 'foobar'); - } - } -} - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/hierarchy-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/hierarchy-test.js deleted file mode 100644 index 1ef8b7c..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/hierarchy-test.js +++ /dev/null @@ -1,67 +0,0 @@ -/* - * hierarchy-test.js: Basic tests for hierarchical file stores. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var assert = require('assert'), - fs = require('fs'), - path = require('path'), - spawn = require('child_process').spawn, - vows = require('vows'), - nconf = require('../lib/nconf'); - -var configDir = path.join(__dirname, 'fixtures', 'hierarchy'), - globalConfig = path.join(configDir, 'global.json'), - userConfig = path.join(configDir, 'user.json'); - -vows.describe('nconf/hierarchy').addBatch({ - "When using nconf": { - "configured with two file stores": { - topic: function () { - nconf.add('user', { type: 'file', file: userConfig }) - nconf.add('global', { type: 'file', file: globalConfig }) - nconf.load(); - return nconf; - }, - "should have the appropriate keys present": function () { - assert.equal(nconf.get('title'), 'My specific title'); - assert.equal(nconf.get('color'), 'green'); - assert.equal(nconf.get('movie'), 'Kill Bill'); - } - }, - "configured with .argv(), .env() and .file()": { - topic: function () { - var configFile = path.join(__dirname, 'fixtures', 'load-save.json'), - script = path.join(__dirname, 'fixtures', 'scripts', 'nconf-hierarchical-load-save.js'), - argv = ['--foo', 'foo', '--bar', 'bar'], - that = this, - data = '', - child; - - try { fs.unlinkSync(configFile) } - catch (ex) { } - - child = spawn('node', [script].concat(argv)); - - child.stdout.on('data', function (d) { - data += d; - }); - - child.on('exit', function () { - fs.readFile(configFile, 'utf8', that.callback.bind(null, null, data)); - }); - }, - "should not persist information passed in to process.env and process.argv to disk ": function (_, data, _, ondisk){ - assert.equal(data, 'foo'); - assert.deepEqual(JSON.parse(ondisk), { - database: { - host: '127.0.0.1', - port: 5984 - } - }); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/nconf-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/nconf-test.js deleted file mode 100644 index 677b141..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/nconf-test.js +++ /dev/null @@ -1,114 +0,0 @@ -/* - * file-store-test.js: Tests for the nconf File store. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var fs = require('fs'), - path = require('path'), - vows = require('vows'), - assert = require('assert'), - nconf = require('../lib/nconf'), - data = require('./fixtures/data').data; - -vows.describe('nconf').addBatch({ - "When using the nconf": { - "should have the correct methods set": function () { - assert.isFunction(nconf.key); - assert.isFunction(nconf.path); - assert.isFunction(nconf.use); - assert.isFunction(nconf.get); - assert.isFunction(nconf.set); - assert.isFunction(nconf.clear); - assert.isFunction(nconf.load); - assert.isFunction(nconf.save); - assert.isFunction(nconf.reset); - }, - "the use() method": { - "should instaniate the correct store": function () { - nconf.use('memory'); - nconf.load(); - assert.instanceOf(nconf.stores['memory'], nconf.Memory); - } - }, - "it should": { - topic: function () { - fs.readFile(path.join(__dirname, '..', 'package.json'), this.callback); - }, - "have the correct version set": function (err, data) { - assert.isNull(err); - data = JSON.parse(data.toString()); - assert.equal(nconf.version, data.version); - } - } - } -}).addBatch({ - "When using the nconf": { - "with the memory store": { - "the set() method": { - "should respond with true": function () { - assert.isTrue(nconf.set('foo:bar:bazz', 'buzz')); - } - }, - "the get() method": { - "without a callback": { - "should respond with the correct value": function () { - assert.equal(nconf.get('foo:bar:bazz'), 'buzz'); - } - }, - "with a callback": { - topic: function () { - nconf.get('foo:bar:bazz', this.callback); - }, - "should respond with the correct value": function (err, value) { - assert.equal(value, 'buzz'); - } - } - } - } - } -}).addBatch({ - "When using nconf": { - "with the memory store": { - "the clear() method": { - "should respond with the true": function () { - assert.equal(nconf.get('foo:bar:bazz'), 'buzz'); - assert.isTrue(nconf.clear('foo:bar:bazz')); - assert.isTrue(typeof nconf.get('foo:bar:bazz') === 'undefined'); - } - }, - "the load() method": { - "without a callback": { - "should respond with the merged store": function () { - assert.deepEqual(nconf.load(), { foo: { bar: {} } }); - } - }, - "with a callback": { - topic: function () { - nconf.load(this.callback.bind(null, null)); - }, - "should respond with the merged store": function (ign, err, store) { - assert.isNull(err); - assert.deepEqual(store, { foo: { bar: {} } }); - } - } - }, - "the save() method": { - "without a callback": { - "should throw an exception": function () { - assert.throws(function () { nconf.save() }); - } - }, - "with a callback": { - topic: function () { - nconf.save(this.callback.bind(null, null)); - }, - "should respond with an error": function (ign, err) { - assert.isNotNull(err); - } - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/provider-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/provider-test.js deleted file mode 100644 index 60e2783..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/provider-test.js +++ /dev/null @@ -1,120 +0,0 @@ -/* - * file-store-test.js: Tests for the nconf File store. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var assert = require('assert'), - fs = require('fs'), - path = require('path'), - spawn = require('child_process').spawn, - vows = require('vows'), - helpers = require('./helpers'), - nconf = require('../lib/nconf'); - -var fixturesDir = path.join(__dirname, 'fixtures'), - mergeFixtures = path.join(fixturesDir, 'merge'), - files = [path.join(mergeFixtures, 'file1.json'), path.join(mergeFixtures, 'file2.json')], - override = JSON.parse(fs.readFileSync(files[0]), 'utf8'); - -vows.describe('nconf/provider').addBatch({ - "When using nconf": { - "an instance of 'nconf.Provider'": { - "calling the use() method with the same store type and different options": { - topic: new nconf.Provider().use('file', { file: files[0] }), - "should use a new instance of the store type": function (provider) { - var old = provider.stores['file']; - - assert.equal(provider.stores.file.file, files[0]); - provider.use('file', { file: files[1] }); - - assert.notStrictEqual(old, provider.stores.file); - assert.equal(provider.stores.file.file, files[1]); - } - }, - "when 'argv' is true": helpers.assertSystemConf({ - script: path.join(fixturesDir, 'scripts', 'provider-argv.js'), - argv: ['--something', 'foobar'] - }), - "when 'env' is true": helpers.assertSystemConf({ - script: path.join(fixturesDir, 'scripts', 'provider-env.js'), - env: { SOMETHING: 'foobar' } - }) - }, - "the default nconf provider": { - "when 'argv' is set to true": helpers.assertSystemConf({ - script: path.join(fixturesDir, 'scripts', 'nconf-argv.js'), - argv: ['--something', 'foobar'], - env: { SOMETHING: true } - }), - "when 'env' is set to true": helpers.assertSystemConf({ - script: path.join(fixturesDir, 'scripts', 'nconf-env.js'), - env: { SOMETHING: 'foobar' } - }), - "when 'argv' is set to true and process.argv is modified": helpers.assertSystemConf({ - script: path.join(fixturesDir, 'scripts', 'nconf-change-argv.js'), - argv: ['--something', 'badValue', 'evenWorse', 'OHNOEZ', 'foobar'] - }), - "when hierarchical 'argv' get": helpers.assertSystemConf({ - script: path.join(fixturesDir, 'scripts', 'nconf-hierarchical-file-argv.js'), - argv: ['--something', 'foobar'], - env: { SOMETHING: true } - }) - } - } -}).addBatch({ - "When using nconf": { - "an instance of 'nconf.Provider'": { - "the merge() method": { - topic: new nconf.Provider().use('file', { file: files[1] }), - "should have the result merged in": function (provider) { - provider.load(); - provider.merge(override); - helpers.assertMerged(null, provider.stores.file.store); - assert.equal(provider.stores.file.store.candy.something, 'file1'); - } - } - } - } -}).addBatch({ - "When using nconf": { - "an instance of 'nconf.Provider'": { - "the load() method": { - "when sources are passed in": { - topic: new nconf.Provider({ - sources: { - user: { - type: 'file', - file: files[0] - }, - global: { - type: 'file', - file: files[1] - } - } - }), - "should respect the hierarchy ": function (provider) { - var merged = provider.load(); - - helpers.assertMerged(null, merged); - assert.equal(merged.candy.something, 'file1'); - console.log(provider.sources); - } - }, - "when multiple stores are used": { - topic: new nconf.Provider().overrides({foo: {bar: 'baz'}}) - .add('file1', {type: 'file', file: files[0]}) - .add('file2', {type: 'file', file: files[1]}), - "should respect the hierarchy": function(provider) { - var merged = provider.load(); - - helpers.assertMerged(null, merged); - assert.equal(merged.foo.bar, 'baz'); - assert.equal(merged.candy.something, 'file1'); - } - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/stores/argv-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/stores/argv-test.js deleted file mode 100644 index 9dbf3a9..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/stores/argv-test.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * argv-test.js: Tests for the nconf argv store. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var vows = require('vows'), - assert = require('assert'), - helpers = require('../helpers'), - nconf = require('../../lib/nconf'); - -vows.describe('nconf/stores/argv').addBatch({ - "An instance of nconf.Argv": { - topic: new nconf.Argv(), - "should have the correct methods defined": function (argv) { - assert.isFunction(argv.loadSync); - assert.isFunction(argv.loadArgv); - assert.isFalse(argv.options); - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/stores/env-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/stores/env-test.js deleted file mode 100644 index e96b05f..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/stores/env-test.js +++ /dev/null @@ -1,23 +0,0 @@ -/* - * env-test.js: Tests for the nconf env store. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var vows = require('vows'), - assert = require('assert'), - helpers = require('../helpers'), - nconf = require('../../lib/nconf'); - -vows.describe('nconf/stores/env').addBatch({ - "An instance of nconf.Env": { - topic: new nconf.Env(), - "should have the correct methods defined": function (env) { - assert.isFunction(env.loadSync); - assert.isFunction(env.loadEnv); - assert.isArray(env.options); - assert.lengthOf(env.options, 0); - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/stores/file-store-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/stores/file-store-test.js deleted file mode 100644 index 75ec280..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/stores/file-store-test.js +++ /dev/null @@ -1,175 +0,0 @@ -/* - * file-store-test.js: Tests for the nconf File store. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var fs = require('fs'), - path = require('path'), - vows = require('vows'), - assert = require('assert'), - nconf = require('../../lib/nconf'), - data = require('../fixtures/data').data, - store; - -vows.describe('nconf/stores/file').addBatch({ - "When using the nconf file store": { - "with a valid JSON file": { - topic: function () { - var filePath = path.join(__dirname, '..', 'fixtures', 'store.json'); - fs.writeFileSync(filePath, JSON.stringify(data, null, 2)); - this.store = store = new nconf.File({ file: filePath }); - return null; - }, - "the load() method": { - topic: function () { - this.store.load(this.callback); - }, - "should load the data correctly": function (err, data) { - assert.isNull(err); - assert.deepEqual(data, this.store.store); - } - } - }, - "with a malformed JSON file": { - topic: function () { - var filePath = path.join(__dirname, '..', 'fixtures', 'malformed.json'); - this.store = new nconf.File({ file: filePath }); - return null; - }, - "the load() method with a malformed JSON config file": { - topic: function () { - this.store.load(this.callback.bind(null, null)); - }, - "should respond with an error": function (_, err) { - assert.isTrue(!!err); - } - } - } - } -}).addBatch({ - "When using the nconf file store": { - topic: function () { - var tmpPath = path.join(__dirname, '..', 'fixtures', 'tmp.json'), - tmpStore = new nconf.File({ file: tmpPath }); - return tmpStore; - }, - "the save() method": { - topic: function (tmpStore) { - var that = this; - - Object.keys(data).forEach(function (key) { - tmpStore.set(key, data[key]); - }); - - tmpStore.save(function () { - fs.readFile(tmpStore.file, function (err, d) { - fs.unlinkSync(tmpStore.file); - - return err - ? that.callback(err) - : that.callback(err, JSON.parse(d.toString())); - }); - }); - }, - "should save the data correctly": function (err, read) { - assert.isNull(err); - assert.deepEqual(read, data); - } - } - } -}).addBatch({ - "When using the nconf file store": { - topic: function () { - var tmpPath = path.join(__dirname, '..', 'fixtures', 'tmp.json'), - tmpStore = new nconf.File({ file: tmpPath }); - return tmpStore; - }, - "the saveSync() method": { - topic: function (tmpStore) { - var that = this; - - Object.keys(data).forEach(function (key) { - tmpStore.set(key, data[key]); - }); - - var saved = tmpStore.saveSync(); - - fs.readFile(tmpStore.file, function (err, d) { - fs.unlinkSync(tmpStore.file); - - return err - ? that.callback(err) - : that.callback(err, JSON.parse(d.toString()), saved); - }); - }, - "should save the data correctly": function (err, read, saved) { - assert.isNull(err); - assert.deepEqual(read, data); - assert.deepEqual(read, saved); - } - } - } -}).addBatch({ - "When using the nconf file store": { - "the set() method": { - "should respond with true": function () { - assert.isTrue(store.set('foo:bar:bazz', 'buzz')); - assert.isTrue(store.set('falsy:number', 0)); - assert.isTrue(store.set('falsy:string', '')); - assert.isTrue(store.set('falsy:boolean', false)); - assert.isTrue(store.set('falsy:object', null)); - } - }, - "the get() method": { - "should respond with the correct value": function () { - assert.equal(store.get('foo:bar:bazz'), 'buzz'); - assert.equal(store.get('falsy:number'), 0); - assert.equal(store.get('falsy:string'), ''); - assert.equal(store.get('falsy:boolean'), false); - assert.equal(store.get('falsy:object'), null); - } - }, - "the clear() method": { - "should respond with the true": function () { - assert.equal(store.get('foo:bar:bazz'), 'buzz'); - assert.isTrue(store.clear('foo:bar:bazz')); - assert.isTrue(typeof store.get('foo:bar:bazz') === 'undefined'); - } - } - } -}).addBatch({ - "When using the nconf file store": { - "the search() method": { - "when the target file exists higher in the directory tree": { - topic: function () { - var filePath = this.filePath = path.join(process.env.HOME, '.nconf'); - fs.writeFileSync(filePath, JSON.stringify(data, null, 2)); - return new (nconf.File)({ - file: '.nconf' - }) - }, - "should update the file appropriately": function (store) { - store.search(); - assert.equal(store.file, this.filePath); - fs.unlinkSync(this.filePath); - } - }, - "when the target file doesn't exist higher in the directory tree": { - topic: function () { - var filePath = this.filePath = path.join(__dirname, '..', 'fixtures', 'search-store.json'); - return new (nconf.File)({ - dir: path.dirname(filePath), - file: 'search-store.json' - }) - }, - "should update the file appropriately": function (store) { - store.search(); - assert.equal(store.file, this.filePath); - } - } - } - } -}).export(module); - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/stores/literal-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/stores/literal-test.js deleted file mode 100644 index 368ebe5..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/stores/literal-test.js +++ /dev/null @@ -1,31 +0,0 @@ -/* - * literal-test.js: Tests for the nconf literal store. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var vows = require('vows'), - assert = require('assert'), - helpers = require('../helpers'), - nconf = require('../../lib/nconf'); - -vows.describe('nconf/stores/literal').addBatch({ - "An instance of nconf.Literal": { - topic: new nconf.Literal({ - foo: 'bar', - one: 2 - }), - "should have the correct methods defined": function (literal) { - assert.equal(literal.type, 'literal'); - assert.isFunction(literal.get); - assert.isFunction(literal.set); - assert.isFunction(literal.merge); - assert.isFunction(literal.loadSync); - }, - "should have the correct values in the store": function (literal) { - assert.equal(literal.store.foo, 'bar'); - assert.equal(literal.store.one, 2); - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/stores/memory-store-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/stores/memory-store-test.js deleted file mode 100644 index a64c8d3..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/test/stores/memory-store-test.js +++ /dev/null @@ -1,84 +0,0 @@ -/* - * memory-store-test.js: Tests for the nconf Memory store. - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var vows = require('vows'), - assert = require('assert'), - nconf = require('../../lib/nconf'), - merge = require('../fixtures/data').merge; - -vows.describe('nconf/stores/memory').addBatch({ - "When using the nconf memory store": { - topic: new nconf.Memory(), - "the set() method": { - "should respond with true": function (store) { - assert.isTrue(store.set('foo:bar:bazz', 'buzz')); - assert.isTrue(store.set('falsy:number', 0)); - assert.isTrue(store.set('falsy:string', '')); - assert.isTrue(store.set('falsy:boolean', false)); - assert.isTrue(store.set('falsy:object', null)); - } - }, - "the get() method": { - "should respond with the correct value": function (store) { - assert.equal(store.get('foo:bar:bazz'), 'buzz'); - assert.equal(store.get('falsy:number'), 0); - assert.equal(store.get('falsy:string'), ''); - assert.equal(store.get('falsy:boolean'), false); - assert.equal(store.get('falsy:object'), null); - }, - "should not fail when retrieving non-existent keys": function (store) { - assert.doesNotThrow(function() { - assert.equal(store.get('this:key:does:not:exist'), undefined); - }, TypeError); - }, - "should not fail when drilling into non-objects": function (store) { - assert.doesNotThrow(function() { - assert.equal(store.get('falsy:number:uh:oh'), undefined); - }, TypeError); - } - }, - "the clear() method": { - "should respond with the true": function (store) { - assert.equal(store.get('foo:bar:bazz'), 'buzz'); - assert.isTrue(store.clear('foo:bar:bazz')); - assert.isTrue(typeof store.get('foo:bar:bazz') === 'undefined'); - } - }, - "the merge() method": { - "when overriding an existing literal value": function (store) { - store.set('merge:literal', 'string-value'); - store.merge('merge:literal', merge); - assert.deepEqual(store.get('merge:literal'), merge); - }, - "when overriding an existing Array value": function (store) { - store.set('merge:array', [1,2,3,4]); - store.merge('merge:array', merge); - assert.deepEqual(store.get('merge:literal'), merge); - }, - "when merging into an existing Object value": function (store) { - store.set('merge:object', { - prop1: 2, - prop2: 'prop2', - prop3: { - bazz: 'bazz' - }, - prop4: ['foo', 'bar'] - }); - store.merge('merge:object', merge); - - assert.equal(store.get('merge:object:prop1'), 1); - assert.equal(store.get('merge:object:prop2').length, 3); - assert.deepEqual(store.get('merge:object:prop3'), { - foo: 'bar', - bar: 'foo', - bazz: 'bazz' - }); - assert.equal(store.get('merge:object:prop4').length, 2); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/usage.js b/node_modules/flatiron/node_modules/broadway/node_modules/nconf/usage.js deleted file mode 100644 index b7c30ca..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/nconf/usage.js +++ /dev/null @@ -1,50 +0,0 @@ -var fs = require('fs'), - path = require('path'), - nconf = require('./lib/nconf'); - -// -// Configure the provider with a single store and -// support for command-line arguments and environment -// variables. -// -var single = new nconf.Provider({ - env: true, - argv: true, - store: { - type: 'file', - file: path.join(__dirname, 'config.json') - } -}); - -// -// Configure the provider with multiple hierarchical stores -// representing `user` and `global` configuration values. -// -var multiple = new nconf.Provider({ - stores: [ - { name: 'user', type: 'file', file: path.join(__dirname, 'user-config.json') }, - { name: 'global', type: 'global', file: path.join(__dirname, 'global-config.json') } - ] -}); - -// -// Setup nconf to use the 'file' store and set a couple of values; -// -nconf.use('file', { file: path.join(__dirname, 'config.json') }); -nconf.set('database:host', '127.0.0.1'); -nconf.set('database:port', 5984); - -// -// Get the entire database object from nconf -// -var database = nconf.get('database'); -console.dir(database); - -// -// Save the configuration object to disk -// -nconf.save(function (err) { - fs.readFile(path.join(__dirname, 'config.json'), function (err, data) { - console.dir(JSON.parse(data.toString())) - }); -}); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/.npmignore b/node_modules/flatiron/node_modules/broadway/node_modules/utile/.npmignore deleted file mode 100644 index 5171c54..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -npm-debug.log \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/.travis.yml b/node_modules/flatiron/node_modules/broadway/node_modules/utile/.travis.yml deleted file mode 100644 index 63e4183..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 - -notifications: - email: - - travis@nodejitsu.com - irc: "irc.freenode.org#nodejitsu" - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/LICENSE b/node_modules/flatiron/node_modules/broadway/node_modules/utile/LICENSE deleted file mode 100644 index 56217ca..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010 Nodejitsu Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/README.md b/node_modules/flatiron/node_modules/broadway/node_modules/utile/README.md deleted file mode 100644 index 6f7fd59..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/README.md +++ /dev/null @@ -1,82 +0,0 @@ -# utile [![Build Status](https://secure.travis-ci.org/flatiron/utile.png)](http://travis-ci.org/flatiron/utile) - -A drop-in replacement for `util` with some additional advantageous functions - -## Motivation -Javascript is definitely a "batteries not included language" when compared to languages like Ruby or Python. Node.js has a simple utility library which exposes some basic (but important) functionality: - -``` -$ node -> var util = require('util'); -> util. -(...) - -util.debug util.error util.exec util.inherits util.inspect -util.log util.p util.print util.pump util.puts -``` - -When one considers their own utility library, why ever bother requiring `util` again? That is the approach taken by this module. To compare: - -``` -$ node -> var utile = require('./lib') -> utile. -(...) - -utile.async utile.capitalize utile.clone utile.cpr utile.createPath utile.debug -utile.each utile.error utile.exec utile.file utile.filter utile.find -utile.inherits utile.log utile.mixin utile.mkdirp utile.p utile.path -utile.print utile.pump utile.puts utile.randomString utile.rimraf -``` - -As you can see all of the original methods from `util` are there, but there are several new methods specific to `utile`. A note about implementation: _no node.js native modules are modified by utile, it simply copies those methods._ - -**Remark:** The `util.inspect` method is not exposed in `utile` [until this issue is resolved](https://github.com/joyent/node/issues/2225). - -## Methods -The `utile` modules exposes some simple utility methods: - -* `.each(obj, iterator)`: Iterate over the keys of an object. -* `.mixin(target [source0, source1, ...])`: Copies enumerable properties from `source0 ... sourceN` onto `target` and returns the resulting object. -* `.clone(obj)`: Shallow clones the specified object. -* `.capitalize(str)`: Capitalizes the specified `str`. -* `.randomString(length)`: randomString returns a pseudo-random ASCII string (subset) the return value is a string of length ⌈bits/6⌉ of characters from the base64 alphabet. -* `.filter(obj, test)`: return an object with the properties that `test` returns true on. - -## Packaged Dependencies -In addition to the methods that are built-in, utile includes a number of commonly used dependencies to reduce the number of includes in your package.json. These modules _are not eagerly loaded to be respectful of startup time,_ but instead are lazy-loaded getters on the `utile` object - -* `.async`: [Async utilities for node and the browser][0] -* `.mkdirp`: [Recursively mkdir, like mkdir -p, but in node.js][1] -* `.rimraf`: [A rm -rf util for nodejs][2] -* `.cpr`: [Asynchronous recursive file copying with Node.js][3] - -## Installation - -### Installing npm (node package manager) -``` - curl http://npmjs.org/install.sh | sh -``` - -### Installing utile -``` - [sudo] npm install utile -``` - -## Tests -All tests are written with [vows][4] and should be run with [npm][5]: - -``` bash - $ npm test -``` - -#### Author: [Nodejitsu Inc.](http://www.nodejitsu.com) -#### Contributors: [Charlie Robbins](http://github.com/indexzero), [Dominic Tarr](http://github.com/dominictarr) -#### License: MIT - -[0]: https://github.com/caolan/async -[1]: https://github.com/substack/node-mkdirp -[2]: https://github.com/isaacs/rimraf -[3]: https://github.com/avianflu/ncp -[4]: https://vowsjs.org -[5]: https://npmjs.org diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/lib/base64.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/lib/base64.js deleted file mode 100644 index b238a2d..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/lib/base64.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * base64.js: An extremely simple implementation of base64 encoding / decoding using node.js Buffers - * - * (C) 2010, Nodejitsu Inc. - * - */ - -var base64 = exports; - -// -// ### function encode (unencoded) -// #### @unencoded {string} The string to base64 encode -// Encodes the specified string to base64 using node.js Buffers. -// -base64.encode = function (unencoded) { - var encoded; - - try { - encoded = new Buffer(unencoded || '').toString('base64'); - } - catch (ex) { - return null; - } - - return encoded; -}; - -// -// ### function decode (encoded) -// #### @encoded {string} The string to base64 decode -// Decodes the specified string from base64 using node.js Buffers. -// -base64.decode = function (encoded) { - var decoded; - - try { - decoded = new Buffer(encoded || '', 'base64').toString('utf8'); - } - catch (ex) { - return null; - } - - return decoded; -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/lib/file.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/lib/file.js deleted file mode 100644 index 4641878..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/lib/file.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - * file.js: Simple utilities for working with the file system. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var fs = require('fs'); - -exports.readJson = exports.readJSON = function (file, callback) { - if (typeof callback !== 'function') { - throw new Error('utile.file.readJson needs a callback'); - } - - fs.readFile(file, 'utf-8', function (err, data) { - if (err) { - return callback(err); - } - - try { - var json = JSON.parse(data); - callback(null, json); - } - catch (err) { - return callback(err); - } - }); -}; - -exports.readJsonSync = exports.readJSONSync = function (file) { - return JSON.parse(fs.readFileSync(file, 'utf-8')); -}; diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/lib/index.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/lib/index.js deleted file mode 100644 index 50bfa78..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/lib/index.js +++ /dev/null @@ -1,277 +0,0 @@ -/* - * index.js: Top-level include for the `utile` module. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var fs = require('fs'), - path = require('path'), - util = require('util'); - -var utile = module.exports; - -// -// Extend the `utile` object with all methods from the -// core node `util` methods. -// -// Remark: Somehow copying `util.inspect` makes the `utile` -// object `2`. See: https://github.com/joyent/node/issues/2225 -// -Object.keys(util).forEach(function (key) { - if (key !== 'inspect') { - utile[key] = util[key]; - } -}); - -// -// @async {Object} -// Simple wrapper to `require('async')`. -// -utile.__defineGetter__('async', function () { - return require('async'); -}); - -// -// ### function mkdirp -// Simple wrapper to `require('mkdirp')` -// -utile.__defineGetter__('mkdirp', function () { - return require('mkdirp'); -}); - -// -// ### function rimraf -// Simple wrapper to `require('rimraf')` -// -utile.__defineGetter__('rimraf', function () { - return require('rimraf'); -}); - -// -// ### function cpr -// Simple wrapper to `require('ncp').ncp` -// -utile.__defineGetter__('cpr', function () { - return require('ncp').ncp; -}); - -// -// ### @file {Object} -// Lazy-loaded `file` module -// -utile.__defineGetter__('file', function () { - return require('./file'); -}); - -// -// ### @base64 {Object} -// Lazy-loaded `base64` object -// -utile.__defineGetter__('base64', function () { - return require('./base64'); -}); - -// -// ### function each (obj, iterator) -// #### @obj {Object} Object to iterate over -// #### @iterator {function} Continuation to use on each key. `function (value, key, object)` -// Iterate over the keys of an object. -// -utile.each = function (obj, iterator) { - Object.keys(obj).forEach(function (key) { - iterator(obj[key], key, obj); - }); -}; - -// -// ### function find (o) -// -// -utile.find = function (obj, pred) { - var value, key; - - for (key in obj) { - value = obj[key]; - if (pred(value, key)) { - return value; - } - } -}; - -// -// ### function createPath (obj, path, value) -// ### @obj {Object} Object to insert value into -// ### @path {Array} List of nested keys to insert value at -// Retreives a value from given Object, `obj`, located at the -// nested keys, `path`. -// -utile.path = function (obj, path) { - var key, i; - - for (i in path) { - if (typeof obj === 'undefined') { - return undefined; - } - - key = path[i]; - obj = obj[key]; - } - - return obj; -}; - -// -// ### function createPath (obj, path, value) -// ### @obj {Object} Object to insert value into -// ### @path {Array} List of nested keys to insert value at -// ### @value {*} Value to insert into the object. -// Inserts the `value` into the given Object, `obj`, creating -// any keys in `path` along the way if necessary. -// -utile.createPath = function (obj, path, value) { - var key, i; - - for (i in path) { - key = path[i]; - if (!obj[key]) { - obj[key] = ((+i + 1 === path.length) ? value : {}); - } - - obj = obj[key]; - } -}; - -// -// ### function mixin (target [source0, source1, ...]) -// Copies enumerable properties from `source0 ... sourceN` -// onto `target` and returns the resulting object. -// -utile.mixin = function (target) { - var objs = Array.prototype.slice.call(arguments, 1); - objs.forEach(function (o) { - Object.keys(o).forEach(function (attr) { - var getter = o.__lookupGetter__(attr); - if (!getter) { - target[attr] = o[attr]; - } - else { - target.__defineGetter__(attr, getter); - } - }); - }); - - return target; -}; - -// -// ### function capitalize (str) -// #### @str {string} String to capitalize -// Capitalizes the specified `str`. -// -utile.capitalize = function (str) { - return str && str[0].toUpperCase() + str.slice(1); -}; - -// -// ### function randomString (length) -// #### @length {integer} The number of bits for the random base64 string returned to contain -// randomString returns a pseude-random ASCII string (subset) -// the return value is a string of length ⌈bits/6⌉ of characters -// from the base64 alphabet. -// -utile.randomString = function (length) { - var chars, rand, i, ret, mod, bits; - - chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-'; - ret = ''; - // standard 4 - mod = 4; - // default is 16 - bits = length * mod || 64; - - // in v8, Math.random() yields 32 pseudo-random bits (in spidermonkey it gives 53) - while (bits > 0) { - // 32-bit integer - rand = Math.floor(Math.random() * 0x100000000); - //we use the top bits - for (i = 26; i > 0 && bits > 0; i -= mod, bits -= mod) { - ret += chars[0x3F & rand >>> i]; - } - } - - return ret; -}; - -// -// ### function filter (object, test) -// #### @obj {Object} Object to iterate over -// #### @pred {function} Predicate applied to each property. `function (value, key, object)` -// Returns an object with properties from `obj` which satisfy -// the predicate `pred` -// -utile.filter = function (obj, pred) { - var copy = Array.isArray(obj) ? [] : {}; - utile.each(obj, function (val, key) { - if (pred(val, key, obj)) { - copy[key] = val; - } - }); - - return copy; -}; - -// -// ### function requireDir (directory) -// #### @directory {string} Directory to require -// Requires all files and directories from `directory`, returning an object -// with keys being filenames (without trailing `.js`) and respective values -// being return values of `require(filename)`. -// -utile.requireDir = function (directory) { - var result = {}, - files = fs.readdirSync(directory); - - files.forEach(function (file) { - if (file.substr(-3) == '.js') { - file = file.substr(0, file.length - 3); - } - result[file] = require(path.resolve(directory, file)); - }); - return result; -}; - -// -// ### function requireDirLazy (directory) -// #### @directory {string} Directory to require -// Lazily requires all files and directories from `directory`, returning an -// object with keys being filenames (without trailing `.js`) and respective -// values (getters) being return values of `require(filename)`. -// -utile.requireDirLazy = function (directory) { - var result = {}, - files = fs.readdirSync(directory); - - files.forEach(function (file) { - if (file.substr(-3) == '.js') { - file = file.substr(0, file.length - 3); - } - result.__defineGetter__(file, function () { - return require(path.resolve(directory, file)); - }); - }); - return result; -}; - -// -// ### function clone (object) -// #### @object {Object} Object to clone -// Shallow clones the specified object. -// -utile.clone = function (object) { - return Object.keys(object).reduce(function (obj, k) { - obj[k] = object[k]; - return obj; - }, {}); -}; diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/.bin/ncp b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/.bin/ncp deleted file mode 120000 index 1c02648..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/.bin/ncp +++ /dev/null @@ -1 +0,0 @@ -../ncp/bin/ncp \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/.gitmodules b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/.gitmodules deleted file mode 100644 index a9aae98..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/.gitmodules +++ /dev/null @@ -1,9 +0,0 @@ -[submodule "deps/nodeunit"] - path = deps/nodeunit - url = git://github.com/caolan/nodeunit.git -[submodule "deps/UglifyJS"] - path = deps/UglifyJS - url = https://github.com/mishoo/UglifyJS.git -[submodule "deps/nodelint"] - path = deps/nodelint - url = https://github.com/tav/nodelint.git diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/.npmignore b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/.npmignore deleted file mode 100644 index 9bdfc97..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -deps -dist -test -nodelint.cfg \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/LICENSE b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/LICENSE deleted file mode 100644 index b7f9d50..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010 Caolan McMahon - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/Makefile b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/Makefile deleted file mode 100644 index bad647c..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -PACKAGE = asyncjs -NODEJS = $(if $(shell test -f /usr/bin/nodejs && echo "true"),nodejs,node) -CWD := $(shell pwd) -NODEUNIT = $(CWD)/node_modules/nodeunit/bin/nodeunit -UGLIFY = $(CWD)/node_modules/uglify-js/bin/uglifyjs -NODELINT = $(CWD)/node_modules/nodelint/nodelint - -BUILDDIR = dist - -all: clean test build - -build: $(wildcard lib/*.js) - mkdir -p $(BUILDDIR) - $(UGLIFY) lib/async.js > $(BUILDDIR)/async.min.js - -test: - $(NODEUNIT) test - -clean: - rm -rf $(BUILDDIR) - -lint: - $(NODELINT) --config nodelint.cfg lib/async.js - -.PHONY: test build all diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/README.md b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/README.md deleted file mode 100644 index 0cf7fc9..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/README.md +++ /dev/null @@ -1,1022 +0,0 @@ -# Async.js - -Async is a utility module which provides straight-forward, powerful functions -for working with asynchronous JavaScript. Although originally designed for -use with [node.js](http://nodejs.org), it can also be used directly in the -browser. - -Async provides around 20 functions that include the usual 'functional' -suspects (map, reduce, filter, forEach…) as well as some common patterns -for asynchronous control flow (parallel, series, waterfall…). All these -functions assume you follow the node.js convention of providing a single -callback as the last argument of your async function. - - -## Quick Examples - - async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file - }); - - async.filter(['file1','file2','file3'], path.exists, function(results){ - // results now equals an array of the existing files - }); - - async.parallel([ - function(){ ... }, - function(){ ... } - ], callback); - - async.series([ - function(){ ... }, - function(){ ... } - ]); - -There are many more functions available so take a look at the docs below for a -full list. This module aims to be comprehensive, so if you feel anything is -missing please create a GitHub issue for it. - - -## Download - -Releases are available for download from -[GitHub](http://github.com/caolan/async/downloads). -Alternatively, you can install using Node Package Manager (npm): - - npm install async - - -__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 17.5kb Uncompressed - -__Production:__ [async.min.js](https://github.com/caolan/async/raw/master/dist/async.min.js) - 1.7kb Packed and Gzipped - - -## In the Browser - -So far its been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage: - - - - - -## Documentation - -### Collections - -* [forEach](#forEach) -* [map](#map) -* [filter](#filter) -* [reject](#reject) -* [reduce](#reduce) -* [detect](#detect) -* [sortBy](#sortBy) -* [some](#some) -* [every](#every) -* [concat](#concat) - -### Control Flow - -* [series](#series) -* [parallel](#parallel) -* [whilst](#whilst) -* [until](#until) -* [waterfall](#waterfall) -* [queue](#queue) -* [auto](#auto) -* [iterator](#iterator) -* [apply](#apply) -* [nextTick](#nextTick) - -### Utils - -* [memoize](#memoize) -* [unmemoize](#unmemoize) -* [log](#log) -* [dir](#dir) -* [noConflict](#noConflict) - - -## Collections - - -### forEach(arr, iterator, callback) - -Applies an iterator function to each item in an array, in parallel. -The iterator is called with an item from the list and a callback for when it -has finished. If the iterator passes an error to this callback, the main -callback for the forEach function is immediately called with the error. - -Note, that since this function applies the iterator to each item in parallel -there is no guarantee that the iterator functions will complete in order. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(err) - A callback which is called after all the iterator functions - have finished, or an error has occurred. - -__Example__ - - // assuming openFiles is an array of file names and saveFile is a function - // to save the modified contents of that file: - - async.forEach(openFiles, saveFile, function(err){ - // if any of the saves produced an error, err would equal that error - }); - ---------------------------------------- - - -### forEachSeries(arr, iterator, callback) - -The same as forEach only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. This means the iterator functions will complete in order. - - ---------------------------------------- - - -### forEachLimit(arr, limit, iterator, callback) - -The same as forEach only the iterator is applied to batches of items in the -array, in series. The next batch of iterators is only called once the current -one has completed processing. - -__Arguments__ - -* arr - An array to iterate over. -* limit - How many items should be in each batch. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(err) - A callback which is called after all the iterator functions - have finished, or an error has occurred. - -__Example__ - - // Assume documents is an array of JSON objects and requestApi is a - // function that interacts with a rate-limited REST api. - - async.forEachLimit(documents, 20, requestApi, function(err){ - // if any of the saves produced an error, err would equal that error - }); ---------------------------------------- - - -### map(arr, iterator, callback) - -Produces a new array of values by mapping each value in the given array through -the iterator function. The iterator is called with an item from the array and a -callback for when it has finished processing. The callback takes 2 arguments, -an error and the transformed item from the array. If the iterator passes an -error to this callback, the main callback for the map function is immediately -called with the error. - -Note, that since this function applies the iterator to each item in parallel -there is no guarantee that the iterator functions will complete in order, however -the results array will be in the same order as the original array. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed - with an error (which can be null) and a transformed item. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is an array of the - transformed items from the original array. - -__Example__ - - async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file - }); - ---------------------------------------- - - -### mapSeries(arr, iterator, callback) - -The same as map only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. The results array will be in the same order as the original. - - ---------------------------------------- - - -### filter(arr, iterator, callback) - -__Alias:__ select - -Returns a new array of all the values which pass an async truth test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like path.exists. This operation is -performed in parallel, but the results array will be in the same order as the -original. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(results) - A callback which is called after all the iterator - functions have finished. - -__Example__ - - async.filter(['file1','file2','file3'], path.exists, function(results){ - // results now equals an array of the existing files - }); - ---------------------------------------- - - -### filterSeries(arr, iterator, callback) - -__alias:__ selectSeries - -The same as filter only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. The results array will be in the same order as the original. - ---------------------------------------- - - -### reject(arr, iterator, callback) - -The opposite of filter. Removes values that pass an async truth test. - ---------------------------------------- - - -### rejectSeries(arr, iterator, callback) - -The same as filter, only the iterator is applied to each item in the array -in series. - - ---------------------------------------- - - -### reduce(arr, memo, iterator, callback) - -__aliases:__ inject, foldl - -Reduces a list of values into a single value using an async iterator to return -each successive step. Memo is the initial state of the reduction. This -function only operates in series. For performance reasons, it may make sense to -split a call to this function into a parallel map, then use the normal -Array.prototype.reduce on the results. This function is for situations where -each step in the reduction needs to be async, if you can get the data before -reducing it then its probably a good idea to do so. - -__Arguments__ - -* arr - An array to iterate over. -* memo - The initial state of the reduction. -* iterator(memo, item, callback) - A function applied to each item in the - array to produce the next step in the reduction. The iterator is passed a - callback which accepts an optional error as its first argument, and the state - of the reduction as the second. If an error is passed to the callback, the - reduction is stopped and the main callback is immediately called with the - error. -* callback(err, result) - A callback which is called after all the iterator - functions have finished. Result is the reduced value. - -__Example__ - - async.reduce([1,2,3], 0, function(memo, item, callback){ - // pointless async: - process.nextTick(function(){ - callback(null, memo + item) - }); - }, function(err, result){ - // result is now equal to the last value of memo, which is 6 - }); - ---------------------------------------- - - -### reduceRight(arr, memo, iterator, callback) - -__Alias:__ foldr - -Same as reduce, only operates on the items in the array in reverse order. - - ---------------------------------------- - - -### detect(arr, iterator, callback) - -Returns the first value in a list that passes an async truth test. The -iterator is applied in parallel, meaning the first iterator to return true will -fire the detect callback with that result. That means the result might not be -the first item in the original array (in terms of order) that passes the test. - -If order within the original array is important then look at detectSeries. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(result) - A callback which is called as soon as any iterator returns - true, or after all the iterator functions have finished. Result will be - the first item in the array that passes the truth test (iterator) or the - value undefined if none passed. - -__Example__ - - async.detect(['file1','file2','file3'], path.exists, function(result){ - // result now equals the first file in the list that exists - }); - ---------------------------------------- - - -### detectSeries(arr, iterator, callback) - -The same as detect, only the iterator is applied to each item in the array -in series. This means the result is always the first in the original array (in -terms of array order) that passes the truth test. - - ---------------------------------------- - - -### sortBy(arr, iterator, callback) - -Sorts a list by the results of running each value through an async iterator. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed - with an error (which can be null) and a value to use as the sort criteria. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is the items from - the original array sorted by the values returned by the iterator calls. - -__Example__ - - async.sortBy(['file1','file2','file3'], function(file, callback){ - fs.stat(file, function(err, stats){ - callback(err, stats.mtime); - }); - }, function(err, results){ - // results is now the original array of files sorted by - // modified date - }); - - ---------------------------------------- - - -### some(arr, iterator, callback) - -__Alias:__ any - -Returns true if at least one element in the array satisfies an async test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like path.exists. Once any iterator -call returns true, the main callback is immediately called. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(result) - A callback which is called as soon as any iterator returns - true, or after all the iterator functions have finished. Result will be - either true or false depending on the values of the async tests. - -__Example__ - - async.some(['file1','file2','file3'], path.exists, function(result){ - // if result is true then at least one of the files exists - }); - ---------------------------------------- - - -### every(arr, iterator, callback) - -__Alias:__ all - -Returns true if every element in the array satisfies an async test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like path.exists. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(result) - A callback which is called after all the iterator - functions have finished. Result will be either true or false depending on - the values of the async tests. - -__Example__ - - async.every(['file1','file2','file3'], path.exists, function(result){ - // if result is true then every file exists - }); - ---------------------------------------- - - -### concat(arr, iterator, callback) - -Applies an iterator to each item in a list, concatenating the results. Returns the -concatenated list. The iterators are called in parallel, and the results are -concatenated as they return. There is no guarantee that the results array will -be returned in the original order of the arguments passed to the iterator function. - -__Arguments__ - -* arr - An array to iterate over -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed - with an error (which can be null) and an array of results. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is an array containing - the concatenated results of the iterator function. - -__Example__ - - async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){ - // files is now a list of filenames that exist in the 3 directories - }); - ---------------------------------------- - - -### concatSeries(arr, iterator, callback) - -Same as async.concat, but executes in series instead of parallel. - - -## Control Flow - - -### series(tasks, [callback]) - -Run an array of functions in series, each one running once the previous -function has completed. If any functions in the series pass an error to its -callback, no more functions are run and the callback for the series is -immediately called with the value of the error. Once the tasks have completed, -the results are passed to the final callback as an array. - -It is also possible to use an object instead of an array. Each property will be -run as a function and the results will be passed to the final callback as an object -instead of an array. This can be a more readable way of handling results from -async.series. - - -__Arguments__ - -* tasks - An array or object containing functions to run, each function is passed - a callback it must call on completion. -* callback(err, results) - An optional callback to run once all the functions - have completed. This function gets an array of all the arguments passed to - the callbacks used in the array. - -__Example__ - - async.series([ - function(callback){ - // do some stuff ... - callback(null, 'one'); - }, - function(callback){ - // do some more stuff ... - callback(null, 'two'); - }, - ], - // optional callback - function(err, results){ - // results is now equal to ['one', 'two'] - }); - - - // an example using an object instead of an array - async.series({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - }, - }, - function(err, results) { - // results is now equal to: {one: 1, two: 2} - }); - - ---------------------------------------- - - -### parallel(tasks, [callback]) - -Run an array of functions in parallel, without waiting until the previous -function has completed. If any of the functions pass an error to its -callback, the main callback is immediately called with the value of the error. -Once the tasks have completed, the results are passed to the final callback as an -array. - -It is also possible to use an object instead of an array. Each property will be -run as a function and the results will be passed to the final callback as an object -instead of an array. This can be a more readable way of handling results from -async.parallel. - - -__Arguments__ - -* tasks - An array or object containing functions to run, each function is passed a - callback it must call on completion. -* callback(err, results) - An optional callback to run once all the functions - have completed. This function gets an array of all the arguments passed to - the callbacks used in the array. - -__Example__ - - async.parallel([ - function(callback){ - setTimeout(function(){ - callback(null, 'one'); - }, 200); - }, - function(callback){ - setTimeout(function(){ - callback(null, 'two'); - }, 100); - }, - ], - // optional callback - function(err, results){ - // in this case, the results array will equal ['two','one'] - // because the functions were run in parallel and the second - // function had a shorter timeout before calling the callback. - }); - - - // an example using an object instead of an array - async.parallel({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - }, - }, - function(err, results) { - // results is now equals to: {one: 1, two: 2} - }); - - ---------------------------------------- - - -### whilst(test, fn, callback) - -Repeatedly call fn, while test returns true. Calls the callback when stopped, -or an error occurs. - -__Arguments__ - -* test() - synchronous truth test to perform before each execution of fn. -* fn(callback) - A function to call each time the test passes. The function is - passed a callback which must be called once it has completed with an optional - error as the first argument. -* callback(err) - A callback which is called after the test fails and repeated - execution of fn has stopped. - -__Example__ - - var count = 0; - - async.whilst( - function () { return count < 5; }, - function (callback) { - count++; - setTimeout(callback, 1000); - }, - function (err) { - // 5 seconds have passed - } - ); - - ---------------------------------------- - - -### until(test, fn, callback) - -Repeatedly call fn, until test returns true. Calls the callback when stopped, -or an error occurs. - -The inverse of async.whilst. - - ---------------------------------------- - - -### waterfall(tasks, [callback]) - -Runs an array of functions in series, each passing their results to the next in -the array. However, if any of the functions pass an error to the callback, the -next function is not executed and the main callback is immediately called with -the error. - -__Arguments__ - -* tasks - An array of functions to run, each function is passed a callback it - must call on completion. -* callback(err, [results]) - An optional callback to run once all the functions - have completed. This will be passed the results of the last task's callback. - - - -__Example__ - - async.waterfall([ - function(callback){ - callback(null, 'one', 'two'); - }, - function(arg1, arg2, callback){ - callback(null, 'three'); - }, - function(arg1, callback){ - // arg1 now equals 'three' - callback(null, 'done'); - } - ], function (err, result) { - // result now equals 'done' - }); - - ---------------------------------------- - - -### queue(worker, concurrency) - -Creates a queue object with the specified concurrency. Tasks added to the -queue will be processed in parallel (up to the concurrency limit). If all -workers are in progress, the task is queued until one is available. Once -a worker has completed a task, the task's callback is called. - -__Arguments__ - -* worker(task, callback) - An asynchronous function for processing a queued - task. -* concurrency - An integer for determining how many worker functions should be - run in parallel. - -__Queue objects__ - -The queue object returned by this function has the following properties and -methods: - -* length() - a function returning the number of items waiting to be processed. -* concurrency - an integer for determining how many worker functions should be - run in parallel. This property can be changed after a queue is created to - alter the concurrency on-the-fly. -* push(task, [callback]) - add a new task to the queue, the callback is called - once the worker has finished processing the task. - instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list. -* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued -* empty - a callback that is called when the last item from the queue is given to a worker -* drain - a callback that is called when the last item from the queue has returned from the worker - -__Example__ - - // create a queue object with concurrency 2 - - var q = async.queue(function (task, callback) { - console.log('hello ' + task.name); - callback(); - }, 2); - - - // assign a callback - q.drain = function() { - console.log('all items have been processed'); - } - - // add some items to the queue - - q.push({name: 'foo'}, function (err) { - console.log('finished processing foo'); - }); - q.push({name: 'bar'}, function (err) { - console.log('finished processing bar'); - }); - - // add some items to the queue (batch-wise) - - q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) { - console.log('finished processing bar'); - }); - - ---------------------------------------- - - -### auto(tasks, [callback]) - -Determines the best order for running functions based on their requirements. -Each function can optionally depend on other functions being completed first, -and each function is run as soon as its requirements are satisfied. If any of -the functions pass an error to their callback, that function will not complete -(so any other functions depending on it will not run) and the main callback -will be called immediately with the error. Functions also receive an object -containing the results of functions which have completed so far. - -__Arguments__ - -* tasks - An object literal containing named functions or an array of - requirements, with the function itself the last item in the array. The key - used for each function or array is used when specifying requirements. The - syntax is easier to understand by looking at the example. -* callback(err, results) - An optional callback which is called when all the - tasks have been completed. The callback will receive an error as an argument - if any tasks pass an error to their callback. If all tasks complete - successfully, it will receive an object containing their results. - -__Example__ - - async.auto({ - get_data: function(callback){ - // async code to get some data - }, - make_folder: function(callback){ - // async code to create a directory to store a file in - // this is run at the same time as getting the data - }, - write_file: ['get_data', 'make_folder', function(callback){ - // once there is some data and the directory exists, - // write the data to a file in the directory - callback(null, filename); - }], - email_link: ['write_file', function(callback, results){ - // once the file is written let's email a link to it... - // results.write_file contains the filename returned by write_file. - }] - }); - -This is a fairly trivial example, but to do this using the basic parallel and -series functions would look like this: - - async.parallel([ - function(callback){ - // async code to get some data - }, - function(callback){ - // async code to create a directory to store a file in - // this is run at the same time as getting the data - } - ], - function(results){ - async.series([ - function(callback){ - // once there is some data and the directory exists, - // write the data to a file in the directory - }, - email_link: function(callback){ - // once the file is written let's email a link to it... - } - ]); - }); - -For a complicated series of async tasks using the auto function makes adding -new tasks much easier and makes the code more readable. - - ---------------------------------------- - - -### iterator(tasks) - -Creates an iterator function which calls the next function in the array, -returning a continuation to call the next one after that. Its also possible to -'peek' the next iterator by doing iterator.next(). - -This function is used internally by the async module but can be useful when -you want to manually control the flow of functions in series. - -__Arguments__ - -* tasks - An array of functions to run, each function is passed a callback it - must call on completion. - -__Example__ - - var iterator = async.iterator([ - function(){ sys.p('one'); }, - function(){ sys.p('two'); }, - function(){ sys.p('three'); } - ]); - - node> var iterator2 = iterator(); - 'one' - node> var iterator3 = iterator2(); - 'two' - node> iterator3(); - 'three' - node> var nextfn = iterator2.next(); - node> nextfn(); - 'three' - - ---------------------------------------- - - -### apply(function, arguments..) - -Creates a continuation function with some arguments already applied, a useful -shorthand when combined with other control flow functions. Any arguments -passed to the returned function are added to the arguments originally passed -to apply. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to automatically apply when the - continuation is called. - -__Example__ - - // using apply - - async.parallel([ - async.apply(fs.writeFile, 'testfile1', 'test1'), - async.apply(fs.writeFile, 'testfile2', 'test2'), - ]); - - - // the same process without using apply - - async.parallel([ - function(callback){ - fs.writeFile('testfile1', 'test1', callback); - }, - function(callback){ - fs.writeFile('testfile2', 'test2', callback); - }, - ]); - -It's possible to pass any number of additional arguments when calling the -continuation: - - node> var fn = async.apply(sys.puts, 'one'); - node> fn('two', 'three'); - one - two - three - ---------------------------------------- - - -### nextTick(callback) - -Calls the callback on a later loop around the event loop. In node.js this just -calls process.nextTick, in the browser it falls back to setTimeout(callback, 0), -which means other higher priority events may precede the execution of the callback. - -This is used internally for browser-compatibility purposes. - -__Arguments__ - -* callback - The function to call on a later loop around the event loop. - -__Example__ - - var call_order = []; - async.nextTick(function(){ - call_order.push('two'); - // call_order now equals ['one','two] - }); - call_order.push('one') - - -## Utils - - -### memoize(fn, [hasher]) - -Caches the results of an async function. When creating a hash to store function -results against, the callback is omitted from the hash and an optional hash -function can be used. - -__Arguments__ - -* fn - the function you to proxy and cache results from. -* hasher - an optional function for generating a custom hash for storing - results, it has all the arguments applied to it apart from the callback, and - must be synchronous. - -__Example__ - - var slow_fn = function (name, callback) { - // do something - callback(null, result); - }; - var fn = async.memoize(slow_fn); - - // fn can now be used as if it were slow_fn - fn('some name', function () { - // callback - }); - - -### unmemoize(fn) - -Undoes a memoized function, reverting it to the original, unmemoized -form. Comes handy in tests. - -__Arguments__ - -* fn - the memoized function - - -### log(function, arguments) - -Logs the result of an async function to the console. Only works in node.js or -in browsers that support console.log and console.error (such as FF and Chrome). -If multiple arguments are returned from the async function, console.log is -called on each argument in order. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to apply to the function. - -__Example__ - - var hello = function(name, callback){ - setTimeout(function(){ - callback(null, 'hello ' + name); - }, 1000); - }; - - node> async.log(hello, 'world'); - 'hello world' - - ---------------------------------------- - - -### dir(function, arguments) - -Logs the result of an async function to the console using console.dir to -display the properties of the resulting object. Only works in node.js or -in browsers that support console.dir and console.error (such as FF and Chrome). -If multiple arguments are returned from the async function, console.dir is -called on each argument in order. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to apply to the function. - -__Example__ - - var hello = function(name, callback){ - setTimeout(function(){ - callback(null, {hello: name}); - }, 1000); - }; - - node> async.dir(hello, 'world'); - {hello: 'world'} - - ---------------------------------------- - - -### noConflict() - -Changes the value of async back to its original value, returning a reference to the -async object. diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/index.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/index.js deleted file mode 100644 index 8e23845..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// This file is just added for convenience so this repository can be -// directly checked out into a project's deps folder -module.exports = require('./lib/async'); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/lib/async.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/lib/async.js deleted file mode 100644 index 52276d6..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/lib/async.js +++ /dev/null @@ -1,692 +0,0 @@ -/*global setTimeout: false, console: false */ -(function () { - - var async = {}; - - // global on the server, window in the browser - var root = this, - previous_async = root.async; - - if (typeof module !== 'undefined' && module.exports) { - module.exports = async; - } - else { - root.async = async; - } - - async.noConflict = function () { - root.async = previous_async; - return async; - }; - - //// cross-browser compatiblity functions //// - - var _forEach = function (arr, iterator) { - if (arr.forEach) { - return arr.forEach(iterator); - } - for (var i = 0; i < arr.length; i += 1) { - iterator(arr[i], i, arr); - } - }; - - var _map = function (arr, iterator) { - if (arr.map) { - return arr.map(iterator); - } - var results = []; - _forEach(arr, function (x, i, a) { - results.push(iterator(x, i, a)); - }); - return results; - }; - - var _reduce = function (arr, iterator, memo) { - if (arr.reduce) { - return arr.reduce(iterator, memo); - } - _forEach(arr, function (x, i, a) { - memo = iterator(memo, x, i, a); - }); - return memo; - }; - - var _keys = function (obj) { - if (Object.keys) { - return Object.keys(obj); - } - var keys = []; - for (var k in obj) { - if (obj.hasOwnProperty(k)) { - keys.push(k); - } - } - return keys; - }; - - //// exported async module functions //// - - //// nextTick implementation with browser-compatible fallback //// - if (typeof process === 'undefined' || !(process.nextTick)) { - async.nextTick = function (fn) { - setTimeout(fn, 0); - }; - } - else { - async.nextTick = process.nextTick; - } - - async.forEach = function (arr, iterator, callback) { - callback = callback || function () {}; - if (!arr.length) { - return callback(); - } - var completed = 0; - _forEach(arr, function (x) { - iterator(x, function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - if (completed === arr.length) { - callback(); - } - } - }); - }); - }; - - async.forEachSeries = function (arr, iterator, callback) { - callback = callback || function () {}; - if (!arr.length) { - return callback(); - } - var completed = 0; - var iterate = function () { - iterator(arr[completed], function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - if (completed === arr.length) { - callback(); - } - else { - iterate(); - } - } - }); - }; - iterate(); - }; - - async.forEachLimit = function (arr, limit, iterator, callback) { - callback = callback || function () {}; - if (!arr.length || limit <= 0) { - return callback(); - } - var completed = 0; - var started = 0; - var running = 0; - - (function replenish () { - if (completed === arr.length) { - return callback(); - } - - while (running < limit && started < arr.length) { - iterator(arr[started], function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - running -= 1; - if (completed === arr.length) { - callback(); - } - else { - replenish(); - } - } - }); - started += 1; - running += 1; - } - })(); - }; - - - var doParallel = function (fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [async.forEach].concat(args)); - }; - }; - var doSeries = function (fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [async.forEachSeries].concat(args)); - }; - }; - - - var _asyncMap = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (err, v) { - results[x.index] = v; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - }; - async.map = doParallel(_asyncMap); - async.mapSeries = doSeries(_asyncMap); - - - // reduce only has a series version, as doing reduce in parallel won't - // work in many situations. - async.reduce = function (arr, memo, iterator, callback) { - async.forEachSeries(arr, function (x, callback) { - iterator(memo, x, function (err, v) { - memo = v; - callback(err); - }); - }, function (err) { - callback(err, memo); - }); - }; - // inject alias - async.inject = async.reduce; - // foldl alias - async.foldl = async.reduce; - - async.reduceRight = function (arr, memo, iterator, callback) { - var reversed = _map(arr, function (x) { - return x; - }).reverse(); - async.reduce(reversed, memo, iterator, callback); - }; - // foldr alias - async.foldr = async.reduceRight; - - var _filter = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (v) { - if (v) { - results.push(x); - } - callback(); - }); - }, function (err) { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - }; - async.filter = doParallel(_filter); - async.filterSeries = doSeries(_filter); - // select alias - async.select = async.filter; - async.selectSeries = async.filterSeries; - - var _reject = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (v) { - if (!v) { - results.push(x); - } - callback(); - }); - }, function (err) { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - }; - async.reject = doParallel(_reject); - async.rejectSeries = doSeries(_reject); - - var _detect = function (eachfn, arr, iterator, main_callback) { - eachfn(arr, function (x, callback) { - iterator(x, function (result) { - if (result) { - main_callback(x); - main_callback = function () {}; - } - else { - callback(); - } - }); - }, function (err) { - main_callback(); - }); - }; - async.detect = doParallel(_detect); - async.detectSeries = doSeries(_detect); - - async.some = function (arr, iterator, main_callback) { - async.forEach(arr, function (x, callback) { - iterator(x, function (v) { - if (v) { - main_callback(true); - main_callback = function () {}; - } - callback(); - }); - }, function (err) { - main_callback(false); - }); - }; - // any alias - async.any = async.some; - - async.every = function (arr, iterator, main_callback) { - async.forEach(arr, function (x, callback) { - iterator(x, function (v) { - if (!v) { - main_callback(false); - main_callback = function () {}; - } - callback(); - }); - }, function (err) { - main_callback(true); - }); - }; - // all alias - async.all = async.every; - - async.sortBy = function (arr, iterator, callback) { - async.map(arr, function (x, callback) { - iterator(x, function (err, criteria) { - if (err) { - callback(err); - } - else { - callback(null, {value: x, criteria: criteria}); - } - }); - }, function (err, results) { - if (err) { - return callback(err); - } - else { - var fn = function (left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - }; - callback(null, _map(results.sort(fn), function (x) { - return x.value; - })); - } - }); - }; - - async.auto = function (tasks, callback) { - callback = callback || function () {}; - var keys = _keys(tasks); - if (!keys.length) { - return callback(null); - } - - var results = {}; - - var listeners = []; - var addListener = function (fn) { - listeners.unshift(fn); - }; - var removeListener = function (fn) { - for (var i = 0; i < listeners.length; i += 1) { - if (listeners[i] === fn) { - listeners.splice(i, 1); - return; - } - } - }; - var taskComplete = function () { - _forEach(listeners.slice(0), function (fn) { - fn(); - }); - }; - - addListener(function () { - if (_keys(results).length === keys.length) { - callback(null, results); - callback = function () {}; - } - }); - - _forEach(keys, function (k) { - var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k]; - var taskCallback = function (err) { - if (err) { - callback(err); - // stop subsequent errors hitting callback multiple times - callback = function () {}; - } - else { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - taskComplete(); - } - }; - var requires = task.slice(0, Math.abs(task.length - 1)) || []; - var ready = function () { - return _reduce(requires, function (a, x) { - return (a && results.hasOwnProperty(x)); - }, true); - }; - if (ready()) { - task[task.length - 1](taskCallback, results); - } - else { - var listener = function () { - if (ready()) { - removeListener(listener); - task[task.length - 1](taskCallback, results); - } - }; - addListener(listener); - } - }); - }; - - async.waterfall = function (tasks, callback) { - callback = callback || function () {}; - if (!tasks.length) { - return callback(); - } - var wrapIterator = function (iterator) { - return function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - var args = Array.prototype.slice.call(arguments, 1); - var next = iterator.next(); - if (next) { - args.push(wrapIterator(next)); - } - else { - args.push(callback); - } - async.nextTick(function () { - iterator.apply(null, args); - }); - } - }; - }; - wrapIterator(async.iterator(tasks))(); - }; - - async.parallel = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - async.map(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args); - }); - } - }, callback); - } - else { - var results = {}; - async.forEach(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.series = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - async.mapSeries(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args); - }); - } - }, callback); - } - else { - var results = {}; - async.forEachSeries(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.iterator = function (tasks) { - var makeCallback = function (index) { - var fn = function () { - if (tasks.length) { - tasks[index].apply(null, arguments); - } - return fn.next(); - }; - fn.next = function () { - return (index < tasks.length - 1) ? makeCallback(index + 1): null; - }; - return fn; - }; - return makeCallback(0); - }; - - async.apply = function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - return function () { - return fn.apply( - null, args.concat(Array.prototype.slice.call(arguments)) - ); - }; - }; - - var _concat = function (eachfn, arr, fn, callback) { - var r = []; - eachfn(arr, function (x, cb) { - fn(x, function (err, y) { - r = r.concat(y || []); - cb(err); - }); - }, function (err) { - callback(err, r); - }); - }; - async.concat = doParallel(_concat); - async.concatSeries = doSeries(_concat); - - async.whilst = function (test, iterator, callback) { - if (test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.whilst(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.until = function (test, iterator, callback) { - if (!test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.until(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.queue = function (worker, concurrency) { - var workers = 0; - var q = { - tasks: [], - concurrency: concurrency, - saturated: null, - empty: null, - drain: null, - push: function (data, callback) { - if(data.constructor !== Array) { - data = [data]; - } - _forEach(data, function(task) { - q.tasks.push({ - data: task, - callback: typeof callback === 'function' ? callback : null - }); - if (q.saturated && q.tasks.length == concurrency) { - q.saturated(); - } - async.nextTick(q.process); - }); - }, - process: function () { - if (workers < q.concurrency && q.tasks.length) { - var task = q.tasks.shift(); - if(q.empty && q.tasks.length == 0) q.empty(); - workers += 1; - worker(task.data, function () { - workers -= 1; - if (task.callback) { - task.callback.apply(task, arguments); - } - if(q.drain && q.tasks.length + workers == 0) q.drain(); - q.process(); - }); - } - }, - length: function () { - return q.tasks.length; - }, - running: function () { - return workers; - } - }; - return q; - }; - - var _console_fn = function (name) { - return function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - fn.apply(null, args.concat([function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (typeof console !== 'undefined') { - if (err) { - if (console.error) { - console.error(err); - } - } - else if (console[name]) { - _forEach(args, function (x) { - console[name](x); - }); - } - } - }])); - }; - }; - async.log = _console_fn('log'); - async.dir = _console_fn('dir'); - /*async.info = _console_fn('info'); - async.warn = _console_fn('warn'); - async.error = _console_fn('error');*/ - - async.memoize = function (fn, hasher) { - var memo = {}; - var queues = {}; - hasher = hasher || function (x) { - return x; - }; - var memoized = function () { - var args = Array.prototype.slice.call(arguments); - var callback = args.pop(); - var key = hasher.apply(null, args); - if (key in memo) { - callback.apply(null, memo[key]); - } - else if (key in queues) { - queues[key].push(callback); - } - else { - queues[key] = [callback]; - fn.apply(null, args.concat([function () { - memo[key] = arguments; - var q = queues[key]; - delete queues[key]; - for (var i = 0, l = q.length; i < l; i++) { - q[i].apply(null, arguments); - } - }])); - } - }; - memoized.unmemoized = fn; - return memoized; - }; - - async.unmemoize = function (fn) { - return function () { - return (fn.unmemoized || fn).apply(null, arguments); - } - }; - -}()); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/package.json b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/package.json deleted file mode 100644 index bf89264..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/async/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "async", - "description": "Higher-order functions and common patterns for asynchronous code", - "main": "./index", - "author": { - "name": "Caolan McMahon" - }, - "version": "0.1.18", - "repository": { - "type": "git", - "url": "git://github.com/caolan/async.git" - }, - "bugs": { - "url": "http://github.com/caolan/async/issues" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://github.com/caolan/async/raw/master/LICENSE" - } - ], - "devDependencies": { - "nodeunit": ">0.0.0", - "uglify-js": "1.2.x", - "nodelint": ">0.0.0" - }, - "_id": "async@0.1.18", - "dependencies": {}, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "async@0.1.x", - "scripts": {} -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/.gitignore.orig b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/.gitignore.orig deleted file mode 100644 index 9303c34..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/.gitignore.orig +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -npm-debug.log \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/.gitignore.rej b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/.gitignore.rej deleted file mode 100644 index 69244ff..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/.gitignore.rej +++ /dev/null @@ -1,5 +0,0 @@ ---- /dev/null -+++ .gitignore -@@ -0,0 +1,2 @@ -+node_modules/ -+npm-debug.log \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/.npmignore b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/.npmignore deleted file mode 100644 index 9303c34..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -npm-debug.log \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/.travis.yml b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/.travis.yml deleted file mode 100644 index f1d0f13..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/LICENSE b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/LICENSE deleted file mode 100644 index 432d1ae..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright 2010 James Halliday (mail@substack.net) - -This project is free software released under the MIT/X11 license: - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/README.markdown b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/README.markdown deleted file mode 100644 index 40de04f..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/README.markdown +++ /dev/null @@ -1,61 +0,0 @@ -mkdirp -====== - -Like `mkdir -p`, but in node.js! - -[![build status](https://secure.travis-ci.org/substack/node-mkdirp.png)](http://travis-ci.org/substack/node-mkdirp) - -example -======= - -pow.js ------- - var mkdirp = require('mkdirp'); - - mkdirp('/tmp/foo/bar/baz', function (err) { - if (err) console.error(err) - else console.log('pow!') - }); - -Output - pow! - -And now /tmp/foo/bar/baz exists, huzzah! - -methods -======= - -var mkdirp = require('mkdirp'); - -mkdirp(dir, mode, cb) ---------------------- - -Create a new directory and any necessary subdirectories at `dir` with octal -permission string `mode`. - -If `mode` isn't specified, it defaults to `0777 & (~process.umask())`. - -`cb(err, made)` fires with the error or the first directory `made` -that had to be created, if any. - -mkdirp.sync(dir, mode) ----------------------- - -Synchronously create a new directory and any necessary subdirectories at `dir` -with octal permission string `mode`. - -If `mode` isn't specified, it defaults to `0777 & (~process.umask())`. - -Returns the first directory that had to be created, if any. - -install -======= - -With [npm](http://npmjs.org) do: - - npm install mkdirp - -license -======= - -MIT/X11 diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/examples/pow.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/examples/pow.js deleted file mode 100644 index e692421..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/examples/pow.js +++ /dev/null @@ -1,6 +0,0 @@ -var mkdirp = require('mkdirp'); - -mkdirp('/tmp/foo/bar/baz', function (err) { - if (err) console.error(err) - else console.log('pow!') -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/examples/pow.js.orig b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/examples/pow.js.orig deleted file mode 100644 index 7741462..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/examples/pow.js.orig +++ /dev/null @@ -1,6 +0,0 @@ -var mkdirp = require('mkdirp'); - -mkdirp('/tmp/foo/bar/baz', 0755, function (err) { - if (err) console.error(err) - else console.log('pow!') -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/examples/pow.js.rej b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/examples/pow.js.rej deleted file mode 100644 index 81e7f43..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/examples/pow.js.rej +++ /dev/null @@ -1,19 +0,0 @@ ---- examples/pow.js -+++ examples/pow.js -@@ -1,6 +1,15 @@ --var mkdirp = require('mkdirp').mkdirp; -+var mkdirp = require('../').mkdirp, -+ mkdirpSync = require('../').mkdirpSync; - - mkdirp('/tmp/foo/bar/baz', 0755, function (err) { - if (err) console.error(err) - else console.log('pow!') - }); -+ -+try { -+ mkdirpSync('/tmp/bar/foo/baz', 0755); -+ console.log('double pow!'); -+} -+catch (ex) { -+ console.log(ex); -+} \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/index.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/index.js deleted file mode 100644 index 6d81c62..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/index.js +++ /dev/null @@ -1,83 +0,0 @@ -var path = require('path'); -var fs = require('fs'); - -module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP; - -function mkdirP (p, mode, f, made) { - if (typeof mode === 'function' || mode === undefined) { - f = mode; - mode = 0777 & (~process.umask()); - } - if (!made) made = null; - - var cb = f || function () {}; - if (typeof mode === 'string') mode = parseInt(mode, 8); - p = path.resolve(p); - - fs.mkdir(p, mode, function (er) { - if (!er) { - made = made || p; - return cb(null, made); - } - switch (er.code) { - case 'ENOENT': - mkdirP(path.dirname(p), mode, function (er, made) { - if (er) cb(er, made); - else mkdirP(p, mode, cb, made); - }); - break; - - case 'EEXIST': - fs.stat(p, function (er2, stat) { - // if the stat fails, then that's super weird. - // let the original EEXIST be the failure reason. - if (er2 || !stat.isDirectory()) cb(er, made) - else cb(null, made); - }); - break; - - default: - cb(er, made); - break; - } - }); -} - -mkdirP.sync = function sync (p, mode, made) { - if (mode === undefined) { - mode = 0777 & (~process.umask()); - } - if (!made) made = null; - - if (typeof mode === 'string') mode = parseInt(mode, 8); - p = path.resolve(p); - - try { - fs.mkdirSync(p, mode); - made = made || p; - } - catch (err0) { - switch (err0.code) { - case 'ENOENT' : - made = sync(path.dirname(p), mode, made); - sync(p, mode, made); - break; - - case 'EEXIST' : - var stat; - try { - stat = fs.statSync(p); - } - catch (err1) { - throw err0; - } - if (!stat.isDirectory()) throw err0; - break; - default : - throw err0 - break; - } - } - - return made; -}; diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/package.json b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/package.json deleted file mode 100644 index 5faea3c..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/package.json +++ /dev/null @@ -1,37 +0,0 @@ -{ - "name": "mkdirp", - "description": "Recursively mkdir, like `mkdir -p`", - "version": "0.3.1", - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "main": "./index", - "keywords": [ - "mkdir", - "directory" - ], - "repository": { - "type": "git", - "url": "git://github.com/substack/node-mkdirp.git" - }, - "scripts": { - "test": "tap test/*.js" - }, - "devDependencies": { - "tap": "~0.2.4" - }, - "license": "MIT/X11", - "engines": { - "node": "*" - }, - "_id": "mkdirp@0.3.1", - "dependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "mkdirp@0.x.x" -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/chmod.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/chmod.js deleted file mode 100644 index 520dcb8..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/chmod.js +++ /dev/null @@ -1,38 +0,0 @@ -var mkdirp = require('../').mkdirp; -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -var ps = [ '', 'tmp' ]; - -for (var i = 0; i < 25; i++) { - var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - ps.push(dir); -} - -var file = ps.join('/'); - -test('chmod-pre', function (t) { - var mode = 0744 - mkdirp(file, mode, function (er) { - t.ifError(er, 'should not error'); - fs.stat(file, function (er, stat) { - t.ifError(er, 'should exist'); - t.ok(stat && stat.isDirectory(), 'should be directory'); - t.equal(stat && stat.mode & 0777, mode, 'should be 0744'); - t.end(); - }); - }); -}); - -test('chmod', function (t) { - var mode = 0755 - mkdirp(file, mode, function (er) { - t.ifError(er, 'should not error'); - fs.stat(file, function (er, stat) { - t.ifError(er, 'should exist'); - t.ok(stat && stat.isDirectory(), 'should be directory'); - t.end(); - }); - }); -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/clobber.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/clobber.js deleted file mode 100644 index 0eb7099..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/clobber.js +++ /dev/null @@ -1,37 +0,0 @@ -var mkdirp = require('../').mkdirp; -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -var ps = [ '', 'tmp' ]; - -for (var i = 0; i < 25; i++) { - var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - ps.push(dir); -} - -var file = ps.join('/'); - -// a file in the way -var itw = ps.slice(0, 3).join('/'); - - -test('clobber-pre', function (t) { - console.error("about to write to "+itw) - fs.writeFileSync(itw, 'I AM IN THE WAY, THE TRUTH, AND THE LIGHT.'); - - fs.stat(itw, function (er, stat) { - t.ifError(er) - t.ok(stat && stat.isFile(), 'should be file') - t.end() - }) -}) - -test('clobber', function (t) { - t.plan(2); - mkdirp(file, 0755, function (err) { - t.ok(err); - t.equal(err.code, 'ENOTDIR'); - t.end(); - }); -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/mkdirp.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/mkdirp.js deleted file mode 100644 index b07cd70..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/mkdirp.js +++ /dev/null @@ -1,28 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('woo', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - mkdirp(file, 0755, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }) - }); -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/perm.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/perm.js deleted file mode 100644 index 23a7abb..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/perm.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('async perm', function (t) { - t.plan(2); - var file = '/tmp/' + (Math.random() * (1<<30)).toString(16); - - mkdirp(file, 0755, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }) - }); -}); - -test('async root perm', function (t) { - mkdirp('/tmp', 0755, function (err) { - if (err) t.fail(err); - t.end(); - }); - t.end(); -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/perm_sync.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/perm_sync.js deleted file mode 100644 index f685f60..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/perm_sync.js +++ /dev/null @@ -1,39 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('sync perm', function (t) { - t.plan(2); - var file = '/tmp/' + (Math.random() * (1<<30)).toString(16) + '.json'; - - mkdirp.sync(file, 0755); - path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }); -}); - -test('sync root perm', function (t) { - t.plan(1); - - var file = '/tmp'; - mkdirp.sync(file, 0755); - path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }); -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/race.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/race.js deleted file mode 100644 index 96a0447..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/race.js +++ /dev/null @@ -1,41 +0,0 @@ -var mkdirp = require('../').mkdirp; -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('race', function (t) { - t.plan(4); - var ps = [ '', 'tmp' ]; - - for (var i = 0; i < 25; i++) { - var dir = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - ps.push(dir); - } - var file = ps.join('/'); - - var res = 2; - mk(file, function () { - if (--res === 0) t.end(); - }); - - mk(file, function () { - if (--res === 0) t.end(); - }); - - function mk (file, cb) { - mkdirp(file, 0755, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - if (cb) cb(); - } - }) - }) - }); - } -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/rel.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/rel.js deleted file mode 100644 index 7985824..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/rel.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('rel', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var cwd = process.cwd(); - process.chdir('/tmp'); - - var file = [x,y,z].join('/'); - - mkdirp(file, 0755, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - process.chdir(cwd); - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }) - }); -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/return.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/return.js deleted file mode 100644 index bce68e5..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/return.js +++ /dev/null @@ -1,25 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('return value', function (t) { - t.plan(4); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - // should return the first dir created. - // By this point, it would be profoundly surprising if /tmp didn't - // already exist, since every other test makes things in there. - mkdirp(file, function (err, made) { - t.ifError(err); - t.equal(made, '/tmp/' + x); - mkdirp(file, function (err, made) { - t.ifError(err); - t.equal(made, null); - }); - }); -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/return_sync.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/return_sync.js deleted file mode 100644 index 7c222d3..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/return_sync.js +++ /dev/null @@ -1,24 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('return value', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - // should return the first dir created. - // By this point, it would be profoundly surprising if /tmp didn't - // already exist, since every other test makes things in there. - // Note that this will throw on failure, which will fail the test. - var made = mkdirp.sync(file); - t.equal(made, '/tmp/' + x); - - // making the same file again should have no effect. - made = mkdirp.sync(file); - t.equal(made, null); -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/sync.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/sync.js deleted file mode 100644 index 7530cad..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/sync.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('sync', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - try { - mkdirp.sync(file, 0755); - } catch (err) { - t.fail(err); - return t.end(); - } - - path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0755); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }); - }); -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/umask.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/umask.js deleted file mode 100644 index 64ccafe..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/umask.js +++ /dev/null @@ -1,28 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('implicit mode from umask', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - mkdirp(file, function (err) { - if (err) t.fail(err); - else path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, 0777 & (~process.umask())); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }) - }) - }); -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/umask_sync.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/umask_sync.js deleted file mode 100644 index 4bd5376..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/mkdirp/test/umask_sync.js +++ /dev/null @@ -1,32 +0,0 @@ -var mkdirp = require('../'); -var path = require('path'); -var fs = require('fs'); -var test = require('tap').test; - -test('umask sync modes', function (t) { - t.plan(2); - var x = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var y = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - var z = Math.floor(Math.random() * Math.pow(16,4)).toString(16); - - var file = '/tmp/' + [x,y,z].join('/'); - - try { - mkdirp.sync(file, 0755); - } catch (err) { - t.fail(err); - return t.end(); - } - - path.exists(file, function (ex) { - if (!ex) t.fail('file not created') - else fs.stat(file, function (err, stat) { - if (err) t.fail(err) - else { - t.equal(stat.mode & 0777, (0777 & (~process.umask()))); - t.ok(stat.isDirectory(), 'target not a directory'); - t.end(); - } - }); - }); -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/.npmignore b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/.npmignore deleted file mode 100644 index 9ecd205..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -.*.sw[op] -.DS_Store -test/fixtures/out diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/.travis.yml b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/.travis.yml deleted file mode 100644 index 3a05aef..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: node_js - -node_js: - - 0.4 - - 0.6 - - 0.7 diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/LICENSE.md b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/LICENSE.md deleted file mode 100644 index e2b9b41..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -# MIT License - -###Copyright (C) 2011 by Charlie McConnell - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/README.md b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/README.md deleted file mode 100644 index 745fe99..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/README.md +++ /dev/null @@ -1,46 +0,0 @@ -# ncp - Asynchronous recursive file & directory copying - -[![Build Status](https://secure.travis-ci.org/AvianFlu/ncp.png)](http://travis-ci.org/AvianFlu/ncp) - -Think `cp -r`, but pure node, and asynchronous. `ncp` can be used both as a CLI tool and programmatically. - -## Command Line usage - -Usage is simple: `ncp [source] [dest] [--limit=concurrency limit] -[--filter=filter] --stopOnErr` - -The 'filter' is a Regular Expression - matched files will be copied. - -The 'concurrency limit' is an integer that represents how many pending file system requests `ncp` has at a time. - -'stopOnErr' is a boolean flag that will tell `ncp` to stop immediately if any -errors arise, rather than attempting to continue while logging errors. - -If there are no errors, `ncp` will output `done.` when complete. If there are errors, the error messages will be logged to `stdout` and to `./ncp-debug.log`, and the copy operation will attempt to continue. - -## Programmatic usage - -Programmatic usage of `ncp` is just as simple. The only argument to the completion callback is a possible error. - -```javascript -var ncp = require('ncp').ncp; - -ncp.limit = 16; - -ncp(source, destination, function (err) { - if (err) { - return console.error(err); - } - console.log('done!'); -}); -``` - -You can also call ncp like `ncp(source, destination, options, callback)`. -`options` should be a dictionary. Currently, such options are available: - - * `options.filter` - a `RegExp` instance, against which each file name is - tested to determine whether to copy it or not, or a function taking single - parameter: copied file name, returning `true` or `false`, determining - whether to copy file or not. - -Please open an issue if any bugs arise. As always, I accept (working) pull requests, and refunds are available at `/dev/null`. diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/bin/ncp b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/bin/ncp deleted file mode 100755 index 388eaba..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/bin/ncp +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env node - - - - -var ncp = require('../lib/ncp'), - args = process.argv.slice(2), - source, dest; - -if (args.length < 2) { - console.error('Usage: ncp [source] [destination] [--filter=filter] [--limit=concurrency limit]'); - process.exit(1); -} - -// parse arguments the hard way -function startsWith(str, prefix) { - return str.substr(0, prefix.length) == prefix; -} - -var options = {}; -args.forEach(function (arg) { - if (startsWith(arg, "--limit=")) { - options.limit = parseInt(arg.split('=', 2)[1], 10); - } - if (startsWith(arg, "--filter=")) { - options.filter = new RegExp(arg.split('=', 2)[1]); - } - if (startsWith(arg, "--stoponerr")) { - options.stopOnErr = true; - } -}); - -ncp.ncp(args[0], args[1], options, function (err) { - if (Array.isArray(err)) { - console.error('There were errors during the copy.'); - err.forEach(function (err) { - console.error(err.stack || err.message); - }); - process.exit(1); - } - else if (err) { - console.error('An error has occurred.'); - console.error(err.stack || err.message); - process.exit(1); - } -}); - - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/hahaha b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/hahaha deleted file mode 100755 index e69de29..0000000 diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/laull b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/laull deleted file mode 100755 index ccb75a4..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/laull +++ /dev/null @@ -1,3 +0,0 @@ -OMG LULZ OMG HI - - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/lib/ncp.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/lib/ncp.js deleted file mode 100644 index 886da7a..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/lib/ncp.js +++ /dev/null @@ -1,210 +0,0 @@ -var fs = require('fs'), - path = require('path'); - -var ncp = exports; - -ncp.ncp = function (source, dest, options, callback) { - if (!callback) { - callback = options; - options = {}; - } - - var basePath = process.cwd(), - currentPath = path.resolve(basePath, source), - targetPath = path.resolve(basePath, dest), - filter = options.filter, - errs = null, - started = 0, - finished = 0, - running = 0, - limit = options.limit || ncp.limit || 16; - - limit = (limit < 1) ? 1 : (limit > 512) ? 512 : limit; - - startCopy(currentPath); - - function startCopy(source) { - started++; - if (filter) { - if (filter instanceof RegExp) { - if (!filter.test(source)) { - return cb(true); - } - } - else if (typeof filter === 'function') { - if (!filter(source)) { - return cb(true); - } - } - } - return getStats(source); - } - - function getStats(source) { - if (running >= limit) { - return process.nextTick(function () { - getStats(source); - }); - } - running++; - fs.lstat(source, function (err, stats) { - var item = {}; - if (err) { - return onError(err); - } - - // We need to get the mode from the stats object and preserve it. - item.name = source; - item.mode = stats.mode; - - if (stats.isDirectory()) { - return onDir(item); - } - else if (stats.isFile()) { - return onFile(item); - } - else if (stats.isSymbolicLink()) { - // Symlinks don't really need to know about the mode. - return onLink(source); - } - }); - } - - function onFile(file) { - var target = file.name.replace(currentPath, targetPath); - isWritable(target, function (writable) { - if (writable) { - return copyFile(file, target); - } - rmFile(target, function () { - copyFile(file, target); - }); - }); - } - - function copyFile(file, target) { - var readStream = fs.createReadStream(file.name), - writeStream = fs.createWriteStream(target, { mode: file.mode }); - readStream.pipe(writeStream); - readStream.once('end', cb); - } - - function rmFile(file, done) { - fs.unlink(file, function (err) { - if (err) { - return onError(err); - } - return done(); - }); - } - - function onDir(dir) { - var target = dir.name.replace(currentPath, targetPath); - isWritable(target, function (writable) { - if (writable) { - return mkDir(dir, target); - } - copyDir(dir.name); - }); - } - - function mkDir(dir, target) { - fs.mkdir(target, dir.mode, function (err) { - if (err) { - return onError(err); - } - copyDir(dir.name); - }); - } - - function copyDir(dir) { - fs.readdir(dir, function (err, items) { - if (err) { - return onError(err); - } - items.forEach(function (item) { - startCopy(dir + '/' + item); - }); - return cb(); - }); - } - - function onLink(link) { - var target = link.replace(currentPath, targetPath); - fs.readlink(link, function (err, resolvedPath) { - if (err) { - return onError(err); - } - checkLink(resolvedPath, target); - }); - } - - function checkLink(resolvedPath, target) { - isWritable(target, function (writable) { - if (writable) { - return makeLink(resolvedPath, target); - } - fs.readlink(target, function (err, targetDest) { - if (err) { - return onError(err); - } - if (targetDest === resolvedPath) { - return cb(); - } - return rmFile(target, function () { - makeLink(resolvedPath, target); - }); - }); - }); - } - - function makeLink(linkPath, target) { - fs.symlink(linkPath, target, function (err) { - if (err) { - return onError(err); - } - return cb(); - }); - } - - function isWritable(path, done) { - fs.lstat(path, function (err, stats) { - if (err) { - if (err.code === 'ENOENT') return done(true); - return done(false); - } - return done(false); - }); - } - - function onError(err) { - if (options.stopOnError) { - return callback(err); - } - else if (!errs && options.errs) { - errs = fs.createWriteStream(options.errs); - } - else if (!errs) { - errs = []; - } - else if (options.errs) { - if (typeof errs.write === 'undefined') { - errs.push(err); - } - else { - errs.write(err.stack + '\n\n'); - } - } - return cb(); - } - - function cb(skipped) { - if (!skipped) running--; - finished++; - if ((started === finished) && (running === 0)) { - return errs ? callback(errs) : callback(null); - } - } -}; - - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/mode.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/mode.js deleted file mode 100644 index fb0587d..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/mode.js +++ /dev/null @@ -1,19 +0,0 @@ - - -var fs = require('fs'); - -fs.lstat('hahaha', function (err, stats) { - if (err) throw err; - var stream = fs.createWriteStream('laull', { - mode: stats.mode - }); - stream.on('end', function () { - if (err) throw err; - fs.lstat('laull', function (err, stats2) { - if (err) throw err; - console.dir(stats2); - }); - }); - stream.write('OMG LULZ OMG HI\n\n\n'); - stream.end(); -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/package.json b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/package.json deleted file mode 100644 index 56dcf35..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/package.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "name": "ncp", - "version": "0.2.6", - "author": { - "name": "AvianFlu", - "email": "charlie@charlieistheman.com" - }, - "description": "Asynchronous recursive file copy utility.", - "bin": { - "ncp": "./bin/ncp" - }, - "devDependencies": { - "vows": "0.6.x", - "rimraf": "1.0.x", - "read-dir-files": "0.0.x" - }, - "main": "./lib/ncp.js", - "repository": { - "type": "git", - "url": "git://github.com/AvianFlu/ncp.git" - }, - "keywords": [ - "cli", - "copy" - ], - "license": "MIT", - "engine": { - "node": ">=0.4" - }, - "scripts": { - "test": "vows --isolate --spec" - }, - "_id": "ncp@0.2.6", - "dependencies": {}, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "ncp@0.2.x" -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/test/fixtures/src/a b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/test/fixtures/src/a deleted file mode 100644 index 802992c..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/test/fixtures/src/a +++ /dev/null @@ -1 +0,0 @@ -Hello world diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/test/fixtures/src/b b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/test/fixtures/src/b deleted file mode 100644 index 9f6bb18..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/test/fixtures/src/b +++ /dev/null @@ -1 +0,0 @@ -Hello ncp diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/test/fixtures/src/c b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/test/fixtures/src/c deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/test/fixtures/src/d b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/test/fixtures/src/d deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/test/fixtures/src/e b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/test/fixtures/src/e deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/test/fixtures/src/f b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/test/fixtures/src/f deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/test/fixtures/src/sub/a b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/test/fixtures/src/sub/a deleted file mode 100644 index cf291b5..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/test/fixtures/src/sub/a +++ /dev/null @@ -1 +0,0 @@ -Hello nodejitsu diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/test/fixtures/src/sub/b b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/test/fixtures/src/sub/b deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/test/ncp-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/test/ncp-test.js deleted file mode 100644 index 3783f60..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/ncp/test/ncp-test.js +++ /dev/null @@ -1,74 +0,0 @@ -var assert = require('assert'), - path = require('path'), - rimraf = require('rimraf'), - vows = require('vows'), - readDirFiles = require('read-dir-files'), - ncp = require('../').ncp; - -var fixtures = path.join(__dirname, 'fixtures'), - src = path.join(fixtures, 'src'), - out = path.join(fixtures, 'out'); - -vows.describe('ncp').addBatch({ - 'When copying a directory of files': { - topic: function () { - var cb = this.callback; - rimraf(out, function () { - ncp(src, out, cb); - }); - }, - 'files should be copied': { - topic: function () { - var cb = this.callback; - - readDirFiles(src, 'utf8', function (srcErr, srcFiles) { - readDirFiles(out, 'utf8', function (outErr, outFiles) { - cb(outErr, srcFiles, outFiles); - }); - }); - }, - 'and the destination should match the source': function (err, srcFiles, outFiles) { - assert.isNull(err); - assert.deepEqual(srcFiles, outFiles); - } - } - } -}).addBatch({ - 'When copying files using filter': { - topic: function() { - var cb = this.callback; - var filter = function(name) { - return name.substr(name.length - 1) != 'a' - } - rimraf(out, function () { - ncp(src, out, {filter: filter}, cb); - }); - }, - 'it should copy files': { - topic: function () { - var cb = this.callback; - - readDirFiles(src, 'utf8', function (srcErr, srcFiles) { - function filter(files) { - for (var fileName in files) { - var curFile = files[fileName]; - if (curFile instanceof Object) - return filter(curFile); - if (fileName.substr(fileName.length - 1) == 'a') - delete files[fileName]; - } - } - filter(srcFiles); - readDirFiles(out, 'utf8', function (outErr, outFiles) { - cb(outErr, srcFiles, outFiles); - }); - }); - }, - 'and destination files should match source files that pass filter': function (err, srcFiles, outFiles) { - assert.isNull(err); - assert.deepEqual(srcFiles, outFiles); - } - } - } -}).export(module); - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/AUTHORS b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/AUTHORS deleted file mode 100644 index 008cbe7..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/AUTHORS +++ /dev/null @@ -1,5 +0,0 @@ -# Authors sorted by whether or not they're me. -Isaac Z. Schlueter (http://blog.izs.me) -Wayne Larsen (http://github.com/wvl) -ritch -Marcel Laverdet diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/LICENSE b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/LICENSE deleted file mode 100644 index 05a4010..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -Copyright 2009, 2010, 2011 Isaac Z. Schlueter. -All rights reserved. - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following -conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/README.md b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/README.md deleted file mode 100644 index 99983dc..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/README.md +++ /dev/null @@ -1,32 +0,0 @@ -A `rm -rf` for node. - -Install with `npm install rimraf`, or just drop rimraf.js somewhere. - -## API - -`rimraf(f, [options,] callback)` - -The callback will be called with an error if there is one. Certain -errors are handled for you: - -* `EBUSY` - rimraf will back off a maximum of opts.maxBusyTries times - before giving up. -* `EMFILE` - If too many file descriptors get opened, rimraf will - patiently wait until more become available. - -## Options - -The options object is optional. These fields are respected: - -* `maxBusyTries` - The number of times to retry a file or folder in the - event of an `EBUSY` error. The default is 3. -* `gently` - If provided a `gently` path, then rimraf will only delete - files and folders that are beneath this path, and only delete symbolic - links that point to a place within this path. (This is very important - to npm's use-case, and shows rimraf's pedigree.) - - -## rimraf.sync - -It can remove stuff synchronously, too. But that's not so good. Use -the async API. It's better. diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/fiber.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/fiber.js deleted file mode 100644 index 8812a6b..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/fiber.js +++ /dev/null @@ -1,86 +0,0 @@ -// fiber/future port originally written by Marcel Laverdet -// https://gist.github.com/1131093 -// I updated it to bring to feature parity with cb version. -// The bugs are probably mine, not Marcel's. -// -- isaacs - -var path = require('path') - , fs = require('fs') - , Future = require('fibers/future') - -// Create future-returning fs functions -var fs2 = {} -for (var ii in fs) { - fs2[ii] = Future.wrap(fs[ii]) -} - -// Return a future which just pauses for a certain amount of time - -function timer (ms) { - var future = new Future - setTimeout(function () { - future.return() - }, ms) - return future -} - -function realish (p) { - return path.resolve(path.dirname(fs2.readlink(p))) -} - -// for EMFILE backoff. -var timeout = 0 - , EMFILE_MAX = 1000 - -function rimraf_ (p, opts) { - opts = opts || {} - opts.maxBusyTries = opts.maxBusyTries || 3 - if (opts.gently) opts.gently = path.resolve(opts.gently) - var busyTries = 0 - - // exits by throwing or returning. - // loops on handled errors. - while (true) { - try { - var stat = fs2.lstat(p).wait() - - // check to make sure that symlinks are ours. - if (opts.gently) { - var rp = stat.isSymbolicLink() ? realish(p) : path.resolve(p) - if (rp.indexOf(opts.gently) !== 0) { - var er = new Error("Refusing to delete: "+p+" not in "+opts.gently) - er.errno = require("constants").EEXIST - er.code = "EEXIST" - er.path = p - throw er - } - } - - if (!stat.isDirectory()) return fs2.unlink(p).wait() - - var rimrafs = fs2.readdir(p).wait().map(function (file) { - return rimraf(path.join(p, file), opts) - }) - - Future.wait(rimrafs) - fs2.rmdir(p).wait() - timeout = 0 - return - - } catch (er) { - if (er.message.match(/^EMFILE/) && timeout < EMFILE_MAX) { - timer(timeout++).wait() - } else if (er.message.match(/^EBUSY/) - && busyTries < opt.maxBusyTries) { - timer(++busyTries * 100).wait() - } else if (er.message.match(/^ENOENT/)) { - // already gone - return - } else { - throw er - } - } - } -} - -var rimraf = module.exports = rimraf_.future() diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/package.json b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/package.json deleted file mode 100644 index 6327e4e..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "rimraf", - "version": "1.0.9", - "main": "rimraf.js", - "description": "A deep deletion module for node (like `rm -rf`)", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "license": { - "type": "MIT", - "url": "https://github.com/isaacs/rimraf/raw/master/LICENSE" - }, - "repository": { - "type": "git", - "url": "git://github.com/isaacs/rimraf.git" - }, - "scripts": { - "test": "cd test && bash run.sh" - }, - "_id": "rimraf@1.0.9", - "contributors": [ - { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me" - }, - { - "name": "Wayne Larsen", - "email": "wayne@larsen.st", - "url": "http://github.com/wvl" - }, - { - "name": "ritch", - "email": "skawful@gmail.com" - }, - { - "name": "Marcel Laverdet" - } - ], - "dependencies": {}, - "devDependencies": {}, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "rimraf@1.x.x" -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/rimraf.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/rimraf.js deleted file mode 100644 index e8104e9..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/rimraf.js +++ /dev/null @@ -1,145 +0,0 @@ -module.exports = rimraf -rimraf.sync = rimrafSync - -var path = require("path") - , fs - -try { - // optional dependency - fs = require("graceful-fs") -} catch (er) { - fs = require("fs") -} - -var lstat = process.platform === "win32" ? "stat" : "lstat" - , lstatSync = lstat + "Sync" - -// for EMFILE handling -var timeout = 0 - , EMFILE_MAX = 1000 - -function rimraf (p, opts, cb) { - if (typeof opts === "function") cb = opts, opts = {} - - if (!cb) throw new Error("No callback passed to rimraf()") - if (!opts) opts = {} - - var busyTries = 0 - opts.maxBusyTries = opts.maxBusyTries || 3 - - if (opts.gently) opts.gently = path.resolve(opts.gently) - - rimraf_(p, opts, function CB (er) { - if (er) { - if (er.code === "EBUSY" && busyTries < opts.maxBusyTries) { - var time = (opts.maxBusyTries - busyTries) * 100 - busyTries ++ - // try again, with the same exact callback as this one. - return setTimeout(function () { - rimraf_(p, opts, CB) - }) - } - - // this one won't happen if graceful-fs is used. - if (er.code === "EMFILE" && timeout < EMFILE_MAX) { - return setTimeout(function () { - rimraf_(p, opts, CB) - }, timeout ++) - } - - // already gone - if (er.code === "ENOENT") er = null - } - - timeout = 0 - cb(er) - }) -} - -function rimraf_ (p, opts, cb) { - fs[lstat](p, function (er, s) { - // if the stat fails, then assume it's already gone. - if (er) { - // already gone - if (er.code === "ENOENT") return cb() - // some other kind of error, permissions, etc. - return cb(er) - } - - // don't delete that don't point actually live in the "gently" path - if (opts.gently) return clobberTest(p, s, opts, cb) - return rm_(p, s, opts, cb) - }) -} - -function rm_ (p, s, opts, cb) { - if (!s.isDirectory()) return fs.unlink(p, cb) - fs.readdir(p, function (er, files) { - if (er) return cb(er) - asyncForEach(files.map(function (f) { - return path.join(p, f) - }), function (file, cb) { - rimraf(file, opts, cb) - }, function (er) { - if (er) return cb(er) - fs.rmdir(p, cb) - }) - }) -} - -function clobberTest (p, s, opts, cb) { - var gently = opts.gently - if (!s.isSymbolicLink()) next(null, path.resolve(p)) - else realish(p, next) - - function next (er, rp) { - if (er) return rm_(p, s, cb) - if (rp.indexOf(gently) !== 0) return clobberFail(p, gently, cb) - else return rm_(p, s, opts, cb) - } -} - -function realish (p, cb) { - fs.readlink(p, function (er, r) { - if (er) return cb(er) - return cb(null, path.resolve(path.dirname(p), r)) - }) -} - -function clobberFail (p, g, cb) { - var er = new Error("Refusing to delete: "+p+" not in "+g) - , constants = require("constants") - er.errno = constants.EEXIST - er.code = "EEXIST" - er.path = p - return cb(er) -} - -function asyncForEach (list, fn, cb) { - if (!list.length) cb() - var c = list.length - , errState = null - list.forEach(function (item, i, list) { - fn(item, function (er) { - if (errState) return - if (er) return cb(errState = er) - if (-- c === 0) return cb() - }) - }) -} - -// this looks simpler, but it will fail with big directory trees, -// or on slow stupid awful cygwin filesystems -function rimrafSync (p) { - try { - var s = fs[lstatSync](p) - } catch (er) { - if (er.code === "ENOENT") return - throw er - } - if (!s.isDirectory()) return fs.unlinkSync(p) - fs.readdirSync(p).forEach(function (f) { - rimrafSync(path.join(p, f)) - }) - fs.rmdirSync(p) -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/test/run.sh b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/test/run.sh deleted file mode 100644 index 598f016..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/test/run.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -set -e -for i in test-*.js; do - echo -n $i ... - bash setup.sh - node $i - ! [ -d target ] - echo "pass" -done -rm -rf target diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/test/setup.sh b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/test/setup.sh deleted file mode 100644 index 2602e63..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/test/setup.sh +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash - -set -e - -files=10 -folders=2 -depth=4 -target="$PWD/target" - -rm -rf target - -fill () { - local depth=$1 - local files=$2 - local folders=$3 - local target=$4 - - if ! [ -d $target ]; then - mkdir -p $target - fi - - local f - - f=$files - while [ $f -gt 0 ]; do - touch "$target/f-$depth-$f" - let f-- - done - - let depth-- - - if [ $depth -le 0 ]; then - return 0 - fi - - f=$folders - while [ $f -gt 0 ]; do - mkdir "$target/folder-$depth-$f" - fill $depth $files $folders "$target/d-$depth-$f" - let f-- - done -} - -fill $depth $files $folders $target - -# sanity assert -[ -d $target ] diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/test/test-async.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/test/test-async.js deleted file mode 100644 index 9c2e0b7..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/test/test-async.js +++ /dev/null @@ -1,5 +0,0 @@ -var rimraf = require("../rimraf") - , path = require("path") -rimraf(path.join(__dirname, "target"), function (er) { - if (er) throw er -}) diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/test/test-fiber.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/test/test-fiber.js deleted file mode 100644 index 20d61a1..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/test/test-fiber.js +++ /dev/null @@ -1,15 +0,0 @@ -var rimraf - , path = require("path") - -try { - rimraf = require("../fiber") -} catch (er) { - console.error("skipping fiber test") -} - -if (rimraf) { - Fiber(function () { - rimraf(path.join(__dirname, "target")).wait() - }).run() -} - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/test/test-sync.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/test/test-sync.js deleted file mode 100644 index eb71f10..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/node_modules/rimraf/test/test-sync.js +++ /dev/null @@ -1,3 +0,0 @@ -var rimraf = require("../rimraf") - , path = require("path") -rimraf.sync(path.join(__dirname, "target")) diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/package.json b/node_modules/flatiron/node_modules/broadway/node_modules/utile/package.json deleted file mode 100644 index ce417b4..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "utile", - "description": "A drop-in replacement for `util` with some additional advantageous functions", - "version": "0.0.10", - "author": { - "name": "Nodejitsu Inc", - "email": "info@nodejitsu.com" - }, - "contributors": [ - { - "name": "Charlie Robbins", - "email": "charlie@nodejitsu.com" - }, - { - "name": "Dominic Tarr", - "email": "dominic@nodejitsu.com" - }, - { - "name": "Maciej Malecki", - "email": "maciej@nodejitsu.com" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/flatiron/utile.git" - }, - "dependencies": { - "async": "0.1.x", - "mkdirp": "0.x.x", - "ncp": "0.2.x", - "rimraf": "1.x.x" - }, - "devDependencies": { - "vows": "0.6.x" - }, - "scripts": { - "test": "vows --spec --isolate" - }, - "main": "./lib/index", - "engines": { - "node": ">= 0.4.0" - }, - "_id": "utile@0.0.10", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "utile@0.0.10" -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/file-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/file-test.js deleted file mode 100644 index 439be68..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/file-test.js +++ /dev/null @@ -1,31 +0,0 @@ -/* - * file-test.js: Tests for `utile.file` module. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - path = require('path'), - vows = require('vows'), - macros = require('./helpers/macros'), - utile = require('../'); - -var fixture = path.join(__dirname, 'fixtures', 'read-json-file', 'config.json'); - -vows.describe('utile/file').addBatch({ - 'When using utile': { - 'the `.file.readJson()` function': { - topic: function () { - utile.file.readJson(fixture, this.callback); - }, - 'should return correct JSON structure': macros.assertReadCorrectJson - }, - 'the `.file.readJsonSync()` function': { - topic: utile.file.readJsonSync(fixture), - 'should return correct JSON structure': macros.assertReadCorrectJson - } - } -}).export(module); - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/fixtures/read-json-file/config.json b/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/fixtures/read-json-file/config.json deleted file mode 100644 index e12a106..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/fixtures/read-json-file/config.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "hello": "World", - "I am": ["the utile module"], - "thisMakesMe": { - "really": 1337, - "right?": true - } -} - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/fixtures/require-directory/directory/index.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/fixtures/require-directory/directory/index.js deleted file mode 100644 index 1afb489..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/fixtures/require-directory/directory/index.js +++ /dev/null @@ -1,2 +0,0 @@ -exports.me = 'directory/index.js'; - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/fixtures/require-directory/helloWorld.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/fixtures/require-directory/helloWorld.js deleted file mode 100644 index 1c842ec..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/fixtures/require-directory/helloWorld.js +++ /dev/null @@ -1,2 +0,0 @@ -exports.me = 'helloWorld.js'; - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/helpers/macros.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/helpers/macros.js deleted file mode 100644 index ab53040..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/helpers/macros.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * macros.js: Test macros for `utile` module. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'); - -var macros = exports; - -macros.assertReadCorrectJson = function (obj) { - assert.isObject(obj); - assert.deepEqual(obj, { - hello: 'World', - 'I am': ['the utile module'], - thisMakesMe: { - really: 1337, - 'right?': true - } - }); -}; - -macros.assertDirectoryRequired = function (obj) { - assert.isObject(obj); - assert.deepEqual(obj, { - directory: { - me: 'directory/index.js' - }, - helloWorld: { - me: 'helloWorld.js' - } - }); -}; - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/random-string-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/random-string-test.js deleted file mode 100644 index 214e522..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/random-string-test.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * common-test.js : testing common.js for expected functionality - * - * (C) 2011, Nodejitsu Inc. - * - */ - -var assert = require('assert'), - vows = require('vows'), - utile = require('../lib'); - -vows.describe('utile/randomString').addBatch({ - "When using utile": { - "the randomString() function": { - topic: function () { - return utile.randomString(); - }, - "should return 16 characters that are actually random by default": function (random) { - assert.isString(random); - assert.lengthOf(random, 16); - assert.notEqual(random, utile.randomString()); - }, - "when you can asked for different length strings": { - topic: function () { - return [utile.randomString(4), utile.randomString(128)]; - }, - "where they actually are of length 4, 128": function (strings) { - assert.isArray(strings); - assert.lengthOf(strings,2); - assert.isString(strings[0]); - assert.isString(strings[1]); - assert.lengthOf(strings[0], 4); - assert.lengthOf(strings[1], 128); - assert.notEqual(strings[0], strings[1].substr(0,4)); - } - } - } - } -}).export(module); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/require-directory-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/require-directory-test.js deleted file mode 100644 index 044a8e3..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/require-directory-test.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * require-directory-test.js: Tests for `requireDir` and `requireDirLazy` - * methods. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - path = require('path'), - vows = require('vows'), - macros = require('./helpers/macros'), - utile = require('../'); - -var requireFixtures = path.join(__dirname, 'fixtures', 'require-directory'); - -vows.describe('utile/require-directory').addBatch({ - 'When using utile': { - 'the `requireDir()` function': { - topic: utile.requireDir(requireFixtures), - 'should contain all wanted modules': macros.assertDirectoryRequired - }, - 'the `requireDirLazy()` function': { - topic: utile.requireDirLazy(requireFixtures), - 'should contain all wanted modules': macros.assertDirectoryRequired, - 'all properties should be getters': function (obj) { - assert.isObject(obj); - assert.isTrue(!!obj.__lookupGetter__('directory')); - assert.isTrue(!!obj.__lookupGetter__('helloWorld')); - } - } - } -}).export(module); - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/utile-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/utile-test.js deleted file mode 100644 index 406a1f1..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/utile/test/utile-test.js +++ /dev/null @@ -1,71 +0,0 @@ -/* - * utile-test.js: Tests for `utile` module. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - vows = require('vows'), - utile = require('../lib'); - -var obj1, obj2; - -obj1 = { - foo: true, - bar: { - bar1: true, - bar2: 'bar2' - } -}; - -obj2 = { - baz: true, - buzz: 'buzz' -}; -obj2.__defineGetter__('bazz', function () { - return 'bazz'; -}); - -vows.describe('utile').addBatch({ - "When using utile": { - "it should have the same methods as the `util` module": function () { - Object.keys(require('util')).forEach(function (fn) { - if (fn !== 'inspect') { - assert.isFunction(utile[fn]); - } - }); - }, - "it should have the correct methods defined": function () { - assert.isFunction(utile.mixin); - assert.isFunction(utile.clone); - assert.isFunction(utile.rimraf); - assert.isFunction(utile.mkdirp); - assert.isFunction(utile.cpr); - }, - "the mixin() method": function () { - var mixed = utile.mixin({}, obj1, obj2); - assert.isTrue(mixed.foo); - assert.isObject(mixed.bar); - assert.isTrue(mixed.baz); - assert.isString(mixed.buzz); - assert.isTrue(!!mixed.__lookupGetter__('bazz')); - assert.isString(mixed.bazz); - }, - "the clone() method": function () { - var clone = utile.clone(obj1); - assert.isTrue(clone.foo); - assert.isObject(clone.bar); - assert.notStrictEqual(obj1, clone); - }, - "the createPath() method": function () { - var x = {}, - r = Math.random(); - - utile.createPath(x, ['a','b','c'], r) - assert.equal(x.a.b.c, r) - } - } -}).export(module); - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/.npmignore b/node_modules/flatiron/node_modules/broadway/node_modules/winston/.npmignore deleted file mode 100644 index 2c5c40a..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -test/*.log -test/fixtures/*.json -test/fixtures/logs/*.log -node_modules/ -node_modules/* -npm-debug.log \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/.travis.yml b/node_modules/flatiron/node_modules/broadway/node_modules/winston/.travis.yml deleted file mode 100644 index c958222..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 - - 0.7 - -notifications: - email: - - travis@nodejitsu.com - irc: "irc.freenode.org#nodejitsu" - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/LICENSE b/node_modules/flatiron/node_modules/broadway/node_modules/winston/LICENSE deleted file mode 100644 index 948d80d..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010 Charlie Robbins - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/README.md b/node_modules/flatiron/node_modules/broadway/node_modules/winston/README.md deleted file mode 100644 index 3893a1a..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/README.md +++ /dev/null @@ -1,730 +0,0 @@ -# winston [![Build Status](https://secure.travis-ci.org/flatiron/winston.png)](http://travis-ci.org/flatiron/winston) - -A multi-transport async logging library for node.js. "CHILL WINSTON! ... I put it in the logs." - -## Installation - -### Installing npm (node package manager) -``` - curl http://npmjs.org/install.sh | sh -``` - -### Installing winston -``` - [sudo] npm install winston -``` - -## Motivation -Winston is designed to be a simple and universal logging library with support for multiple transports. A transport is essentially a storage device for your logs. Each instance of a winston logger can have multiple transports configured at different levels. For example, one may want error logs to be stored in a persistent remote location (like a database), but all logs output to the console or a local file. - -There also seemed to be a lot of logging libraries out there that coupled their implementation of logging (i.e. how the logs are stored / indexed) to the API that they exposed to the programmer. This library aims to decouple those parts of the process to make it more flexible and extensible. - -## Usage -There are two different ways to use winston: directly via the default logger, or by instantiating your own Logger. The former is merely intended to be a convenient shared logger to use throughout your application if you so choose. - -### Using the Default Logger -The default logger is accessible through the winston module directly. Any method that you could call on an instance of a logger is available on the default logger: - -``` js - var winston = require('winston'); - - winston.log('info', 'Hello distributed log files!'); - winston.info('Hello again distributed logs'); -``` - -By default, only the Console transport is set on the default logger. You can add or remove transports via the add() and remove() methods: - -``` js - winston.add(winston.transports.File, { filename: 'somefile.log' }); - winston.remove(winston.transports.Console); -``` - -For more documenation about working with each individual transport supported by Winston see the "Working with Transports" section below. - -### Instantiating your own Logger -If you would prefer to manage the object lifetime of loggers you are free to instantiate them yourself: - -``` js - var logger = new (winston.Logger)({ - transports: [ - new (winston.transports.Console)(), - new (winston.transports.File)({ filename: 'somefile.log' }) - ] - }); -``` - -You can work with this logger in the same way that you work with the default logger: - -``` js - // - // Logging - // - logger.log('info', 'Hello distributed log files!'); - logger.info('Hello again distributed logs'); - - // - // Adding / Removing Transports - // (Yes It's chainable) - // - logger.add(winston.transports.File) - .remove(winston.transports.Console); -``` - -### Handling Uncaught Exceptions with winston - -With `winston`, it is possible to catch and log `uncaughtException` events from your process. There are two distinct ways of enabling this functionality either through the default winston logger or your own logger instance. - -If you want to use this feature with the default logger simply call `.handleExceptions()` with a transport instance. - -``` js - // - // You can add a separate exception logger by passing it to `.handleExceptions` - // - winston.handleExceptions(new winston.transports.File({ filename: 'path/to/exceptions.log' })) - - // - // Alternatively you can set `.handleExceptions` to true when adding transports to winston - // - winston.add(winston.transports.File, { - filename: 'path/to/all-logs.log', - handleExceptions: true - }); -``` - -## to exit or not to exit - -by default, winston will exit after logging an uncaughtException. if this is not the behavior you want, -set `exitOnError = false` - -``` js - var logger = new (winston.Logger)({ exitOnError: false }); - - // - // or, like this: - // - logger.exitOnError = false; -``` - -When working with custom logger instances, you can pass in separate transports to the `exceptionHandlers` property or set `.handleExceptions` on any transport. - -``` js - var logger = new (winston.Logger)({ - transports: [ - new winston.transports.File({ filename: 'path/to/all-logs.log' }) - ] - exceptionHandlers: [ - new winston.transports.File({ filename: 'path/to/exceptions.log' }) - ] - }); -``` - -The `exitOnError` option can also be a function to prevent exit on only certain types of errors: - -``` js - function ignoreEpipe(err) { - return err.code !== 'EPIPE'; - } - - var logger = new (winston.Logger)({ exitOnError: ignoreEpipe }); - - // - // or, like this: - // - logger.exitOnError = ignoreEpipe; -``` - -### Using Logging Levels -Setting the level for your logging message can be accomplished in one of two ways. You can pass a string representing the logging level to the log() method or use the level specified methods defined on every winston Logger. - -``` js - // - // Any logger instance - // - logger.log('info', "127.0.0.1 - there's no place like home"); - logger.info("127.0.0.1 - there's no place like home"); - - // - // Default logger - // - winston.log('info', "127.0.0.1 - there's no place like home"); - winston.info("127.0.0.1 - there's no place like home"); -``` - -As of 0.2.0, winston supports customizable logging levels, defaulting to [npm][0] style logging levels. Changing logging levels is easy: - -``` js - // - // Change levels on the default winston logger - // - winston.setLevels(winston.config.syslog.levels); - - // - // Change levels on an instance of a logger - // - logger.setLevels(winston.config.syslog.levels); -``` - -Calling `.setLevels` on a logger will remove all of the previous helper methods for the old levels and define helper methods for the new levels. Thus, you should be careful about the logging statements you use when changing levels. For example, if you ran this code after changing to the syslog levels: - -``` js - // - // Logger does not have 'silly' defined since that level is not in the syslog levels - // - logger.silly('some silly message'); -``` - -### Using Custom Logging Levels -In addition to the predefined `npm` and `syslog` levels available in Winston, you can also choose to define your own: - -``` js - var myCustomLevels = { - levels: { - foo: 0, - bar: 1, - baz: 2, - foobar: 3 - }, - colors: { - foo: 'blue', - bar: 'green', - baz: 'yellow', - foobar: 'red' - } - }; - - var customLevelLogger = new (winston.Logger)({ levels: myCustomLevels.levels }); - customLevelLogger.foobar('some foobar level-ed message'); -``` - -Although there is slight repetition in this data structure, it enables simple encapsulation if you not to have colors. If you do wish to have colors, in addition to passing the levels to the Logger itself, you must make winston aware of them: - -``` js - // - // Make winston aware of these colors - // - winston.addColors(myCustomLevels.colors); -``` - -This enables transports with the 'colorize' option set to appropriately color the output of custom levels. - -### Events and Callbacks in Winston -Each instance of winston.Logger is also an instance of an [EventEmitter][1]. A log event will be raised each time a transport successfully logs a message: - -``` js - logger.on('logging', function (transport, level, msg, meta) { - // [msg] and [meta] have now been logged at [level] to [transport] - }); - - logger.info('CHILL WINSTON!', { seriously: true }); -``` - -It is also worth mentioning that the logger also emits an 'error' event which you should handle or suppress if you don't want unhandled exceptions: - -``` js - // - // Handle errors - // - logger.on('error', function (err) { /* Do Something */ }); - - // - // Or just suppress them. - // - logger.emitErrs = false; -``` - -Every logging method described in the previous section also takes an optional callback which will be called only when all of the transports have logged the specified message. - -``` js - logger.info('CHILL WINSTON!', { seriously: true }, function (err, level, msg, meta) { - // [msg] and [meta] have now been logged at [level] to **every** transport. - }); -``` - -### Working with multiple Loggers in winston - -Often in larger, more complex applications it is necessary to have multiple logger instances with different settings. Each logger is responsible for a different feature area (or category). This is exposed in `winston` in two ways: through `winston.loggers` and instances of `winston.Container`. In fact, `winston.loggers` is just a predefined instance of `winston.Container`: - -``` js - var winston = require('winston'); - - // - // Configure the logger for `category1` - // - winston.loggers.add('category1', { - console: { - level: 'silly', - colorize: 'true' - }, - file: { - filename: '/path/to/some/file' - } - }); - - // - // Configure the logger for `category2` - // - winston.loggers.add('category2', { - couchdb: { - host: '127.0.0.1', - port: 5984 - } - }); -``` - -Now that your loggers are setup you can require winston _in any file in your application_ and access these pre-configured loggers: - -``` js - var winston = require('winston'); - - // - // Grab your preconfigured logger - // - var category1 = winston.loggers.get('category1'); - - category1.info('logging from your IoC container-based logger'); -``` - -If you prefer to manage the `Container` yourself you can simply instantiate one: - -``` js - var winston = require('winston'), - container = new winston.Container(); - - container.add('category1', { - console: { - level: 'silly', - colorize: 'true' - }, - file: { - filename: '/path/to/some/file' - } - }); -``` - -### Sharing transports between Loggers in winston - -``` js - var winston = require('winston'); - - // - // Setup transports to be shared across all loggers - // in three ways: - // - // 1. By setting it on the default Container - // 2. By passing `transports` into the constructor function of winston.Container - // 3. By passing `transports` into the `.get()` or `.add()` methods - // - - // - // 1. By setting it on the default Container - // - winston.loggers.options.transports = [ - // Setup your shared transports here - ]; - - // - // 2. By passing `transports` into the constructor function of winston.Container - // - var container = new winston.Container({ - transports: [ - // Setup your shared transports here - ] - }); - - // - // 3. By passing `transports` into the `.get()` or `.add()` methods - // - winston.loggers.add('some-category', { - transports: [ - // Setup your shared transports here - ] - }); - - container.add('some-category', { - transports: [ - // Setup your shared transports here - ] - }); -``` - -### Logging with Metadata -In addition to logging string messages, winston will also optionally log additional JSON metadata objects. Adding metadata is simple: - -``` js - winston.log('info', 'Test Log Message', { anything: 'This is metadata' }); -``` - -The way these objects is stored varies from transport to transport (to best support the storage mechanisms offered). Here's a quick summary of how each transports handles metadata: - -1. __Console:__ Logged via util.inspect(meta) -2. __File:__ Logged via util.inspect(meta) -3. __Loggly:__ Logged in suggested [Loggly format][2] - -### Profiling with Winston -In addition to logging messages and metadata, winston also has a simple profiling mechanism implemented for any logger: - -``` js - // - // Start profile of 'test' - // Remark: Consider using Date.now() with async operations - // - winston.profile('test'); - - setTimeout(function () { - // - // Stop profile of 'test'. Logging will now take place: - // "17 Jan 21:00:00 - info: test duration=1000ms" - // - winston.profile('test'); - }, 1000); -``` - -All profile messages are set to the 'info' by default and both message and metadata are optional There are no plans in the Roadmap to make this configurable, but I'm open to suggestions / issues. - -### Using winston in a CLI tool -A common use-case for logging is output to a CLI tool. Winston has a special helper method which will pretty print output from your CLI tool. Here's an example from the [require-analyzer][15] written by [Nodejitsu][5]: - -``` - info: require-analyzer starting in /Users/Charlie/Nodejitsu/require-analyzer - info: Found existing dependencies - data: { - data: colors: '0.x.x', - data: eyes: '0.1.x', - data: findit: '0.0.x', - data: npm: '1.0.x', - data: optimist: '0.2.x', - data: semver: '1.0.x', - data: winston: '0.2.x' - data: } - info: Analyzing dependencies... - info: Done analyzing raw dependencies - info: Retrieved packages from npm - warn: No additional dependencies found -``` - -Configuring output for this style is easy, just use the `.cli()` method on `winston` or an instance of `winston.Logger`: - -``` js - var winston = require('winston'); - - // - // Configure CLI output on the default logger - // - winston.cli(); - - // - // Configure CLI on an instance of winston.Logger - // - var logger = new winston.Logger({ - transports: [ - new (winston.transports.Console)() - ] - }); - - logger.cli(); -``` - -### Extending another object with Logging functionality -Often in a given code base with lots of Loggers it is useful to add logging methods a different object so that these methods can be called with less syntax. Winston exposes this functionality via the 'extend' method: - -``` js - var myObject = {}; - - logger.extend(myObject); - - // - // You can now call logger methods on 'myObject' - // - myObject.info('127.0.0.1 - there's no place like home'); -``` - -## Working with Transports -Right now there are four transports supported by winston core. If you have a transport you would like to add either open an issue or fork and submit a pull request. Commits are welcome, but I'll give you extra street cred if you __add tests too :D__ - -1. __Console:__ Output to the terminal -2. __Files:__ Append to a file -3. __Loggly:__ Log to Logging-as-a-Service platform Loggly - -### Console Transport -``` js - winston.add(winston.transports.Console, options) -``` - -The Console transport takes two simple options: - -* __level:__ Level of messages that this transport should log (default 'debug'). -* __silent:__ Boolean flag indicating whether to suppress output (default false). -* __colorize:__ Boolean flag indicating if we should colorize output (default false). -* __timestamp:__ Boolean flag indicating if we should prepend output with timestamps (default false). - -*Metadata:* Logged via util.inspect(meta); - -### File Transport -``` js - winston.add(winston.transports.File, options) -``` - -The File transport should really be the 'Stream' transport since it will accept any [WritableStream][14]. It is named such because it will also accept filenames via the 'filename' option: - -* __level:__ Level of messages that this transport should log. -* __silent:__ Boolean flag indicating whether to suppress output. -* __colorize:__ Boolean flag indicating if we should colorize output. -* __filename:__ The filename of the logfile to write output to. -* __maxsize:__ Max size in bytes of the logfile, if the size is exceeded then a new file is created. -* __maxFiles:__ Limit the number of files created when the size of the logfile is exceeded. -* __stream:__ The WriteableStream to write output to. - -*Metadata:* Logged via util.inspect(meta); - -### Loggly Transport -``` js - winston.add(winston.transports.Loggly, options); -``` - -The Loggly transport is based on [Nodejitsu's][5] [node-loggly][6] implementation of the [Loggly][7] API. If you haven't heard of Loggly before, you should probably read their [value proposition][8]. The Loggly transport takes the following options. Either 'inputToken' or 'inputName' is required: - -* __level:__ Level of messages that this transport should log. -* __subdomain:__ The subdomain of your Loggly account. *[required]* -* __auth__: The authentication information for your Loggly account. *[required with inputName]* -* __inputName:__ The name of the input this instance should log to. -* __inputToken:__ The input token of the input this instance should log to. -* __json:__ If true, messages will be sent to Loggly as JSON. - -*Metadata:* Logged in suggested [Loggly format][2] - -### Riak Transport -As of `0.3.0` the Riak transport has been broken out into a new module: [winston-riak][17]. Using it is just as easy: - -``` js - var Riak = require('winston-riak').Riak; - winston.add(Riak, options); -``` - -In addition to the options accepted by the [riak-js][3] [client][4], the Riak transport also accepts the following options. It is worth noting that the riak-js debug option is set to *false* by default: - -* __level:__ Level of messages that this transport should log. -* __bucket:__ The name of the Riak bucket you wish your logs to be in or a function to generate bucket names dynamically. - -``` js - // Use a single bucket for all your logs - var singleBucketTransport = new (Riak)({ bucket: 'some-logs-go-here' }); - - // Generate a dynamic bucket based on the date and level - var dynamicBucketTransport = new (Riak)({ - bucket: function (level, msg, meta, now) { - var d = new Date(now); - return level + [d.getDate(), d.getMonth(), d.getFullYear()].join('-'); - } - }); -``` - -*Metadata:* Logged as JSON literal in Riak - -### MongoDB Transport -As of `0.3.0` the MongoDB transport has been broken out into a new module: [winston-mongodb][16]. Using it is just as easy: - -``` js - var MongoDB = require('winston-mongodb').MongoDB; - winston.add(MongoDB, options); -``` - -The MongoDB transport takes the following options. 'db' is required: - -* __level:__ Level of messages that this transport should log. -* __silent:__ Boolean flag indicating whether to suppress output. -* __db:__ The name of the database you want to log to. *[required]* -* __collection__: The name of the collection you want to store log messages in, defaults to 'log'. -* __safe:__ Boolean indicating if you want eventual consistency on your log messages, if set to true it requires an extra round trip to the server to ensure the write was committed, defaults to true. -* __host:__ The host running MongoDB, defaults to localhost. -* __port:__ The port on the host that MongoDB is running on, defaults to MongoDB's default port. - -*Metadata:* Logged as a native JSON object. - -### SimpleDB Transport - -The [winston-simpledb][18] transport is just as easy: - -``` js - var SimpleDB = require('winston-simpledb').SimpleDB; - winston.add(SimpleDB, options); -``` - -The SimpleDB transport takes the following options. All items marked with an asterisk are required: - -* __awsAccessKey__:* your AWS Access Key -* __secretAccessKey__:* your AWS Secret Access Key -* __awsAccountId__:* your AWS Account Id -* __domainName__:* a string or function that returns the domain name to log to -* __region__:* the region your domain resides in -* __itemName__: a string ('uuid', 'epoch', 'timestamp') or function that returns the item name to log - -*Metadata:* Logged as a native JSON object to the 'meta' attribute of the item. - -### Mail Transport - -The [winston-mail][19] is an email transport: - -``` js - var Mail = require('winston-mail').Mail; - winston.add(Mail, options); -``` - -The Mail transport uses [node-mail][20] behind the scenes. Options are the following, `to` and `host` are required: - -* __to:__ The address(es) you want to send to. *[required]* -* __from:__ The address you want to send from. (default: `winston@[server-host-name]`) -* __host:__ SMTP server hostname -* __port:__ SMTP port (default: 587 or 25) -* __secure:__ Use secure -* __username__ User for server auth -* __password__ Password for server auth -* __level:__ Level of messages that this transport should log. -* __silent:__ Boolean flag indicating whether to suppress output. - -*Metadata:* Stringified as JSON in email. - -### Amazon SNS (Simple Notification System) Transport - -The [winston-sns][21] transport uses amazon SNS to send emails, texts, or a bunch of other notifications. - -``` js - require('winston-sns').SNS; - winston.add(winston.transports.SNS, options); -``` - -Options: - -* __aws_key:__ Your Amazon Web Services Key. *[required]* -* __aws_secret:__ Your Amazon Web Services Secret. *[required]* -* __subscriber:__ Subscriber number - found in your SNS AWS Console, after clicking on a topic. Same as AWS Account ID. *[required]* -* __topic_arn:__ Also found in SNS AWS Console - listed under a topic as Topic ARN. *[required]* -* __region:__ AWS Region to use. Can be one of: `us-east-1`,`us-west-1`,`eu-west-1`,`ap-southeast-1`,`ap-northeast-1`,`us-gov-west-1`,`sa-east-1`. (default: `us-east-1`) -* __subject:__ Subject for notifications. (default: "Winston Error Report") -* __message:__ Message of notifications. Uses placeholders for level (%l), error message (%e), and metadata (%m). (default: "Level '%l' Error:\n%e\n\nMetadata:\n%m") -* __level:__ lowest level this transport will log. (default: `info`) - -### Graylog2 Transport - -[winston-graylog2][22] is a Graylog2 transport: - -``` js - var Graylog2 = require('winston-graylog2').Graylog2; - winston.add(Graylog2, options); -``` - -The Graylog2 transport connects to a Graylog2 server over UDP using the following options: - -* __level:__ Level of messages this transport should log. (default: info) -* __silent:__ Boolean flag indicating whether to suppress output. (default: false) - -* __graylogHost:__ IP address or hostname of the graylog2 server. (default: localhost) -* __graylogPort:__ Port to send messages to on the graylog2 server. (default: 12201) -* __graylogHostname:__ The hostname associated with graylog2 messages. (default: require('os').hostname()) -* __graylogFacility:__ The graylog2 facility to send log messages.. (default: nodejs) - -*Metadata:* Stringified as JSON in the full message GELF field. - -### Adding Custom Transports -Adding a custom transport (say for one of the datastore on the Roadmap) is actually pretty easy. All you need to do is accept a couple of options, set a name, implement a log() method, and add it to the set of transports exposed by winston. - -``` js - var util = require('util'), - winston = require('winston'); - - var CustomLogger = winston.transports.CustomerLogger = function (options) { - // - // Name this logger - // - this.name = 'customLogger'; - - // - // Set the level from your options - // - this.level = options.level || 'info'; - - // - // Configure your storage backing as you see fit - // - }; - - // - // Inherit from `winston.Transport` so you can take advantage - // of the base functionality and `.handleExceptions()`. - // - util.inherits(CustomLogger, winston.Transport); - - CustomLogger.prototype.log = function (level, msg, meta, callback) { - // - // Store this message and metadata, maybe use some custom logic - // then callback indicating success. - // - callback(null, true); - }; -``` - -## What's Next? -Winston is stable and under active development. It is supported by and used at [Nodejitsu][5]. - -### Inspirations -1. [npm][0] -2. [log.js][9] -3. [socket.io][10] -4. [node-rlog][11] -5. [BigBrother][12] -6. [Loggly][7] - -### Road Map -1. Improve support for adding custom Transports not defined in Winston core. -2. Create API for reading from logs across all transports. -3. Add more transports: Redis - -## Run Tests -All of the winston tests are written in [vows][13], and cover all of the use cases described above. You will need to add valid credentials for the various transports included to test/fixtures/test-config.json before running tests: - -``` js - { - "transports": { - "loggly": { - "subdomain": "your-subdomain", - "inputToken": "really-long-token-you-got-from-loggly", - "auth": { - "username": "your-username", - "password": "your-password" - } - } - } - } -``` - -Once you have valid configuration and credentials you can run tests with [vows][13]: - -``` - vows --spec --isolate -``` - -#### Author: [Charlie Robbins](http://twitter.com/indexzero) -#### Contributors: [Matthew Bergman](http://github.com/fotoverite), [Marak Squires](http://github.com/marak) - -[0]: https://github.com/isaacs/npm/blob/master/lib/utils/log.js -[1]: http://nodejs.org/docs/v0.3.5/api/events.html#events.EventEmitter -[2]: http://wiki.loggly.com/loggingfromcode -[3]: http://riakjs.org -[4]: https://github.com/frank06/riak-js/blob/master/src/http_client.coffee#L10 -[5]: http://nodejitsu.com -[6]: http://github.com/nodejitsu/node-loggly -[7]: http://loggly.com -[8]: http://www.loggly.com/product/ -[9]: https://github.com/visionmedia/log.js -[10]: http://socket.io -[11]: https://github.com/jbrisbin/node-rlog -[12]: https://github.com/feisty/BigBrother -[13]: http://vowsjs.org -[14]: http://nodejs.org/docs/v0.3.5/api/streams.html#writable_Stream -[15]: http://github.com/nodejitsu/require-analyzer -[16]: http://github.com/indexzero/winston-mongodb -[17]: http://github.com/indexzero/winston-riak -[18]: http://github.com/appsattic/winston-simpledb -[19]: http://github.com/wavded/winston-mail -[20]: https://github.com/weaver/node-mail -[21]: https://github.com/jesseditson/winston-sns -[22]: https://github.com/flite/winston-graylog2 diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/docco.css b/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/docco.css deleted file mode 100644 index bd54134..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/docco.css +++ /dev/null @@ -1,194 +0,0 @@ -/*--------------------- Layout and Typography ----------------------------*/ -body { - font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; - font-size: 15px; - line-height: 22px; - color: #252519; - margin: 0; padding: 0; -} -a { - color: #261a3b; -} - a:visited { - color: #261a3b; - } -p { - margin: 0 0 15px 0; -} -h4, h5, h6 { - color: #333; - margin: 6px 0 6px 0; - font-size: 13px; -} - h2, h3 { - margin-bottom: 0; - color: #000; - } - h1 { - margin-top: 40px; - margin-bottom: 15px; - color: #000; - } -#container { - position: relative; -} -#background { - position: fixed; - top: 0; left: 525px; right: 0; bottom: 0; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - z-index: -1; -} -#jump_to, #jump_page { - background: white; - -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; - -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; - font: 10px Arial; - text-transform: uppercase; - cursor: pointer; - text-align: right; -} -#jump_to, #jump_wrapper { - position: fixed; - right: 0; top: 0; - padding: 5px 10px; -} - #jump_wrapper { - padding: 0; - display: none; - } - #jump_to:hover #jump_wrapper { - display: block; - } - #jump_page { - padding: 5px 0 3px; - margin: 0 0 25px 25px; - } - #jump_page .source { - display: block; - padding: 5px 10px; - text-decoration: none; - border-top: 1px solid #eee; - } - #jump_page .source:hover { - background: #f5f5ff; - } - #jump_page .source:first-child { - } -table td { - border: 0; - outline: 0; -} - td.docs, th.docs { - max-width: 450px; - min-width: 450px; - min-height: 5px; - padding: 10px 25px 1px 50px; - overflow-x: hidden; - vertical-align: top; - text-align: left; - } - .docs pre { - margin: 15px 0 15px; - padding-left: 15px; - } - .docs p tt, .docs p code { - background: #f8f8ff; - border: 1px solid #dedede; - font-size: 12px; - padding: 0 0.2em; - } - .pilwrap { - position: relative; - } - .pilcrow { - font: 12px Arial; - text-decoration: none; - color: #454545; - position: absolute; - top: 3px; left: -20px; - padding: 1px 2px; - opacity: 0; - -webkit-transition: opacity 0.2s linear; - } - td.docs:hover .pilcrow { - opacity: 1; - } - td.code, th.code { - padding: 14px 15px 16px 25px; - width: 100%; - vertical-align: top; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - } - pre, tt, code { - font-size: 12px; line-height: 18px; - font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; - margin: 0; padding: 0; - } - - -/*---------------------- Syntax Highlighting -----------------------------*/ -td.linenos { background-color: #f0f0f0; padding-right: 10px; } -span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } -body .hll { background-color: #ffffcc } -body .c { color: #408080; font-style: italic } /* Comment */ -body .err { border: 1px solid #FF0000 } /* Error */ -body .k { color: #954121 } /* Keyword */ -body .o { color: #666666 } /* Operator */ -body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ -body .cp { color: #BC7A00 } /* Comment.Preproc */ -body .c1 { color: #408080; font-style: italic } /* Comment.Single */ -body .cs { color: #408080; font-style: italic } /* Comment.Special */ -body .gd { color: #A00000 } /* Generic.Deleted */ -body .ge { font-style: italic } /* Generic.Emph */ -body .gr { color: #FF0000 } /* Generic.Error */ -body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -body .gi { color: #00A000 } /* Generic.Inserted */ -body .go { color: #808080 } /* Generic.Output */ -body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -body .gs { font-weight: bold } /* Generic.Strong */ -body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -body .gt { color: #0040D0 } /* Generic.Traceback */ -body .kc { color: #954121 } /* Keyword.Constant */ -body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ -body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ -body .kp { color: #954121 } /* Keyword.Pseudo */ -body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ -body .kt { color: #B00040 } /* Keyword.Type */ -body .m { color: #666666 } /* Literal.Number */ -body .s { color: #219161 } /* Literal.String */ -body .na { color: #7D9029 } /* Name.Attribute */ -body .nb { color: #954121 } /* Name.Builtin */ -body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ -body .no { color: #880000 } /* Name.Constant */ -body .nd { color: #AA22FF } /* Name.Decorator */ -body .ni { color: #999999; font-weight: bold } /* Name.Entity */ -body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -body .nf { color: #0000FF } /* Name.Function */ -body .nl { color: #A0A000 } /* Name.Label */ -body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -body .nt { color: #954121; font-weight: bold } /* Name.Tag */ -body .nv { color: #19469D } /* Name.Variable */ -body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -body .w { color: #bbbbbb } /* Text.Whitespace */ -body .mf { color: #666666 } /* Literal.Number.Float */ -body .mh { color: #666666 } /* Literal.Number.Hex */ -body .mi { color: #666666 } /* Literal.Number.Integer */ -body .mo { color: #666666 } /* Literal.Number.Oct */ -body .sb { color: #219161 } /* Literal.String.Backtick */ -body .sc { color: #219161 } /* Literal.String.Char */ -body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ -body .s2 { color: #219161 } /* Literal.String.Double */ -body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -body .sh { color: #219161 } /* Literal.String.Heredoc */ -body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -body .sx { color: #954121 } /* Literal.String.Other */ -body .sr { color: #BB6688 } /* Literal.String.Regex */ -body .s1 { color: #219161 } /* Literal.String.Single */ -body .ss { color: #19469D } /* Literal.String.Symbol */ -body .bp { color: #954121 } /* Name.Builtin.Pseudo */ -body .vc { color: #19469D } /* Name.Variable.Class */ -body .vg { color: #19469D } /* Name.Variable.Global */ -body .vi { color: #19469D } /* Name.Variable.Instance */ -body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston.html deleted file mode 100644 index 0c7f087..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston.html +++ /dev/null @@ -1,86 +0,0 @@ - winston.js

      winston.js

      /*
      - * winston.js: Top-level include defining Winston.
      - *
      - * (C) 2010 Charlie Robbins
      - * MIT LICENCE
      - *
      - */
      -
      -var winston = exports;

      Expose version using pkginfo

      require('pkginfo')(module, 'version');

      Include transports defined by default by winston

      winston.transports = require('./winston/transports');
      -
      -var common           = require('./winston/common');
      -winston.hash           = common.hash;
      -winston.clone          = common.clone;
      -winston.longestElement = common.longestElement;
      -winston.exception      = require('./winston/exception');
      -winston.config         = require('./winston/config');
      -winston.addColors      = winston.config.addColors; 
      -winston.Logger         = require('./winston/logger').Logger;
      -winston.Transport      = require('./winston/transports/transport').Transport;

      We create and expose a 'defaultLogger' so that the programmer may do the -following without the need to create an instance of winston.Logger directly:

      - -
      var winston = require('winston');
      -winston.log('info', 'some message');
      -winston.error('some error'); 
      -
      var defaultLogger = new winston.Logger({ 
      -  transports: [new winston.transports.Console()] 
      -});

      Pass through the target methods onto `winston.

      var methods = [
      -  'log', 
      -  'add', 
      -  'remove', 
      -  'profile', 
      -  'extend', 
      -  'cli', 
      -  'handleExceptions', 
      -  'unhandleExceptions'
      -];
      -common.setLevels(winston, null, defaultLogger.levels);
      -methods.forEach(function (method) {
      -  winston[method] = function () {
      -    return defaultLogger[method].apply(defaultLogger, arguments);
      -  };
      -});

      function cli ()

      - -

      Configures the default winston logger to have the -settings for command-line interfaces: no timestamp, -colors enabled, padded output, and additional levels.

      winston.cli = function () {
      -  winston.padLevels = true;
      -  common.setLevels(winston, defaultLogger.levels, winston.config.cli.levels);
      -  defaultLogger.setLevels(winston.config.cli.levels);
      -  winston.config.addColors(winston.config.cli.colors);
      -  
      -  if (defaultLogger.transports.console) {
      -    defaultLogger.transports.console.colorize = true;
      -    defaultLogger.transports.console.timestamp = false;
      -  }
      -  
      -  return winston;
      -};

      function setLevels (target)

      - -

      @target {Object} Target levels to use

      - -

      Sets the target levels specified on the default winston logger.

      winston.setLevels = function (target) {
      -  common.setLevels(winston, defaultLogger.levels, target);
      -  defaultLogger.setLevels(target);
      -};

      Define getters / setters for appropriate properties of the -default logger which need to be exposed by winston.

      ['emitErrs', 'padLevels', 'levelLength'].forEach(function (prop) {
      -  Object.defineProperty(winston, prop, {
      -    get: function () {
      -      return defaultLogger[prop];
      -    },
      -    set: function (val) {
      -      defaultLogger[prop] = val;
      -    }
      -  });
      -});

      @default {Object} -The default transports and exceptionHandlers for -the default winston logger.

      Object.defineProperty(winston, 'default', {
      -  get: function () {
      -    return {
      -      transports: defaultLogger.transports,
      -      exceptionHandlers: defaultLogger.exceptionHandlers
      -    };
      -  }
      -});
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/common.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/common.html deleted file mode 100644 index 1ab139c..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/common.html +++ /dev/null @@ -1,140 +0,0 @@ - common.js

      common.js

      /*
      - * common.js: Internal helper and utility functions for winston
      - *
      - * (C) 2010 Charlie Robbins
      - * MIT LICENCE
      - *
      - */
      -
      -var util = require('util'),
      -    crypto = require('crypto'),
      -    loggly = require('loggly'),
      -    config = require('./config');

      function setLevels (target, past, current)

      - -

      @target {Object} Object on which to set levels.

      - -

      @past {Object} Previous levels set on target.

      - -

      @current {Object} Current levels to set on target.

      - -

      Create functions on the target objects for each level -in current.levels. If past is defined, remove functions -for each of those levels.

      exports.setLevels = function (target, past, current, isDefault) {
      -  if (past) {
      -    Object.keys(past).forEach(function (level) {
      -      delete target[level];
      -    });
      -  }
      -
      -  target.levels = current || config.npm.levels;
      -  if (target.padLevels) {
      -    target.levelLength = exports.longestElement(Object.keys(target.levels));
      -  }
      -  

      Define prototype methods for each log level - e.g. target.log('info', msg) <=> target.info(msg)

        Object.keys(target.levels).forEach(function (level) {
      -    target[level] = function (msg) {
      -      var args     = Array.prototype.slice.call(arguments),
      -          callback = typeof args[args.length - 1] === 'function' ? args.pop() : null,
      -          meta     = args.length === 2 ? args.pop() : null;
      -
      -      return target.log(level, msg, meta, callback);
      -    };
      -  });
      -  
      -  return target;
      -};

      function longestElement

      - -

      @xs {Array} Array to calculate against

      - -

      Returns the longest element in the xs array.

      exports.longestElement = function (xs) {
      -  return Math.max.apply(
      -    null,
      -    xs.map(function (x) { return x.length })
      -  );
      -};

      function clone (obj)

      - -

      @obj {Object} Object to clone.

      - -

      Helper method for deep cloning pure JSON objects -i.e. JSON objects that are either literals or objects (no Arrays, etc)

      exports.clone = function (obj) {
      -  var copy = {};
      -  for (var i in obj) {
      -    if (Array.isArray(obj[i])) {
      -      copy[i] = obj[i].slice(0);
      -    }
      -    else {
      -      copy[i] = obj[i] instanceof Object ? exports.clone(obj[i]) : obj[i];
      -    }
      -  }
      -
      -  return copy;
      -};

      function log (options)

      - -

      @options {Object} All information about the log serialization.

      - -

      Generic logging function for returning timestamped strings -with the following options:

      - -

      { - level: 'level to add to serialized message', - message: 'message to serialize', - meta: 'additional logging metadata to serialize', - colorize: false, // Colorizes output (only if .json is false) - timestamp: true // Adds a timestamp to the serialized message - }

      exports.log = function (options) {
      -  var timestampFn = typeof options.timestamp === 'function' ? options.timestamp : exports.timestamp,
      -      timestamp   = options.timestamp ? timestampFn() : null,
      -      meta        = options.meta ? exports.clone(options.meta) : null,
      -      output;
      -
      -  if (options.json) {
      -    output         = meta || {};
      -    output.level   = options.level;
      -    output.message = options.message;
      -    
      -    if (timestamp) {
      -      output.timestamp = timestamp;
      -    }
      -    
      -    return JSON.stringify(output);
      -  }
      -
      -  output = timestamp ? timestamp + ' - ' : '';
      -  output += options.colorize ? config.colorize(options.level) : options.level;
      -  output += (': ' + options.message);
      -
      -  if (meta && typeof meta === 'object' && Object.keys(meta).length > 0) {
      -    output += ' ' + loggly.serialize(meta);
      -  }
      -
      -  return output;
      -};

      function hash (str)

      - -

      @str {string} String to hash.

      - -

      Utility function for creating unique ids -e.g. Profiling incoming HTTP requests on the same tick

      exports.hash = function (str) {
      -  return crypto.createHash('sha1').update(str).digest('hex');
      -};

      Borrowed from node.js core

      - -

      I wanted a universal lowercase header message, as opposed to the DEBUG -(i.e. all uppercase header) used only in util.debug()

      var months = ['Jan', 'Feb', 'Mar', 'Apr', 
      -              'May', 'Jun', 'Jul', 'Aug', 
      -              'Sep', 'Oct', 'Nov', 'Dec'];

      function pad (n)

      - -

      Returns a padded string if n < 10.

      exports.pad = function (n) {
      -  return n < 10 ? '0' + n.toString(10) : n.toString(10);
      -};

      function timestamp ()

      - -

      Returns a timestamp string for the current time.

      exports.timestamp = function () {
      -  var d = new Date();
      -  var time = [
      -    exports.pad(d.getHours()),
      -    exports.pad(d.getMinutes()),
      -    exports.pad(d.getSeconds())
      -  ].join(':');
      -              
      -  return [d.getDate(), months[d.getMonth()], time].join(' ');
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/config.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/config.html deleted file mode 100644 index c623d64..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/config.html +++ /dev/null @@ -1,37 +0,0 @@ - config.js

      config.js

      /*
      - * config.js: Default settings for all levels that winston knows about 
      - *
      - * (C) 2010 Charlie Robbins
      - * MIT LICENCE
      - *
      - */
      -
      -var colors = require('colors');
      -
      -var config = exports, 
      -    allColors = exports.allColors = {};
      -
      -config.addColors = function (colors) {
      -  mixin(allColors, colors);
      -};
      -
      -config.colorize = function (level) {
      -  return level[allColors[level]];
      -};

      Export config sets

      config.cli    = require('./config/cli-config');
      -config.npm    = require('./config/npm-config');
      -config.syslog = require('./config/syslog-config');

      Add colors for pre-defined config sets

      config.addColors(config.npm.colors);
      -config.addColors(config.syslog.colors);
      -
      -function mixin (target) {
      -  var args = Array.prototype.slice.call(arguments, 1);
      -
      -  args.forEach(function (a) {
      -    var keys = Object.keys(a);
      -    for (var i = 0; i < keys.length; i++) {
      -      target[keys[i]] = a[keys[i]];
      -    }
      -  });
      -  return target;
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/config/cli-config.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/config/cli-config.html deleted file mode 100644 index 075edd0..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/config/cli-config.html +++ /dev/null @@ -1,37 +0,0 @@ - cli-config.js

      cli-config.js

      /*
      - * cli-config.js: Config that conform to commonly used CLI logging levels. 
      - *
      - * (C) 2010 Charlie Robbins
      - * MIT LICENCE
      - *
      - */
      - 
      -var cliConfig = exports;
      -
      -cliConfig.levels = {
      -  silly: 0,
      -  input: 1,
      -  verbose: 2,
      -  prompt: 3,
      -  info: 4,
      -  data: 5,
      -  help: 6,
      -  warn: 7,
      -  debug: 8,
      -  error: 9
      -};
      -
      -cliConfig.colors = {
      -  silly: 'magenta',
      -  input: 'grey',
      -  verbose: 'cyan',
      -  prompt: 'grey',
      -  info: 'green',
      -  data: 'grey',
      -  help: 'cyan',
      -  warn: 'yellow',
      -  debug: 'blue',
      -  error: 'red'
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/config/npm-config.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/config/npm-config.html deleted file mode 100644 index 8517430..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/config/npm-config.html +++ /dev/null @@ -1,29 +0,0 @@ - npm-config.js

      npm-config.js

      /*
      - * npm-config.js: Config that conform to npm logging levels. 
      - *
      - * (C) 2010 Charlie Robbins
      - * MIT LICENCE
      - *
      - */
      - 
      -var npmConfig = exports;
      -
      -npmConfig.levels = {
      -  silly: 0, 
      -  verbose: 1, 
      -  info: 2, 
      -  warn: 3,
      -  debug: 4, 
      -  error: 5
      -};
      -
      -npmConfig.colors = {
      -  silly: 'magenta',
      -  verbose: 'cyan',
      -  info: 'green',
      -  warn: 'yellow',
      -  debug: 'blue',
      -  error: 'red'
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/config/syslog-config.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/config/syslog-config.html deleted file mode 100644 index 6da0993..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/config/syslog-config.html +++ /dev/null @@ -1,33 +0,0 @@ - syslog-config.js

      syslog-config.js

      /*
      - * syslog-config.js: Config that conform to syslog logging levels. 
      - *
      - * (C) 2010 Charlie Robbins
      - * MIT LICENCE
      - *
      - */
      - 
      -var syslogConfig = exports;
      -
      -syslogConfig.levels = {
      -  debug: 0, 
      -  info: 1, 
      -  notice: 2, 
      -  warning: 3,
      -  error: 4, 
      -  crit: 5,
      -  alert: 6,
      -  emerg: 7
      -};
      -
      -syslogConfig.colors = {
      -  debug: 'blue',
      -  info: 'green',
      -  notice: 'yellow',
      -  warning: 'red',
      -  error: 'red', 
      -  crit: 'red',
      -  alert: 'yellow',
      -  emerg: 'red'
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/exception.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/exception.html deleted file mode 100644 index f6a4a6c..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/exception.html +++ /dev/null @@ -1,56 +0,0 @@ - exception.js

      exception.js

      /*
      - * exception.js: Utility methods for gathing information about uncaughtExceptions.
      - *
      - * (C) 2010 Charlie Robbins
      - * MIT LICENCE
      - *
      - */
      - 
      -var os = require('os'),
      -    stackTrace = require('stack-trace');
      -    
      -var exception = exports;
      -
      -exception.getAllInfo = function (err) {
      -  return {
      -    process: exception.getProcessInfo(),
      -    os:      exception.getOsInfo(),
      -    trace:   exception.getTrace(err)
      -  };
      -};
      -
      -exception.getProcessInfo = function () {
      -  return {
      -    pid:         process.pid,
      -    uid:         process.getuid(),
      -    gid:         process.getgid(),
      -    cwd:         process.cwd(),
      -    execPath:    process.execPath,
      -    version:     process.version,
      -    argv:        process.argv,
      -    memoryUsage: process.memoryUsage()
      -  };
      -};
      -
      -exception.getOsInfo = function () {
      -  return {
      -    loadavg: os.loadavg(),
      -    uptime:  os.uptime()
      -  };
      -};
      -
      -exception.getTrace = function (err) {
      -  var trace = err ? stackTrace.parse(err) : stackTrace.get();
      -  return trace.map(function (site) {
      -    return {
      -      column:   site.getColumnNumber(),
      -      file:     site.getFileName(),
      -      function: site.getFunctionName(),
      -      line:     site.getLineNumber(),
      -      method:   site.getMethodName(),
      -      native:   site.isNative(),
      -    }
      -  });
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/logger.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/logger.html deleted file mode 100644 index de7038a..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/logger.html +++ /dev/null @@ -1,344 +0,0 @@ - logger.js

      logger.js

      /*
      - * logger.js: Core logger object used by winston.
      - *
      - * (C) 2010 Charlie Robbins
      - * MIT LICENCE
      - *
      - */
      - 
      -var events = require('events'),
      -    util = require('util'),
      -    async = require('async'),
      -    config = require('./config'),
      -    common = require('./common'),
      -    exception = require('./exception');
      -
      -function capitalize(str) {
      -  return str && str[0].toUpperCase() + str.slice(1);
      -}

      Time constants

      var ticksPerMillisecond = 10000;

      function Logger (options)

      - -

      @options {Object} Options for this instance.

      - -

      Constructor function for the Logger object responsible -for persisting log messages and metadata to one or more transports.

      var Logger = exports.Logger = function (options) {
      -  events.EventEmitter.call(this);
      -  options = options || {};
      -  
      -  var self = this,
      -      handleExceptions = false;
      -  

      Set Levels and default logging level

        this.padLevels = options.padLevels || false;
      -  this.setLevels(options.levels);
      -  

      Setup other intelligent default settings.

        this.level             = options.level || 'info';
      -  this.emitErrs          = options.emitErrs || false;
      -  this.stripColors       = options.stripColors || false;
      -  this.transports        = {};
      -  this.exceptionHandlers = {};
      -  this.profilers         = {};
      -  this._names            = [];
      -  this._hnames           = [];
      -  
      -  if (options.transports) {
      -    options.transports.forEach(function (transport) {
      -      self.add(transport, null, true);
      -      
      -      if (transport.handleExceptions) {
      -        handleExceptions = true;
      -      }
      -    });
      -  }
      -  
      -  if (options.exceptionHandlers) {
      -    options.exceptionHandlers.forEach(function (handler) {
      -      self._hnames.push(handler.name);
      -      self.exceptionHandlers[handler.name] = handler;
      -    });
      -  }
      -  
      -  if (options.handleExceptions || handleExceptions) {
      -    this.handleExceptions();
      -  }
      -};

      Inherit from events.EventEmitter.

      util.inherits(Logger, events.EventEmitter);

      function extend (target)

      - -

      @target {Object} Target to extend.

      - -

      Extends the target object with a 'log' method -along with a method for each level in this instance.

      Logger.prototype.extend = function (target) {
      -  var self = this;
      -  ['log', 'profile'].concat(Object.keys(this.levels)).forEach(function (method) {
      -    target[method] = function () {
      -      return self[method].apply(self, arguments);
      -    };
      -  });
      -  
      -  return this;
      -};

      function log (level, msg, [meta], callback)

      - -

      @level {string} Level at which to log the message.

      - -

      @msg {string} Message to log

      - -

      @meta {Object} Optional Additional metadata to attach

      - -

      @callback {function} Continuation to respond to when complete.

      - -

      Core logging method exposed to Winston. Metadata is optional.

      Logger.prototype.log = function (level, msg) {
      -  var self = this, 
      -      callback,
      -      meta;
      -  
      -  if (arguments.length === 3) {
      -    if (typeof arguments[2] === 'function') {
      -      meta = {};
      -      callback = arguments[2];
      -    }
      -    else if (typeof arguments[2] === 'object') {
      -      meta = arguments[2];
      -    }
      -  }
      -  else if (arguments.length === 4) {
      -    meta = arguments[2];
      -    callback = arguments[3];
      -  }

      If we should pad for levels, do so

        if (this.padLevels) {
      -    msg = new Array(this.levelLength - level.length).join(' ') + msg;
      -  }
      -
      -  function onError (err) {
      -    if (callback) {
      -      callback(err);
      -    }
      -    else if (self.emitErrs) {
      -      self.emit('error', err);
      -    };
      -  }
      -  
      -  if (this.transports.length === 0) {
      -    return onError(new Error('Cannot log with no transports.'));
      -  }
      -  else if (typeof self.levels[level] === 'undefined') {
      -    return onError(new Error('Unknown log level: ' + level));
      -  }
      -  

      For consideration of terminal 'color" programs like colors.js, -which can add ANSI escape color codes to strings, we destyle the -ANSI color escape codes when this.stripColors is set.

      - -

      see: http://en.wikipedia.org/wiki/ANSIescapecode

        if (this.stripColors) {
      -    var code = /\u001b\[\d+m/g;
      -    msg = ('' + msg).replace(code, '');
      -  }
      -  
      -  for (var i = 0, l = this._names.length; i < l; i++) {
      -    var transport = this.transports[this._names[i]];
      -    if ((transport.level && self.levels[transport.level] <= self.levels[level])
      -      || (!transport.level && self.levels[self.level] <= self.levels[level])) {
      -      transport.log(level, msg, meta, function (err) {
      -        self.emit('logging', transport, level, msg, meta);
      -      });
      -    }
      -  }
      -  

      Immediately respond to the callback

        if (callback) {
      -    callback(null, level, msg, meta);    
      -  }
      -  
      -  return this;
      -};

      function handleExceptions ()

      - -

      Handles uncaughtException events for the current process

      Logger.prototype.handleExceptions = function () {
      -  var args = Array.prototype.slice.call(arguments),
      -      handlers = [],
      -      self = this;
      -      
      -  args.forEach(function (a) {
      -    if (Array.isArray(a)) {
      -      handlers = handlers.concat(a);
      -    }
      -    else {
      -      handlers.push(a);
      -    }
      -  });
      -  
      -  handlers.forEach(function (handler) {
      -    self.exceptionHandlers[handler.name] = handler;
      -  });
      -  
      -  this._hnames = Object.keys(self.exceptionHandlers);
      -    
      -  if (!this.catchExceptions) {
      -    this.catchExceptions = this._uncaughtException.bind(this);
      -    process.on('uncaughtException', this.catchExceptions);
      -  }
      -};

      function unhandleExceptions ()

      - -

      Removes any handlers to uncaughtException events -for the current process

      Logger.prototype.unhandleExceptions = function () {
      -  var self = this;
      -  
      -  if (this.catchExceptions) {
      -    Object.keys(this.exceptionHandlers).forEach(function (name) {
      -      if (handler.close) {
      -        handler.close();
      -      }
      -    });
      -    
      -    this.exceptionHandlers = {};
      -    Object.keys(this.transports).forEach(function (name) {
      -      var transport = self.transports[name];
      -      if (transport.handleExceptions) {
      -        transport.handleExceptions = false;
      -      }
      -    })
      -    
      -    process.removeListener('uncaughtException', this.catchExceptions);
      -    this.catchExceptions = false;    
      -  }
      -};

      function add (transport, [options])

      - -

      @transport {Transport} Prototype of the Transport object to add.

      - -

      @options {Object} Optional Options for the Transport to add.

      - -

      @instance {Boolean} Optional Value indicating if transport is already instantiated.

      - -

      Adds a transport of the specified type to this instance.

      Logger.prototype.add = function (transport, options, created) {
      -  var instance = created ? transport : (new (transport)(options));
      -  
      -  if (!instance.name && !instance.log) {
      -    throw new Error('Unknown transport with no log() method');
      -  }
      -  else if (this.transports[instance.name]) {
      -    throw new Error('Transport already attached: ' + instance.name);
      -  }
      -  
      -  this.transports[instance.name] = instance;
      -  this._names = Object.keys(this.transports);
      -  

      Listen for the error event on the new Transport

        instance._onError = this._onError.bind(this, instance)
      -  instance.on('error', instance._onError);
      -
      -  return this;
      -};

      function remove (transport)

      - -

      @transport {Transport} Transport to remove.

      - -

      Removes a transport of the specified type from this instance.

      Logger.prototype.remove = function (transport) {
      -  var name = transport.name || transport.prototype.name;
      -    
      -  if (!this.transports[name]) {
      -    throw new Error('Transport ' + name + ' not attached to this instance');
      -  }
      -  
      -  var instance = this.transports[name];
      -  delete this.transports[name];
      -  this._names = Object.keys(this.transports);
      -  
      -  if (instance.close) {
      -    instance.close();
      -  }
      -  
      -  instance.removeListener('error', instance._onError);
      -  return this;
      -};

      function profile (id, [msg, meta, callback])

      - -

      @id {string} Unique id of the profiler

      - -

      @msg {string} Optional Message to log

      - -

      @meta {Object} Optional Additional metadata to attach

      - -

      @callback {function} Optional Continuation to respond to when complete.

      - -

      Tracks the time inbetween subsequent calls to this method -with the same id parameter. The second call to this method -will log the difference in milliseconds along with the message.

      Logger.prototype.profile = function (id) {
      -  var now = Date.now(), then, args,
      -      msg, meta, callback;
      -  
      -  if (this.profilers[id] && arguments.length !== 1) {
      -    then = this.profilers[id];
      -    delete this.profilers[id];
      -    

      Support variable arguments: msg, meta, callback

          args     = Array.prototype.slice.call(arguments);
      -    callback = typeof args[args.length - 1] === 'function' ? args.pop() : null;
      -    meta     = typeof args[args.length - 1] === 'object' ? args.pop() : {};
      -    msg      = args.length === 2 ? args[1] : id; 
      -    

      Set the duration property of the metadata

          meta.duration = now - then + 'ms'; 
      -    return this.info(msg, meta, callback);
      -  }
      -  else {
      -    this.profilers[id] = now;
      -  }
      -  
      -  return this;
      -};

      function setLevels (target)

      - -

      @target {Object} Target levels to use on this instance

      - -

      Sets the target levels specified on this instance.

      Logger.prototype.setLevels = function (target) {
      -  return common.setLevels(this, this.levels, target);
      -};

      function cli ()

      - -

      Configures this instance to have the default -settings for command-line interfaces: no timestamp, -colors enabled, padded output, and additional levels.

      Logger.prototype.cli = function () {
      -  this.padLevels = true;
      -  this.setLevels(config.cli.levels);
      -  config.addColors(config.cli.colors);
      -  
      -  if (this.transports.console) {
      -    this.transports.console.colorize = true;
      -    this.transports.console.timestamp = false;
      -  }
      -  
      -  return this;
      -};

      @private function _uncaughtException (err)

      - -

      @err {Error} Error to handle

      - -

      Logs all relevant information around the err and -exits the current process.

      Logger.prototype._uncaughtException = function (err) {
      -  var self = this,
      -      responded = false,
      -      info = exception.getAllInfo(err),
      -      handlers = this._getExceptionHandlers(),
      -      timeout;
      -  
      -  function logAndWait (transport, next) {
      -    transport.logException('uncaughtException', info, next);
      -  }
      -  
      -  function gracefulExit () {
      -    if (!responded) {

      Remark: Currently ignoring any exceptions from transports - when catching uncaught exceptions.

            clearTimeout(timeout);
      -      responded = true;
      -      process.exit(1);
      -    }
      -  }
      -  
      -  if (!handlers || handlers.length === 0) {
      -    return gracefulExit();
      -  }
      -  

      Log to all transports and allow the operation to take -only up to 3000ms.

        async.forEach(handlers, logAndWait, gracefulExit);
      -  timeout = setTimeout(gracefulExit, 3000);
      -};

      @private function _getExceptionHandlers ()

      - -

      Returns the list of transports and exceptionHandlers -for this instance.

      Logger.prototype._getExceptionHandlers = function () {
      -  var self = this;
      -
      -  return this._hnames.map(function (name) {
      -    return self.exceptionHandlers[name];
      -  }).concat(this._names.map(function (name) {
      -    return self.transports[name].handleExceptions && self.transports[name];
      -  })).filter(Boolean);
      -};

      @private function _onError (transport, err)

      - -

      @transport {Object} Transport on which the error occured

      - -

      @err {Error} Error that occurred on the transport

      - -

      Bubbles the error, err, that occured on the specified transport -up from this instance if emitErrs has been set.

      Logger.prototype._onError = function (transport, err) {
      -  if (self.emitErrs) {
      -    self.emit('error', err, transport);
      -  }
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/transports.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/transports.html deleted file mode 100644 index bc92fc8..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/transports.html +++ /dev/null @@ -1,29 +0,0 @@ - transports.js

      transports.js

      /*
      - * transports.js: Set of all transports Winston knows about
      - *
      - * (C) 2010 Charlie Robbins
      - * MIT LICENCE
      - *
      - */
      -
      -var fs = require('fs'),
      -    path = require('path');
      -
      -var transports = exports;
      -
      -function capitalize (str) {
      -  return str && str[0].toUpperCase() + str.slice(1);
      -};

      Setup all transports as lazy-loaded getters.

      fs.readdirSync(path.join(__dirname, 'transports')).forEach(function (file) {
      -  var transport = file.replace('.js', ''),
      -      name  = capitalize(transport);
      -  
      -  if (transport === 'transport') {
      -    return;
      -  }
      -  
      -  transports.__defineGetter__(name, function () {
      -    return require('./transports/' + transport)[name];
      -  });
      -});
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/transports/console.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/transports/console.html deleted file mode 100644 index 3d45f36..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/transports/console.html +++ /dev/null @@ -1,59 +0,0 @@ - console.js

      console.js

      /*
      - * console.js: Transport for outputting to the console
      - *
      - * (C) 2010 Charlie Robbins
      - * MIT LICENCE
      - *
      - */
      -
      -var events = require('events'),
      -    util = require('util'),
      -    colors = require('colors'),
      -    common = require('../common'),
      -    Transport = require('./transport').Transport;

      function Console (options)

      - -

      @options {Object} Options for this instance.

      - -

      Constructor function for the Console transport object responsible -for persisting log messages and metadata to a terminal or TTY.

      var Console = exports.Console = function (options) {
      -  Transport.call(this, options);
      -  options = options || {};
      -  
      -  this.name      = 'console';
      -  this.json      = options.json     || false;
      -  this.colorize  = options.colorize || false;
      -  this.timestamp = typeof options.timestamp !== 'undefined' ? options.timestamp : false;
      -};

      Inherit from winston.Transport.

      util.inherits(Console, Transport);

      Expose the name of this Transport on the prototype

      Console.prototype.name = 'console';

      function log (level, msg, [meta], callback)

      - -

      @level {string} Level at which to log the message.

      - -

      @msg {string} Message to log

      - -

      @meta {Object} Optional Additional metadata to attach

      - -

      @callback {function} Continuation to respond to when complete.

      - -

      Core logging method exposed to Winston. Metadata is optional.

      Console.prototype.log = function (level, msg, meta, callback) {
      -  if (this.silent) {
      -    return callback(null, true);
      -  }
      -    
      -  var self = this, output = common.log({
      -    level:     level,
      -    message:   msg,
      -    meta:      meta,
      -    colorize:  this.colorize, 
      -    timestamp: this.timestamp
      -  });
      -  
      -  if (level === 'error' || level === 'debug') {
      -    util.error(output);
      -  }
      -  else {
      -    util.puts(output);
      -  }

      Emit the logged event immediately because the event loop -will not exit until process.stdout has drained anyway.

        self.emit('logged');
      -  callback(null, true);
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/transports/couchdb.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/transports/couchdb.html deleted file mode 100644 index b7690de..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/transports/couchdb.html +++ /dev/null @@ -1,84 +0,0 @@ - couchdb.js

      couchdb.js

      /*
      - * Couchdb.js: Transport for logging to Couchdb
      - *
      - * (C) 2011 Max Ogden
      - * MIT LICENSE
      - *
      - */
      -
      -var events = require('events'),
      -    http = require('http'),
      -    util = require('util'),
      -    common = require('../common'),
      -    Transport = require('./transport').Transport; 

      function Couchdb (options)

      - -

      @options {Object} Options for this instance.

      - -

      Constructor function for the Console transport object responsible -for making arbitrary HTTP requests whenever log messages and metadata -are received.

      var Couchdb = exports.Couchdb = function (options) {
      -  Transport.call(this, options);
      -
      -  this.name   = 'Couchdb'; 
      -  this.db     = options.db;
      -  this.user   = options.user;
      -  this.pass   = options.pass;
      -  this.host   = options.host   || 'localhost';
      -  this.port   = options.port   || 5984;
      -
      -  if (options.auth) {

      TODO: add http basic auth options for outgoing HTTP requests

        }
      -  
      -  if (options.ssl) {

      TODO: add ssl support for outgoing HTTP requests

        }  
      -};

      Inherit from winston.Transport.

      util.inherits(Couchdb, Transport);

      Expose the name of this Transport on the prototype

      Couchdb.prototype.name = 'Couchdb';

      function log (level, msg, [meta], callback)

      - -

      @level {string} Level at which to log the message.

      - -

      @msg {string} Message to log

      - -

      @meta {Object} Optional Additional metadata to attach

      - -

      @callback {function} Continuation to respond to when complete.

      - -

      Core logging method exposed to Winston. Metadata is optional.

      Couchdb.prototype.log = function (level, msg, meta, callback) {
      -  if (this.silent) {
      -    return callback(null, true);
      -  }
      -  
      -  var self = this,
      -      message = common.clone(meta),
      -      options,
      -      req;
      -      
      -  message.level = level;
      -  message.message = msg;

      Prepare options for outgoing HTTP request

        options = {
      -    host: this.host,
      -    port: this.port,
      -    path: "/" + this.db,
      -    method: "POST",
      -    headers: {"content-type": "application/json"}
      -  };
      -  
      -  if (options.user && options.pass) {
      -    options.headers["Authorization"] = "Basic " + new Buffer(options.user + ":" + options.pass).toString('base64');
      -  }
      -  

      Perform HTTP logging request

        req = http.request(options, function (res) { 

      No callback on request, fire and forget about the response

          self.emit('logged', res);
      -  }); 
      -
      -  req.on('error', function (err) {

      Propagate the error back up to the Logger that this -instance belongs to.

          self.emit('error', err);
      -  });
      -  

      Write logging event to the outgoing request body

        req.write(JSON.stringify({ 
      -    method: 'log', 
      -    params: { 
      -      timestamp: new Date(), // RFC3339/ISO8601 format instead of common.timestamp()
      -      msg: msg, 
      -      level: level, 
      -      meta: meta 
      -    } 
      -  }));
      -  
      -  req.end();
      -  

      Always return true, regardless of any errors

        callback(null, true);
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/transports/file.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/transports/file.html deleted file mode 100644 index bba8459..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/transports/file.html +++ /dev/null @@ -1,211 +0,0 @@ - file.js

      file.js

      /*
      - * file.js: Transport for outputting to a local log file
      - *
      - * (C) 2010 Charlie Robbins
      - * MIT LICENCE
      - *
      - */
      -
      -var events = require('events'),
      -    fs = require('fs'),
      -    path = require('path'),
      -    util = require('util'),
      -    colors = require('colors'),
      -    common = require('../common'),
      -    Transport = require('./transport').Transport;
      -    

      function File (options)

      - -

      @options {Object} Options for this instance.

      - -

      Constructor function for the File transport object responsible -for persisting log messages and metadata to one or more files.

      var File = exports.File = function (options) {
      -  Transport.call(this, options);
      -  

      Helper function which throws an Error in the event -that any of the rest of the arguments is present in options.

        function throwIf (target /*, illegal... */) {
      -    Array.prototype.slice.call(arguments, 1).forEach(function (name) {
      -      if (options[name]) {
      -        throw new Error('Cannot set ' + name + ' and ' + target + 'together');
      -      }
      -    });
      -  }
      -  
      -  if (options.filename || options.dirname) {
      -    throwIf('filename or dirname', 'stream');
      -    this._basename = this.filename = path.basename(options.filename) || 'winston.log';
      -    this.dirname   = options.dirname || path.dirname(options.filename);
      -    this.options   = options.options || { flags: 'a' };    
      -  }
      -  else if (options.stream) {
      -    throwIf('stream', 'filename', 'maxsize');
      -    this.stream = options.stream;
      -  }
      -  else {
      -    throw new Error('Cannot log to file without filename or stream.');
      -  }
      -    
      -  this.json      = options.json !== false;
      -  this.colorize  = options.colorize  || false;
      -  this.maxsize   = options.maxsize   || null;
      -  this.timestamp = typeof options.timestamp !== 'undefined' ? options.timestamp : false;

      Internal state variables representing the number -of files this instance has created and the current -size (in bytes) of the current logfile.

        this._size    = 0;
      -  this._created = 0;
      -  this._buffer  = [];
      -};

      Inherit from winston.Transport.

      util.inherits(File, Transport);

      Expose the name of this Transport on the prototype

      File.prototype.name = 'file';

      function log (level, msg, [meta], callback)

      - -

      @level {string} Level at which to log the message.

      - -

      @msg {string} Message to log

      - -

      @meta {Object} Optional Additional metadata to attach

      - -

      @callback {function} Continuation to respond to when complete.

      - -

      Core logging method exposed to Winston. Metadata is optional.

      File.prototype.log = function (level, msg, meta, callback) {
      -  if (this.silent) {
      -    return callback(null, true);
      -  }
      -
      -  var self = this, output = common.log({
      -    level:     level,
      -    message:   msg,
      -    meta:      meta,
      -    json:      this.json,
      -    colorize:  this.colorize,
      -    timestamp: this.timestamp
      -  }) + '\n';
      -  
      -  this._size += output.length;
      -  
      -  function onDrain () {
      -    self.emit('logged');
      -  }
      -  
      -  if (!this.filename) {

      If there is no filename on this instance then it was configured -with a raw WriteableStream instance and we should not perform any -size restrictions.

          this.stream.write(output);
      -    this.stream.once('drain', onDrain);
      -  }
      -  else {
      -    this.open(function (err) {
      -      if (err) {

      If there was an error enqueue the message

              return self._buffer.push(output);
      -      }
      -      
      -      self.stream.write(output);
      -      self.stream.once('drain', onDrain);
      -    });
      -  }
      -
      -  callback(null, true);
      -};

      function open (callback)

      - -

      @callback {function} Continuation to respond to when complete

      - -

      Checks to see if a new file needs to be created based on the maxsize -(if any) and the current size of the file used.

      File.prototype.open = function (callback) {
      -  if (this.opening) {

      If we are already attempting to open the next -available file then respond with a value indicating -that the message should be buffered.

          return callback(true);
      -  }
      -  else if (!this.stream || (this.maxsize && this._size >= this.maxsize)) {

      If we dont have a stream or have exceeded our size, then create -the next stream and respond with a value indicating that -the message should be buffered.

          callback(true);
      -    return this._createStream();
      -  }
      -  

      Otherwise we have a valid (and ready) stream.

        callback();
      -};

      function close ()

      - -

      Closes the stream associated with this instance.

      File.prototype.close = function() {
      -  var self = this;
      -
      -  if (this.stream) {
      -    this.stream.end();
      -    this.stream.destroySoon();
      -    
      -    this.stream.once('drain', function () {
      -      self.emit('flush');
      -      self.emit('closed');
      -    });
      -  }
      -};

      function flush ()

      - -

      Flushes any buffered messages to the current stream -used by this instance.

      File.prototype.flush = function () {
      -  var self = this;

      Iterate over the _buffer of enqueued messaged -and then write them to the newly created stream.

        this._buffer.forEach(function (str) {
      -    process.nextTick(function () {
      -      self.stream.write(str);
      -      self._size += str.length;
      -    });
      -  });
      -  

      Quickly truncate the _buffer once the write operations -have been started

        self._buffer.length = 0;
      -  

      When the stream has drained we have flushed -our buffer.

        self.stream.once('drain', function () {
      -    self.emit('flush');
      -    self.emit('logged');
      -  });
      -};

      @private function _createStream ()

      - -

      Attempts to open the next appropriate file for this instance -based on the common state (such as maxsize and _basename).

      File.prototype._createStream = function () {
      -  var self = this;
      -  this.opening = true;
      -    
      -  (function checkFile (target) {
      -    var fullname = path.join(self.dirname, target);
      -    

      Creates the WriteStream and then flushes any -buffered messages.

          function createAndFlush (size) {
      -      if (self.stream) {
      -        self.stream.end();
      -        self.stream.destroySoon();
      -      }
      -      
      -      self._size = size;
      -      self.filename = target;
      -      self.stream = fs.createWriteStream(fullname, self.options);
      -      

      When the current stream has finished flushing -then we can be sure we have finished opening -and thus can emit the open event.

            self.once('flush', function () {
      -        self.opening = false;
      -        self.emit('open', fullname);
      -      });

      Remark: It is possible that in the time it has taken to find the -next logfile to be written more data than maxsize has been buffered, -but for sensible limits (10s - 100s of MB) this seems unlikely in less -than one second.

            self.flush();
      -    }
      -
      -    fs.stat(fullname, function (err, stats) {
      -      if (err) {
      -        if (err.code !== 'ENOENT') {
      -          return self.emit('error', err);
      -        }
      -        
      -        return createAndFlush(0);
      -      }
      -      
      -      if (!stats || (self.maxsize && stats.size >= self.maxsize)) {

      If stats.size is greater than the maxsize for -this instance then try again

              return checkFile(self._getFile(true));
      -      }
      -      
      -      createAndFlush(stats.size);
      -    });
      -  })(this._getFile());  
      -};

      @private function _getFile ()

      - -

      Gets the next filename to use for this instance -in the case that log filesizes are being capped.

      File.prototype._getFile = function (inc) {
      -  var self = this,
      -      ext = path.extname(this._basename),
      -      basename = path.basename(this._basename, ext);
      -  
      -  if (inc) {

      Increment the number of files created or -checked by this instance.

          this._created += 1;
      -  }
      -  
      -  return this._created 
      -    ? basename + this._created + ext
      -    : basename + ext;
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/transports/loggly.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/transports/loggly.html deleted file mode 100644 index 7652318..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/transports/loggly.html +++ /dev/null @@ -1,118 +0,0 @@ - loggly.js

      loggly.js

      /*
      - * loggly.js: Transport for logginh to remote Loggly API
      - *
      - * (C) 2010 Charlie Robbins
      - * MIT LICENCE
      - *
      - */
      -
      -var events = require('events'),
      -    loggly = require('loggly'),
      -    util = require('util'),
      -    async = require('async'),
      -    common = require('../common'),
      -    Transport = require('./transport').Transport; 

      function Loggly (options)

      - -

      @options {Object} Options for this instance.

      - -

      Constructor function for the Loggly transport object responsible -for persisting log messages and metadata to Loggly; 'LaaS'.

      var Loggly = exports.Loggly = function (options) {
      -  Transport.call(this, options);
      -
      -  if (!options.subdomain) {
      -    throw new Error('Loggly Subdomain is required');
      -  }
      -  
      -  if (!options.inputToken && !options.inputName) {
      -    throw new Error('Target input token or name is required.');
      -  }
      -  
      -  if (!options.auth && options.inputName) {
      -    throw new Error('Loggly authentication is required');
      -  }
      -  
      -  this.name = 'loggly'; 
      -  this.logBuffer = [];
      -  
      -  this.client = loggly.createClient({
      -    subdomain: options.subdomain,
      -    auth: options.auth || null,
      -    json: options.json || false
      -  });
      -  
      -  if (options.inputToken) {
      -    this.inputToken = options.inputToken;
      -    this.ready = true;
      -  }
      -  else if (options.inputName) {
      -    this.ready = false;
      -    this.inputName = options.inputName;
      -    
      -    var self = this;
      -    this.client.getInput(this.inputName, function (err, input) {
      -      if (err) {
      -        throw err;
      -      }
      -      
      -      self.inputToken = input.input_token;
      -      self.ready = true;
      -    });
      -  }
      -};

      Inherit from winston.Transport.

      util.inherits(Loggly, Transport);

      Expose the name of this Transport on the prototype

      Loggly.prototype.name = 'loggly';

      function log (level, msg, [meta], callback)

      - -

      @level {string} Level at which to log the message.

      - -

      @msg {string} Message to log

      - -

      @meta {Object} Optional Additional metadata to attach

      - -

      @callback {function} Continuation to respond to when complete.

      - -

      Core logging method exposed to Winston. Metadata is optional.

      Loggly.prototype.log = function (level, msg, meta, callback) {
      -  if (this.silent) {
      -    return callback(null, true);
      -  }
      -
      -  var self = this,
      -      message = common.clone(meta);
      -      
      -  message.level = level;
      -  message.message = msg;
      -  
      -  if (!this.ready) {

      If we haven't gotten the input token yet -add this message to the log buffer.

          this.logBuffer.push(message);
      -  }
      -  else if (this.ready && this.logBuffer.length > 0) {

      Otherwise if we have buffered messages -add this message to the buffer and flush them.

          this.logBuffer.push(message);
      -    this.flush();
      -  }
      -  else {

      Otherwise just log the message as normal

          this.client.log(this.inputToken, message, function () {
      -      self.emit('logged');
      -    });
      -  }
      -  
      -  callback(null, true);
      -};

      function flush ()

      - -

      Flushes any buffered messages to the current stream -used by this instance.

      Loggly.prototype.flush = function () {
      -  var self = this;
      -  
      -  function logMsg (msg, next) {
      -    self.client.log(self.inputToken, msg, function (err) {
      -      if (err) {
      -        self.emit('error', err);
      -      }
      -      
      -      next();
      -    });
      -  }
      -  

      Initiate calls to loggly for each message in the buffer

        async.forEach(this.logBuffer, logMsg, function () {
      -    self.emit('logged');
      -  });
      -  
      -  process.nextTick(function () {

      Then quickly truncate the list

          self.logBuffer.length = 0;
      -  });
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/transports/transport.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/transports/transport.html deleted file mode 100644 index f0cc4b9..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/transports/transport.html +++ /dev/null @@ -1,50 +0,0 @@ - transport.js

      transport.js

      /*
      - * transport.js: Base Transport object for all Winston transports.
      - *
      - * (C) 2010 Charlie Robbins
      - * MIT LICENCE
      - *
      - */
      -
      -var events = require('events'),
      -    util = require('util'); 

      function Transport (options)

      - -

      @options {Object} Options for this instance.

      - -

      Constructor function for the Tranport object responsible -base functionality for all winston transports.

      var Transport = exports.Transport = function (options) {
      -  events.EventEmitter.call(this);
      -  
      -  options               = options        || {};  
      -  this.level            = options.level  || 'info';
      -  this.silent           = options.silent || false;
      -  this.handleExceptions = options.handleExceptions || false;
      -};

      Inherit from events.EventEmitter.

      util.inherits(Transport, events.EventEmitter);

      function logException (msg, meta, callback)

      - -

      @msg {string} Message to log

      - -

      @meta {Object} Optional Additional metadata to attach

      - -

      @callback {function} Continuation to respond to when complete.

      - -

      Logs the specified msg, meta and responds to the callback once the log -operation is complete to ensure that the event loop will not exit before -all logging has completed.

      Transport.prototype.logException = function (msg, meta, callback) {
      -  var self = this;
      -  
      -  function onLogged () {
      -    self.removeListener('error', onError);
      -    callback();
      -  }
      -  
      -  function onError () {
      -    self.removeListener('logged', onLogged);
      -    callback();
      -  }
      -  
      -  this.once('logged', onLogged);
      -  this.once('error', onError);  
      -  this.log('error', msg, meta, function () { });
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/transports/webhook.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/transports/webhook.html deleted file mode 100644 index 7191495..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/docs/winston/transports/webhook.html +++ /dev/null @@ -1,82 +0,0 @@ - webhook.js

      webhook.js

      /*
      - * webhook.js: Transport for logging to remote http endpoints ( POST / RECEIVE webhooks )
      - *
      - * (C) 2011 Marak Squires
      - * MIT LICENCE
      - *
      - */
      -
      -var events = require('events'),
      -    http = require('http'),
      -    util = require('util'),
      -    common = require('../common'),
      -    Transport = require('./transport').Transport; 

      function WebHook (options)

      - -

      @options {Object} Options for this instance.

      - -

      Constructor function for the Console transport object responsible -for making arbitrary HTTP requests whenever log messages and metadata -are received.

      var Webhook = exports.Webhook = function (options) {
      -  Transport.call(this, options);
      -
      -  this.name   = 'webhook'; 
      -  this.host   = options.host   || 'localhost';
      -  this.port   = options.port   || 8080;
      -  this.method = options.method || 'POST';
      -  this.path   = options.path   || '/winston-log';
      -
      -  if (options.auth) {

      TODO: add http basic auth options for outgoing HTTP requests

        }
      -  
      -  if (options.ssl) {

      TODO: add ssl support for outgoing HTTP requests

        }  
      -};

      Inherit from winston.Transport.

      util.inherits(Webhook, Transport);

      Expose the name of this Transport on the prototype

      Webhook.prototype.name = 'webhook';

      function log (level, msg, [meta], callback)

      - -

      @level {string} Level at which to log the message.

      - -

      @msg {string} Message to log

      - -

      @meta {Object} Optional Additional metadata to attach

      - -

      @callback {function} Continuation to respond to when complete.

      - -

      Core logging method exposed to Winston. Metadata is optional.

      Webhook.prototype.log = function (level, msg, meta, callback) {
      -  if (this.silent) {
      -    return callback(null, true);
      -  }
      -  
      -  var self = this,
      -      message = common.clone(meta),
      -      options,
      -      req;
      -      
      -  message.level = level;
      -  message.message = msg;

      Prepare options for outgoing HTTP request

        options = {
      -    host: this.host,
      -    port: this.port,
      -    path: this.path,
      -    method: this.method
      -  };
      -  

      Perform HTTP logging request

        req = http.request(options, function (res) { 

      No callback on request, fire and forget about the response

          self.emit('logged');
      -  }); 
      -
      -  req.on('error', function (err) {

      Propagate the error back up to the Logger that this -instance belongs to.

          self.emit('error', err);
      -  });
      -  

      Write logging event to the outgoing request body

      - -

      jsonMessage is currently conforming to JSON-RPC v1.0, -but without the unique id since there is no anticipated response -see: http://en.wikipedia.org/wiki/JSON-RPC

        req.write(JSON.stringify({ 
      -    method: 'log', 
      -    params: { 
      -      timestamp: common.timestamp(), 
      -      msg: msg, 
      -      level: level, 
      -      meta: meta 
      -    } 
      -  }));
      -  
      -  req.end();
      -  

      Always return true, regardless of any errors

        callback(null, true);
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/examples/couchdb.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/examples/couchdb.js deleted file mode 100644 index ce2d960..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/examples/couchdb.js +++ /dev/null @@ -1,18 +0,0 @@ -var winston = require('../lib/winston'); - -// -// Create a new winston logger instance with two tranports: Console, and Couchdb -// -// -// The Console transport will simply output to the console screen -// The Couchdb tranport will perform an HTTP POST request to the specified CouchDB instance -// -var logger = new (winston.Logger)({ - transports: [ - new (winston.transports.Console)(), - new (winston.transports.Couchdb)({ 'host': 'localhost', 'db': 'logs' }) - // if you need auth do this: new (winston.transports.Couchdb)({ 'user': 'admin', 'pass': 'admin', 'host': 'localhost', 'db': 'logs' }) - ] -}); - -logger.log('info', 'Hello webhook log files!', { 'foo': 'bar' }); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/examples/webhook-post.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/examples/webhook-post.js deleted file mode 100644 index 0fa1c8d..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/examples/webhook-post.js +++ /dev/null @@ -1,17 +0,0 @@ -var winston = require('../lib/winston'); - -// -// Create a new winston logger instance with two tranports: Console, and Webhook -// -// -// The Console transport will simply output to the console screen -// The Webhook tranports will perform an HTTP POST request to an abritrary end-point ( for post/recieve webhooks ) -// -var logger = new (winston.Logger)({ - transports: [ - new (winston.transports.Console)(), - new (winston.transports.Webhook)({ 'host': 'localhost', 'port': 8080, 'path': '/collectdata' }) - ] -}); - -logger.log('info', 'Hello webhook log files!', { 'foo': 'bar' }); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston.js deleted file mode 100644 index 51bfb45..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston.js +++ /dev/null @@ -1,143 +0,0 @@ -/* - * winston.js: Top-level include defining Winston. - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var winston = exports; - -// -// Expose version using `pkginfo` -// -require('pkginfo')(module, 'version'); - -// -// Include transports defined by default by winston -// -winston.transports = require('./winston/transports'); - -// -// Expose utility methods -// -var common = require('./winston/common'); -winston.hash = common.hash; -winston.clone = common.clone; -winston.longestElement = common.longestElement; -winston.exception = require('./winston/exception'); -winston.config = require('./winston/config'); -winston.addColors = winston.config.addColors; - -// -// Expose core Logging-related prototypes. -// -winston.Container = require('./winston/container').Container; -winston.Logger = require('./winston/logger').Logger; -winston.Transport = require('./winston/transports/transport').Transport; - -// -// We create and expose a default `Container` to `winston.loggers` so that the -// programmer may manage multiple `winston.Logger` instances without any additional overhead. -// -// ### some-file1.js -// -// var logger = require('winston').loggers.get('something'); -// -// ### some-file2.js -// -// var logger = require('winston').loggers.get('something'); -// -winston.loggers = new winston.Container(); - -// -// We create and expose a 'defaultLogger' so that the programmer may do the -// following without the need to create an instance of winston.Logger directly: -// -// var winston = require('winston'); -// winston.log('info', 'some message'); -// winston.error('some error'); -// -var defaultLogger = new winston.Logger({ - transports: [new winston.transports.Console()] -}); - -// -// Pass through the target methods onto `winston. -// -var methods = [ - 'log', - 'add', - 'remove', - 'profile', - 'startTimer', - 'extend', - 'cli', - 'handleExceptions', - 'unhandleExceptions' -]; -common.setLevels(winston, null, defaultLogger.levels); -methods.forEach(function (method) { - winston[method] = function () { - return defaultLogger[method].apply(defaultLogger, arguments); - }; -}); - -// -// ### function cli () -// Configures the default winston logger to have the -// settings for command-line interfaces: no timestamp, -// colors enabled, padded output, and additional levels. -// -winston.cli = function () { - winston.padLevels = true; - common.setLevels(winston, defaultLogger.levels, winston.config.cli.levels); - defaultLogger.setLevels(winston.config.cli.levels); - winston.config.addColors(winston.config.cli.colors); - - if (defaultLogger.transports.console) { - defaultLogger.transports.console.colorize = true; - defaultLogger.transports.console.timestamp = false; - } - - return winston; -}; - -// -// ### function setLevels (target) -// #### @target {Object} Target levels to use -// Sets the `target` levels specified on the default winston logger. -// -winston.setLevels = function (target) { - common.setLevels(winston, defaultLogger.levels, target); - defaultLogger.setLevels(target); -}; - -// -// Define getters / setters for appropriate properties of the -// default logger which need to be exposed by winston. -// -['emitErrs', 'exitOnError', 'padLevels', 'level', 'levelLength', 'stripColors'].forEach(function (prop) { - Object.defineProperty(winston, prop, { - get: function () { - return defaultLogger[prop]; - }, - set: function (val) { - defaultLogger[prop] = val; - } - }); -}); - -// -// @default {Object} -// The default transports and exceptionHandlers for -// the default winston logger. -// -Object.defineProperty(winston, 'default', { - get: function () { - return { - transports: defaultLogger.transports, - exceptionHandlers: defaultLogger.exceptionHandlers - }; - } -}); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/common.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/common.js deleted file mode 100644 index ba65e0f..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/common.js +++ /dev/null @@ -1,239 +0,0 @@ -/* - * common.js: Internal helper and utility functions for winston - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var util = require('util'), - crypto = require('crypto'), - config = require('./config'); - -// -// ### function setLevels (target, past, current) -// #### @target {Object} Object on which to set levels. -// #### @past {Object} Previous levels set on target. -// #### @current {Object} Current levels to set on target. -// Create functions on the target objects for each level -// in current.levels. If past is defined, remove functions -// for each of those levels. -// -exports.setLevels = function (target, past, current, isDefault) { - if (past) { - Object.keys(past).forEach(function (level) { - delete target[level]; - }); - } - - target.levels = current || config.npm.levels; - if (target.padLevels) { - target.levelLength = exports.longestElement(Object.keys(target.levels)); - } - - // - // Define prototype methods for each log level - // e.g. target.log('info', msg) <=> target.info(msg) - // - Object.keys(target.levels).forEach(function (level) { - target[level] = function (msg) { - var args = Array.prototype.slice.call(arguments), - callback = typeof args[args.length - 1] === 'function' || !args[args.length - 1] ? args.pop() : null, - meta = args.length === 2 ? args.pop() : null; - - return target.log(level, msg, meta, callback); - }; - }); - - return target; -}; - -// -// ### function longestElement -// #### @xs {Array} Array to calculate against -// Returns the longest element in the `xs` array. -// -exports.longestElement = function (xs) { - return Math.max.apply( - null, - xs.map(function (x) { return x.length }) - ); -}; - -// -// ### function clone (obj) -// #### @obj {Object} Object to clone. -// Helper method for deep cloning pure JSON objects -// i.e. JSON objects that are either literals or objects (no Arrays, etc) -// -exports.clone = function (obj) { - // we only need to clone refrence types (Object) - if (!(obj instanceof Object)) { - return obj; - } - else if (obj instanceof Date) { - return obj; - } - - var copy = {}; - for (var i in obj) { - if (Array.isArray(obj[i])) { - copy[i] = obj[i].slice(0); - } - else { - copy[i] = obj[i] instanceof Object ? exports.clone(obj[i]) : obj[i]; - } - } - - return copy; -}; - -// -// ### function log (options) -// #### @options {Object} All information about the log serialization. -// Generic logging function for returning timestamped strings -// with the following options: -// -// { -// level: 'level to add to serialized message', -// message: 'message to serialize', -// meta: 'additional logging metadata to serialize', -// colorize: false, // Colorizes output (only if `.json` is false) -// timestamp: true // Adds a timestamp to the serialized message -// } -// -exports.log = function (options) { - var timestampFn = typeof options.timestamp === 'function' ? options.timestamp : exports.timestamp, - timestamp = options.timestamp ? timestampFn() : null, - meta = options.meta ? exports.clone(options.meta) : null, - output; - - if (options.json) { - output = meta || {}; - output.level = options.level; - output.message = options.message; - - if (timestamp) { - output.timestamp = timestamp; - } - - return typeof options.stringify === 'function' - ? options.stringify(output) - : JSON.stringify(output); - } - - output = timestamp ? timestamp + ' - ' : ''; - output += options.colorize ? config.colorize(options.level) : options.level; - output += (': ' + options.message); - - if (meta) { - if (typeof meta !== 'object') { - output += ' ' + meta; - } - else if (Object.keys(meta).length > 0) { - output += ' ' + exports.serialize(meta); - } - } - - return output; -}; - -exports.capitalize = function (str) { - return str && str[0].toUpperCase() + str.slice(1); -}; - -// -// ### function hash (str) -// #### @str {string} String to hash. -// Utility function for creating unique ids -// e.g. Profiling incoming HTTP requests on the same tick -// -exports.hash = function (str) { - return crypto.createHash('sha1').update(str).digest('hex'); -}; - -// -// ## Borrowed from node.js core -// I wanted a universal lowercase header message, as opposed to the `DEBUG` -// (i.e. all uppercase header) used only in `util.debug()` -// -var months = ['Jan', 'Feb', 'Mar', 'Apr', - 'May', 'Jun', 'Jul', 'Aug', - 'Sep', 'Oct', 'Nov', 'Dec']; - -// -// ### function pad (n) -// Returns a padded string if `n < 10`. -// -exports.pad = function (n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); -}; - -// -// ### function timestamp () -// Returns a timestamp string for the current time. -// -exports.timestamp = function () { - var d = new Date(); - var time = [ - exports.pad(d.getHours()), - exports.pad(d.getMinutes()), - exports.pad(d.getSeconds()) - ].join(':'); - - return [d.getDate(), months[d.getMonth()], time].join(' '); -}; - -// -// ### function serialize (obj, key) -// #### @obj {Object|literal} Object to serialize -// #### @key {string} **Optional** Optional key represented by obj in a larger object -// Performs simple comma-separated, `key=value` serialization for Loggly when -// logging to non-JSON inputs. -// -exports.serialize = function (obj, key) { - if (obj === null) { - obj = 'null'; - } - else if (obj === undefined) { - obj = 'undefined'; - } - else if (obj === false) { - obj = 'false'; - } - - if (typeof obj !== 'object') { - return key ? key + '=' + obj : obj; - } - - var msg = '', - keys = Object.keys(obj), - length = keys.length; - - for (var i = 0; i < length; i++) { - if (Array.isArray(obj[keys[i]])) { - msg += keys[i] + '=[' - - for (var j = 0, l = obj[keys[i]].length; j < l; j++) { - msg += exports.serialize(obj[keys[i]][j]); - if (j < l - 1) { - msg += ', '; - } - } - - msg += ']'; - } - else if (obj[keys[i]] instanceof Date) { - msg += keys[i] + '=' + obj[keys[i]]; - } - else { - msg += exports.serialize(obj[keys[i]], keys[i]); - } - - if (i < length - 1) { - msg += ', '; - } - } - - return msg; -}; diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/config.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/config.js deleted file mode 100644 index 45e9283..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/config.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * config.js: Default settings for all levels that winston knows about - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var colors = require('colors'); - -var config = exports, - allColors = exports.allColors = {}; - -config.addColors = function (colors) { - mixin(allColors, colors); -}; - -config.colorize = function (level) { - return level[allColors[level]]; -}; - -// -// Export config sets -// -config.cli = require('./config/cli-config'); -config.npm = require('./config/npm-config'); -config.syslog = require('./config/syslog-config'); - -// -// Add colors for pre-defined config sets -// -config.addColors(config.npm.colors); -config.addColors(config.syslog.colors); - -function mixin (target) { - var args = Array.prototype.slice.call(arguments, 1); - - args.forEach(function (a) { - var keys = Object.keys(a); - for (var i = 0; i < keys.length; i++) { - target[keys[i]] = a[keys[i]]; - } - }); - return target; -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/config/cli-config.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/config/cli-config.js deleted file mode 100644 index 9798ddc..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/config/cli-config.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * cli-config.js: Config that conform to commonly used CLI logging levels. - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var cliConfig = exports; - -cliConfig.levels = { - silly: 0, - input: 1, - verbose: 2, - prompt: 3, - info: 4, - data: 5, - help: 6, - warn: 7, - debug: 8, - error: 9 -}; - -cliConfig.colors = { - silly: 'magenta', - input: 'grey', - verbose: 'cyan', - prompt: 'grey', - info: 'green', - data: 'grey', - help: 'cyan', - warn: 'yellow', - debug: 'blue', - error: 'red' -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/config/npm-config.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/config/npm-config.js deleted file mode 100644 index 464f735..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/config/npm-config.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * npm-config.js: Config that conform to npm logging levels. - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var npmConfig = exports; - -npmConfig.levels = { - silly: 0, - verbose: 1, - info: 2, - warn: 3, - debug: 4, - error: 5 -}; - -npmConfig.colors = { - silly: 'magenta', - verbose: 'cyan', - info: 'green', - warn: 'yellow', - debug: 'blue', - error: 'red' -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/config/syslog-config.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/config/syslog-config.js deleted file mode 100644 index a198abc..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/config/syslog-config.js +++ /dev/null @@ -1,31 +0,0 @@ -/* - * syslog-config.js: Config that conform to syslog logging levels. - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var syslogConfig = exports; - -syslogConfig.levels = { - debug: 0, - info: 1, - notice: 2, - warning: 3, - error: 4, - crit: 5, - alert: 6, - emerg: 7 -}; - -syslogConfig.colors = { - debug: 'blue', - info: 'green', - notice: 'yellow', - warning: 'red', - error: 'red', - crit: 'red', - alert: 'yellow', - emerg: 'red' -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/container.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/container.js deleted file mode 100644 index 0e67b20..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/container.js +++ /dev/null @@ -1,101 +0,0 @@ -/* - * container.js: Inversion of control container for winston logger instances - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var common = require('./common'), - winston = require('../winston'); - -// -// ### function Container (options) -// #### @options {Object} Default pass-thru options for Loggers -// Constructor function for the Container object responsible for managing -// a set of `winston.Logger` instances based on string ids. -// -var Container = exports.Container = function (options) { - this.loggers = {}; - this.options = options || {}; - this.default = { - transports: [ - new winston.transports.Console({ - level: 'silly', - colorize: false - }) - ] - } -}; - -// -// ### function get / add (id, options) -// #### @id {string} Id of the Logger to get -// #### @options {Object} **Optional** Options for the Logger instance -// Retreives a `winston.Logger` instance for the specified `id`. If -// an instance does not exist, one is created. -// -Container.prototype.get = Container.prototype.add = function (id, options) { - if (!this.loggers[id]) { - options = common.clone(options || this.options || this.default); - options.transports = options.transports || []; - - if (options.transports.length === 0 && (!options || !options['console'])) { - options.transports.push(this.default.transports[0]); - } - - Object.keys(options).forEach(function (key) { - if (key === 'transports') { - return; - } - - var name = common.capitalize(key); - - if (!winston.transports[name]) { - throw new Error('Cannot add unknown transport: ' + name); - } - - var namedOptions = options[key]; - namedOptions.id = id; - options.transports.push(new (winston.transports[name])(namedOptions)); - }); - - this.loggers[id] = new winston.Logger(options); - } - - return this.loggers[id]; -}; - -// -// ### function close (id) -// #### @id {string} **Optional** Id of the Logger instance to find -// Returns a boolean value indicating if this instance -// has a logger with the specified `id`. -// -Container.prototype.has = function (id) { - return !!this.loggers[id]; -}; - -// -// ### function close (id) -// #### @id {string} **Optional** Id of the Logger instance to close -// Closes a `Logger` instance with the specified `id` if it exists. -// If no `id` is supplied then all Loggers are closed. -// -Container.prototype.close = function (id) { - var self = this; - - function _close (id) { - if (!self.loggers[id]) { - return; - } - - self.loggers[id].close(); - delete self.loggers[id]; - } - - return id ? _close(id) : Object.keys(this.loggers).forEach(function (id) { - _close(id); - }); -}; - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/exception.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/exception.js deleted file mode 100644 index 2a01e91..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/exception.js +++ /dev/null @@ -1,55 +0,0 @@ -/* - * exception.js: Utility methods for gathing information about uncaughtExceptions. - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var os = require('os'), - stackTrace = require('stack-trace'); - -var exception = exports; - -exception.getAllInfo = function (err) { - return { - process: exception.getProcessInfo(), - os: exception.getOsInfo(), - trace: exception.getTrace(err), - stack: err.stack.split('\n') - }; -}; - -exception.getProcessInfo = function () { - return { - pid: process.pid, - uid: process.getuid(), - gid: process.getgid(), - cwd: process.cwd(), - execPath: process.execPath, - version: process.version, - argv: process.argv, - memoryUsage: process.memoryUsage() - }; -}; - -exception.getOsInfo = function () { - return { - loadavg: os.loadavg(), - uptime: os.uptime() - }; -}; - -exception.getTrace = function (err) { - var trace = err ? stackTrace.parse(err) : stackTrace.get(); - return trace.map(function (site) { - return { - column: site.getColumnNumber(), - file: site.getFileName(), - function: site.getFunctionName(), - line: site.getLineNumber(), - method: site.getMethodName(), - native: site.isNative(), - } - }); -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/logger.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/logger.js deleted file mode 100644 index 5ca51e0..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/logger.js +++ /dev/null @@ -1,515 +0,0 @@ -/* - * logger.js: Core logger object used by winston. - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var events = require('events'), - util = require('util'), - async = require('async'), - config = require('./config'), - common = require('./common'), - exception = require('./exception'); - -// -// Time constants -// -var ticksPerMillisecond = 10000; - -// -// ### function Logger (options) -// #### @options {Object} Options for this instance. -// Constructor function for the Logger object responsible -// for persisting log messages and metadata to one or more transports. -// -var Logger = exports.Logger = function (options) { - events.EventEmitter.call(this); - options = options || {}; - - var self = this, - handleExceptions = false; - - // - // Set Levels and default logging level - // - this.padLevels = options.padLevels || false; - this.setLevels(options.levels); - if (options.colors) { - config.addColors(options.colors); - } - - // - // Hoist other options onto this instance. - // - this.level = options.level || 'info'; - this.emitErrs = options.emitErrs || false; - this.stripColors = options.stripColors || false; - this.exitOnError = typeof options.exitOnError !== 'undefined' - ? options.exitOnError - : true; - - // - // Setup other intelligent default settings. - // - this.transports = {}; - this.rewriters = []; - this.exceptionHandlers = {}; - this.profilers = {}; - this._names = []; - this._hnames = []; - - if (options.transports) { - options.transports.forEach(function (transport) { - self.add(transport, null, true); - - if (transport.handleExceptions) { - handleExceptions = true; - } - }); - } - - if (options.rewriters) { - options.rewriters.forEach(function(rewriter) { - self.addRewriter(rewriter); - }); - } - - if (options.exceptionHandlers) { - handleExceptions = true; - options.exceptionHandlers.forEach(function (handler) { - self._hnames.push(handler.name); - self.exceptionHandlers[handler.name] = handler; - }); - } - - if (options.handleExceptions || handleExceptions) { - this.handleExceptions(); - } -}; - -// -// Inherit from `events.EventEmitter`. -// -util.inherits(Logger, events.EventEmitter); - -// -// ### function extend (target) -// #### @target {Object} Target to extend. -// Extends the target object with a 'log' method -// along with a method for each level in this instance. -// -Logger.prototype.extend = function (target) { - var self = this; - ['log', 'profile', 'startTimer'].concat(Object.keys(this.levels)).forEach(function (method) { - target[method] = function () { - return self[method].apply(self, arguments); - }; - }); - - return this; -}; - -// -// ### function log (level, msg, [meta], callback) -// #### @level {string} Level at which to log the message. -// #### @msg {string} Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} Continuation to respond to when complete. -// Core logging method exposed to Winston. Metadata is optional. -// -Logger.prototype.log = function (level, msg) { - var self = this, - callback, - meta; - - if (arguments.length === 3) { - if (typeof arguments[2] === 'function') { - meta = {}; - callback = arguments[2]; - } - else if (typeof arguments[2] === 'object') { - meta = arguments[2]; - } - } - else if (arguments.length === 4) { - meta = arguments[2]; - callback = arguments[3]; - } - - // If we should pad for levels, do so - if (this.padLevels) { - msg = new Array(this.levelLength - level.length).join(' ') + msg; - } - - function onError (err) { - if (callback) { - callback(err); - } - else if (self.emitErrs) { - self.emit('error', err); - }; - } - - if (this.transports.length === 0) { - return onError(new Error('Cannot log with no transports.')); - } - else if (typeof self.levels[level] === 'undefined') { - return onError(new Error('Unknown log level: ' + level)); - } - - this.rewriters.forEach(function(rewriter) { - meta = rewriter(level, msg, meta); - }); - - // - // For consideration of terminal 'color" programs like colors.js, - // which can add ANSI escape color codes to strings, we destyle the - // ANSI color escape codes when `this.stripColors` is set. - // - // see: http://en.wikipedia.org/wiki/ANSI_escape_code - // - if (this.stripColors) { - var code = /\u001b\[\d+m/g; - msg = ('' + msg).replace(code, ''); - } - - for (var i = 0, l = this._names.length; i < l; i++) { - var transport = this.transports[this._names[i]]; - if ((transport.level && self.levels[transport.level] <= self.levels[level]) - || (!transport.level && self.levels[self.level] <= self.levels[level])) { - transport.log(level, msg, meta, function (err) { - self.emit('logging', transport, level, msg, meta); - }); - } - } - - // - // Immediately respond to the callback - // - if (callback) { - callback(null, level, msg, meta); - } - - return this; -}; - -// -// ### function close () -// Cleans up resources (streams, event listeners) for all -// transports associated with this instance (if necessary). -// -Logger.prototype.close = function () { - var self = this; - - this._names.forEach(function (name) { - var transport = self.transports[name]; - if (transport && transport.close) { - transport.close(); - } - }); -}; - -// -// ### function handleExceptions () -// Handles `uncaughtException` events for the current process -// -Logger.prototype.handleExceptions = function () { - var args = Array.prototype.slice.call(arguments), - handlers = [], - self = this; - - args.forEach(function (a) { - if (Array.isArray(a)) { - handlers = handlers.concat(a); - } - else { - handlers.push(a); - } - }); - - handlers.forEach(function (handler) { - self.exceptionHandlers[handler.name] = handler; - }); - - this._hnames = Object.keys(self.exceptionHandlers); - - if (!this.catchExceptions) { - this.catchExceptions = this._uncaughtException.bind(this); - process.on('uncaughtException', this.catchExceptions); - } -}; - -// -// ### function unhandleExceptions () -// Removes any handlers to `uncaughtException` events -// for the current process -// -Logger.prototype.unhandleExceptions = function () { - var self = this; - - if (this.catchExceptions) { - Object.keys(this.exceptionHandlers).forEach(function (name) { - if (handler.close) { - handler.close(); - } - }); - - this.exceptionHandlers = {}; - Object.keys(this.transports).forEach(function (name) { - var transport = self.transports[name]; - if (transport.handleExceptions) { - transport.handleExceptions = false; - } - }) - - process.removeListener('uncaughtException', this.catchExceptions); - this.catchExceptions = false; - } -}; - -// -// ### function add (transport, [options]) -// #### @transport {Transport} Prototype of the Transport object to add. -// #### @options {Object} **Optional** Options for the Transport to add. -// #### @instance {Boolean} **Optional** Value indicating if `transport` is already instantiated. -// Adds a transport of the specified type to this instance. -// -Logger.prototype.add = function (transport, options, created) { - var instance = created ? transport : (new (transport)(options)); - - if (!instance.name && !instance.log) { - throw new Error('Unknown transport with no log() method'); - } - else if (this.transports[instance.name]) { - throw new Error('Transport already attached: ' + instance.name); - } - - this.transports[instance.name] = instance; - this._names = Object.keys(this.transports); - - // - // Listen for the `error` event on the new Transport - // - instance._onError = this._onError.bind(this, instance) - instance.on('error', instance._onError); - - // - // If this transport has `handleExceptions` set to `true` - // and we are not already handling exceptions, do so. - // - if (transport.handleExceptions && !this.catchExceptions) { - this.handleExceptions(); - } - - return this; -}; - -// -// ### function addRewriter (transport, [options]) -// #### @transport {Transport} Prototype of the Transport object to add. -// #### @options {Object} **Optional** Options for the Transport to add. -// #### @instance {Boolean} **Optional** Value indicating if `transport` is already instantiated. -// Adds a transport of the specified type to this instance. -// -Logger.prototype.addRewriter = function(rewriter) { - this.rewriters.push(rewriter); -} - -// -// ### function clear () -// Remove all transports from this instance -// -Logger.prototype.clear = function () { - for (var name in this.transports) { - this.remove({ name: name }); - } -}; - -// -// ### function remove (transport) -// #### @transport {Transport} Transport to remove. -// Removes a transport of the specified type from this instance. -// -Logger.prototype.remove = function (transport) { - var name = transport.name || transport.prototype.name; - - if (!this.transports[name]) { - throw new Error('Transport ' + name + ' not attached to this instance'); - } - - var instance = this.transports[name]; - delete this.transports[name]; - this._names = Object.keys(this.transports); - - if (instance.close) { - instance.close(); - } - - instance.removeListener('error', instance._onError); - return this; -}; - -var ProfileHandler = function (logger) { - this.logger = logger; - - this.start = Date.now(); - - this.done = function (msg) { - var args, callback, meta; - args = Array.prototype.slice.call(arguments); - callback = typeof args[args.length - 1] === 'function' ? args.pop() : null; - meta = typeof args[args.length - 1] === 'object' ? args.pop() : {}; - - meta.duration = (Date.now()) - this.start + 'ms'; - - return this.logger.info(msg, meta, callback); - } -} - -Logger.prototype.startTimer = function () { - return new ProfileHandler(this); -} - -// -// ### function profile (id, [msg, meta, callback]) -// #### @id {string} Unique id of the profiler -// #### @msg {string} **Optional** Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} **Optional** Continuation to respond to when complete. -// Tracks the time inbetween subsequent calls to this method -// with the same `id` parameter. The second call to this method -// will log the difference in milliseconds along with the message. -// -Logger.prototype.profile = function (id) { - var now = Date.now(), then, args, - msg, meta, callback; - - if (this.profilers[id]) { - then = this.profilers[id]; - delete this.profilers[id]; - - // Support variable arguments: msg, meta, callback - args = Array.prototype.slice.call(arguments); - callback = typeof args[args.length - 1] === 'function' ? args.pop() : null; - meta = typeof args[args.length - 1] === 'object' ? args.pop() : {}; - msg = args.length === 2 ? args[1] : id; - - // Set the duration property of the metadata - meta.duration = now - then + 'ms'; - return this.info(msg, meta, callback); - } - else { - this.profilers[id] = now; - } - - return this; -}; - -// -// ### function setLevels (target) -// #### @target {Object} Target levels to use on this instance -// Sets the `target` levels specified on this instance. -// -Logger.prototype.setLevels = function (target) { - return common.setLevels(this, this.levels, target); -}; - -// -// ### function cli () -// Configures this instance to have the default -// settings for command-line interfaces: no timestamp, -// colors enabled, padded output, and additional levels. -// -Logger.prototype.cli = function () { - this.padLevels = true; - this.setLevels(config.cli.levels); - config.addColors(config.cli.colors); - - if (this.transports.console) { - this.transports.console.colorize = true; - this.transports.console.timestamp = false; - } - - return this; -}; - -// -// ### @private function _uncaughtException (err) -// #### @err {Error} Error to handle -// Logs all relevant information around the `err` and -// exits the current process. -// -Logger.prototype._uncaughtException = function (err) { - var self = this, - responded = false, - info = exception.getAllInfo(err), - handlers = this._getExceptionHandlers(), - timeout, - doExit; - - // - // Calculate if we should exit on this error - // - doExit = typeof this.exitOnError === 'function' - ? this.exitOnError(err) - : this.exitOnError; - - function logAndWait(transport, next) { - transport.logException('uncaughtException', info, next); - } - - function gracefulExit() { - if (doExit && !responded) { - // - // Remark: Currently ignoring any exceptions from transports - // when catching uncaught exceptions. - // - clearTimeout(timeout); - responded = true; - process.exit(1); - } - } - - if (!handlers || handlers.length === 0) { - return gracefulExit(); - } - - // - // Log to all transports and allow the operation to take - // only up to `3000ms`. - // - async.forEach(handlers, logAndWait, gracefulExit); - if (doExit) { - timeout = setTimeout(gracefulExit, 3000); - } -}; - -// -// ### @private function _getExceptionHandlers () -// Returns the list of transports and exceptionHandlers -// for this instance. -// -Logger.prototype._getExceptionHandlers = function () { - var self = this; - - return this._hnames.map(function (name) { - return self.exceptionHandlers[name]; - }).concat(this._names.map(function (name) { - return self.transports[name].handleExceptions && self.transports[name]; - })).filter(Boolean); -}; - -// -// ### @private function _onError (transport, err) -// #### @transport {Object} Transport on which the error occured -// #### @err {Error} Error that occurred on the transport -// Bubbles the error, `err`, that occured on the specified `transport` -// up from this instance if `emitErrs` has been set. -// -Logger.prototype._onError = function (transport, err) { - if (this.emitErrs) { - this.emit('error', err, transport); - } -}; diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/transports.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/transports.js deleted file mode 100644 index 5080634..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/transports.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * transports.js: Set of all transports Winston knows about - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var fs = require('fs'), - path = require('path'), - common = require('./common'); - -var transports = exports; - -// -// Setup all transports as lazy-loaded getters. -// -fs.readdirSync(path.join(__dirname, 'transports')).forEach(function (file) { - var transport = file.replace('.js', ''), - name = common.capitalize(transport); - - if (transport === 'transport') { - return; - } - - transports.__defineGetter__(name, function () { - return require('./transports/' + transport)[name]; - }); -}); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/transports/console.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/transports/console.js deleted file mode 100644 index b38ef04..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/transports/console.js +++ /dev/null @@ -1,83 +0,0 @@ -/* - * console.js: Transport for outputting to the console - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var events = require('events'), - util = require('util'), - colors = require('colors'), - common = require('../common'), - Transport = require('./transport').Transport; - -// -// ### function Console (options) -// #### @options {Object} Options for this instance. -// Constructor function for the Console transport object responsible -// for persisting log messages and metadata to a terminal or TTY. -// -var Console = exports.Console = function (options) { - Transport.call(this, options); - options = options || {}; - - this.name = 'console'; - this.json = options.json || false; - this.colorize = options.colorize || false; - this.timestamp = typeof options.timestamp !== 'undefined' ? options.timestamp : false; - - if (this.json) { - this.stringify = options.stringify || function (obj) { - return JSON.stringify(obj, null, 2); - }; - } -}; - -// -// Inherit from `winston.Transport`. -// -util.inherits(Console, Transport); - -// -// Expose the name of this Transport on the prototype -// -Console.prototype.name = 'console'; - -// -// ### function log (level, msg, [meta], callback) -// #### @level {string} Level at which to log the message. -// #### @msg {string} Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} Continuation to respond to when complete. -// Core logging method exposed to Winston. Metadata is optional. -// -Console.prototype.log = function (level, msg, meta, callback) { - if (this.silent) { - return callback(null, true); - } - - var self = this, output = common.log({ - colorize: this.colorize, - json: this.json, - level: level, - message: msg, - meta: meta, - stringify: this.stringify, - timestamp: this.timestamp - }); - - if (level === 'error' || level === 'debug') { - util.error(output); - } - else { - util.puts(output); - } - - // - // Emit the `logged` event immediately because the event loop - // will not exit until `process.stdout` has drained anyway. - // - self.emit('logged'); - callback(null, true); -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/transports/couchdb.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/transports/couchdb.js deleted file mode 100644 index 61ad74a..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/transports/couchdb.js +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Couchdb.js: Transport for logging to Couchdb - * - * (C) 2011 Max Ogden - * MIT LICENSE - * - */ - -var events = require('events'), - http = require('http'), - util = require('util'), - common = require('../common'), - Transport = require('./transport').Transport; - -// -// ### function Couchdb (options) -// #### @options {Object} Options for this instance. -// Constructor function for the Console transport object responsible -// for making arbitrary HTTP requests whenever log messages and metadata -// are received. -// -var Couchdb = exports.Couchdb = function (options) { - Transport.call(this, options); - - this.name = 'Couchdb'; - this.db = options.db; - this.user = options.user; - this.pass = options.pass; - this.host = options.host || 'localhost'; - this.port = options.port || 5984; - - if (options.auth) { - // - // TODO: add http basic auth options for outgoing HTTP requests - // - } - - if (options.ssl) { - // - // TODO: add ssl support for outgoing HTTP requests - // - } -}; - -// -// Inherit from `winston.Transport`. -// -util.inherits(Couchdb, Transport); - -// -// Expose the name of this Transport on the prototype -// -Couchdb.prototype.name = 'Couchdb'; - -// -// ### function log (level, msg, [meta], callback) -// #### @level {string} Level at which to log the message. -// #### @msg {string} Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} Continuation to respond to when complete. -// Core logging method exposed to Winston. Metadata is optional. -// -Couchdb.prototype.log = function (level, msg, meta, callback) { - if (this.silent) { - return callback(null, true); - } - - var self = this, - message = common.clone(meta || {}), - options, - req; - - message.level = level; - message.message = msg; - - // Prepare options for outgoing HTTP request - options = { - host: this.host, - port: this.port, - path: "/" + this.db, - method: "POST", - headers: {"content-type": "application/json"} - }; - - if (options.user && options.pass) { - options.headers["Authorization"] = "Basic " + new Buffer(options.user + ":" + options.pass).toString('base64'); - } - - // Perform HTTP logging request - req = http.request(options, function (res) { - // - // No callback on request, fire and forget about the response - // - self.emit('logged', res); - }); - - req.on('error', function (err) { - // - // Propagate the `error` back up to the `Logger` that this - // instance belongs to. - // - self.emit('error', err); - }); - - // - // Write logging event to the outgoing request body - // - req.write(JSON.stringify({ - method: 'log', - params: { - timestamp: new Date(), // RFC3339/ISO8601 format instead of common.timestamp() - msg: msg, - level: level, - meta: meta - } - })); - - req.end(); - - // Always return true, regardless of any errors - callback(null, true); -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/transports/file.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/transports/file.js deleted file mode 100644 index 0a96c01..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/transports/file.js +++ /dev/null @@ -1,332 +0,0 @@ -/* - * file.js: Transport for outputting to a local log file - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var events = require('events'), - fs = require('fs'), - path = require('path'), - util = require('util'), - colors = require('colors'), - common = require('../common'), - Transport = require('./transport').Transport; - -// -// ### function File (options) -// #### @options {Object} Options for this instance. -// Constructor function for the File transport object responsible -// for persisting log messages and metadata to one or more files. -// -var File = exports.File = function (options) { - Transport.call(this, options); - - // - // Helper function which throws an `Error` in the event - // that any of the rest of the arguments is present in `options`. - // - function throwIf (target /*, illegal... */) { - Array.prototype.slice.call(arguments, 1).forEach(function (name) { - if (options[name]) { - throw new Error('Cannot set ' + name + ' and ' + target + 'together'); - } - }); - } - - if (options.filename || options.dirname) { - throwIf('filename or dirname', 'stream'); - this._basename = this.filename = path.basename(options.filename) || 'winston.log'; - this.dirname = options.dirname || path.dirname(options.filename); - this.options = options.options || { flags: 'a' }; - } - else if (options.stream) { - throwIf('stream', 'filename', 'maxsize'); - this.stream = options.stream; - } - else { - throw new Error('Cannot log to file without filename or stream.'); - } - - this.json = options.json !== false; - this.colorize = options.colorize || false; - this.maxsize = options.maxsize || null; - this.maxFiles = options.maxFiles || null; - this.timestamp = typeof options.timestamp !== 'undefined' ? options.timestamp : false; - - // - // Internal state variables representing the number - // of files this instance has created and the current - // size (in bytes) of the current logfile. - // - this._size = 0; - this._created = 0; - this._buffer = []; - this._draining = false; -}; - -// -// Inherit from `winston.Transport`. -// -util.inherits(File, Transport); - -// -// Expose the name of this Transport on the prototype -// -File.prototype.name = 'file'; - -// -// ### function log (level, msg, [meta], callback) -// #### @level {string} Level at which to log the message. -// #### @msg {string} Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} Continuation to respond to when complete. -// Core logging method exposed to Winston. Metadata is optional. -// -File.prototype.log = function (level, msg, meta, callback) { - if (this.silent) { - return callback(null, true); - } - - var self = this, output = common.log({ - level: level, - message: msg, - meta: meta, - json: this.json, - colorize: this.colorize, - timestamp: this.timestamp - }) + '\n'; - - this._size += output.length; - - if (!this.filename) { - // - // If there is no `filename` on this instance then it was configured - // with a raw `WriteableStream` instance and we should not perform any - // size restrictions. - // - this.stream.write(output); - self._lazyDrain(); - } - else { - this.open(function (err) { - if (err) { - // - // If there was an error enqueue the message - // - return self._buffer.push(output); - } - - self.stream.write(output); - self._lazyDrain(); - }); - } - - callback(null, true); -}; - -// -// ### function open (callback) -// #### @callback {function} Continuation to respond to when complete -// Checks to see if a new file needs to be created based on the `maxsize` -// (if any) and the current size of the file used. -// -File.prototype.open = function (callback) { - if (this.opening) { - // - // If we are already attempting to open the next - // available file then respond with a value indicating - // that the message should be buffered. - // - return callback(true); - } - else if (!this.stream || (this.maxsize && this._size >= this.maxsize)) { - // - // If we dont have a stream or have exceeded our size, then create - // the next stream and respond with a value indicating that - // the message should be buffered. - // - callback(true); - return this._createStream(); - } - - // - // Otherwise we have a valid (and ready) stream. - // - callback(); -}; - -// -// ### function close () -// Closes the stream associated with this instance. -// -File.prototype.close = function () { - var self = this; - - if (this.stream) { - this.stream.end(); - this.stream.destroySoon(); - - this.stream.once('drain', function () { - self.emit('flush'); - self.emit('closed'); - }); - } -}; - -// -// ### function flush () -// Flushes any buffered messages to the current `stream` -// used by this instance. -// -File.prototype.flush = function () { - var self = this; - - // - // Iterate over the `_buffer` of enqueued messaged - // and then write them to the newly created stream. - // - this._buffer.forEach(function (str) { - process.nextTick(function () { - self.stream.write(str); - self._size += str.length; - }); - }); - - // - // Quickly truncate the `_buffer` once the write operations - // have been started - // - self._buffer.length = 0; - - // - // When the stream has drained we have flushed - // our buffer. - // - self.stream.once('drain', function () { - self.emit('flush'); - self.emit('logged'); - }); -}; - -// -// ### @private function _createStream () -// Attempts to open the next appropriate file for this instance -// based on the common state (such as `maxsize` and `_basename`). -// -File.prototype._createStream = function () { - var self = this; - this.opening = true; - - (function checkFile (target) { - var fullname = path.join(self.dirname, target); - - // - // Creates the `WriteStream` and then flushes any - // buffered messages. - // - function createAndFlush (size) { - if (self.stream) { - self.stream.end(); - self.stream.destroySoon(); - } - - self._size = size; - self.filename = target; - self.stream = fs.createWriteStream(fullname, self.options); - - // - // When the current stream has finished flushing - // then we can be sure we have finished opening - // and thus can emit the `open` event. - // - self.once('flush', function () { - self.opening = false; - self.emit('open', fullname); - }); - - // - // Remark: It is possible that in the time it has taken to find the - // next logfile to be written more data than `maxsize` has been buffered, - // but for sensible limits (10s - 100s of MB) this seems unlikely in less - // than one second. - // - self.flush(); - } - - fs.stat(fullname, function (err, stats) { - if (err) { - if (err.code !== 'ENOENT') { - return self.emit('error', err); - } - - return createAndFlush(0); - } - - if (!stats || (self.maxsize && stats.size >= self.maxsize)) { - // - // If `stats.size` is greater than the `maxsize` for - // this instance then try again - // - return checkFile(self._getFile(true)); - } - - createAndFlush(stats.size); - }); - })(this._getFile()); -}; - -// -// ### @private function _getFile () -// Gets the next filename to use for this instance -// in the case that log filesizes are being capped. -// -File.prototype._getFile = function (inc) { - var self = this, - ext = path.extname(this._basename), - basename = path.basename(this._basename, ext), - remaining; - - if (inc) { - // - // Increment the number of files created or - // checked by this instance. - // - // Check for maxFiles option and delete file - if (this.maxFiles && (this._created >= (this.maxFiles - 1))) { - remaining = this._created - (this.maxFiles - 1); - if (remaining === 0) { - fs.unlinkSync(path.join(this.dirname, basename + ext)); - } - else { - fs.unlinkSync(path.join(this.dirname, basename + remaining + ext)); - } - } - - this._created += 1; - } - - return this._created - ? basename + this._created + ext - : basename + ext; -}; - -// -// ### @private function _lazyDrain () -// Lazily attempts to emit the `logged` event when `this.stream` has -// drained. This is really just a simple mutex that only works because -// Node.js is single-threaded. -// -File.prototype._lazyDrain = function () { - var self = this; - - if (!this._draining && this.stream) { - this._draining = true; - - this.stream.once('drain', function () { - this._draining = false; - self.emit('logged'); - }); - } -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/transports/loggly.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/transports/loggly.js deleted file mode 100644 index dd5762b..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/transports/loggly.js +++ /dev/null @@ -1,161 +0,0 @@ -/* - * loggly.js: Transport for logginh to remote Loggly API - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var events = require('events'), - loggly = require('loggly'), - util = require('util'), - async = require('async'), - common = require('../common'), - Transport = require('./transport').Transport; - -// -// ### function Loggly (options) -// #### @options {Object} Options for this instance. -// Constructor function for the Loggly transport object responsible -// for persisting log messages and metadata to Loggly; 'LaaS'. -// -var Loggly = exports.Loggly = function (options) { - Transport.call(this, options); - - function valid() { - return options.inputToken - || options.inputName && options.auth - || options.inputName && options.inputs && options.inputs[options.inputName] - || options.id && options.inputs && options.inputs[options.id]; - } - - if (!options.subdomain) { - throw new Error('Loggly Subdomain is required'); - } - - if (!valid()) { - throw new Error('Target input token or name is required.'); - } - - this.name = 'loggly'; - this.logBuffer = []; - - this.client = loggly.createClient({ - subdomain: options.subdomain, - auth: options.auth || null, - json: options.json || false - }); - - if (options.inputToken) { - this.inputToken = options.inputToken; - this.ready = true; - } - else if (options.inputs && (options.inputs[options.inputName] - || options.inputs[options.id])) { - this.inputToken = options.inputs[options.inputName] || options.inputs[options.id]; - this.ready = true; - } - else if (options.inputName) { - this.ready = false; - this.inputName = options.inputName; - - var self = this; - this.client.getInput(this.inputName, function (err, input) { - if (err) { - throw err; - } - - self.inputToken = input.input_token; - self.ready = true; - }); - } -}; - -// -// Inherit from `winston.Transport`. -// -util.inherits(Loggly, Transport); - -// -// Expose the name of this Transport on the prototype -// -Loggly.prototype.name = 'loggly'; - -// -// ### function log (level, msg, [meta], callback) -// #### @level {string} Level at which to log the message. -// #### @msg {string} Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} Continuation to respond to when complete. -// Core logging method exposed to Winston. Metadata is optional. -// -Loggly.prototype.log = function (level, msg, meta, callback) { - if (this.silent) { - return callback(null, true); - } - - var self = this, - message = common.clone(meta || {}); - - message.level = level; - message.message = msg; - - if (!this.ready) { - // - // If we haven't gotten the input token yet - // add this message to the log buffer. - // - this.logBuffer.push(message); - } - else if (this.ready && this.logBuffer.length > 0) { - // - // Otherwise if we have buffered messages - // add this message to the buffer and flush them. - // - this.logBuffer.push(message); - this.flush(); - } - else { - // - // Otherwise just log the message as normal - // - this.client.log(this.inputToken, message, function () { - self.emit('logged'); - }); - } - - callback(null, true); -}; - -// -// ### function flush () -// Flushes any buffered messages to the current `stream` -// used by this instance. -// -Loggly.prototype.flush = function () { - var self = this; - - function logMsg (msg, next) { - self.client.log(self.inputToken, msg, function (err) { - if (err) { - self.emit('error', err); - } - - next(); - }); - } - - // - // Initiate calls to loggly for each message in the buffer - // - async.forEach(this.logBuffer, logMsg, function () { - self.emit('logged'); - }); - - process.nextTick(function () { - // - // Then quickly truncate the list - // - self.logBuffer.length = 0; - }); -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/transports/transport.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/transports/transport.js deleted file mode 100644 index a2f941c..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/transports/transport.js +++ /dev/null @@ -1,57 +0,0 @@ -/* - * transport.js: Base Transport object for all Winston transports. - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var events = require('events'), - util = require('util'); - -// -// ### function Transport (options) -// #### @options {Object} Options for this instance. -// Constructor function for the Tranport object responsible -// base functionality for all winston transports. -// -var Transport = exports.Transport = function (options) { - events.EventEmitter.call(this); - - options = options || {}; - this.level = options.level || 'info'; - this.silent = options.silent || false; - this.handleExceptions = options.handleExceptions || false; -}; - -// -// Inherit from `events.EventEmitter`. -// -util.inherits(Transport, events.EventEmitter); - -// -// ### function logException (msg, meta, callback) -// #### @msg {string} Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} Continuation to respond to when complete. -// Logs the specified `msg`, `meta` and responds to the callback once the log -// operation is complete to ensure that the event loop will not exit before -// all logging has completed. -// -Transport.prototype.logException = function (msg, meta, callback) { - var self = this; - - function onLogged () { - self.removeListener('error', onError); - callback(); - } - - function onError () { - self.removeListener('logged', onLogged); - callback(); - } - - this.once('logged', onLogged); - this.once('error', onError); - this.log('error', msg, meta, function () { }); -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/transports/webhook.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/transports/webhook.js deleted file mode 100644 index bf8eb27..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/lib/winston/transports/webhook.js +++ /dev/null @@ -1,136 +0,0 @@ -/* - * webhook.js: Transport for logging to remote http endpoints ( POST / RECEIVE webhooks ) - * - * (C) 2011 Marak Squires - * MIT LICENCE - * - */ - -var events = require('events'), - http = require('http'), - https = require('https'), - util = require('util'), - common = require('../common'), - Transport = require('./transport').Transport; - -// -// ### function WebHook (options) -// #### @options {Object} Options for this instance. -// Constructor function for the Console transport object responsible -// for making arbitrary HTTP requests whenever log messages and metadata -// are received. -// -var Webhook = exports.Webhook = function (options) { - Transport.call(this, options); - - this.name = 'webhook'; - this.host = options.host || 'localhost'; - this.port = options.port || 8080; - this.method = options.method || 'POST'; - this.path = options.path || '/winston-log'; - - if (options.auth) { - this.auth = {}; - this.auth.username = options.auth.username || ''; - this.auth.password = options.auth.password || ''; - } - - if (options.ssl) { - this.ssl = {}; - this.ssl.key = options.ssl.key || null; - this.ssl.cert = options.ssl.cert || null; - this.ssl.ca = options.ssl.ca; - } -}; - -// -// Inherit from `winston.Transport`. -// -util.inherits(Webhook, Transport); - -// -// Expose the name of this Transport on the prototype -// -Webhook.prototype.name = 'webhook'; - -// -// ### function log (level, msg, [meta], callback) -// #### @level {string} Level at which to log the message. -// #### @msg {string} Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} Continuation to respond to when complete. -// Core logging method exposed to Winston. Metadata is optional. -// -Webhook.prototype.log = function (level, msg, meta, callback) { - if (this.silent) { - return callback(null, true); - } - - var self = this, - message = common.clone(meta), - options, - req; - - message.level = level; - message.message = msg; - - // Prepare options for outgoing HTTP request - options = { - host: this.host, - port: this.port, - path: this.path, - method: this.method, - headers: { 'Content-Type': 'application/json' } - }; - - if (this.ssl) { - options.ca = this.ssl.ca; - options.key = this.ssl.key; - options.cert = this.ssl.cert; - } - - if (this.auth) { - // Encode `Authorization` header used by Basic Auth - options.headers['Authorization'] = 'Basic ' + new Buffer( - this.auth.username + ':' + this.auth.password, 'utf8' - ).toString('base64'); - } - - // Perform HTTP logging request - req = (self.ssl ? https : http).request(options, function (res) { - // - // No callback on request, fire and forget about the response - // - self.emit('logged'); - }); - - req.on('error', function (err) { - // - // Propagate the `error` back up to the `Logger` that this - // instance belongs to. - // - self.emit('error', err); - }); - - // - // Write logging event to the outgoing request body - // - // jsonMessage is currently conforming to JSON-RPC v1.0, - // but without the unique id since there is no anticipated response - // see: http://en.wikipedia.org/wiki/JSON-RPC - // - req.write(JSON.stringify({ - method: 'log', - params: { - timestamp: new Date(), - msg: msg, - level: level, - meta: meta - } - })); - - req.end(); - - // Always return true, regardless of any errors - callback(null, true); -}; diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/.gitmodules b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/.gitmodules deleted file mode 100644 index a9aae98..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/.gitmodules +++ /dev/null @@ -1,9 +0,0 @@ -[submodule "deps/nodeunit"] - path = deps/nodeunit - url = git://github.com/caolan/nodeunit.git -[submodule "deps/UglifyJS"] - path = deps/UglifyJS - url = https://github.com/mishoo/UglifyJS.git -[submodule "deps/nodelint"] - path = deps/nodelint - url = https://github.com/tav/nodelint.git diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/.npmignore b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/.npmignore deleted file mode 100644 index 9bdfc97..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -deps -dist -test -nodelint.cfg \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/LICENSE b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/LICENSE deleted file mode 100644 index b7f9d50..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010 Caolan McMahon - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/Makefile b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/Makefile deleted file mode 100644 index bad647c..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -PACKAGE = asyncjs -NODEJS = $(if $(shell test -f /usr/bin/nodejs && echo "true"),nodejs,node) -CWD := $(shell pwd) -NODEUNIT = $(CWD)/node_modules/nodeunit/bin/nodeunit -UGLIFY = $(CWD)/node_modules/uglify-js/bin/uglifyjs -NODELINT = $(CWD)/node_modules/nodelint/nodelint - -BUILDDIR = dist - -all: clean test build - -build: $(wildcard lib/*.js) - mkdir -p $(BUILDDIR) - $(UGLIFY) lib/async.js > $(BUILDDIR)/async.min.js - -test: - $(NODEUNIT) test - -clean: - rm -rf $(BUILDDIR) - -lint: - $(NODELINT) --config nodelint.cfg lib/async.js - -.PHONY: test build all diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/README.md b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/README.md deleted file mode 100644 index 0cf7fc9..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/README.md +++ /dev/null @@ -1,1022 +0,0 @@ -# Async.js - -Async is a utility module which provides straight-forward, powerful functions -for working with asynchronous JavaScript. Although originally designed for -use with [node.js](http://nodejs.org), it can also be used directly in the -browser. - -Async provides around 20 functions that include the usual 'functional' -suspects (map, reduce, filter, forEach…) as well as some common patterns -for asynchronous control flow (parallel, series, waterfall…). All these -functions assume you follow the node.js convention of providing a single -callback as the last argument of your async function. - - -## Quick Examples - - async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file - }); - - async.filter(['file1','file2','file3'], path.exists, function(results){ - // results now equals an array of the existing files - }); - - async.parallel([ - function(){ ... }, - function(){ ... } - ], callback); - - async.series([ - function(){ ... }, - function(){ ... } - ]); - -There are many more functions available so take a look at the docs below for a -full list. This module aims to be comprehensive, so if you feel anything is -missing please create a GitHub issue for it. - - -## Download - -Releases are available for download from -[GitHub](http://github.com/caolan/async/downloads). -Alternatively, you can install using Node Package Manager (npm): - - npm install async - - -__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 17.5kb Uncompressed - -__Production:__ [async.min.js](https://github.com/caolan/async/raw/master/dist/async.min.js) - 1.7kb Packed and Gzipped - - -## In the Browser - -So far its been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage: - - - - - -## Documentation - -### Collections - -* [forEach](#forEach) -* [map](#map) -* [filter](#filter) -* [reject](#reject) -* [reduce](#reduce) -* [detect](#detect) -* [sortBy](#sortBy) -* [some](#some) -* [every](#every) -* [concat](#concat) - -### Control Flow - -* [series](#series) -* [parallel](#parallel) -* [whilst](#whilst) -* [until](#until) -* [waterfall](#waterfall) -* [queue](#queue) -* [auto](#auto) -* [iterator](#iterator) -* [apply](#apply) -* [nextTick](#nextTick) - -### Utils - -* [memoize](#memoize) -* [unmemoize](#unmemoize) -* [log](#log) -* [dir](#dir) -* [noConflict](#noConflict) - - -## Collections - - -### forEach(arr, iterator, callback) - -Applies an iterator function to each item in an array, in parallel. -The iterator is called with an item from the list and a callback for when it -has finished. If the iterator passes an error to this callback, the main -callback for the forEach function is immediately called with the error. - -Note, that since this function applies the iterator to each item in parallel -there is no guarantee that the iterator functions will complete in order. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(err) - A callback which is called after all the iterator functions - have finished, or an error has occurred. - -__Example__ - - // assuming openFiles is an array of file names and saveFile is a function - // to save the modified contents of that file: - - async.forEach(openFiles, saveFile, function(err){ - // if any of the saves produced an error, err would equal that error - }); - ---------------------------------------- - - -### forEachSeries(arr, iterator, callback) - -The same as forEach only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. This means the iterator functions will complete in order. - - ---------------------------------------- - - -### forEachLimit(arr, limit, iterator, callback) - -The same as forEach only the iterator is applied to batches of items in the -array, in series. The next batch of iterators is only called once the current -one has completed processing. - -__Arguments__ - -* arr - An array to iterate over. -* limit - How many items should be in each batch. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(err) - A callback which is called after all the iterator functions - have finished, or an error has occurred. - -__Example__ - - // Assume documents is an array of JSON objects and requestApi is a - // function that interacts with a rate-limited REST api. - - async.forEachLimit(documents, 20, requestApi, function(err){ - // if any of the saves produced an error, err would equal that error - }); ---------------------------------------- - - -### map(arr, iterator, callback) - -Produces a new array of values by mapping each value in the given array through -the iterator function. The iterator is called with an item from the array and a -callback for when it has finished processing. The callback takes 2 arguments, -an error and the transformed item from the array. If the iterator passes an -error to this callback, the main callback for the map function is immediately -called with the error. - -Note, that since this function applies the iterator to each item in parallel -there is no guarantee that the iterator functions will complete in order, however -the results array will be in the same order as the original array. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed - with an error (which can be null) and a transformed item. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is an array of the - transformed items from the original array. - -__Example__ - - async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file - }); - ---------------------------------------- - - -### mapSeries(arr, iterator, callback) - -The same as map only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. The results array will be in the same order as the original. - - ---------------------------------------- - - -### filter(arr, iterator, callback) - -__Alias:__ select - -Returns a new array of all the values which pass an async truth test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like path.exists. This operation is -performed in parallel, but the results array will be in the same order as the -original. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(results) - A callback which is called after all the iterator - functions have finished. - -__Example__ - - async.filter(['file1','file2','file3'], path.exists, function(results){ - // results now equals an array of the existing files - }); - ---------------------------------------- - - -### filterSeries(arr, iterator, callback) - -__alias:__ selectSeries - -The same as filter only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. The results array will be in the same order as the original. - ---------------------------------------- - - -### reject(arr, iterator, callback) - -The opposite of filter. Removes values that pass an async truth test. - ---------------------------------------- - - -### rejectSeries(arr, iterator, callback) - -The same as filter, only the iterator is applied to each item in the array -in series. - - ---------------------------------------- - - -### reduce(arr, memo, iterator, callback) - -__aliases:__ inject, foldl - -Reduces a list of values into a single value using an async iterator to return -each successive step. Memo is the initial state of the reduction. This -function only operates in series. For performance reasons, it may make sense to -split a call to this function into a parallel map, then use the normal -Array.prototype.reduce on the results. This function is for situations where -each step in the reduction needs to be async, if you can get the data before -reducing it then its probably a good idea to do so. - -__Arguments__ - -* arr - An array to iterate over. -* memo - The initial state of the reduction. -* iterator(memo, item, callback) - A function applied to each item in the - array to produce the next step in the reduction. The iterator is passed a - callback which accepts an optional error as its first argument, and the state - of the reduction as the second. If an error is passed to the callback, the - reduction is stopped and the main callback is immediately called with the - error. -* callback(err, result) - A callback which is called after all the iterator - functions have finished. Result is the reduced value. - -__Example__ - - async.reduce([1,2,3], 0, function(memo, item, callback){ - // pointless async: - process.nextTick(function(){ - callback(null, memo + item) - }); - }, function(err, result){ - // result is now equal to the last value of memo, which is 6 - }); - ---------------------------------------- - - -### reduceRight(arr, memo, iterator, callback) - -__Alias:__ foldr - -Same as reduce, only operates on the items in the array in reverse order. - - ---------------------------------------- - - -### detect(arr, iterator, callback) - -Returns the first value in a list that passes an async truth test. The -iterator is applied in parallel, meaning the first iterator to return true will -fire the detect callback with that result. That means the result might not be -the first item in the original array (in terms of order) that passes the test. - -If order within the original array is important then look at detectSeries. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(result) - A callback which is called as soon as any iterator returns - true, or after all the iterator functions have finished. Result will be - the first item in the array that passes the truth test (iterator) or the - value undefined if none passed. - -__Example__ - - async.detect(['file1','file2','file3'], path.exists, function(result){ - // result now equals the first file in the list that exists - }); - ---------------------------------------- - - -### detectSeries(arr, iterator, callback) - -The same as detect, only the iterator is applied to each item in the array -in series. This means the result is always the first in the original array (in -terms of array order) that passes the truth test. - - ---------------------------------------- - - -### sortBy(arr, iterator, callback) - -Sorts a list by the results of running each value through an async iterator. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed - with an error (which can be null) and a value to use as the sort criteria. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is the items from - the original array sorted by the values returned by the iterator calls. - -__Example__ - - async.sortBy(['file1','file2','file3'], function(file, callback){ - fs.stat(file, function(err, stats){ - callback(err, stats.mtime); - }); - }, function(err, results){ - // results is now the original array of files sorted by - // modified date - }); - - ---------------------------------------- - - -### some(arr, iterator, callback) - -__Alias:__ any - -Returns true if at least one element in the array satisfies an async test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like path.exists. Once any iterator -call returns true, the main callback is immediately called. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(result) - A callback which is called as soon as any iterator returns - true, or after all the iterator functions have finished. Result will be - either true or false depending on the values of the async tests. - -__Example__ - - async.some(['file1','file2','file3'], path.exists, function(result){ - // if result is true then at least one of the files exists - }); - ---------------------------------------- - - -### every(arr, iterator, callback) - -__Alias:__ all - -Returns true if every element in the array satisfies an async test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like path.exists. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(result) - A callback which is called after all the iterator - functions have finished. Result will be either true or false depending on - the values of the async tests. - -__Example__ - - async.every(['file1','file2','file3'], path.exists, function(result){ - // if result is true then every file exists - }); - ---------------------------------------- - - -### concat(arr, iterator, callback) - -Applies an iterator to each item in a list, concatenating the results. Returns the -concatenated list. The iterators are called in parallel, and the results are -concatenated as they return. There is no guarantee that the results array will -be returned in the original order of the arguments passed to the iterator function. - -__Arguments__ - -* arr - An array to iterate over -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed - with an error (which can be null) and an array of results. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is an array containing - the concatenated results of the iterator function. - -__Example__ - - async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){ - // files is now a list of filenames that exist in the 3 directories - }); - ---------------------------------------- - - -### concatSeries(arr, iterator, callback) - -Same as async.concat, but executes in series instead of parallel. - - -## Control Flow - - -### series(tasks, [callback]) - -Run an array of functions in series, each one running once the previous -function has completed. If any functions in the series pass an error to its -callback, no more functions are run and the callback for the series is -immediately called with the value of the error. Once the tasks have completed, -the results are passed to the final callback as an array. - -It is also possible to use an object instead of an array. Each property will be -run as a function and the results will be passed to the final callback as an object -instead of an array. This can be a more readable way of handling results from -async.series. - - -__Arguments__ - -* tasks - An array or object containing functions to run, each function is passed - a callback it must call on completion. -* callback(err, results) - An optional callback to run once all the functions - have completed. This function gets an array of all the arguments passed to - the callbacks used in the array. - -__Example__ - - async.series([ - function(callback){ - // do some stuff ... - callback(null, 'one'); - }, - function(callback){ - // do some more stuff ... - callback(null, 'two'); - }, - ], - // optional callback - function(err, results){ - // results is now equal to ['one', 'two'] - }); - - - // an example using an object instead of an array - async.series({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - }, - }, - function(err, results) { - // results is now equal to: {one: 1, two: 2} - }); - - ---------------------------------------- - - -### parallel(tasks, [callback]) - -Run an array of functions in parallel, without waiting until the previous -function has completed. If any of the functions pass an error to its -callback, the main callback is immediately called with the value of the error. -Once the tasks have completed, the results are passed to the final callback as an -array. - -It is also possible to use an object instead of an array. Each property will be -run as a function and the results will be passed to the final callback as an object -instead of an array. This can be a more readable way of handling results from -async.parallel. - - -__Arguments__ - -* tasks - An array or object containing functions to run, each function is passed a - callback it must call on completion. -* callback(err, results) - An optional callback to run once all the functions - have completed. This function gets an array of all the arguments passed to - the callbacks used in the array. - -__Example__ - - async.parallel([ - function(callback){ - setTimeout(function(){ - callback(null, 'one'); - }, 200); - }, - function(callback){ - setTimeout(function(){ - callback(null, 'two'); - }, 100); - }, - ], - // optional callback - function(err, results){ - // in this case, the results array will equal ['two','one'] - // because the functions were run in parallel and the second - // function had a shorter timeout before calling the callback. - }); - - - // an example using an object instead of an array - async.parallel({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - }, - }, - function(err, results) { - // results is now equals to: {one: 1, two: 2} - }); - - ---------------------------------------- - - -### whilst(test, fn, callback) - -Repeatedly call fn, while test returns true. Calls the callback when stopped, -or an error occurs. - -__Arguments__ - -* test() - synchronous truth test to perform before each execution of fn. -* fn(callback) - A function to call each time the test passes. The function is - passed a callback which must be called once it has completed with an optional - error as the first argument. -* callback(err) - A callback which is called after the test fails and repeated - execution of fn has stopped. - -__Example__ - - var count = 0; - - async.whilst( - function () { return count < 5; }, - function (callback) { - count++; - setTimeout(callback, 1000); - }, - function (err) { - // 5 seconds have passed - } - ); - - ---------------------------------------- - - -### until(test, fn, callback) - -Repeatedly call fn, until test returns true. Calls the callback when stopped, -or an error occurs. - -The inverse of async.whilst. - - ---------------------------------------- - - -### waterfall(tasks, [callback]) - -Runs an array of functions in series, each passing their results to the next in -the array. However, if any of the functions pass an error to the callback, the -next function is not executed and the main callback is immediately called with -the error. - -__Arguments__ - -* tasks - An array of functions to run, each function is passed a callback it - must call on completion. -* callback(err, [results]) - An optional callback to run once all the functions - have completed. This will be passed the results of the last task's callback. - - - -__Example__ - - async.waterfall([ - function(callback){ - callback(null, 'one', 'two'); - }, - function(arg1, arg2, callback){ - callback(null, 'three'); - }, - function(arg1, callback){ - // arg1 now equals 'three' - callback(null, 'done'); - } - ], function (err, result) { - // result now equals 'done' - }); - - ---------------------------------------- - - -### queue(worker, concurrency) - -Creates a queue object with the specified concurrency. Tasks added to the -queue will be processed in parallel (up to the concurrency limit). If all -workers are in progress, the task is queued until one is available. Once -a worker has completed a task, the task's callback is called. - -__Arguments__ - -* worker(task, callback) - An asynchronous function for processing a queued - task. -* concurrency - An integer for determining how many worker functions should be - run in parallel. - -__Queue objects__ - -The queue object returned by this function has the following properties and -methods: - -* length() - a function returning the number of items waiting to be processed. -* concurrency - an integer for determining how many worker functions should be - run in parallel. This property can be changed after a queue is created to - alter the concurrency on-the-fly. -* push(task, [callback]) - add a new task to the queue, the callback is called - once the worker has finished processing the task. - instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list. -* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued -* empty - a callback that is called when the last item from the queue is given to a worker -* drain - a callback that is called when the last item from the queue has returned from the worker - -__Example__ - - // create a queue object with concurrency 2 - - var q = async.queue(function (task, callback) { - console.log('hello ' + task.name); - callback(); - }, 2); - - - // assign a callback - q.drain = function() { - console.log('all items have been processed'); - } - - // add some items to the queue - - q.push({name: 'foo'}, function (err) { - console.log('finished processing foo'); - }); - q.push({name: 'bar'}, function (err) { - console.log('finished processing bar'); - }); - - // add some items to the queue (batch-wise) - - q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) { - console.log('finished processing bar'); - }); - - ---------------------------------------- - - -### auto(tasks, [callback]) - -Determines the best order for running functions based on their requirements. -Each function can optionally depend on other functions being completed first, -and each function is run as soon as its requirements are satisfied. If any of -the functions pass an error to their callback, that function will not complete -(so any other functions depending on it will not run) and the main callback -will be called immediately with the error. Functions also receive an object -containing the results of functions which have completed so far. - -__Arguments__ - -* tasks - An object literal containing named functions or an array of - requirements, with the function itself the last item in the array. The key - used for each function or array is used when specifying requirements. The - syntax is easier to understand by looking at the example. -* callback(err, results) - An optional callback which is called when all the - tasks have been completed. The callback will receive an error as an argument - if any tasks pass an error to their callback. If all tasks complete - successfully, it will receive an object containing their results. - -__Example__ - - async.auto({ - get_data: function(callback){ - // async code to get some data - }, - make_folder: function(callback){ - // async code to create a directory to store a file in - // this is run at the same time as getting the data - }, - write_file: ['get_data', 'make_folder', function(callback){ - // once there is some data and the directory exists, - // write the data to a file in the directory - callback(null, filename); - }], - email_link: ['write_file', function(callback, results){ - // once the file is written let's email a link to it... - // results.write_file contains the filename returned by write_file. - }] - }); - -This is a fairly trivial example, but to do this using the basic parallel and -series functions would look like this: - - async.parallel([ - function(callback){ - // async code to get some data - }, - function(callback){ - // async code to create a directory to store a file in - // this is run at the same time as getting the data - } - ], - function(results){ - async.series([ - function(callback){ - // once there is some data and the directory exists, - // write the data to a file in the directory - }, - email_link: function(callback){ - // once the file is written let's email a link to it... - } - ]); - }); - -For a complicated series of async tasks using the auto function makes adding -new tasks much easier and makes the code more readable. - - ---------------------------------------- - - -### iterator(tasks) - -Creates an iterator function which calls the next function in the array, -returning a continuation to call the next one after that. Its also possible to -'peek' the next iterator by doing iterator.next(). - -This function is used internally by the async module but can be useful when -you want to manually control the flow of functions in series. - -__Arguments__ - -* tasks - An array of functions to run, each function is passed a callback it - must call on completion. - -__Example__ - - var iterator = async.iterator([ - function(){ sys.p('one'); }, - function(){ sys.p('two'); }, - function(){ sys.p('three'); } - ]); - - node> var iterator2 = iterator(); - 'one' - node> var iterator3 = iterator2(); - 'two' - node> iterator3(); - 'three' - node> var nextfn = iterator2.next(); - node> nextfn(); - 'three' - - ---------------------------------------- - - -### apply(function, arguments..) - -Creates a continuation function with some arguments already applied, a useful -shorthand when combined with other control flow functions. Any arguments -passed to the returned function are added to the arguments originally passed -to apply. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to automatically apply when the - continuation is called. - -__Example__ - - // using apply - - async.parallel([ - async.apply(fs.writeFile, 'testfile1', 'test1'), - async.apply(fs.writeFile, 'testfile2', 'test2'), - ]); - - - // the same process without using apply - - async.parallel([ - function(callback){ - fs.writeFile('testfile1', 'test1', callback); - }, - function(callback){ - fs.writeFile('testfile2', 'test2', callback); - }, - ]); - -It's possible to pass any number of additional arguments when calling the -continuation: - - node> var fn = async.apply(sys.puts, 'one'); - node> fn('two', 'three'); - one - two - three - ---------------------------------------- - - -### nextTick(callback) - -Calls the callback on a later loop around the event loop. In node.js this just -calls process.nextTick, in the browser it falls back to setTimeout(callback, 0), -which means other higher priority events may precede the execution of the callback. - -This is used internally for browser-compatibility purposes. - -__Arguments__ - -* callback - The function to call on a later loop around the event loop. - -__Example__ - - var call_order = []; - async.nextTick(function(){ - call_order.push('two'); - // call_order now equals ['one','two] - }); - call_order.push('one') - - -## Utils - - -### memoize(fn, [hasher]) - -Caches the results of an async function. When creating a hash to store function -results against, the callback is omitted from the hash and an optional hash -function can be used. - -__Arguments__ - -* fn - the function you to proxy and cache results from. -* hasher - an optional function for generating a custom hash for storing - results, it has all the arguments applied to it apart from the callback, and - must be synchronous. - -__Example__ - - var slow_fn = function (name, callback) { - // do something - callback(null, result); - }; - var fn = async.memoize(slow_fn); - - // fn can now be used as if it were slow_fn - fn('some name', function () { - // callback - }); - - -### unmemoize(fn) - -Undoes a memoized function, reverting it to the original, unmemoized -form. Comes handy in tests. - -__Arguments__ - -* fn - the memoized function - - -### log(function, arguments) - -Logs the result of an async function to the console. Only works in node.js or -in browsers that support console.log and console.error (such as FF and Chrome). -If multiple arguments are returned from the async function, console.log is -called on each argument in order. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to apply to the function. - -__Example__ - - var hello = function(name, callback){ - setTimeout(function(){ - callback(null, 'hello ' + name); - }, 1000); - }; - - node> async.log(hello, 'world'); - 'hello world' - - ---------------------------------------- - - -### dir(function, arguments) - -Logs the result of an async function to the console using console.dir to -display the properties of the resulting object. Only works in node.js or -in browsers that support console.dir and console.error (such as FF and Chrome). -If multiple arguments are returned from the async function, console.dir is -called on each argument in order. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to apply to the function. - -__Example__ - - var hello = function(name, callback){ - setTimeout(function(){ - callback(null, {hello: name}); - }, 1000); - }; - - node> async.dir(hello, 'world'); - {hello: 'world'} - - ---------------------------------------- - - -### noConflict() - -Changes the value of async back to its original value, returning a reference to the -async object. diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/index.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/index.js deleted file mode 100644 index 8e23845..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// This file is just added for convenience so this repository can be -// directly checked out into a project's deps folder -module.exports = require('./lib/async'); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/lib/async.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/lib/async.js deleted file mode 100644 index 52276d6..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/lib/async.js +++ /dev/null @@ -1,692 +0,0 @@ -/*global setTimeout: false, console: false */ -(function () { - - var async = {}; - - // global on the server, window in the browser - var root = this, - previous_async = root.async; - - if (typeof module !== 'undefined' && module.exports) { - module.exports = async; - } - else { - root.async = async; - } - - async.noConflict = function () { - root.async = previous_async; - return async; - }; - - //// cross-browser compatiblity functions //// - - var _forEach = function (arr, iterator) { - if (arr.forEach) { - return arr.forEach(iterator); - } - for (var i = 0; i < arr.length; i += 1) { - iterator(arr[i], i, arr); - } - }; - - var _map = function (arr, iterator) { - if (arr.map) { - return arr.map(iterator); - } - var results = []; - _forEach(arr, function (x, i, a) { - results.push(iterator(x, i, a)); - }); - return results; - }; - - var _reduce = function (arr, iterator, memo) { - if (arr.reduce) { - return arr.reduce(iterator, memo); - } - _forEach(arr, function (x, i, a) { - memo = iterator(memo, x, i, a); - }); - return memo; - }; - - var _keys = function (obj) { - if (Object.keys) { - return Object.keys(obj); - } - var keys = []; - for (var k in obj) { - if (obj.hasOwnProperty(k)) { - keys.push(k); - } - } - return keys; - }; - - //// exported async module functions //// - - //// nextTick implementation with browser-compatible fallback //// - if (typeof process === 'undefined' || !(process.nextTick)) { - async.nextTick = function (fn) { - setTimeout(fn, 0); - }; - } - else { - async.nextTick = process.nextTick; - } - - async.forEach = function (arr, iterator, callback) { - callback = callback || function () {}; - if (!arr.length) { - return callback(); - } - var completed = 0; - _forEach(arr, function (x) { - iterator(x, function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - if (completed === arr.length) { - callback(); - } - } - }); - }); - }; - - async.forEachSeries = function (arr, iterator, callback) { - callback = callback || function () {}; - if (!arr.length) { - return callback(); - } - var completed = 0; - var iterate = function () { - iterator(arr[completed], function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - if (completed === arr.length) { - callback(); - } - else { - iterate(); - } - } - }); - }; - iterate(); - }; - - async.forEachLimit = function (arr, limit, iterator, callback) { - callback = callback || function () {}; - if (!arr.length || limit <= 0) { - return callback(); - } - var completed = 0; - var started = 0; - var running = 0; - - (function replenish () { - if (completed === arr.length) { - return callback(); - } - - while (running < limit && started < arr.length) { - iterator(arr[started], function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - running -= 1; - if (completed === arr.length) { - callback(); - } - else { - replenish(); - } - } - }); - started += 1; - running += 1; - } - })(); - }; - - - var doParallel = function (fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [async.forEach].concat(args)); - }; - }; - var doSeries = function (fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [async.forEachSeries].concat(args)); - }; - }; - - - var _asyncMap = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (err, v) { - results[x.index] = v; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - }; - async.map = doParallel(_asyncMap); - async.mapSeries = doSeries(_asyncMap); - - - // reduce only has a series version, as doing reduce in parallel won't - // work in many situations. - async.reduce = function (arr, memo, iterator, callback) { - async.forEachSeries(arr, function (x, callback) { - iterator(memo, x, function (err, v) { - memo = v; - callback(err); - }); - }, function (err) { - callback(err, memo); - }); - }; - // inject alias - async.inject = async.reduce; - // foldl alias - async.foldl = async.reduce; - - async.reduceRight = function (arr, memo, iterator, callback) { - var reversed = _map(arr, function (x) { - return x; - }).reverse(); - async.reduce(reversed, memo, iterator, callback); - }; - // foldr alias - async.foldr = async.reduceRight; - - var _filter = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (v) { - if (v) { - results.push(x); - } - callback(); - }); - }, function (err) { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - }; - async.filter = doParallel(_filter); - async.filterSeries = doSeries(_filter); - // select alias - async.select = async.filter; - async.selectSeries = async.filterSeries; - - var _reject = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (v) { - if (!v) { - results.push(x); - } - callback(); - }); - }, function (err) { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - }; - async.reject = doParallel(_reject); - async.rejectSeries = doSeries(_reject); - - var _detect = function (eachfn, arr, iterator, main_callback) { - eachfn(arr, function (x, callback) { - iterator(x, function (result) { - if (result) { - main_callback(x); - main_callback = function () {}; - } - else { - callback(); - } - }); - }, function (err) { - main_callback(); - }); - }; - async.detect = doParallel(_detect); - async.detectSeries = doSeries(_detect); - - async.some = function (arr, iterator, main_callback) { - async.forEach(arr, function (x, callback) { - iterator(x, function (v) { - if (v) { - main_callback(true); - main_callback = function () {}; - } - callback(); - }); - }, function (err) { - main_callback(false); - }); - }; - // any alias - async.any = async.some; - - async.every = function (arr, iterator, main_callback) { - async.forEach(arr, function (x, callback) { - iterator(x, function (v) { - if (!v) { - main_callback(false); - main_callback = function () {}; - } - callback(); - }); - }, function (err) { - main_callback(true); - }); - }; - // all alias - async.all = async.every; - - async.sortBy = function (arr, iterator, callback) { - async.map(arr, function (x, callback) { - iterator(x, function (err, criteria) { - if (err) { - callback(err); - } - else { - callback(null, {value: x, criteria: criteria}); - } - }); - }, function (err, results) { - if (err) { - return callback(err); - } - else { - var fn = function (left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - }; - callback(null, _map(results.sort(fn), function (x) { - return x.value; - })); - } - }); - }; - - async.auto = function (tasks, callback) { - callback = callback || function () {}; - var keys = _keys(tasks); - if (!keys.length) { - return callback(null); - } - - var results = {}; - - var listeners = []; - var addListener = function (fn) { - listeners.unshift(fn); - }; - var removeListener = function (fn) { - for (var i = 0; i < listeners.length; i += 1) { - if (listeners[i] === fn) { - listeners.splice(i, 1); - return; - } - } - }; - var taskComplete = function () { - _forEach(listeners.slice(0), function (fn) { - fn(); - }); - }; - - addListener(function () { - if (_keys(results).length === keys.length) { - callback(null, results); - callback = function () {}; - } - }); - - _forEach(keys, function (k) { - var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k]; - var taskCallback = function (err) { - if (err) { - callback(err); - // stop subsequent errors hitting callback multiple times - callback = function () {}; - } - else { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - taskComplete(); - } - }; - var requires = task.slice(0, Math.abs(task.length - 1)) || []; - var ready = function () { - return _reduce(requires, function (a, x) { - return (a && results.hasOwnProperty(x)); - }, true); - }; - if (ready()) { - task[task.length - 1](taskCallback, results); - } - else { - var listener = function () { - if (ready()) { - removeListener(listener); - task[task.length - 1](taskCallback, results); - } - }; - addListener(listener); - } - }); - }; - - async.waterfall = function (tasks, callback) { - callback = callback || function () {}; - if (!tasks.length) { - return callback(); - } - var wrapIterator = function (iterator) { - return function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - var args = Array.prototype.slice.call(arguments, 1); - var next = iterator.next(); - if (next) { - args.push(wrapIterator(next)); - } - else { - args.push(callback); - } - async.nextTick(function () { - iterator.apply(null, args); - }); - } - }; - }; - wrapIterator(async.iterator(tasks))(); - }; - - async.parallel = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - async.map(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args); - }); - } - }, callback); - } - else { - var results = {}; - async.forEach(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.series = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - async.mapSeries(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args); - }); - } - }, callback); - } - else { - var results = {}; - async.forEachSeries(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.iterator = function (tasks) { - var makeCallback = function (index) { - var fn = function () { - if (tasks.length) { - tasks[index].apply(null, arguments); - } - return fn.next(); - }; - fn.next = function () { - return (index < tasks.length - 1) ? makeCallback(index + 1): null; - }; - return fn; - }; - return makeCallback(0); - }; - - async.apply = function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - return function () { - return fn.apply( - null, args.concat(Array.prototype.slice.call(arguments)) - ); - }; - }; - - var _concat = function (eachfn, arr, fn, callback) { - var r = []; - eachfn(arr, function (x, cb) { - fn(x, function (err, y) { - r = r.concat(y || []); - cb(err); - }); - }, function (err) { - callback(err, r); - }); - }; - async.concat = doParallel(_concat); - async.concatSeries = doSeries(_concat); - - async.whilst = function (test, iterator, callback) { - if (test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.whilst(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.until = function (test, iterator, callback) { - if (!test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.until(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.queue = function (worker, concurrency) { - var workers = 0; - var q = { - tasks: [], - concurrency: concurrency, - saturated: null, - empty: null, - drain: null, - push: function (data, callback) { - if(data.constructor !== Array) { - data = [data]; - } - _forEach(data, function(task) { - q.tasks.push({ - data: task, - callback: typeof callback === 'function' ? callback : null - }); - if (q.saturated && q.tasks.length == concurrency) { - q.saturated(); - } - async.nextTick(q.process); - }); - }, - process: function () { - if (workers < q.concurrency && q.tasks.length) { - var task = q.tasks.shift(); - if(q.empty && q.tasks.length == 0) q.empty(); - workers += 1; - worker(task.data, function () { - workers -= 1; - if (task.callback) { - task.callback.apply(task, arguments); - } - if(q.drain && q.tasks.length + workers == 0) q.drain(); - q.process(); - }); - } - }, - length: function () { - return q.tasks.length; - }, - running: function () { - return workers; - } - }; - return q; - }; - - var _console_fn = function (name) { - return function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - fn.apply(null, args.concat([function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (typeof console !== 'undefined') { - if (err) { - if (console.error) { - console.error(err); - } - } - else if (console[name]) { - _forEach(args, function (x) { - console[name](x); - }); - } - } - }])); - }; - }; - async.log = _console_fn('log'); - async.dir = _console_fn('dir'); - /*async.info = _console_fn('info'); - async.warn = _console_fn('warn'); - async.error = _console_fn('error');*/ - - async.memoize = function (fn, hasher) { - var memo = {}; - var queues = {}; - hasher = hasher || function (x) { - return x; - }; - var memoized = function () { - var args = Array.prototype.slice.call(arguments); - var callback = args.pop(); - var key = hasher.apply(null, args); - if (key in memo) { - callback.apply(null, memo[key]); - } - else if (key in queues) { - queues[key].push(callback); - } - else { - queues[key] = [callback]; - fn.apply(null, args.concat([function () { - memo[key] = arguments; - var q = queues[key]; - delete queues[key]; - for (var i = 0, l = q.length; i < l; i++) { - q[i].apply(null, arguments); - } - }])); - } - }; - memoized.unmemoized = fn; - return memoized; - }; - - async.unmemoize = function (fn) { - return function () { - return (fn.unmemoized || fn).apply(null, arguments); - } - }; - -}()); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/package.json b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/package.json deleted file mode 100644 index bf89264..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/async/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "async", - "description": "Higher-order functions and common patterns for asynchronous code", - "main": "./index", - "author": { - "name": "Caolan McMahon" - }, - "version": "0.1.18", - "repository": { - "type": "git", - "url": "git://github.com/caolan/async.git" - }, - "bugs": { - "url": "http://github.com/caolan/async/issues" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://github.com/caolan/async/raw/master/LICENSE" - } - ], - "devDependencies": { - "nodeunit": ">0.0.0", - "uglify-js": "1.2.x", - "nodelint": ">0.0.0" - }, - "_id": "async@0.1.18", - "dependencies": {}, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "async@0.1.x", - "scripts": {} -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/eyes/LICENSE b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/eyes/LICENSE deleted file mode 100644 index a1edd93..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/eyes/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2009 cloudhead - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/eyes/Makefile b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/eyes/Makefile deleted file mode 100644 index a121dea..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/eyes/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -test: - @@node test/eyes-test.js - -.PHONY: test diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/eyes/README.md b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/eyes/README.md deleted file mode 100644 index 7a92158..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/eyes/README.md +++ /dev/null @@ -1,72 +0,0 @@ -eyes -==== - -a customizable value inspector for Node.js - -synopsis --------- - -I was tired of looking at cluttered output in the console -- something needed to be done, -`sys.inspect()` didn't display regexps correctly, and was too verbose, and I had an hour or two to spare. -So I decided to have some fun. _eyes_ were born. - -![eyes-ss](http://dl.dropbox.com/u/251849/eyes-js-ss.gif) - -_example of the output of a user-customized eyes.js inspector_ - -*eyes* also deals with circular objects in an intelligent way, and can pretty-print object literals. - -usage ------ - - var inspect = require('eyes').inspector({styles: {all: 'magenta'}}); - - inspect(something); // inspect with the settings passed to `inspector` - -or - - var eyes = require('eyes'); - - eyes.inspect(something); // inspect with the default settings - -you can pass a _label_ to `inspect()`, to keep track of your inspections: - - eyes.inspect(something, "a random value"); - -If you want to return the output of eyes without printing it, you can set it up this way: - - var inspect = require('eyes').inspector({ stream: null }); - - sys.puts(inspect({ something: 42 })); - -customization -------------- - -These are the default styles and settings used by _eyes_. - styles: { // Styles applied to stdout - all: 'cyan', // Overall style applied to everything - label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]` - other: 'inverted', // Objects which don't have a literal representation, such as functions - key: 'bold', // The keys in object literals, like 'a' in `{a: 1}` - - special: 'grey', // null, undefined... - string: 'green', - number: 'magenta', - bool: 'blue', // true false - regexp: 'green', // /\d+/ - }, - pretty: true, // Indent object literals - hideFunctions: false, // Don't output functions at all - stream: process.stdout, // Stream to write to, or null - maxLength: 2048 // Truncate output if longer - -You can overwrite them with your own, by passing a similar object to `inspector()` or `inspect()`. - - var inspect = require('eyes').inspector({ - styles: { - all: 'magenta', - special: 'bold' - }, - maxLength: 512 - }); - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/eyes/lib/eyes.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/eyes/lib/eyes.js deleted file mode 100644 index 10d964b..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/eyes/lib/eyes.js +++ /dev/null @@ -1,236 +0,0 @@ -// -// Eyes.js - a customizable value inspector for Node.js -// -// usage: -// -// var inspect = require('eyes').inspector({styles: {all: 'magenta'}}); -// inspect(something); // inspect with the settings passed to `inspector` -// -// or -// -// var eyes = require('eyes'); -// eyes.inspect(something); // inspect with the default settings -// -var eyes = exports, - stack = []; - -eyes.defaults = { - styles: { // Styles applied to stdout - all: 'cyan', // Overall style applied to everything - label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]` - other: 'inverted', // Objects which don't have a literal representation, such as functions - key: 'bold', // The keys in object literals, like 'a' in `{a: 1}` - special: 'grey', // null, undefined... - string: 'green', - number: 'magenta', - bool: 'blue', // true false - regexp: 'green', // /\d+/ - }, - pretty: true, // Indent object literals - hideFunctions: false, - showHidden: false, - stream: process.stdout, - maxLength: 2048 // Truncate output if longer -}; - -// Return a curried inspect() function, with the `options` argument filled in. -eyes.inspector = function (options) { - var that = this; - return function (obj, label, opts) { - return that.inspect.call(that, obj, label, - merge(options || {}, opts || {})); - }; -}; - -// If we have a `stream` defined, use it to print a styled string, -// if not, we just return the stringified object. -eyes.inspect = function (obj, label, options) { - options = merge(this.defaults, options || {}); - - if (options.stream) { - return this.print(stringify(obj, options), label, options); - } else { - return stringify(obj, options) + (options.styles ? '\033[39m' : ''); - } -}; - -// Output using the 'stream', and an optional label -// Loop through `str`, and truncate it after `options.maxLength` has been reached. -// Because escape sequences are, at this point embeded within -// the output string, we can't measure the length of the string -// in a useful way, without separating what is an escape sequence, -// versus a printable character (`c`). So we resort to counting the -// length manually. -eyes.print = function (str, label, options) { - for (var c = 0, i = 0; i < str.length; i++) { - if (str.charAt(i) === '\033') { i += 4 } // `4` because '\033[25m'.length + 1 == 5 - else if (c === options.maxLength) { - str = str.slice(0, i - 1) + '…'; - break; - } else { c++ } - } - return options.stream.write.call(options.stream, (label ? - this.stylize(label, options.styles.label, options.styles) + ': ' : '') + - this.stylize(str, options.styles.all, options.styles) + '\033[0m' + "\n"); -}; - -// Apply a style to a string, eventually, -// I'd like this to support passing multiple -// styles. -eyes.stylize = function (str, style, styles) { - var codes = { - 'bold' : [1, 22], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'cyan' : [36, 39], - 'magenta' : [35, 39], - 'blue' : [34, 39], - 'yellow' : [33, 39], - 'green' : [32, 39], - 'red' : [31, 39], - 'grey' : [90, 39] - }, endCode; - - if (style && codes[style]) { - endCode = (codes[style][1] === 39 && styles.all) ? codes[styles.all][0] - : codes[style][1]; - return '\033[' + codes[style][0] + 'm' + str + - '\033[' + endCode + 'm'; - } else { return str } -}; - -// Convert any object to a string, ready for output. -// When an 'array' or an 'object' are encountered, they are -// passed to specialized functions, which can then recursively call -// stringify(). -function stringify(obj, options) { - var that = this, stylize = function (str, style) { - return eyes.stylize(str, options.styles[style], options.styles) - }, index, result; - - if ((index = stack.indexOf(obj)) !== -1) { - return stylize(new(Array)(stack.length - index + 1).join('.'), 'special'); - } - stack.push(obj); - - result = (function (obj) { - switch (typeOf(obj)) { - case "string" : obj = stringifyString(obj.indexOf("'") === -1 ? "'" + obj + "'" - : '"' + obj + '"'); - return stylize(obj, 'string'); - case "regexp" : return stylize('/' + obj.source + '/', 'regexp'); - case "number" : return stylize(obj + '', 'number'); - case "function" : return options.stream ? stylize("Function", 'other') : '[Function]'; - case "null" : return stylize("null", 'special'); - case "undefined": return stylize("undefined", 'special'); - case "boolean" : return stylize(obj + '', 'bool'); - case "date" : return stylize(obj.toUTCString()); - case "array" : return stringifyArray(obj, options, stack.length); - case "object" : return stringifyObject(obj, options, stack.length); - } - })(obj); - - stack.pop(); - return result; -}; - -// Escape invisible characters in a string -function stringifyString (str, options) { - return str.replace(/\\/g, '\\\\') - .replace(/\n/g, '\\n') - .replace(/[\u0001-\u001F]/g, function (match) { - return '\\0' + match[0].charCodeAt(0).toString(8); - }); -} - -// Convert an array to a string, such as [1, 2, 3]. -// This function calls stringify() for each of the elements -// in the array. -function stringifyArray(ary, options, level) { - var out = []; - var pretty = options.pretty && (ary.length > 4 || ary.some(function (o) { - return (o !== null && typeof(o) === 'object' && Object.keys(o).length > 0) || - (Array.isArray(o) && o.length > 0); - })); - var ws = pretty ? '\n' + new(Array)(level * 4 + 1).join(' ') : ' '; - - for (var i = 0; i < ary.length; i++) { - out.push(stringify(ary[i], options)); - } - - if (out.length === 0) { - return '[]'; - } else { - return '[' + ws - + out.join(',' + (pretty ? ws : ' ')) - + (pretty ? ws.slice(0, -4) : ws) + - ']'; - } -}; - -// Convert an object to a string, such as {a: 1}. -// This function calls stringify() for each of its values, -// and does not output functions or prototype values. -function stringifyObject(obj, options, level) { - var out = []; - var pretty = options.pretty && (Object.keys(obj).length > 2 || - Object.keys(obj).some(function (k) { return typeof(obj[k]) === 'object' })); - var ws = pretty ? '\n' + new(Array)(level * 4 + 1).join(' ') : ' '; - - var keys = options.showHidden ? Object.keys(obj) : Object.getOwnPropertyNames(obj); - keys.forEach(function (k) { - if (Object.prototype.hasOwnProperty.call(obj, k) - && !(obj[k] instanceof Function && options.hideFunctions)) { - out.push(eyes.stylize(k, options.styles.key, options.styles) + ': ' + - stringify(obj[k], options)); - } - }); - - if (out.length === 0) { - return '{}'; - } else { - return "{" + ws - + out.join(',' + (pretty ? ws : ' ')) - + (pretty ? ws.slice(0, -4) : ws) + - "}"; - } -}; - -// A better `typeof` -function typeOf(value) { - var s = typeof(value), - types = [Object, Array, String, RegExp, Number, Function, Boolean, Date]; - - if (s === 'object' || s === 'function') { - if (value) { - types.forEach(function (t) { - if (value instanceof t) { s = t.name.toLowerCase() } - }); - } else { s = 'null' } - } - return s; -} - -function merge(/* variable args */) { - var objs = Array.prototype.slice.call(arguments); - var target = {}; - - objs.forEach(function (o) { - Object.keys(o).forEach(function (k) { - if (k === 'styles') { - if (! o.styles) { - target.styles = false; - } else { - target.styles = {} - for (var s in o.styles) { - target.styles[s] = o.styles[s]; - } - } - } else { - target[k] = o[k]; - } - }); - }); - return target; -} - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/eyes/package.json b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/eyes/package.json deleted file mode 100644 index ad90430..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/eyes/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "eyes", - "description": "a customizable value inspector", - "url": "http://github.com/cloudhead/eyes.js", - "keywords": [ - "inspector", - "debug", - "inspect", - "print" - ], - "author": { - "name": "Alexis Sellier", - "email": "self@cloudhead.net" - }, - "contributors": [ - { - "name": "Charlie Robbins", - "email": "charlie@nodejitsu.com" - } - ], - "licenses": [ - "MIT" - ], - "dependencies": {}, - "main": "./lib/eyes", - "version": "0.1.7", - "scripts": { - "test": "node test/*-test.js" - }, - "directories": { - "lib": "./lib", - "test": "./test" - }, - "engines": { - "node": "> 0.1.90" - }, - "_id": "eyes@0.1.7", - "devDependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "eyes@0.1.x" -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/eyes/test/eyes-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/eyes/test/eyes-test.js deleted file mode 100644 index 1f9606a..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/eyes/test/eyes-test.js +++ /dev/null @@ -1,56 +0,0 @@ -var util = require('util'); -var eyes = require('../lib/eyes'); - -eyes.inspect({ - number: 42, - string: "John Galt", - regexp: /[a-z]+/, - array: [99, 168, 'x', {}], - func: function () {}, - bool: false, - nil: null, - undef: undefined, - object: {attr: []} -}, "native types"); - -eyes.inspect({ - number: new(Number)(42), - string: new(String)("John Galt"), - regexp: new(RegExp)(/[a-z]+/), - array: new(Array)(99, 168, 'x', {}), - bool: new(Boolean)(false), - object: new(Object)({attr: []}), - date: new(Date) -}, "wrapped types"); - -var obj = {}; -obj.that = { self: obj }; -obj.self = obj; - -eyes.inspect(obj, "circular object"); -eyes.inspect({hello: 'moto'}, "small object"); -eyes.inspect({hello: new(Array)(6) }, "big object"); -eyes.inspect(["hello 'world'", 'hello "world"'], "quotes"); -eyes.inspect({ - recommendations: [{ - id: 'a7a6576c2c822c8e2bd81a27e41437d8', - key: [ 'spree', 3.764316258020699 ], - value: { - _id: 'a7a6576c2c822c8e2bd81a27e41437d8', - _rev: '1-2e2d2f7fd858c4a5984bcf809d22ed98', - type: 'domain', - domain: 'spree', - weight: 3.764316258020699, - product_id: 30 - } - }] -}, 'complex'); - -eyes.inspect([null], "null in array"); - -var inspect = eyes.inspector({ stream: null }); - -util.puts(inspect('something', "something")); -util.puts(inspect("something else")); - -util.puts(inspect(["no color"], null, { styles: false })); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/.npmignore b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/.npmignore deleted file mode 100644 index 8f08029..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -test/data -test/data/* -node_modules -npm-debug.log \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/README.md b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/README.md deleted file mode 100644 index 926cb63..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/README.md +++ /dev/null @@ -1,227 +0,0 @@ -# node-loggly - -A client implementation for Loggly in node.js - -## Installation - -### Installing npm (node package manager) -``` bash - $ curl http://npmjs.org/install.sh | sh -``` - -### Installing node-loggly -``` bash - $ [sudo] npm install loggly -``` - -## Usage - -The node-loggly library is compliant with the [Loggly API][0]. Using node-loggly is easy for a variety of scenarios: logging, working with devices and inputs, searching, and facet searching. - -### Getting Started -Before we can do anything with Loggly, we have to create a client with valid credentials. We will authenticate for you automatically: - -``` js - var loggly = require('loggly'); - var config = { - subdomain: "your-subdomain", - auth: { - username: "your-username", - password: "your-password" - } - }; - var client = loggly.createClient(config); -``` - -### Logging -There are two ways to send log information to Loggly via node-loggly. The first is to simply call client.log with an appropriate input token: - -``` js - client.log('your-really-long-input-token', '127.0.0.1 - Theres no place like home', function (err, result) { - // Do something once you've logged - }); -``` - -Note that the callback in the above example is optional, if you prefer the 'fire and forget' method of logging: - -``` js - client.log('your-really-long-input-token', '127.0.0.1 - Theres no place like home'); -``` - -The second way to send log information to Loggly is to do so once you've retrieved an input directly from Loggly: - -``` js - client.getInput('your-input-name', function (err, input) { - input.log('127.0.0.1 - Theres no place like home'); - }); -``` - -Again the callback in the above example is optional and you can pass it if you'd like to. - -### Logging Shallow JSON Object Literals as a String -In addition to logging pure strings it is also possible to pass shallow JSON object literals (i.e. no nested objects) to client.log(..) or input.log(..) methods, which will get converted into the [Loggly recommended string representation][1]. So - -``` js - var source = { - foo: 1, - bar: 2, - buzz: 3 - }; - - input.log(source); -``` - -will be logged as: - -``` - foo=1,bar=2,buzz=3 -``` - -### Logging Objects to JSON Enabled Loggly Inputs -It is also possible to log complex objects using the new JSON capabilities of Loggly. To enable JSON functionality in the client simply add 'json: true' to the configuration: - -``` js - var config = { - subdomain: "your-subdomain", - auth: { - username: "your-username", - password: "your-password" - }, - json: true - }; -``` - -When the json flag is enabled, objects will be converted to JSON using JSON.stringify before being transmitted to Loggly. So - -``` js - var source = { - foo: 1, - bar: 2, - buzz: { - sheep: 'jumped', - times: 10 - } - }; - - input.log(source); -``` - -will be logged as: - -``` json - { "foo": 1, "bar": 2, "buzz": {"sheep": "jumped", "times": 10 }} -``` - -### Searching -[Searching][3] with node-loggly is easy. All you have to do is use the search() method defined on each Loggly client: - -``` js - var util = require('util'); - - client.search('404', function (err, results) { - // Inspect the result set - util.inspect(results.data); - }); -``` - -The search() exposes a chainable interface that allows you to set additional search parameters such as: ip, input name, rows, start, end, etc. - -``` js - var util = require('util'); - - client.search('404') - .meta({ ip: '127.0.0.1', inputname: test }) - .context({ rows: 10 }) - .run(function (err, results) { - // Inspect the result set - util.inspect(results.data); - }); -``` - -The context of the search (set using the `.context()` method) represents additional parameters in the Loggly API besides the search query itself. See the [Search API documentation][9] for a list of all options. - -Metadata set using the `.meta()` method is data that is set in the query parameter of your Loggly search, but `:` delimited. For more information about search queries in Loggly, check out the [Search Language Guide][4] on the [Loggly Wiki][5]. - -### Facet Searching -Loggly also exposes searches that can return counts of events over a time range. These are called [facets][6]. The valid facets are 'ip', 'date', and 'input'. Performing a facet search is very similar to a normal search: - -``` js - var util = require('util'); - - client.facet('ip', '404') - .context({ buckets: 10 }) - .run(function (err, results) { - // Inspect the result set - util.inspect(results.data); - }); -``` - -The chaining and options for the facet method(s) are the same as the search method above. - -### Working with Devices and Inputs -Loggly exposes several entities that are available through node-loggly: inputs and devices. For more information about these terms, checkout the [Loggly Jargon][7] on the wiki. There are several methods available in node-loggly to work with these entities: - -``` js - // - // Returns all inputs associated with your account - // - client.getInputs(function (err, inputs) { /* ... */ }); - - // - // Returns an input with the specified name - // - client.getInput('input-name', function (err, input) { /* ... */ }); - - // - // Returns all devices associated with your account - // - client.getDevices(function (err, devices) { /* ... */ }); -``` - -## Run Tests -All of the node-loggly tests are written in [vows][8], and cover all of the use cases described above. You will need to add your Loggly username, password, subdomain, and a two test inputs to test/data/test-config.json before running tests. When configuring the test inputs on Loggly, the first test input should be named 'test' using the HTTP service. The second input should be name 'test_json' using the HTTP service with the JSON logging option enabled: - -``` js - { - "subdomain": "your-subdomain", - "auth": { - "username": "your-username", - "password": "your-password" - }, - "inputs": { - "test": { - // - // Token and ID of your plain-text input. - // - "token": "your-really-long-token-you-got-when-you-created-an-http-input", - "id": 000 - }, - "test_json": { - // - // Token and ID of your JSON input. - // - "token": "your-really-long-token-you-got-when-you-created-an-http-input", - "id": 001 - }, - } - } -``` - -Once you have valid Loggly credentials you can run tests with [vows][8]: - -``` bash - $ npm test -``` - -#### Author: [Charlie Robbins](http://www.github.com/indexzero) -#### Contributors: [Marak Squires](http://github.com/marak), [hij1nx](http://github.com/hij1nx), [Kord Campbell](http://loggly.com), [Erik Hedenström](http://github.com/ehedenst), - -[0]: http://wiki.loggly.com/apidocumentation -[1]: http://wiki.loggly.com/loggingfromcode -[3]: http://wiki.loggly.com/retrieve_events#search_uri -[4]: http://wiki.loggly.com/searchguide -[5]: http://wiki.loggly.com/ -[6]: http://wiki.loggly.com/retrieve_events#facet_uris -[7]: http://wiki.loggly.com/loggingjargon -[8]: http://vowsjs.org -[9]: http://wiki.loggly.com/retrieve_events#optional diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/docco.css b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/docco.css deleted file mode 100644 index bd54134..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/docco.css +++ /dev/null @@ -1,194 +0,0 @@ -/*--------------------- Layout and Typography ----------------------------*/ -body { - font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; - font-size: 15px; - line-height: 22px; - color: #252519; - margin: 0; padding: 0; -} -a { - color: #261a3b; -} - a:visited { - color: #261a3b; - } -p { - margin: 0 0 15px 0; -} -h4, h5, h6 { - color: #333; - margin: 6px 0 6px 0; - font-size: 13px; -} - h2, h3 { - margin-bottom: 0; - color: #000; - } - h1 { - margin-top: 40px; - margin-bottom: 15px; - color: #000; - } -#container { - position: relative; -} -#background { - position: fixed; - top: 0; left: 525px; right: 0; bottom: 0; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - z-index: -1; -} -#jump_to, #jump_page { - background: white; - -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; - -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; - font: 10px Arial; - text-transform: uppercase; - cursor: pointer; - text-align: right; -} -#jump_to, #jump_wrapper { - position: fixed; - right: 0; top: 0; - padding: 5px 10px; -} - #jump_wrapper { - padding: 0; - display: none; - } - #jump_to:hover #jump_wrapper { - display: block; - } - #jump_page { - padding: 5px 0 3px; - margin: 0 0 25px 25px; - } - #jump_page .source { - display: block; - padding: 5px 10px; - text-decoration: none; - border-top: 1px solid #eee; - } - #jump_page .source:hover { - background: #f5f5ff; - } - #jump_page .source:first-child { - } -table td { - border: 0; - outline: 0; -} - td.docs, th.docs { - max-width: 450px; - min-width: 450px; - min-height: 5px; - padding: 10px 25px 1px 50px; - overflow-x: hidden; - vertical-align: top; - text-align: left; - } - .docs pre { - margin: 15px 0 15px; - padding-left: 15px; - } - .docs p tt, .docs p code { - background: #f8f8ff; - border: 1px solid #dedede; - font-size: 12px; - padding: 0 0.2em; - } - .pilwrap { - position: relative; - } - .pilcrow { - font: 12px Arial; - text-decoration: none; - color: #454545; - position: absolute; - top: 3px; left: -20px; - padding: 1px 2px; - opacity: 0; - -webkit-transition: opacity 0.2s linear; - } - td.docs:hover .pilcrow { - opacity: 1; - } - td.code, th.code { - padding: 14px 15px 16px 25px; - width: 100%; - vertical-align: top; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - } - pre, tt, code { - font-size: 12px; line-height: 18px; - font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; - margin: 0; padding: 0; - } - - -/*---------------------- Syntax Highlighting -----------------------------*/ -td.linenos { background-color: #f0f0f0; padding-right: 10px; } -span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } -body .hll { background-color: #ffffcc } -body .c { color: #408080; font-style: italic } /* Comment */ -body .err { border: 1px solid #FF0000 } /* Error */ -body .k { color: #954121 } /* Keyword */ -body .o { color: #666666 } /* Operator */ -body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ -body .cp { color: #BC7A00 } /* Comment.Preproc */ -body .c1 { color: #408080; font-style: italic } /* Comment.Single */ -body .cs { color: #408080; font-style: italic } /* Comment.Special */ -body .gd { color: #A00000 } /* Generic.Deleted */ -body .ge { font-style: italic } /* Generic.Emph */ -body .gr { color: #FF0000 } /* Generic.Error */ -body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -body .gi { color: #00A000 } /* Generic.Inserted */ -body .go { color: #808080 } /* Generic.Output */ -body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -body .gs { font-weight: bold } /* Generic.Strong */ -body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -body .gt { color: #0040D0 } /* Generic.Traceback */ -body .kc { color: #954121 } /* Keyword.Constant */ -body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ -body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ -body .kp { color: #954121 } /* Keyword.Pseudo */ -body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ -body .kt { color: #B00040 } /* Keyword.Type */ -body .m { color: #666666 } /* Literal.Number */ -body .s { color: #219161 } /* Literal.String */ -body .na { color: #7D9029 } /* Name.Attribute */ -body .nb { color: #954121 } /* Name.Builtin */ -body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ -body .no { color: #880000 } /* Name.Constant */ -body .nd { color: #AA22FF } /* Name.Decorator */ -body .ni { color: #999999; font-weight: bold } /* Name.Entity */ -body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -body .nf { color: #0000FF } /* Name.Function */ -body .nl { color: #A0A000 } /* Name.Label */ -body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -body .nt { color: #954121; font-weight: bold } /* Name.Tag */ -body .nv { color: #19469D } /* Name.Variable */ -body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -body .w { color: #bbbbbb } /* Text.Whitespace */ -body .mf { color: #666666 } /* Literal.Number.Float */ -body .mh { color: #666666 } /* Literal.Number.Hex */ -body .mi { color: #666666 } /* Literal.Number.Integer */ -body .mo { color: #666666 } /* Literal.Number.Oct */ -body .sb { color: #219161 } /* Literal.String.Backtick */ -body .sc { color: #219161 } /* Literal.String.Char */ -body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ -body .s2 { color: #219161 } /* Literal.String.Double */ -body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -body .sh { color: #219161 } /* Literal.String.Heredoc */ -body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -body .sx { color: #954121 } /* Literal.String.Other */ -body .sr { color: #BB6688 } /* Literal.String.Regex */ -body .s1 { color: #219161 } /* Literal.String.Single */ -body .ss { color: #19469D } /* Literal.String.Symbol */ -body .bp { color: #954121 } /* Name.Builtin.Pseudo */ -body .vc { color: #19469D } /* Name.Variable.Class */ -body .vg { color: #19469D } /* Name.Variable.Global */ -body .vi { color: #19469D } /* Name.Variable.Instance */ -body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly.html deleted file mode 100644 index 7afcf68..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly.html +++ /dev/null @@ -1,16 +0,0 @@ - loggly.js

      loggly.js

      /*
      - * loggly.js: Wrapper for node-loggly object
      - *
      - * (C) 2010 Nodejitsu Inc.
      - * MIT LICENSE
      - *
      - */
      -
      -var loggly = exports;

      Export node-loggly core client APIs

      loggly.createClient  = require('./loggly/core').createClient;
      -loggly.Loggly        = require('./loggly/core').Loggly;
      -loggly.Config        = require('./loggly/config').Config;

      Export Resources for node-loggly

      loggly.Input  = require('./loggly/input').Input;
      -loggly.Facet  = require('./loggly/facet').Facet;
      -loggly.Device = require('./loggly/device').Device;
      -loggly.Search = require('./loggly/search').Search;
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly/common.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly/common.html deleted file mode 100644 index 94336be..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly/common.html +++ /dev/null @@ -1,126 +0,0 @@ - common.js

      common.js

      /*
      - * common.js: Common utility functions for requesting against Loggly APIs
      - *
      - * (C) 2010 Nodejitsu Inc.
      - * MIT LICENSE
      - *
      - */
      -
      -var request = require('request'),
      -    loggly = require('../loggly');
      -
      -var common = exports;

      Failure HTTP Response codes based -off Loggly specification.

      var failCodes = common.failCodes = {
      -  400: "Bad Request",
      -  401: "Unauthorized",
      -  403: "Forbidden",
      -  404: "Not Found",
      -  409: "Conflict / Duplicate",
      -  410: "Gone",
      -  500: "Internal Server Error",
      -  501: "Not Implemented",
      -  503: "Throttled"
      -};

      Success HTTP Response codes based -off Loggly specification.

      var successCodes = common.successCodes = {
      -  200: "OK",
      -  201: "Created", 
      -  202: "Accepted",
      -  203: "Non-authoritative information",
      -  204: "Deleted",
      -};

      Core method that actually sends requests to Loggly. -This method is designed to be flexible w.r.t. arguments -and continuation passing given the wide range of different -requests required to fully implement the Loggly API.

      - -

      Continuations: - 1. 'callback': The callback passed into every node-loggly method - 2. 'success': A callback that will only be called on successful requests. - This is used throughout node-loggly to conditionally - do post-request processing such as JSON parsing.

      - -

      Possible Arguments (1 & 2 are equivalent): - 1. common.loggly('some-fully-qualified-url', auth, callback, success) - 2. common.loggly('GET', 'some-fully-qualified-url', auth, callback, success) - 3. common.loggly('DELETE', 'some-fully-qualified-url', auth, callback, success) - 4. common.loggly({ method: 'POST', uri: 'some-url', body: { some: 'body'} }, callback, success)

      common.loggly = function () {
      -  var args = Array.prototype.slice.call(arguments),
      -      success = args.pop(),
      -      callback = args.pop(),
      -      requestBody, 
      -      headers,
      -      method, 
      -      auth, 
      -      uri;
      -  

      Now that we've popped off the two callbacks -We can make decisions about other arguments

        if (args.length == 1) {
      -    if (typeof args[0] === 'string') {

      If we got a string assume that it's the URI

            method = 'GET';
      -      uri    = args[0];
      -    }
      -    else {
      -      method      = args[0]['method'] || 'GET',
      -      uri         = args[0]['uri'];
      -      requestBody = args[0]['body'];
      -      auth        = args[0]['auth'];
      -      headers     = args[0]['headers'];
      -    }
      -  }
      -  else if (args.length == 2) {
      -    method = 'GET';
      -    uri    = args[0];
      -    auth   = args[1];
      -  }
      -  else {
      -    method = args[0];
      -    uri    = args[1];
      -    auth   = args[2];
      -  }
      -  
      -  function onError (err) {
      -    if (callback) {
      -      callback(err);
      -    }
      -  }
      -  
      -  var requestOptions = {
      -    uri: uri,
      -    method: method,
      -    headers: headers || {}
      -  };
      -  
      -  if (auth) {
      -    requestOptions.headers['authorization'] = 'Basic ' + new Buffer(auth.username + ':' + auth.password).toString('base64');
      -  }
      -  
      -  if (requestBody) {
      -    requestOptions.body = requestBody;
      -  }
      -  
      -  try {
      -    request(requestOptions, function (err, res, body) {
      -      if (err) {
      -        return onError(err);
      -      }
      -
      -      var statusCode = res.statusCode.toString();
      -      if (Object.keys(failCodes).indexOf(statusCode) !== -1) {
      -        return onError((new Error('Loggly Error (' + statusCode + '): ' + failCodes[statusCode])));
      -      }
      -
      -      success(res, body);
      -    });
      -  }
      -  catch (ex) {
      -    onError(ex);
      -  }
      -};

      function clone (obj) - Helper method for deep cloning pure JSON objects - i.e. JSON objects that are either literals or objects (no Arrays, etc)

      common.clone = function (obj) {
      -  var clone = {};
      -  for (var i in obj) {
      -    clone[i] = obj[i] instanceof Object ? common.clone(obj[i]) : obj[i];
      -  }
      -
      -  return clone;
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly/config.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly/config.html deleted file mode 100644 index 0f39f4a..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly/config.html +++ /dev/null @@ -1,41 +0,0 @@ - config.js

      config.js

      /*
      - * config.js: Configuration information for your Loggly account.
      - *            This information is only used for require('loggly')./\.+/ methods
      - *
      - * (C) 2010 Nodejitsu Inc.
      - * MIT LICENSE
      - *
      - */

      function createConfig (defaults) - Creates a new instance of the configuration - object based on default values

      exports.createConfig = function (defaults) {
      -  return new Config(defaults);
      -};

      Config (defaults) - Constructor for the Config object

      var Config = exports.Config = function (defaults) {
      -  if (!defaults.subdomain) {
      -    throw new Error('Subdomain is required to create an instance of Config');
      -  }
      -  
      -  this.subdomain = defaults.subdomain;
      -  this.json = defaults.json || null;
      -  this.auth = defaults.auth || null;
      -};
      - 
      -Config.prototype = {
      -  get subdomain () {
      -   return this._subdomain; 
      -  },
      -
      -  set subdomain (value) {
      -    this._subdomain = value;
      -  },
      -  
      -  get logglyUrl () {
      -    return 'https://' + [this._subdomain, 'loggly', 'com'].join('.') + '/api';
      -  },
      -  
      -  get inputUrl () {
      -    return 'https://logs.loggly.com/inputs/';
      -  }
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly/core.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly/core.html deleted file mode 100644 index 7d1a4bf..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly/core.html +++ /dev/null @@ -1,150 +0,0 @@ - core.js

      core.js

      /*
      - * core.js: Core functions for accessing Loggly
      - *
      - * (C) 2010 Nodejitsu Inc.
      - * MIT LICENSE
      - *
      - */
      -
      -var events = require('events'),
      -    qs = require('querystring'),
      -    config = require('./config'),
      -    common = require('./common'),
      -    Search = require('./search').Search,
      -    Facet = require('./facet').Facet,
      -    loggly = require('../loggly');

      function createClient (options) - Creates a new instance of a Loggly client.

      exports.createClient = function (options) {
      -  return new Loggly(config.createConfig(options));
      -};

      Loggly (config) - Constructor for the Loggly object

      var Loggly = exports.Loggly = function (config) {
      -  this.config = config;
      -};

      function log (callback) - logs args to input device

      Loggly.prototype.log = function (inputId, msg, callback) {
      -  var emitter = new (events.EventEmitter)(),
      -      message;
      -      
      -  if (msg instanceof Object) {
      -    message = this.config.json ? JSON.stringify(msg) : qs.unescape(qs.stringify(msg, ','));
      -  } else {
      -    message = this.config.json ? JSON.stringify({ message : msg }) : msg;
      -  }
      -
      -  var logOptions = {
      -    uri: this.config.inputUrl + inputId,
      -    method: 'POST', 
      -    body: message,
      -    headers: {
      -      'Content-Type': this.config.json ? 'application/json' : 'text/plain'
      -    }
      -  };
      -
      -  common.loggly(logOptions, callback, function (res, body) {
      -    try {
      -      var result = JSON.parse(body);
      -      if (callback) {
      -        callback(null, result);
      -      }
      -      
      -      emitter.emit('log', result);
      -    }
      -    catch (ex) {
      -      if (callback) {
      -        callback(new Error('Unspecified error from Loggly: ' + ex));
      -      }
      -    }
      -  }); 
      -  
      -  return emitter; 
      -};

      function search (query, callback) - Returns a new search object which can be chained - with options or called directly if @callback is passed - initially.

      - -

      Sample Usage:

      - -

      client.search('404') - .meta({ ip: '127.0.0.1' }) - .context({ rows: 100 }) - .run(function () { /* ... */ });

      Loggly.prototype.search = function (query, callback) {
      -  return new Search(query, this, callback);
      -};

      function facet (facet, query, [options], callback) - Performs a facet search against loggly with the - specified facet, query and options.

      Loggly.prototype.facet = function (facet, query, callback) {
      -  return new Facet(facet, query, this, callback);
      -};

      function getInputs ([raw], callback) - Returns a list of all inputs for the authenicated account

      Loggly.prototype.getInputs = function () {
      -  var self = this,
      -      args = Array.prototype.slice.call(arguments),
      -      callback = args.pop(),
      -      raw = args.length > 0 ? args[0] : false;
      -  
      -  common.loggly(this.logglyUrl('inputs'), this.config.auth, callback, function (res, body) {
      -    var inputs = [], 
      -        results = JSON.parse(body);
      -        
      -    if (!raw) {
      -      results.forEach(function (result) {
      -        inputs.push(new (loggly.Input)(self, result));
      -      });
      -      
      -      return callback(null, inputs);
      -    }
      -    
      -    callback(null, results);
      -  });
      -};

      function getInput (name, callback) - Returns the input with the specified name

      Loggly.prototype.getInput = function (name, callback) {
      -  var self = this;
      -  this.getInputs(true, function (err, results) {
      -    if (err) {
      -      return callback(err);
      -    }
      -    
      -    var matches = results.filter(function (r) { return r.name === name }),
      -        input = null;
      -        
      -    if (matches.length > 0) {
      -      input = new (loggly.Input)(self, matches[0]);
      -    }
      -    
      -    callback(null, input);
      -  });
      -};

      function addDevice (inputId, address, callback) - Adds the device at address to the input specified by inputId

      Loggly.prototype.addDeviceToInput = function (inputId, address, callback) {
      -  var addOptions = {
      -    uri: this.logglyUrl('devices'),
      -    auth: this.config.auth,
      -    method: 'POST', 
      -    headers: {
      -      'Content-Type': 'application/x-www-form-urlencoded'
      -    },
      -    body: qs.stringify({ 'input_id': inputId, 'ip': address }).replace('"', '')
      -  };
      -
      -  common.loggly(addOptions, callback, function (res, body) {
      -    callback(null, res);
      -  });
      -};

      function addDevice (inputId, callback) - Adds the calling device to the input

      Loggly.prototype.addDevice = function (inputId, callback) {

      Remark: This is not fully implemented yet

        callback(new Error('Not Implemented Yet...'));
      -  

      common.loggly(this.logglyUrl('inputs', inputId, 'adddevice'), this.config.auth, callback, function (res, body) { -});

      };

      function getDevices (callback) - Returns a list of all devices for the authenicated account

      Loggly.prototype.getDevices = function (callback) {
      -  var self = this;
      -  common.loggly(this.logglyUrl('devices'), this.config.auth, callback, function (res, body) {
      -    var results = JSON.parse(body),
      -        devices = [];
      -        
      -    results.forEach(function (result) {
      -      devices.push(new (loggly.Device)(self, result));
      -    });
      -    
      -    callback(null, devices);
      -  });
      -};

      function logglyUrl ([path, to, resource]) - Helper method that concats the string params into a url - to request against a loggly serverUrl.

      Loggly.prototype.logglyUrl = function (/* path, to, resource */) {
      -  var args = Array.prototype.slice.call(arguments);
      -  return [this.config.logglyUrl].concat(args).join('/');
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly/device.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly/device.html deleted file mode 100644 index 3cc7fc5..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly/device.html +++ /dev/null @@ -1,26 +0,0 @@ - device.js

      device.js

      /*
      - * device.js: Instance of a single Loggly device
      - *
      - * (C) 2010 Nodejitsu Inc.
      - * MIT LICENSE
      - *
      - */
      - 
      -var Device = exports.Device = function (client, details) {
      -  if (!details) throw new Error("Device must be constructed with at least basic details.")
      -
      -  this.client = client;
      -  this._setProperties(details);
      -};
      -
      -Device.prototype.addToInput = function (inputId, callback) {
      -  this.client.addDeviceToInput(inputId, this.id, callback);
      -};
      -  

      Sets the properties for this instance -Parameters: details

      Device.prototype._setProperties = function (details) {

      Copy the properties to this instance

        var self = this;
      -  Object.keys(details).forEach(function (key) {
      -    self[key] = details[key];
      -  });
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly/facet.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly/facet.html deleted file mode 100644 index 39fe2b3..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly/facet.html +++ /dev/null @@ -1,26 +0,0 @@ - facet.js

      facet.js

      /*
      - * facet.js: Chainable search functions for Loggly facet searches.
      - *
      - * (C) 2010 Nodejitsu Inc.
      - * MIT LICENSE
      - *
      - */
      -
      -var util = require('util'),
      -    Search = require('./search').Search;

      function Facet (facet, query, client, callback) - Chainable facet search object for Loggly API

      var Facet = exports.Facet = function (facet, query, client, callback) {
      -  if (['date', 'ip', 'input'].indexOf(facet) === -1) {
      -    var error = new Error('Cannot search with unknown facet: ' + facet); 
      -    
      -    if (callback) {
      -      return callback(error);
      -    }
      -    else {
      -      throw error;
      -    }
      -  }
      -  

      Set the baseUrl to be facet/:facet?

        this.baseUrl = ['facets', facet + '?'].join('/');
      -  

      Call the base constructor.

        Search.call(this, query, client, callback);
      -};

      Inherit from loggly.Search.

      util.inherits(Facet, Search);
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly/input.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly/input.html deleted file mode 100644 index 22bcac2..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly/input.html +++ /dev/null @@ -1,32 +0,0 @@ - input.js

      input.js

      /*
      - * input.js: Instance of a single Loggly input
      - *
      - * (C) 2010 Nodejitsu Inc.
      - * MIT LICENSE
      - *
      - */
      - 
      -var Input = exports.Input = function (client, details) {
      -  if (!details) {
      -    throw new Error("Input must be constructed with at least basic details.");
      -  }
      -  
      -  this.client = client;
      -  this._setProperties(details);
      -};
      -
      -Input.prototype.log = function (msg, callback) {
      -  return this.client.log(this.input_token, msg, callback);
      -};
      -  
      -Input.prototype.addDevice = function (address, callback) {
      -  this.client.addDeviceToInput(this.id, address, callback);
      -};
      -  

      Sets the properties for this instance -Parameters: details

      Input.prototype._setProperties = function (details) {

      Copy the properties to this instance

        var self = this;
      -  Object.keys(details).forEach(function (key) {
      -    self[key] = details[key];
      -  });
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly/search.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly/search.html deleted file mode 100644 index 0a13c0e..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/docs/loggly/search.html +++ /dev/null @@ -1,89 +0,0 @@ - search.js

      search.js

      /*
      - * search.js: chainable search functions for Loggly
      - *
      - * (C) 2010 Nodejitsu Inc.
      - * MIT LICENSE
      - *
      - */
      -
      -var qs = require('querystring'),
      -    timespan = require('timespan'),
      -    common = require('./common');

      function Search (query, client, callback) - Chainable search object for Loggly API

      var Search = exports.Search = function (query, client, callback) {
      -  this.query = query;
      -  this.client = client;
      -  
      -  if (!this.baseUrl) {
      -    this.baseUrl = 'search?';
      -  }
      -  

      If we're passed a callback, run immediately.

        if (callback) {
      -    this.callback = callback;
      -    this.run();
      -  }
      -};

      function meta (meta) - Sets the appropriate metadata for this search query: - e.g. ip, inputname

      Search.prototype.meta = function (meta) {
      -  this._meta = meta;
      -  return this;
      -};

      function context (context) - Sets the appropriate context for this search query: - e.g. rows, start, from, until, order, format, fields

      Search.prototype.context = function (context) {
      -  this._context = context;
      -  return this;
      -};

      function run (callback)

      - -

      @callback {function} Continuation to respond to when complete

      - -

      Runs the search query for for this instance with the query, metadata, -context, and other parameters that have been configured on it.

      Search.prototype.run = function (callback) {
      -  var rangeError;
      -  

      Trim the search query

        this.query.trim();
      -  

      Update the callback for this instance if it's passed

        this.callback = callback || this.callback;
      -  if (!this.callback) {
      -    throw new Error('Cannot run search without a callback function.');
      -  }
      -  

      If meta was passed, update the search query appropriately

        if (this._meta) {
      -    this.query += ' ' + qs.unescape(qs.stringify(this._meta, ' ', ':'));
      -  }

      Set the context for the query string

        this._context = this._context || {};
      -  this._context.q = this.query;
      -  this._checkRange();
      -
      -  var self = this, searchOptions = {
      -    uri: this.client.logglyUrl(this.baseUrl + qs.stringify(this._context)),
      -    auth: this.client.config.auth
      -  };
      -  
      -  common.loggly(searchOptions, this.callback, function (res, body) {
      -    self.callback(null, JSON.parse(body));
      -  });
      -  
      -  return this;
      -};

      function _checkRange ()

      - -

      Checks if the range that has been configured for this -instance is valid and updates if it is not.

      Search.prototype._checkRange = function () {
      -  if (!this._context || (!this._context.until && !this._context.from)) {
      -    return;
      -  }
      -  
      -  this._context.until = this._context.until || 'NOW';
      -  this._context.from  = this._context.from  || 'NOW-24HOURS';
      -  
      -  if (!timespan.parseDate(this._context.until)) {
      -    this._context.until = 'NOW';
      -  }
      -  
      -  if (!timespan.parseDate(this._context.from)) {
      -    this._context.from = 'NOW-24HOURS';
      -  }
      -  
      -  if (timespan.fromDates(this._context.from, this._context.until) < 0
      -    || this._context.until === this._context.from) {

      If the length of the timespan for this Search instance is -negative then set it to default values

          this._context.until = 'NOW';
      -    this._context.from = 'NOW-24HOURS';
      -  }
      -  
      -  return this;
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly.js deleted file mode 100644 index e55d2c2..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * loggly.js: Wrapper for node-loggly object - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var loggly = exports; - -// -// Export node-loggly core client APIs -// -loggly.createClient = require('./loggly/core').createClient; -loggly.serialize = require('./loggly/common').serialize; -loggly.Loggly = require('./loggly/core').Loggly; -loggly.Config = require('./loggly/config').Config; - -// -// Export Resources for node-loggly -// -loggly.Input = require('./loggly/input').Input; -loggly.Facet = require('./loggly/facet').Facet; -loggly.Device = require('./loggly/device').Device; -loggly.Search = require('./loggly/search').Search; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly/common.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly/common.js deleted file mode 100644 index dae938e..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly/common.js +++ /dev/null @@ -1,204 +0,0 @@ -/* - * common.js: Common utility functions for requesting against Loggly APIs - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var util = require('util'), - request = require('request'), - loggly = require('../loggly'); - -var common = exports; - -// -// Failure HTTP Response codes based -// off Loggly specification. -// -var failCodes = common.failCodes = { - 400: "Bad Request", - 401: "Unauthorized", - 403: "Forbidden", - 404: "Not Found", - 409: "Conflict / Duplicate", - 410: "Gone", - 500: "Internal Server Error", - 501: "Not Implemented", - 503: "Throttled" -}; - -// -// Success HTTP Response codes based -// off Loggly specification. -// -var successCodes = common.successCodes = { - 200: "OK", - 201: "Created", - 202: "Accepted", - 203: "Non-authoritative information", - 204: "Deleted", -}; - -// -// Core method that actually sends requests to Loggly. -// This method is designed to be flexible w.r.t. arguments -// and continuation passing given the wide range of different -// requests required to fully implement the Loggly API. -// -// Continuations: -// 1. 'callback': The callback passed into every node-loggly method -// 2. 'success': A callback that will only be called on successful requests. -// This is used throughout node-loggly to conditionally -// do post-request processing such as JSON parsing. -// -// Possible Arguments (1 & 2 are equivalent): -// 1. common.loggly('some-fully-qualified-url', auth, callback, success) -// 2. common.loggly('GET', 'some-fully-qualified-url', auth, callback, success) -// 3. common.loggly('DELETE', 'some-fully-qualified-url', auth, callback, success) -// 4. common.loggly({ method: 'POST', uri: 'some-url', body: { some: 'body'} }, callback, success) -// -common.loggly = function () { - var args = Array.prototype.slice.call(arguments), - success = args.pop(), - callback = args.pop(), - requestBody, - headers, - method, - auth, - uri; - - // - // Now that we've popped off the two callbacks - // We can make decisions about other arguments - // - if (args.length == 1) { - if (typeof args[0] === 'string') { - // - // If we got a string assume that it's the URI - // - method = 'GET'; - uri = args[0]; - } - else { - method = args[0]['method'] || 'GET', - uri = args[0]['uri']; - requestBody = args[0]['body']; - auth = args[0]['auth']; - headers = args[0]['headers']; - } - } - else if (args.length == 2) { - method = 'GET'; - uri = args[0]; - auth = args[1]; - } - else { - method = args[0]; - uri = args[1]; - auth = args[2]; - } - - function onError (err) { - if (callback) { - callback(err); - } - } - - var requestOptions = { - uri: uri, - method: method, - headers: headers || {} - }; - - if (auth) { - requestOptions.headers['authorization'] = 'Basic ' + new Buffer(auth.username + ':' + auth.password).toString('base64'); - } - - if (requestBody) { - requestOptions.body = requestBody; - } - - try { - request(requestOptions, function (err, res, body) { - if (err) { - return onError(err); - } - - var statusCode = res.statusCode.toString(); - if (Object.keys(failCodes).indexOf(statusCode) !== -1) { - return onError((new Error('Loggly Error (' + statusCode + '): ' + failCodes[statusCode]))); - } - - success(res, body); - }); - } - catch (ex) { - onError(ex); - } -}; - -// -// ### function serialize (obj, key) -// #### @obj {Object|literal} Object to serialize -// #### @key {string} **Optional** Optional key represented by obj in a larger object -// Performs simple comma-separated, `key=value` serialization for Loggly when -// logging to non-JSON inputs. -// -common.serialize = function (obj, key) { - if (obj === null) { - obj = 'null'; - } - else if (obj === undefined) { - obj = 'undefined'; - } - else if (obj === false) { - obj = 'false'; - } - - if (typeof obj !== 'object') { - return key ? key + '=' + obj : obj; - } - - var msg = '', - keys = Object.keys(obj), - length = keys.length; - - for (var i = 0; i < length; i++) { - if (Array.isArray(obj[keys[i]])) { - msg += keys[i] + '=[' - - for (var j = 0, l = obj[keys[i]].length; j < l; j++) { - msg += common.serialize(obj[keys[i]][j]); - if (j < l - 1) { - msg += ', '; - } - } - - msg += ']'; - } - else { - msg += common.serialize(obj[keys[i]], keys[i]); - } - - if (i < length - 1) { - msg += ', '; - } - } - - return msg; -}; - -// -// function clone (obj) -// Helper method for deep cloning pure JSON objects -// i.e. JSON objects that are either literals or objects (no Arrays, etc) -// -common.clone = function (obj) { - var clone = {}; - for (var i in obj) { - clone[i] = obj[i] instanceof Object ? common.clone(obj[i]) : obj[i]; - } - - return clone; -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly/config.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly/config.js deleted file mode 100644 index 2156ceb..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly/config.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * config.js: Configuration information for your Loggly account. - * This information is only used for require('loggly')./\.+/ methods - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -// -// function createConfig (defaults) -// Creates a new instance of the configuration -// object based on default values -// -exports.createConfig = function (defaults) { - return new Config(defaults); -}; - -// -// Config (defaults) -// Constructor for the Config object -// -var Config = exports.Config = function (defaults) { - if (!defaults.subdomain) { - throw new Error('Subdomain is required to create an instance of Config'); - } - - this.subdomain = defaults.subdomain; - this.json = defaults.json || null; - this.auth = defaults.auth || null; -}; - -Config.prototype = { - get subdomain () { - return this._subdomain; - }, - - set subdomain (value) { - this._subdomain = value; - }, - - get logglyUrl () { - return 'https://' + [this._subdomain, 'loggly', 'com'].join('.') + '/api'; - }, - - get inputUrl () { - return 'https://logs.loggly.com/inputs/'; - } -}; diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly/core.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly/core.js deleted file mode 100644 index 9be1553..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly/core.js +++ /dev/null @@ -1,211 +0,0 @@ -/* - * core.js: Core functions for accessing Loggly - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var events = require('events'), - qs = require('querystring'), - config = require('./config'), - common = require('./common'), - Search = require('./search').Search, - Facet = require('./facet').Facet, - loggly = require('../loggly'); - -// -// function createClient (options) -// Creates a new instance of a Loggly client. -// -exports.createClient = function (options) { - return new Loggly(config.createConfig(options)); -}; - -// -// Loggly (config) -// Constructor for the Loggly object -// -var Loggly = exports.Loggly = function (config) { - this.config = config; -}; - -// -// function log (callback) -// logs args to input device -// -Loggly.prototype.log = function (inputId, msg, callback) { - var emitter = new (events.EventEmitter)(), - message; - - if (msg instanceof Object) { - message = this.config.json ? JSON.stringify(msg) : common.serialize(msg); - } - else { - message = this.config.json ? JSON.stringify({ message : msg }) : msg; - } - - var logOptions = { - uri: this.config.inputUrl + inputId, - method: 'POST', - body: message, - headers: { - 'Content-Type': this.config.json ? 'application/json' : 'text/plain' - } - }; - - common.loggly(logOptions, callback, function (res, body) { - try { - var result = JSON.parse(body); - if (callback) { - callback(null, result); - } - - emitter.emit('log', result); - } - catch (ex) { - if (callback) { - callback(new Error('Unspecified error from Loggly: ' + ex)); - } - } - }); - - return emitter; -}; - -// -// function search (query, callback) -// Returns a new search object which can be chained -// with options or called directly if @callback is passed -// initially. -// -// Sample Usage: -// -// client.search('404') -// .meta({ ip: '127.0.0.1' }) -// .context({ rows: 100 }) -// .run(function () { /* ... */ }); -// -Loggly.prototype.search = function (query, callback) { - return new Search(query, this, callback); -}; - -// -// function facet (facet, query, [options], callback) -// Performs a facet search against loggly with the -// specified facet, query and options. -// -Loggly.prototype.facet = function (facet, query, callback) { - return new Facet(facet, query, this, callback); -}; - - -// -// function getInputs ([raw], callback) -// Returns a list of all inputs for the authenicated account -// -Loggly.prototype.getInputs = function () { - var self = this, - args = Array.prototype.slice.call(arguments), - callback = args.pop(), - raw = args.length > 0 ? args[0] : false; - - common.loggly(this.logglyUrl('inputs'), this.config.auth, callback, function (res, body) { - var inputs = [], - results = JSON.parse(body); - - if (!raw) { - results.forEach(function (result) { - inputs.push(new (loggly.Input)(self, result)); - }); - - return callback(null, inputs); - } - - callback(null, results); - }); -}; - -// -// function getInput (name, callback) -// Returns the input with the specified name -// -Loggly.prototype.getInput = function (name, callback) { - var self = this; - this.getInputs(true, function (err, results) { - if (err) { - return callback(err); - } - - var matches = results.filter(function (r) { return r.name === name }), - input = null; - - if (matches.length > 0) { - input = new (loggly.Input)(self, matches[0]); - } - - callback(null, input); - }); -}; - -// -// function addDevice (inputId, address, callback) -// Adds the device at address to the input specified by inputId -// -Loggly.prototype.addDeviceToInput = function (inputId, address, callback) { - var addOptions = { - uri: this.logglyUrl('devices'), - auth: this.config.auth, - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded' - }, - body: qs.stringify({ 'input_id': inputId, 'ip': address }).replace('"', '') - }; - - common.loggly(addOptions, callback, function (res, body) { - callback(null, res); - }); -}; - -// -// function addDevice (inputId, callback) -// Adds the calling device to the input -// -Loggly.prototype.addDevice = function (inputId, callback) { - // - // Remark: This is not fully implemented yet - // - callback(new Error('Not Implemented Yet...')); - - //common.loggly(this.logglyUrl('inputs', inputId, 'adddevice'), this.config.auth, callback, function (res, body) { - //}); -}; - -// -// function getDevices (callback) -// Returns a list of all devices for the authenicated account -// -Loggly.prototype.getDevices = function (callback) { - var self = this; - common.loggly(this.logglyUrl('devices'), this.config.auth, callback, function (res, body) { - var results = JSON.parse(body), - devices = []; - - results.forEach(function (result) { - devices.push(new (loggly.Device)(self, result)); - }); - - callback(null, devices); - }); -}; - -// -// function logglyUrl ([path, to, resource]) -// Helper method that concats the string params into a url -// to request against a loggly serverUrl. -// -Loggly.prototype.logglyUrl = function (/* path, to, resource */) { - var args = Array.prototype.slice.call(arguments); - return [this.config.logglyUrl].concat(args).join('/'); -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly/device.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly/device.js deleted file mode 100644 index a06d74a..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly/device.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * device.js: Instance of a single Loggly device - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var Device = exports.Device = function (client, details) { - if (!details) throw new Error("Device must be constructed with at least basic details.") - - this.client = client; - this._setProperties(details); -}; - -Device.prototype.addToInput = function (inputId, callback) { - this.client.addDeviceToInput(inputId, this.id, callback); -}; - -// -// Sets the properties for this instance -// Parameters: details -// -Device.prototype._setProperties = function (details) { - // Copy the properties to this instance - var self = this; - Object.keys(details).forEach(function (key) { - self[key] = details[key]; - }); -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly/facet.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly/facet.js deleted file mode 100644 index a17abf9..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly/facet.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * facet.js: Chainable search functions for Loggly facet searches. - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var util = require('util'), - Search = require('./search').Search; - -// -// function Facet (facet, query, client, callback) -// Chainable facet search object for Loggly API -// -var Facet = exports.Facet = function (facet, query, client, callback) { - if (['date', 'ip', 'input'].indexOf(facet) === -1) { - var error = new Error('Cannot search with unknown facet: ' + facet); - - if (callback) { - return callback(error); - } - else { - throw error; - } - } - - // - // Set the baseUrl to be facet/:facet? - // - this.baseUrl = ['facets', facet + '?'].join('/'); - - // - // Call the base constructor. - // - Search.call(this, query, client, callback); -}; - -// -// Inherit from `loggly.Search`. -// -util.inherits(Facet, Search); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly/input.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly/input.js deleted file mode 100644 index 1e02b85..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly/input.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * input.js: Instance of a single Loggly input - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var Input = exports.Input = function (client, details) { - if (!details) { - throw new Error("Input must be constructed with at least basic details."); - } - - this.client = client; - this._setProperties(details); -}; - -Input.prototype.log = function (msg, callback) { - return this.client.log(this.input_token, msg, callback); -}; - -Input.prototype.addDevice = function (address, callback) { - this.client.addDeviceToInput(this.id, address, callback); -}; - -// -// Sets the properties for this instance -// Parameters: details -// -Input.prototype._setProperties = function (details) { - // Copy the properties to this instance - var self = this; - Object.keys(details).forEach(function (key) { - self[key] = details[key]; - }); -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly/search.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly/search.js deleted file mode 100644 index 09dd437..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/lib/loggly/search.js +++ /dev/null @@ -1,130 +0,0 @@ -/* - * search.js: chainable search functions for Loggly - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var qs = require('querystring'), - timespan = require('timespan'), - common = require('./common'); - -// -// function Search (query, client, callback) -// Chainable search object for Loggly API -// -var Search = exports.Search = function (query, client, callback) { - this.query = query; - this.client = client; - - if (!this.baseUrl) { - this.baseUrl = 'search?'; - } - - // - // If we're passed a callback, run immediately. - // - if (callback) { - this.callback = callback; - this.run(); - } -}; - -// -// function meta (meta) -// Sets the appropriate metadata for this search query: -// e.g. ip, inputname -// -Search.prototype.meta = function (meta) { - this._meta = meta; - return this; -}; - -// -// function context (context) -// Sets the appropriate context for this search query: -// e.g. rows, start, from, until, order, format, fields -// -Search.prototype.context = function (context) { - this._context = context; - return this; -}; - -// -// ### function run (callback) -// #### @callback {function} Continuation to respond to when complete -// Runs the search query for for this instance with the query, metadata, -// context, and other parameters that have been configured on it. -// -Search.prototype.run = function (callback) { - var rangeError; - - // - // Trim the search query - // - this.query.trim(); - - // - // Update the callback for this instance if it's passed - // - this.callback = callback || this.callback; - if (!this.callback) { - throw new Error('Cannot run search without a callback function.'); - } - - // If meta was passed, update the search query appropriately - if (this._meta) { - this.query += ' ' + qs.unescape(qs.stringify(this._meta, ' ', ':')); - } - - // Set the context for the query string - this._context = this._context || {}; - this._context.q = this.query; - this._checkRange(); - - var self = this, searchOptions = { - uri: this.client.logglyUrl(this.baseUrl + qs.stringify(this._context)), - auth: this.client.config.auth - }; - - common.loggly(searchOptions, this.callback, function (res, body) { - self.callback(null, JSON.parse(body)); - }); - - return this; -}; - -// -// ### function _checkRange () -// Checks if the range that has been configured for this -// instance is valid and updates if it is not. -// -Search.prototype._checkRange = function () { - if (!this._context || (!this._context.until && !this._context.from)) { - return; - } - - this._context.until = this._context.until || 'NOW'; - this._context.from = this._context.from || 'NOW-24HOURS'; - - if (!timespan.parseDate(this._context.until)) { - this._context.until = 'NOW'; - } - - if (!timespan.parseDate(this._context.from)) { - this._context.from = 'NOW-24HOURS'; - } - - if (timespan.fromDates(this._context.from, this._context.until) < 0 - || this._context.until === this._context.from) { - // - // If the length of the timespan for this Search instance is - // negative then set it to default values - // - this._context.until = 'NOW'; - this._context.from = 'NOW-24HOURS'; - } - - return this; -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/LICENSE b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/LICENSE deleted file mode 100644 index a4a9aee..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/LICENSE +++ /dev/null @@ -1,55 +0,0 @@ -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of this License; and - -You must cause any modified files to carry prominent notices stating that You changed the files; and - -You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - -If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/README.md b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/README.md deleted file mode 100644 index e5839b5..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/README.md +++ /dev/null @@ -1,288 +0,0 @@ -# Request -- Simplified HTTP request method - -## Install - -
      -  npm install request
      -
      - -Or from source: - -
      -  git clone git://github.com/mikeal/request.git 
      -  cd request
      -  npm link
      -
      - -## Super simple to use - -Request is designed to be the simplest way possible to make http calls. It support HTTPS and follows redirects by default. - -```javascript -var request = require('request'); -request('http://www.google.com', function (error, response, body) { - if (!error && response.statusCode == 200) { - console.log(body) // Print the google web page. - } -}) -``` - -## Streaming - -You can stream any response to a file stream. - -```javascript -request('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png')) -``` - -You can also stream a file to a PUT or POST request. This method will also check the file extension against a mapping of file extensions to content-types, in this case `application/json`, and use the proper content-type in the PUT request if one is not already provided in the headers. - -```javascript -fs.createReadStream('file.json').pipe(request.put('http://mysite.com/obj.json')) -``` - -Request can also pipe to itself. When doing so the content-type and content-length will be preserved in the PUT headers. - -```javascript -request.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img.png')) -``` - -Now let's get fancy. - -```javascript -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - if (req.method === 'PUT') { - req.pipe(request.put('http://mysite.com/doodle.png')) - } else if (req.method === 'GET' || req.method === 'HEAD') { - request.get('http://mysite.com/doodle.png').pipe(resp) - } - } -}) -``` - -You can also pipe() from a http.ServerRequest instance and to a http.ServerResponse instance. The HTTP method and headers will be sent as well as the entity-body data. Which means that, if you don't really care about security, you can do: - -```javascript -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - var x = request('http://mysite.com/doodle.png') - req.pipe(x) - x.pipe(resp) - } -}) -``` - -And since pipe() returns the destination stream in node 0.5.x you can do one line proxying :) - -```javascript -req.pipe(request('http://mysite.com/doodle.png')).pipe(resp) -``` - -Also, none of this new functionality conflicts with requests previous features, it just expands them. - -```javascript -var r = request.defaults({'proxy':'http://localproxy.com'}) - -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - r.get('http://google.com/doodle.png').pipe(resp) - } -}) -``` - -You can still use intermediate proxies, the requests will still follow HTTP forwards, etc. - -## OAuth Signing - -```javascript -// Twitter OAuth -var qs = require('querystring') - , oauth = - { callback: 'http://mysite.com/callback/' - , consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - } - , url = 'https://api.twitter.com/oauth/request_token' - ; -request.post({url:url, oauth:oauth}, function (e, r, body) { - // Assume by some stretch of magic you aquired the verifier - var access_token = qs.parse(body) - , oauth = - { consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - , token: access_token.oauth_token - , verifier: VERIFIER - , token_secret: access_token.oauth_token_secret - } - , url = 'https://api.twitter.com/oauth/access_token' - ; - request.post({url:url, oauth:oauth}, function (e, r, body) { - var perm_token = qs.parse(body) - , oauth = - { consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - , token: perm_token.oauth_token - , token_secret: perm_token.oauth_token_secret - } - , url = 'https://api.twitter.com/1/users/show.json?' - , params = - { screen_name: perm_token.screen_name - , user_id: perm_token.user_id - } - ; - url += qs.stringify(params) - request.get({url:url, oauth:oauth, json:true}, function (e, r, user) { - console.log(user) - }) - }) -}) -``` - - - -### request(options, callback) - -The first argument can be either a url or an options object. The only required option is uri, all others are optional. - -* `uri` || `url` - fully qualified uri or a parsed url object from url.parse() -* `qs` - object containing querystring values to be appended to the uri -* `method` - http method, defaults to GET -* `headers` - http headers, defaults to {} -* `body` - entity body for POST and PUT requests. Must be buffer or string. -* `form` - sets `body` but to querystring representation of value and adds `Content-type: application/x-www-form-urlencoded; charset=utf-8` header. -* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. -* `multipart` - (experimental) array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See example below. -* `followRedirect` - follow HTTP 3xx responses as redirects. defaults to true. -* `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects. defaults to false. -* `maxRedirects` - the maximum number of redirects to follow, defaults to 10. -* `onResponse` - If true the callback will be fired on the "response" event instead of "end". If a function it will be called on "response" and not effect the regular semantics of the main callback on "end". -* `encoding` - Encoding to be used on `setEncoding` of response data. If set to `null`, the body is returned as a Buffer. -* `pool` - A hash object containing the agents for these requests. If omitted this request will use the global pool which is set to node's default maxSockets. -* `pool.maxSockets` - Integer containing the maximum amount of sockets in the pool. -* `timeout` - Integer containing the number of milliseconds to wait for a request to respond before aborting the request -* `proxy` - An HTTP proxy to be used. Support proxy Auth with Basic Auth the same way it's supported with the `url` parameter by embedding the auth info in the uri. -* `oauth` - Options for OAuth HMAC-SHA1 signing, see documentation above. -* `strictSSL` - Set to `true` to require that SSL certificates be valid. Note: to use your own certificate authority, you need to specify an agent that was created with that ca as an option. -* `jar` - Set to `false` if you don't want cookies to be remembered for future use or define your custom cookie jar (see examples section) - - -The callback argument gets 3 arguments. The first is an error when applicable (usually from the http.Client option not the http.ClientRequest object). The second in an http.ClientResponse object. The third is the response body String or Buffer. - -## Convenience methods - -There are also shorthand methods for different HTTP METHODs and some other conveniences. - -### request.defaults(options) - -This method returns a wrapper around the normal request API that defaults to whatever options you pass in to it. - -### request.put - -Same as request() but defaults to `method: "PUT"`. - -```javascript -request.put(url) -``` - -### request.post - -Same as request() but defaults to `method: "POST"`. - -```javascript -request.post(url) -``` - -### request.head - -Same as request() but defaults to `method: "HEAD"`. - -```javascript -request.head(url) -``` - -### request.del - -Same as request() but defaults to `method: "DELETE"`. - -```javascript -request.del(url) -``` - -### request.get - -Alias to normal request method for uniformity. - -```javascript -request.get(url) -``` -### request.cookie - -Function that creates a new cookie. - -```javascript -request.cookie('cookie_string_here') -``` -### request.jar - -Function that creates a new cookie jar. - -```javascript -request.jar() -``` - - -## Examples: - -```javascript - var request = require('request') - , rand = Math.floor(Math.random()*100000000).toString() - ; - request( - { method: 'PUT' - , uri: 'http://mikeal.iriscouch.com/testjs/' + rand - , multipart: - [ { 'content-type': 'application/json' - , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) - } - , { body: 'I am an attachment' } - ] - } - , function (error, response, body) { - if(response.statusCode == 201){ - console.log('document saved as: http://mikeal.iriscouch.com/testjs/'+ rand) - } else { - console.log('error: '+ response.statusCode) - console.log(body) - } - } - ) -``` -Cookies are enabled by default (so they can be used in subsequent requests). To disable cookies set jar to false (either in defaults or in the options sent). - -```javascript -var request = request.defaults({jar: false}) -request('http://www.google.com', function () { - request('http://images.google.com') -}) -``` - -If you to use a custom cookie jar (instead of letting request use its own global cookie jar) you do so by setting the jar default or by specifying it as an option: - -```javascript -var j = request.jar() -var request = request.defaults({jar:j}) -request('http://www.google.com', function () { - request('http://images.google.com') -}) -``` -OR - -```javascript -var j = request.jar() -var cookie = request.cookie('your_cookie_here') -j.add(cookie) -request({url: 'http://www.google.com', jar: j}, function () { - request('http://images.google.com') -}) -``` diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/forever.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/forever.js deleted file mode 100644 index ac853c0..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/forever.js +++ /dev/null @@ -1,103 +0,0 @@ -module.exports = ForeverAgent -ForeverAgent.SSL = ForeverAgentSSL - -var util = require('util') - , Agent = require('http').Agent - , net = require('net') - , tls = require('tls') - , AgentSSL = require('https').Agent - -function ForeverAgent(options) { - var self = this - self.options = options || {} - self.requests = {} - self.sockets = {} - self.freeSockets = {} - self.maxSockets = self.options.maxSockets || Agent.defaultMaxSockets - self.minSockets = self.options.minSockets || ForeverAgent.defaultMinSockets - self.on('free', function(socket, host, port) { - var name = host + ':' + port - if (self.requests[name] && self.requests[name].length) { - self.requests[name].shift().onSocket(socket) - } else if (self.sockets[name].length < self.minSockets) { - if (!self.freeSockets[name]) self.freeSockets[name] = [] - self.freeSockets[name].push(socket) - - // if an error happens while we don't use the socket anyway, meh, throw the socket away - function onIdleError() { - socket.destroy() - } - socket._onIdleError = onIdleError - socket.on('error', onIdleError) - } else { - // If there are no pending requests just destroy the - // socket and it will get removed from the pool. This - // gets us out of timeout issues and allows us to - // default to Connection:keep-alive. - socket.destroy(); - } - }) - -} -util.inherits(ForeverAgent, Agent) - -ForeverAgent.defaultMinSockets = 5 - - -ForeverAgent.prototype.createConnection = net.createConnection -ForeverAgent.prototype.addRequestNoreuse = Agent.prototype.addRequest -ForeverAgent.prototype.addRequest = function(req, host, port) { - var name = host + ':' + port - if (this.freeSockets[name] && this.freeSockets[name].length > 0 && !req.useChunkedEncodingByDefault) { - var idleSocket = this.freeSockets[name].pop() - idleSocket.removeListener('error', idleSocket._onIdleError) - delete idleSocket._onIdleError - req._reusedSocket = true - req.onSocket(idleSocket) - } else { - this.addRequestNoreuse(req, host, port) - } -} - -ForeverAgent.prototype.removeSocket = function(s, name, host, port) { - if (this.sockets[name]) { - var index = this.sockets[name].indexOf(s); - if (index !== -1) { - this.sockets[name].splice(index, 1); - } - } else if (this.sockets[name] && this.sockets[name].length === 0) { - // don't leak - delete this.sockets[name]; - delete this.requests[name]; - } - - if (this.freeSockets[name]) { - var index = this.freeSockets[name].indexOf(s) - if (index !== -1) { - this.freeSockets[name].splice(index, 1) - if (this.freeSockets[name].length === 0) { - delete this.freeSockets[name] - } - } - } - - if (this.requests[name] && this.requests[name].length) { - // If we have pending requests and a socket gets closed a new one - // needs to be created to take over in the pool for the one that closed. - this.createSocket(name, host, port).emit('free'); - } -} - -function ForeverAgentSSL (options) { - ForeverAgent.call(this, options) -} -util.inherits(ForeverAgentSSL, ForeverAgent) - -ForeverAgentSSL.prototype.createConnection = createConnectionSSL -ForeverAgentSSL.prototype.addRequestNoreuse = AgentSSL.prototype.addRequest - -function createConnectionSSL (port, host, options) { - options.port = port - options.host = host - return tls.connect(options) -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/main.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/main.js deleted file mode 100644 index f651202..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/main.js +++ /dev/null @@ -1,874 +0,0 @@ -// Copyright 2010-2012 Mikeal Rogers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -var http = require('http') - , https = false - , tls = false - , url = require('url') - , util = require('util') - , stream = require('stream') - , qs = require('querystring') - , mimetypes = require('./mimetypes') - , oauth = require('./oauth') - , uuid = require('./uuid') - , ForeverAgent = require('./forever') - , Cookie = require('./vendor/cookie') - , CookieJar = require('./vendor/cookie/jar') - , cookieJar = new CookieJar - , tunnel = require('./tunnel') - ; - -if (process.logging) { - var log = process.logging('request') -} - -try { - https = require('https') -} catch (e) {} - -try { - tls = require('tls') -} catch (e) {} - -function toBase64 (str) { - return (new Buffer(str || "", "ascii")).toString("base64") -} - -// Hacky fix for pre-0.4.4 https -if (https && !https.Agent) { - https.Agent = function (options) { - http.Agent.call(this, options) - } - util.inherits(https.Agent, http.Agent) - https.Agent.prototype._getConnection = function(host, port, cb) { - var s = tls.connect(port, host, this.options, function() { - // do other checks here? - if (cb) cb() - }) - return s - } -} - -function isReadStream (rs) { - if (rs.readable && rs.path && rs.mode) { - return true - } -} - -function copy (obj) { - var o = {} - Object.keys(obj).forEach(function (i) { - o[i] = obj[i] - }) - return o -} - -var isUrl = /^https?:/ - -var globalPool = {} - -function Request (options) { - stream.Stream.call(this) - this.readable = true - this.writable = true - - if (typeof options === 'string') { - options = {uri:options} - } - - var reserved = Object.keys(Request.prototype) - for (var i in options) { - if (reserved.indexOf(i) === -1) { - this[i] = options[i] - } else { - if (typeof options[i] === 'function') { - delete options[i] - } - } - } - options = copy(options) - - this.init(options) -} -util.inherits(Request, stream.Stream) -Request.prototype.init = function (options) { - var self = this - - if (!options) options = {} - - if (!self.pool) self.pool = globalPool - self.dests = [] - self.__isRequestRequest = true - - // Protect against double callback - if (!self._callback && self.callback) { - self._callback = self.callback - self.callback = function () { - if (self._callbackCalled) return // Print a warning maybe? - self._callback.apply(self, arguments) - self._callbackCalled = true - } - } - - if (self.url) { - // People use this property instead all the time so why not just support it. - self.uri = self.url - delete self.url - } - - if (!self.uri) { - throw new Error("options.uri is a required argument") - } else { - if (typeof self.uri == "string") self.uri = url.parse(self.uri) - } - if (self.proxy) { - if (typeof self.proxy == 'string') self.proxy = url.parse(self.proxy) - - // do the HTTP CONNECT dance using koichik/node-tunnel - if (http.globalAgent && self.uri.protocol === "https:") { - self.tunnel = true - var tunnelFn = self.proxy.protocol === "http:" - ? tunnel.httpsOverHttp : tunnel.httpsOverHttps - - var tunnelOptions = { proxy: { host: self.proxy.hostname - , port: +self.proxy.port } - , ca: this.ca } - - self.agent = tunnelFn(tunnelOptions) - self.tunnel = true - } - } - - self._redirectsFollowed = self._redirectsFollowed || 0 - self.maxRedirects = (self.maxRedirects !== undefined) ? self.maxRedirects : 10 - self.followRedirect = (self.followRedirect !== undefined) ? self.followRedirect : true - self.followAllRedirects = (self.followAllRedirects !== undefined) ? self.followAllRedirects : false; - if (self.followRedirect || self.followAllRedirects) - self.redirects = self.redirects || [] - - self.headers = self.headers ? copy(self.headers) : {} - - self.setHost = false - if (!self.headers.host) { - self.headers.host = self.uri.hostname - if (self.uri.port) { - if ( !(self.uri.port === 80 && self.uri.protocol === 'http:') && - !(self.uri.port === 443 && self.uri.protocol === 'https:') ) - self.headers.host += (':'+self.uri.port) - } - self.setHost = true - } - - self.jar(options.jar) - - if (!self.uri.pathname) {self.uri.pathname = '/'} - if (!self.uri.port) { - if (self.uri.protocol == 'http:') {self.uri.port = 80} - else if (self.uri.protocol == 'https:') {self.uri.port = 443} - } - - if (self.proxy && !self.tunnel) { - self.port = self.proxy.port - self.host = self.proxy.hostname - } else { - self.port = self.uri.port - self.host = self.uri.hostname - } - - if (self.onResponse === true) { - self.onResponse = self.callback - delete self.callback - } - - self.clientErrorHandler = function (error) { - if (self._aborted) return - - if (self.setHost) delete self.headers.host - if (self.req._reusedSocket && error.code === 'ECONNRESET' - && self.agent.addRequestNoreuse) { - self.agent = { addRequest: self.agent.addRequestNoreuse.bind(self.agent) } - self.start() - self.req.end() - return - } - if (self.timeout && self.timeoutTimer) { - clearTimeout(self.timeoutTimer); - self.timeoutTimer = null; - } - self.emit('error', error) - } - if (self.onResponse) self.on('error', function (e) {self.onResponse(e)}) - if (self.callback) self.on('error', function (e) {self.callback(e)}) - - if (options.form) { - self.form(options.form) - } - - if (options.oauth) { - self.oauth(options.oauth) - } - - if (self.uri.auth && !self.headers.authorization) { - self.headers.authorization = "Basic " + toBase64(self.uri.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':')) - } - if (self.proxy && self.proxy.auth && !self.headers['proxy-authorization'] && !self.tunnel) { - self.headers['proxy-authorization'] = "Basic " + toBase64(self.proxy.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':')) - } - - if (options.qs) self.qs(options.qs) - - if (self.uri.path) { - self.path = self.uri.path - } else { - self.path = self.uri.pathname + (self.uri.search || "") - } - - if (self.path.length === 0) self.path = '/' - - if (self.proxy && !self.tunnel) self.path = (self.uri.protocol + '//' + self.uri.host + self.path) - - if (options.json) { - self.json(options.json) - } else if (options.multipart) { - self.multipart(options.multipart) - } - - if (self.body) { - var length = 0 - if (!Buffer.isBuffer(self.body)) { - if (Array.isArray(self.body)) { - for (var i = 0; i < self.body.length; i++) { - length += self.body[i].length - } - } else { - self.body = new Buffer(self.body) - length = self.body.length - } - } else { - length = self.body.length - } - if (length) { - self.headers['content-length'] = length - } else { - throw new Error('Argument error, options.body.') - } - } - - var protocol = self.proxy && !self.tunnel ? self.proxy.protocol : self.uri.protocol - , defaultModules = {'http:':http, 'https:':https} - , httpModules = self.httpModules || {} - ; - self.httpModule = httpModules[protocol] || defaultModules[protocol] - - if (!self.httpModule) throw new Error("Invalid protocol") - - if (options.ca) self.ca = options.ca - - if (!self.agent) { - if (options.agentOptions) self.agentOptions = options.agentOptions - - if (options.agentClass) { - self.agentClass = options.agentClass - } else if (options.forever) { - self.agentClass = protocol === 'http:' ? ForeverAgent : ForeverAgent.SSL - } else { - self.agentClass = self.httpModule.Agent - } - } - - if (self.pool === false) { - self.agent = false - } else { - self.agent = self.agent || self.getAgent() - if (self.maxSockets) { - // Don't use our pooling if node has the refactored client - self.agent.maxSockets = self.maxSockets - } - if (self.pool.maxSockets) { - // Don't use our pooling if node has the refactored client - self.agent.maxSockets = self.pool.maxSockets - } - } - - self.once('pipe', function (src) { - if (self.ntick) throw new Error("You cannot pipe to this stream after the first nextTick() after creation of the request stream.") - self.src = src - if (isReadStream(src)) { - if (!self.headers['content-type'] && !self.headers['Content-Type']) - self.headers['content-type'] = mimetypes.lookup(src.path.slice(src.path.lastIndexOf('.')+1)) - } else { - if (src.headers) { - for (var i in src.headers) { - if (!self.headers[i]) { - self.headers[i] = src.headers[i] - } - } - } - if (src.method && !self.method) { - self.method = src.method - } - } - - self.on('pipe', function () { - console.error("You have already piped to this stream. Pipeing twice is likely to break the request.") - }) - }) - - process.nextTick(function () { - if (self._aborted) return - - if (self.body) { - if (Array.isArray(self.body)) { - self.body.forEach(function(part) { - self.write(part) - }) - } else { - self.write(self.body) - } - self.end() - } else if (self.requestBodyStream) { - console.warn("options.requestBodyStream is deprecated, please pass the request object to stream.pipe.") - self.requestBodyStream.pipe(self) - } else if (!self.src) { - self.headers['content-length'] = 0 - self.end() - } - self.ntick = true - }) -} - -Request.prototype.getAgent = function () { - var Agent = this.agentClass - var options = {} - if (this.agentOptions) { - for (var i in this.agentOptions) { - options[i] = this.agentOptions[i] - } - } - if (this.ca) options.ca = this.ca - - var poolKey = '' - - // different types of agents are in different pools - if (Agent !== this.httpModule.Agent) { - poolKey += Agent.name - } - - if (!this.httpModule.globalAgent) { - // node 0.4.x - options.host = this.host - options.port = this.port - if (poolKey) poolKey += ':' - poolKey += this.host + ':' + this.port - } - - if (options.ca) { - if (poolKey) poolKey += ':' - poolKey += options.ca - } - - if (!poolKey && Agent === this.httpModule.Agent && this.httpModule.globalAgent) { - // not doing anything special. Use the globalAgent - return this.httpModule.globalAgent - } - - // already generated an agent for this setting - if (this.pool[poolKey]) return this.pool[poolKey] - - return this.pool[poolKey] = new Agent(options) -} - -Request.prototype.start = function () { - var self = this - - if (self._aborted) return - - self._started = true - self.method = self.method || 'GET' - self.href = self.uri.href - if (log) log('%method %href', self) - self.req = self.httpModule.request(self, function (response) { - if (self._aborted) return - if (self._paused) response.pause() - - self.response = response - response.request = self - - if (self.httpModule === https && - self.strictSSL && - !response.client.authorized) { - var sslErr = response.client.authorizationError - self.emit('error', new Error('SSL Error: '+ sslErr)) - return - } - - if (self.setHost) delete self.headers.host - if (self.timeout && self.timeoutTimer) { - clearTimeout(self.timeoutTimer); - self.timeoutTimer = null; - } - - if (response.headers['set-cookie'] && (!self._disableCookies)) { - response.headers['set-cookie'].forEach(function(cookie) { - if (self._jar) self._jar.add(new Cookie(cookie)) - else cookieJar.add(new Cookie(cookie)) - }) - } - - if (response.statusCode >= 300 && response.statusCode < 400 && - (self.followAllRedirects || - (self.followRedirect && (self.method !== 'PUT' && self.method !== 'POST' && self.method !== 'DELETE'))) && - response.headers.location) { - if (self._redirectsFollowed >= self.maxRedirects) { - self.emit('error', new Error("Exceeded maxRedirects. Probably stuck in a redirect loop.")) - return - } - self._redirectsFollowed += 1 - - if (!isUrl.test(response.headers.location)) { - response.headers.location = url.resolve(self.uri.href, response.headers.location) - } - self.uri = response.headers.location - self.redirects.push( - { statusCode : response.statusCode - , redirectUri: response.headers.location - } - ) - self.method = 'GET'; // Force all redirects to use GET - delete self.req - delete self.agent - delete self._started - if (self.headers) { - delete self.headers.host - } - if (log) log('Redirect to %uri', self) - self.init() - return // Ignore the rest of the response - } else { - self._redirectsFollowed = self._redirectsFollowed || 0 - // Be a good stream and emit end when the response is finished. - // Hack to emit end on close because of a core bug that never fires end - response.on('close', function () { - if (!self._ended) self.response.emit('end') - }) - - if (self.encoding) { - if (self.dests.length !== 0) { - console.error("Ingoring encoding parameter as this stream is being piped to another stream which makes the encoding option invalid.") - } else { - response.setEncoding(self.encoding) - } - } - - self.dests.forEach(function (dest) { - self.pipeDest(dest) - }) - - response.on("data", function (chunk) { - self._destdata = true - self.emit("data", chunk) - }) - response.on("end", function (chunk) { - self._ended = true - self.emit("end", chunk) - }) - response.on("close", function () {self.emit("close")}) - - self.emit('response', response) - - if (self.onResponse) { - self.onResponse(null, response) - } - if (self.callback) { - var buffer = [] - var bodyLen = 0 - self.on("data", function (chunk) { - buffer.push(chunk) - bodyLen += chunk.length - }) - self.on("end", function () { - if (self._aborted) return - - if (buffer.length && Buffer.isBuffer(buffer[0])) { - var body = new Buffer(bodyLen) - var i = 0 - buffer.forEach(function (chunk) { - chunk.copy(body, i, 0, chunk.length) - i += chunk.length - }) - if (self.encoding === null) { - response.body = body - } else { - response.body = body.toString() - } - } else if (buffer.length) { - response.body = buffer.join('') - } - - if (self._json) { - try { - response.body = JSON.parse(response.body) - } catch (e) {} - } - - self.callback(null, response, response.body) - }) - } - } - }) - - if (self.timeout && !self.timeoutTimer) { - self.timeoutTimer = setTimeout(function() { - self.req.abort() - var e = new Error("ETIMEDOUT") - e.code = "ETIMEDOUT" - self.emit("error", e) - }, self.timeout) - - // Set additional timeout on socket - in case if remote - // server freeze after sending headers - if (self.req.setTimeout) { // only works on node 0.6+ - self.req.setTimeout(self.timeout, function(){ - if (self.req) { - self.req.abort() - var e = new Error("ESOCKETTIMEDOUT") - e.code = "ESOCKETTIMEDOUT" - self.emit("error", e) - } - }) - } - } - - self.req.on('error', self.clientErrorHandler) - - self.emit('request', self.req) -} - -Request.prototype.abort = function() { - this._aborted = true; - - if (this.req) { - this.req.abort() - } - else if (this.response) { - this.response.abort() - } - - this.emit("abort") -} - -Request.prototype.pipeDest = function (dest) { - var response = this.response - // Called after the response is received - if (dest.headers) { - dest.headers['content-type'] = response.headers['content-type'] - if (response.headers['content-length']) { - dest.headers['content-length'] = response.headers['content-length'] - } - } - if (dest.setHeader) { - for (var i in response.headers) { - dest.setHeader(i, response.headers[i]) - } - dest.statusCode = response.statusCode - } - if (this.pipefilter) this.pipefilter(response, dest) -} - -// Composable API -Request.prototype.setHeader = function (name, value, clobber) { - if (clobber === undefined) clobber = true - if (clobber || !this.headers.hasOwnProperty(name)) this.headers[name] = value - else this.headers[name] += ',' + value - return this -} -Request.prototype.setHeaders = function (headers) { - for (i in headers) {this.setHeader(i, headers[i])} - return this -} -Request.prototype.qs = function (q, clobber) { - var uri = { - protocol: this.uri.protocol, - host: this.uri.host, - pathname: this.uri.pathname, - query: clobber ? q : qs.parse(this.uri.query), - hash: this.uri.hash - }; - if (!clobber) for (var i in q) uri.query[i] = q[i] - - this.uri= url.parse(url.format(uri)) - - return this -} -Request.prototype.form = function (form) { - this.headers['content-type'] = 'application/x-www-form-urlencoded; charset=utf-8' - this.body = qs.stringify(form).toString('utf8') - return this -} -Request.prototype.multipart = function (multipart) { - var self = this - self.body = [] - - if (!self.headers['content-type']) { - self.headers['content-type'] = 'multipart/related;boundary="frontier"'; - } else { - self.headers['content-type'] = self.headers['content-type'].split(';')[0] + ';boundary="frontier"'; - } - - if (!multipart.forEach) throw new Error('Argument error, options.multipart.') - - multipart.forEach(function (part) { - var body = part.body - if(!body) throw Error('Body attribute missing in multipart.') - delete part.body - var preamble = '--frontier\r\n' - Object.keys(part).forEach(function(key){ - preamble += key + ': ' + part[key] + '\r\n' - }) - preamble += '\r\n' - self.body.push(new Buffer(preamble)) - self.body.push(new Buffer(body)) - self.body.push(new Buffer('\r\n')) - }) - self.body.push(new Buffer('--frontier--')) - return self -} -Request.prototype.json = function (val) { - this.setHeader('content-type', 'application/json') - this.setHeader('accept', 'application/json') - this._json = true - if (typeof val === 'boolean') { - if (typeof this.body === 'object') this.body = JSON.stringify(this.body) - } else { - this.body = JSON.stringify(val) - } - return this -} -Request.prototype.oauth = function (_oauth) { - var form - if (this.headers['content-type'] && - this.headers['content-type'].slice(0, 'application/x-www-form-urlencoded'.length) === - 'application/x-www-form-urlencoded' - ) { - form = qs.parse(this.body) - } - if (this.uri.query) { - form = qs.parse(this.uri.query) - } - if (!form) form = {} - var oa = {} - for (var i in form) oa[i] = form[i] - for (var i in _oauth) oa['oauth_'+i] = _oauth[i] - if (!oa.oauth_version) oa.oauth_version = '1.0' - if (!oa.oauth_timestamp) oa.oauth_timestamp = Math.floor( (new Date()).getTime() / 1000 ).toString() - if (!oa.oauth_nonce) oa.oauth_nonce = uuid().replace(/-/g, '') - - oa.oauth_signature_method = 'HMAC-SHA1' - - var consumer_secret = oa.oauth_consumer_secret - delete oa.oauth_consumer_secret - var token_secret = oa.oauth_token_secret - delete oa.oauth_token_secret - - var baseurl = this.uri.protocol + '//' + this.uri.host + this.uri.pathname - var signature = oauth.hmacsign(this.method, baseurl, oa, consumer_secret, token_secret) - - // oa.oauth_signature = signature - for (var i in form) { - if ( i.slice(0, 'oauth_') in _oauth) { - // skip - } else { - delete oa['oauth_'+i] - } - } - this.headers.authorization = - 'OAuth '+Object.keys(oa).sort().map(function (i) {return i+'="'+oauth.rfc3986(oa[i])+'"'}).join(',') - this.headers.authorization += ',oauth_signature="'+oauth.rfc3986(signature)+'"' - return this -} -Request.prototype.jar = function (jar) { - var cookies - - if (this._redirectsFollowed === 0) { - this.originalCookieHeader = this.headers.cookie - } - - if (jar === false) { - // disable cookies - cookies = false; - this._disableCookies = true; - } else if (jar) { - // fetch cookie from the user defined cookie jar - cookies = jar.get({ url: this.uri.href }) - } else { - // fetch cookie from the global cookie jar - cookies = cookieJar.get({ url: this.uri.href }) - } - - if (cookies && cookies.length) { - var cookieString = cookies.map(function (c) { - return c.name + "=" + c.value - }).join("; ") - - if (this.originalCookieHeader) { - // Don't overwrite existing Cookie header - this.headers.cookie = this.originalCookieHeader + '; ' + cookieString - } else { - this.headers.cookie = cookieString - } - } - this._jar = jar - return this -} - - -// Stream API -Request.prototype.pipe = function (dest, opts) { - if (this.response) { - if (this._destdata) { - throw new Error("You cannot pipe after data has been emitted from the response.") - } else if (this._ended) { - throw new Error("You cannot pipe after the response has been ended.") - } else { - stream.Stream.prototype.pipe.call(this, dest, opts) - this.pipeDest(dest) - return dest - } - } else { - this.dests.push(dest) - stream.Stream.prototype.pipe.call(this, dest, opts) - return dest - } -} -Request.prototype.write = function () { - if (!this._started) this.start() - this.req.write.apply(this.req, arguments) -} -Request.prototype.end = function (chunk) { - if (chunk) this.write(chunk) - if (!this._started) this.start() - this.req.end() -} -Request.prototype.pause = function () { - if (!this.response) this._paused = true - else this.response.pause.apply(this.response, arguments) -} -Request.prototype.resume = function () { - if (!this.response) this._paused = false - else this.response.resume.apply(this.response, arguments) -} -Request.prototype.destroy = function () { - if (!this._ended) this.end() -} - -// organize params for post, put, head, del -function initParams(uri, options, callback) { - if ((typeof options === 'function') && !callback) callback = options; - if (typeof options === 'object') { - options.uri = uri; - } else if (typeof uri === 'string') { - options = {uri:uri}; - } else { - options = uri; - uri = options.uri; - } - return { uri: uri, options: options, callback: callback }; -} - -function request (uri, options, callback) { - if ((typeof options === 'function') && !callback) callback = options; - if (typeof options === 'object') { - options.uri = uri; - } else if (typeof uri === 'string') { - options = {uri:uri}; - } else { - options = uri; - } - - if (callback) options.callback = callback; - var r = new Request(options) - return r -} - -module.exports = request - -request.defaults = function (options) { - var def = function (method) { - var d = function (uri, opts, callback) { - var params = initParams(uri, opts, callback); - for (var i in options) { - if (params.options[i] === undefined) params.options[i] = options[i] - } - return method(params.uri, params.options, params.callback) - } - return d - } - var de = def(request) - de.get = def(request.get) - de.post = def(request.post) - de.put = def(request.put) - de.head = def(request.head) - de.del = def(request.del) - de.cookie = def(request.cookie) - de.jar = def(request.jar) - return de -} - -request.forever = function (agentOptions, optionsArg) { - var options = {} - if (optionsArg) { - for (option in optionsArg) { - options[option] = optionsArg[option] - } - } - if (agentOptions) options.agentOptions = agentOptions - options.forever = true - return request.defaults(options) -} - -request.get = request -request.post = function (uri, options, callback) { - var params = initParams(uri, options, callback); - params.options.method = 'POST'; - return request(params.uri, params.options, params.callback) -} -request.put = function (uri, options, callback) { - var params = initParams(uri, options, callback); - params.options.method = 'PUT' - return request(params.uri, params.options, params.callback) -} -request.head = function (uri, options, callback) { - var params = initParams(uri, options, callback); - params.options.method = 'HEAD' - if (params.options.body || - params.options.requestBodyStream || - (params.options.json && typeof params.options.json !== 'boolean') || - params.options.multipart) { - throw new Error("HTTP HEAD requests MUST NOT include a request body.") - } - return request(params.uri, params.options, params.callback) -} -request.del = function (uri, options, callback) { - var params = initParams(uri, options, callback); - params.options.method = 'DELETE' - return request(params.uri, params.options, params.callback) -} -request.jar = function () { - return new CookieJar -} -request.cookie = function (str) { - if (str && str.uri) str = str.uri - if (typeof str !== 'string') throw new Error("The cookie function only accepts STRING as param") - return new Cookie(str) -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/mimetypes.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/mimetypes.js deleted file mode 100644 index 59b21b4..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/mimetypes.js +++ /dev/null @@ -1,152 +0,0 @@ -// from http://github.com/felixge/node-paperboy -exports.types = { - "3gp":"video/3gpp", - "aiff":"audio/x-aiff", - "arj":"application/x-arj-compressed", - "asf":"video/x-ms-asf", - "asx":"video/x-ms-asx", - "au":"audio/ulaw", - "avi":"video/x-msvideo", - "bcpio":"application/x-bcpio", - "ccad":"application/clariscad", - "cod":"application/vnd.rim.cod", - "com":"application/x-msdos-program", - "cpio":"application/x-cpio", - "cpt":"application/mac-compactpro", - "csh":"application/x-csh", - "css":"text/css", - "deb":"application/x-debian-package", - "dl":"video/dl", - "doc":"application/msword", - "drw":"application/drafting", - "dvi":"application/x-dvi", - "dwg":"application/acad", - "dxf":"application/dxf", - "dxr":"application/x-director", - "etx":"text/x-setext", - "ez":"application/andrew-inset", - "fli":"video/x-fli", - "flv":"video/x-flv", - "gif":"image/gif", - "gl":"video/gl", - "gtar":"application/x-gtar", - "gz":"application/x-gzip", - "hdf":"application/x-hdf", - "hqx":"application/mac-binhex40", - "html":"text/html", - "ice":"x-conference/x-cooltalk", - "ico":"image/x-icon", - "ief":"image/ief", - "igs":"model/iges", - "ips":"application/x-ipscript", - "ipx":"application/x-ipix", - "jad":"text/vnd.sun.j2me.app-descriptor", - "jar":"application/java-archive", - "jpeg":"image/jpeg", - "jpg":"image/jpeg", - "js":"text/javascript", - "json":"application/json", - "latex":"application/x-latex", - "lsp":"application/x-lisp", - "lzh":"application/octet-stream", - "m":"text/plain", - "m3u":"audio/x-mpegurl", - "m4v":"video/mp4", - "man":"application/x-troff-man", - "me":"application/x-troff-me", - "midi":"audio/midi", - "mif":"application/x-mif", - "mime":"www/mime", - "mkv":" video/x-matrosk", - "movie":"video/x-sgi-movie", - "mp4":"video/mp4", - "mp41":"video/mp4", - "mp42":"video/mp4", - "mpg":"video/mpeg", - "mpga":"audio/mpeg", - "ms":"application/x-troff-ms", - "mustache":"text/plain", - "nc":"application/x-netcdf", - "oda":"application/oda", - "ogm":"application/ogg", - "pbm":"image/x-portable-bitmap", - "pdf":"application/pdf", - "pgm":"image/x-portable-graymap", - "pgn":"application/x-chess-pgn", - "pgp":"application/pgp", - "pm":"application/x-perl", - "png":"image/png", - "pnm":"image/x-portable-anymap", - "ppm":"image/x-portable-pixmap", - "ppz":"application/vnd.ms-powerpoint", - "pre":"application/x-freelance", - "prt":"application/pro_eng", - "ps":"application/postscript", - "qt":"video/quicktime", - "ra":"audio/x-realaudio", - "rar":"application/x-rar-compressed", - "ras":"image/x-cmu-raster", - "rgb":"image/x-rgb", - "rm":"audio/x-pn-realaudio", - "rpm":"audio/x-pn-realaudio-plugin", - "rtf":"text/rtf", - "rtx":"text/richtext", - "scm":"application/x-lotusscreencam", - "set":"application/set", - "sgml":"text/sgml", - "sh":"application/x-sh", - "shar":"application/x-shar", - "silo":"model/mesh", - "sit":"application/x-stuffit", - "skt":"application/x-koan", - "smil":"application/smil", - "snd":"audio/basic", - "sol":"application/solids", - "spl":"application/x-futuresplash", - "src":"application/x-wais-source", - "stl":"application/SLA", - "stp":"application/STEP", - "sv4cpio":"application/x-sv4cpio", - "sv4crc":"application/x-sv4crc", - "svg":"image/svg+xml", - "swf":"application/x-shockwave-flash", - "tar":"application/x-tar", - "tcl":"application/x-tcl", - "tex":"application/x-tex", - "texinfo":"application/x-texinfo", - "tgz":"application/x-tar-gz", - "tiff":"image/tiff", - "tr":"application/x-troff", - "tsi":"audio/TSP-audio", - "tsp":"application/dsptype", - "tsv":"text/tab-separated-values", - "unv":"application/i-deas", - "ustar":"application/x-ustar", - "vcd":"application/x-cdlink", - "vda":"application/vda", - "vivo":"video/vnd.vivo", - "vrm":"x-world/x-vrml", - "wav":"audio/x-wav", - "wax":"audio/x-ms-wax", - "webm":"video/webm", - "wma":"audio/x-ms-wma", - "wmv":"video/x-ms-wmv", - "wmx":"video/x-ms-wmx", - "wrl":"model/vrml", - "wvx":"video/x-ms-wvx", - "xbm":"image/x-xbitmap", - "xlw":"application/vnd.ms-excel", - "xml":"text/xml", - "xpm":"image/x-xpixmap", - "xwd":"image/x-xwindowdump", - "xyz":"chemical/x-pdb", - "zip":"application/zip" -}; - -exports.lookup = function(ext, defaultType) { - defaultType = defaultType || 'application/octet-stream'; - - return (ext in exports.types) - ? exports.types[ext] - : defaultType; -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/oauth.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/oauth.js deleted file mode 100644 index 31b9dc6..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/oauth.js +++ /dev/null @@ -1,34 +0,0 @@ -var crypto = require('crypto') - , qs = require('querystring') - ; - -function sha1 (key, body) { - return crypto.createHmac('sha1', key).update(body).digest('base64') -} - -function rfc3986 (str) { - return encodeURIComponent(str) - .replace('!','%21') - .replace('*','%2A') - .replace('(','%28') - .replace(')','%29') - .replace("'",'%27') - ; -} - -function hmacsign (httpMethod, base_uri, params, consumer_secret, token_secret, body) { - // adapted from https://dev.twitter.com/docs/auth/oauth - var base = - (httpMethod || 'GET') + "&" + - encodeURIComponent( base_uri ) + "&" + - Object.keys(params).sort().map(function (i) { - // big WTF here with the escape + encoding but it's what twitter wants - return escape(rfc3986(i)) + "%3D" + escape(rfc3986(params[i])) - }).join("%26") - var key = consumer_secret + '&' - if (token_secret) key += token_secret - return sha1(key, base) -} - -exports.hmacsign = hmacsign -exports.rfc3986 = rfc3986 \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/package.json b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/package.json deleted file mode 100644 index 3779d19..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "request", - "description": "Simplified HTTP request client.", - "tags": [ - "http", - "simple", - "util", - "utility" - ], - "version": "2.9.153", - "author": { - "name": "Mikeal Rogers", - "email": "mikeal.rogers@gmail.com" - }, - "repository": { - "type": "git", - "url": "git://github.com/mikeal/request.git" - }, - "bugs": { - "url": "http://github.com/mikeal/request/issues" - }, - "engines": [ - "node >= 0.3.6" - ], - "main": "./main", - "scripts": { - "test": "node tests/run.js" - }, - "_id": "request@2.9.153", - "dependencies": {}, - "devDependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "request@2.9.x" -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/googledoodle.png b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/googledoodle.png deleted file mode 100644 index f80c9c5..0000000 Binary files a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/googledoodle.png and /dev/null differ diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/run.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/run.js deleted file mode 100644 index 6011846..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/run.js +++ /dev/null @@ -1,37 +0,0 @@ -var spawn = require('child_process').spawn - , exitCode = 0 - ; - -var tests = [ - 'test-body.js' - , 'test-cookie.js' - , 'test-cookiejar.js' - , 'test-defaults.js' - , 'test-errors.js' - , 'test-headers.js' - , 'test-httpModule.js' - , 'test-https.js' - , 'test-https-strict.js' - , 'test-oauth.js' - , 'test-pipes.js' - , 'test-proxy.js' - , 'test-qs.js' - , 'test-redirect.js' - , 'test-timeout.js' - , 'test-tunnel.js' -] - -var next = function () { - if (tests.length === 0) process.exit(exitCode); - - var file = tests.shift() - console.log(file) - var proc = spawn('node', [ 'tests/' + file ]) - proc.stdout.pipe(process.stdout) - proc.stderr.pipe(process.stderr) - proc.on('exit', function (code) { - exitCode += code || 0 - next() - }) -} -next() diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/server.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/server.js deleted file mode 100644 index 921f512..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/server.js +++ /dev/null @@ -1,82 +0,0 @@ -var fs = require('fs') - , http = require('http') - , path = require('path') - , https = require('https') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - ; - -exports.createServer = function (port) { - port = port || 6767 - var s = http.createServer(function (req, resp) { - s.emit(req.url, req, resp); - }) - s.port = port - s.url = 'http://localhost:'+port - return s; -} - -exports.createSSLServer = function(port, opts) { - port = port || 16767 - - var options = { 'key' : path.join(__dirname, 'ssl', 'test.key') - , 'cert': path.join(__dirname, 'ssl', 'test.crt') - } - if (opts) { - for (var i in opts) options[i] = opts[i] - } - - for (var i in options) { - options[i] = fs.readFileSync(options[i]) - } - - var s = https.createServer(options, function (req, resp) { - s.emit(req.url, req, resp); - }) - s.port = port - s.url = 'https://localhost:'+port - return s; -} - -exports.createPostStream = function (text) { - var postStream = new stream.Stream(); - postStream.writeable = true; - postStream.readable = true; - setTimeout(function () {postStream.emit('data', new Buffer(text)); postStream.emit('end')}, 0); - return postStream; -} -exports.createPostValidator = function (text) { - var l = function (req, resp) { - var r = ''; - req.on('data', function (chunk) {r += chunk}) - req.on('end', function () { - if (r !== text) console.log(r, text); - assert.equal(r, text) - resp.writeHead(200, {'content-type':'text/plain'}) - resp.write('OK') - resp.end() - }) - } - return l; -} -exports.createGetResponse = function (text, contentType) { - var l = function (req, resp) { - contentType = contentType || 'text/plain' - resp.writeHead(200, {'content-type':contentType}) - resp.write(text) - resp.end() - } - return l; -} -exports.createChunkResponse = function (chunks, contentType) { - var l = function (req, resp) { - contentType = contentType || 'text/plain' - resp.writeHead(200, {'content-type':contentType}) - chunks.forEach(function (chunk) { - resp.write(chunk) - }) - resp.end() - } - return l; -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/squid.conf b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/squid.conf deleted file mode 100644 index 0d4a3b6..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/squid.conf +++ /dev/null @@ -1,77 +0,0 @@ -# -# Recommended minimum configuration: -# -acl manager proto cache_object -acl localhost src 127.0.0.1/32 ::1 -acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1 - -# Example rule allowing access from your local networks. -# Adapt to list your (internal) IP networks from where browsing -# should be allowed -acl localnet src 10.0.0.0/8 # RFC1918 possible internal network -acl localnet src 172.16.0.0/12 # RFC1918 possible internal network -acl localnet src 192.168.0.0/16 # RFC1918 possible internal network -acl localnet src fc00::/7 # RFC 4193 local private network range -acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines - -acl SSL_ports port 443 -acl Safe_ports port 80 # http -acl Safe_ports port 21 # ftp -acl Safe_ports port 443 # https -acl Safe_ports port 70 # gopher -acl Safe_ports port 210 # wais -acl Safe_ports port 1025-65535 # unregistered ports -acl Safe_ports port 280 # http-mgmt -acl Safe_ports port 488 # gss-http -acl Safe_ports port 591 # filemaker -acl Safe_ports port 777 # multiling http -acl CONNECT method CONNECT - -# -# Recommended minimum Access Permission configuration: -# -# Only allow cachemgr access from localhost -http_access allow manager localhost -http_access deny manager - -# Deny requests to certain unsafe ports -http_access deny !Safe_ports - -# Deny CONNECT to other than secure SSL ports -#http_access deny CONNECT !SSL_ports - -# We strongly recommend the following be uncommented to protect innocent -# web applications running on the proxy server who think the only -# one who can access services on "localhost" is a local user -#http_access deny to_localhost - -# -# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS -# - -# Example rule allowing access from your local networks. -# Adapt localnet in the ACL section to list your (internal) IP networks -# from where browsing should be allowed -http_access allow localnet -http_access allow localhost - -# And finally deny all other access to this proxy -http_access deny all - -# Squid normally listens to port 3128 -http_port 3128 - -# We recommend you to use at least the following line. -hierarchy_stoplist cgi-bin ? - -# Uncomment and adjust the following to add a disk cache directory. -#cache_dir ufs /usr/local/var/cache 100 16 256 - -# Leave coredumps in the first cache dir -coredump_dir /usr/local/var/cache - -# Add any of your own refresh_pattern entries above these. -refresh_pattern ^ftp: 1440 20% 10080 -refresh_pattern ^gopher: 1440 0% 1440 -refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 -refresh_pattern . 0 20% 4320 diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.cnf b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.cnf deleted file mode 100644 index 425a889..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.cnf +++ /dev/null @@ -1,20 +0,0 @@ -[ req ] -default_bits = 1024 -days = 3650 -distinguished_name = req_distinguished_name -attributes = req_attributes -prompt = no -output_password = password - -[ req_distinguished_name ] -C = US -ST = CA -L = Oakland -O = request -OU = request Certificate Authority -CN = requestCA -emailAddress = mikeal@mikealrogers.com - -[ req_attributes ] -challengePassword = password challenge - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.crl b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.crl deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.crt b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.crt deleted file mode 100644 index b4524e4..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.crt +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICvTCCAiYCCQDn+P/MSbDsWjANBgkqhkiG9w0BAQUFADCBojELMAkGA1UEBhMC -VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMRAwDgYDVQQKEwdyZXF1 -ZXN0MSYwJAYDVQQLEx1yZXF1ZXN0IENlcnRpZmljYXRlIEF1dGhvcml0eTESMBAG -A1UEAxMJcmVxdWVzdENBMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlrZWFscm9n -ZXJzLmNvbTAeFw0xMjAzMDEyMjUwNTZaFw0yMjAyMjcyMjUwNTZaMIGiMQswCQYD -VQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNVBAcTB09ha2xhbmQxEDAOBgNVBAoT -B3JlcXVlc3QxJjAkBgNVBAsTHXJlcXVlc3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5 -MRIwEAYDVQQDEwlyZXF1ZXN0Q0ExJjAkBgkqhkiG9w0BCQEWF21pa2VhbEBtaWtl -YWxyb2dlcnMuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC7t9pQUAK4 -5XJYTI6NrF0n3G2HZsfN+rPYSVzzL8SuVyb1tHXos+vbPm3NKI4E8X1yVAXU8CjJ -5SqXnp4DAypAhaseho81cbhk7LXUhFz78OvAa+OD+xTAEAnNQ8tGUr4VGyplEjfD -xsBVuqV2j8GPNTftr+drOCFlqfAgMrBn4wIDAQABMA0GCSqGSIb3DQEBBQUAA4GB -ADVdTlVAL45R+PACNS7Gs4o81CwSclukBu4FJbxrkd4xGQmurgfRrYYKjtqiopQm -D7ysRamS3HMN9/VKq2T7r3z1PMHPAy7zM4uoXbbaTKwlnX4j/8pGPn8Ca3qHXYlo -88L/OOPc6Di7i7qckS3HFbXQCTiULtxWmy97oEuTwrAj ------END CERTIFICATE----- diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.csr b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.csr deleted file mode 100644 index e48c56e..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.csr +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIICBjCCAW8CAQAwgaIxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEQMA4GA1UE -BxMHT2FrbGFuZDEQMA4GA1UEChMHcmVxdWVzdDEmMCQGA1UECxMdcmVxdWVzdCBD -ZXJ0aWZpY2F0ZSBBdXRob3JpdHkxEjAQBgNVBAMTCXJlcXVlc3RDQTEmMCQGCSqG -SIb3DQEJARYXbWlrZWFsQG1pa2VhbHJvZ2Vycy5jb20wgZ8wDQYJKoZIhvcNAQEB -BQADgY0AMIGJAoGBALu32lBQArjlclhMjo2sXSfcbYdmx836s9hJXPMvxK5XJvW0 -deiz69s+bc0ojgTxfXJUBdTwKMnlKpeengMDKkCFqx6GjzVxuGTstdSEXPvw68Br -44P7FMAQCc1Dy0ZSvhUbKmUSN8PGwFW6pXaPwY81N+2v52s4IWWp8CAysGfjAgMB -AAGgIzAhBgkqhkiG9w0BCQcxFBMScGFzc3dvcmQgY2hhbGxlbmdlMA0GCSqGSIb3 -DQEBBQUAA4GBAGJO7grHeVHXetjHEK8urIxdnvfB2qeZeObz4GPKIkqUurjr0rfj -bA3EK1kDMR5aeQWR8RunixdM16Q6Ry0lEdLVWkdSwRN9dmirIHT9cypqnD/FYOia -SdezZ0lUzXgmJIwRYRwB1KSMMocIf52ll/xC2bEGg7/ZAEuAyAgcZV3X ------END CERTIFICATE REQUEST----- diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.key b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.key deleted file mode 100644 index a53e7f7..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.key +++ /dev/null @@ -1,18 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,C8B5887048377F02 - -nyD5ZH0Wup2uWsDvurq5mKDaDrf8lvNn9w0SH/ZkVnfR1/bkwqrFriqJWvZNUG+q -nS0iBYczsWLJnbub9a1zLOTENWUKVD5uqbC3aGHhnoUTNSa27DONgP8gHOn6JgR+ -GAKo01HCSTiVT4LjkwN337QKHnMP2fTzg+IoC/CigvMcq09hRLwU1/guq0GJKGwH -gTxYNuYmQC4Tjh8vdS4liF+Ve/P3qPR2CehZrIOkDT8PHJBGQJRo4xGUIB7Tpk38 -VCk+UZ0JCS2coY8VkY/9tqFJp/ZnnQQVmaNbdRqg7ECKL+bXnNo7yjzmazPZmPe3 -/ShbE0+CTt7LrjCaQAxWbeDzqfo1lQfgN1LulTm8MCXpQaJpv7v1VhIhQ7afjMYb -4thW/ypHPiYS2YJCAkAVlua9Oxzzh1qJoh8Df19iHtpd79Q77X/qf+1JvITlMu0U -gi7yEatmQcmYNws1mtTC1q2DXrO90c+NZ0LK/Alse6NRL/xiUdjug2iHeTf/idOR -Gg/5dSZbnnlj1E5zjSMDkzg6EHAFmHV4jYGSAFLEQgp4V3ZhMVoWZrvvSHgKV/Qh -FqrAK4INr1G2+/QTd09AIRzfy3/j6yD4A9iNaOsEf9Ua7Qh6RcALRCAZTWR5QtEf -dX+iSNJ4E85qXs0PqwkMDkoaxIJ+tmIRJY7y8oeylV8cfGAi8Soubt/i3SlR8IHC -uDMas/2OnwafK3N7ODeE1i7r7wkzQkSHaEz0TrF8XRnP25jAICCSLiMdAAjKfxVb -EvzsFSuAy3Jt6bU3hSLY9o4YVYKE+68ITMv9yNjvTsEiW+T+IbN34w== ------END RSA PRIVATE KEY----- diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.srl b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.srl deleted file mode 100644 index 17128db..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.srl +++ /dev/null @@ -1 +0,0 @@ -ADF62016AA40C9C3 diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.cnf b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.cnf deleted file mode 100644 index cd1fd1e..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.cnf +++ /dev/null @@ -1,19 +0,0 @@ -[ req ] -default_bits = 1024 -days = 3650 -distinguished_name = req_distinguished_name -attributes = req_attributes -prompt = no - -[ req_distinguished_name ] -C = US -ST = CA -L = Oakland -O = request -OU = testing -CN = testing.request.mikealrogers.com -emailAddress = mikeal@mikealrogers.com - -[ req_attributes ] -challengePassword = password challenge - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.crt b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.crt deleted file mode 100644 index efe96ce..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.crt +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICejCCAeMCCQCt9iAWqkDJwzANBgkqhkiG9w0BAQUFADCBojELMAkGA1UEBhMC -VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMRAwDgYDVQQKEwdyZXF1 -ZXN0MSYwJAYDVQQLEx1yZXF1ZXN0IENlcnRpZmljYXRlIEF1dGhvcml0eTESMBAG -A1UEAxMJcmVxdWVzdENBMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlrZWFscm9n -ZXJzLmNvbTAeFw0xMjAzMDEyMjUwNTZaFw0yMjAyMjcyMjUwNTZaMIGjMQswCQYD -VQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNVBAcTB09ha2xhbmQxEDAOBgNVBAoT -B3JlcXVlc3QxEDAOBgNVBAsTB3Rlc3RpbmcxKTAnBgNVBAMTIHRlc3RpbmcucmVx -dWVzdC5taWtlYWxyb2dlcnMuY29tMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlr -ZWFscm9nZXJzLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDgVl0jMumvOpmM -20W5v9yhGgZj8hPhEQF/N7yCBVBn/rWGYm70IHC8T/pR5c0LkWc5gdnCJEvKWQjh -DBKxZD8FAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEABShRkNgFbgs4vUWW9R9deNJj -7HJoiTmvkmoOC7QzcYkjdgHbOxsSq3rBnwxsVjY9PAtPwBn0GRspOeG7KzKRgySB -kb22LyrCFKbEOfKO/+CJc80ioK9zEPVjGsFMyAB+ftYRqM+s/4cQlTg/m89l01wC -yapjN3RxZbInGhWR+jA= ------END CERTIFICATE----- diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.csr b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.csr deleted file mode 100644 index a8e7595..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.csr +++ /dev/null @@ -1,11 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIBgjCCASwCAQAwgaMxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEQMA4GA1UE -BxMHT2FrbGFuZDEQMA4GA1UEChMHcmVxdWVzdDEQMA4GA1UECxMHdGVzdGluZzEp -MCcGA1UEAxMgdGVzdGluZy5yZXF1ZXN0Lm1pa2VhbHJvZ2Vycy5jb20xJjAkBgkq -hkiG9w0BCQEWF21pa2VhbEBtaWtlYWxyb2dlcnMuY29tMFwwDQYJKoZIhvcNAQEB -BQADSwAwSAJBAOBWXSMy6a86mYzbRbm/3KEaBmPyE+ERAX83vIIFUGf+tYZibvQg -cLxP+lHlzQuRZzmB2cIkS8pZCOEMErFkPwUCAwEAAaAjMCEGCSqGSIb3DQEJBzEU -ExJwYXNzd29yZCBjaGFsbGVuZ2UwDQYJKoZIhvcNAQEFBQADQQBD3E5WekQzCEJw -7yOcqvtPYIxGaX8gRKkYfLPoj3pm3GF5SGqtJKhylKfi89szHXgktnQgzff9FN+A -HidVJ/3u ------END CERTIFICATE REQUEST----- diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.js deleted file mode 100644 index 05e21c1..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.js +++ /dev/null @@ -1,28 +0,0 @@ -var fs = require("fs") -var https = require("https") -var options = { key: fs.readFileSync("./server.key") - , cert: fs.readFileSync("./server.crt") } - -var server = https.createServer(options, function (req, res) { - res.writeHead(200) - res.end() - server.close() -}) -server.listen(1337) - -var ca = fs.readFileSync("./ca.crt") -var agent = new https.Agent({ host: "localhost", port: 1337, ca: ca }) - -https.request({ host: "localhost" - , method: "HEAD" - , port: 1337 - , headers: { host: "testing.request.mikealrogers.com" } - , agent: agent - , ca: [ ca ] - , path: "/" }, function (res) { - if (res.client.authorized) { - console.log("node test: OK") - } else { - throw new Error(res.client.authorizationError) - } -}).end() diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.key b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.key deleted file mode 100644 index 72d8698..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.key +++ /dev/null @@ -1,9 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIBOwIBAAJBAOBWXSMy6a86mYzbRbm/3KEaBmPyE+ERAX83vIIFUGf+tYZibvQg -cLxP+lHlzQuRZzmB2cIkS8pZCOEMErFkPwUCAwEAAQJAK+r8ZM2sze8s7FRo/ApB -iRBtO9fCaIdJwbwJnXKo4RKwZDt1l2mm+fzZ+/QaQNjY1oTROkIIXmnwRvZWfYlW -gQIhAPKYsG+YSBN9o8Sdp1DMyZ/rUifKX3OE6q9tINkgajDVAiEA7Ltqh01+cnt0 -JEnud/8HHcuehUBLMofeg0G+gCnSbXECIQCqDvkXsWNNLnS/3lgsnvH0Baz4sbeJ -rjIpuVEeg8eM5QIgbu0+9JmOV6ybdmmiMV4yAncoF35R/iKGVHDZCAsQzDECIQDZ -0jGz22tlo5YMcYSqrdD3U4sds1pwiAaWFRbCunoUJw== ------END RSA PRIVATE KEY----- diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/npm-ca.crt b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/npm-ca.crt deleted file mode 100644 index fde2fe9..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/npm-ca.crt +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIChzCCAfACCQDauvz/KHp8ejANBgkqhkiG9w0BAQUFADCBhzELMAkGA1UEBhMC -VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMQwwCgYDVQQKEwNucG0x -IjAgBgNVBAsTGW5wbSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxDjAMBgNVBAMTBW5w -bUNBMRcwFQYJKoZIhvcNAQkBFghpQGl6cy5tZTAeFw0xMTA5MDUwMTQ3MTdaFw0y -MTA5MDIwMTQ3MTdaMIGHMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNV -BAcTB09ha2xhbmQxDDAKBgNVBAoTA25wbTEiMCAGA1UECxMZbnBtIENlcnRpZmlj -YXRlIEF1dGhvcml0eTEOMAwGA1UEAxMFbnBtQ0ExFzAVBgkqhkiG9w0BCQEWCGlA -aXpzLm1lMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLI4tIqPpRW+ACw9GE -OgBlJZwK5f8nnKCLK629Pv5yJpQKs3DENExAyOgDcyaF0HD0zk8zTp+ZsLaNdKOz -Gn2U181KGprGKAXP6DU6ByOJDWmTlY6+Ad1laYT0m64fERSpHw/hjD3D+iX4aMOl -y0HdbT5m1ZGh6SJz3ZqxavhHLQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAC4ySDbC -l7W1WpLmtLGEQ/yuMLUf6Jy/vr+CRp4h+UzL+IQpCv8FfxsYE7dhf/bmWTEupBkv -yNL18lipt2jSvR3v6oAHAReotvdjqhxddpe5Holns6EQd1/xEZ7sB1YhQKJtvUrl -ZNufy1Jf1r0ldEGeA+0ISck7s+xSh9rQD2Op ------END CERTIFICATE----- diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/test.crt b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/test.crt deleted file mode 100644 index b357f86..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/test.crt +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICQzCCAawCCQCO/XWtRFck1jANBgkqhkiG9w0BAQUFADBmMQswCQYDVQQGEwJU -SDEQMA4GA1UECBMHQmFuZ2tvazEOMAwGA1UEBxMFU2lsb20xGzAZBgNVBAoTElRo -ZSBSZXF1ZXN0IE1vZHVsZTEYMBYGA1UEAxMPcmVxdWVzdC5leGFtcGxlMB4XDTEx -MTIwMzAyMjkyM1oXDTIxMTEzMDAyMjkyM1owZjELMAkGA1UEBhMCVEgxEDAOBgNV -BAgTB0Jhbmdrb2sxDjAMBgNVBAcTBVNpbG9tMRswGQYDVQQKExJUaGUgUmVxdWVz -dCBNb2R1bGUxGDAWBgNVBAMTD3JlcXVlc3QuZXhhbXBsZTCBnzANBgkqhkiG9w0B -AQEFAAOBjQAwgYkCgYEAwmctddZqlA48+NXs0yOy92DijcQV1jf87zMiYAIlNUto -wghVbTWgJU5r0pdKrD16AptnWJTzKanhItEX8XCCPgsNkq1afgTtJP7rNkwu3xcj -eIMkhJg/ay4ZnkbnhYdsii5VTU5prix6AqWRAhbkBgoA+iVyHyof8wvZyKBoFTMC -AwEAATANBgkqhkiG9w0BAQUFAAOBgQB6BybMJbpeiABgihDfEVBcAjDoQ8gUMgwV -l4NulugfKTDmArqnR9aPd4ET5jX5dkMP4bwCHYsvrcYDeWEQy7x5WWuylOdKhua4 -L4cEi2uDCjqEErIG3cc1MCOk6Cl6Ld6tkIzQSf953qfdEACRytOeUqLNQcrXrqeE -c7U8F6MWLQ== ------END CERTIFICATE----- diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/test.key b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/test.key deleted file mode 100644 index b85810d..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/test.key +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXgIBAAKBgQDCZy111mqUDjz41ezTI7L3YOKNxBXWN/zvMyJgAiU1S2jCCFVt -NaAlTmvSl0qsPXoCm2dYlPMpqeEi0RfxcII+Cw2SrVp+BO0k/us2TC7fFyN4gySE -mD9rLhmeRueFh2yKLlVNTmmuLHoCpZECFuQGCgD6JXIfKh/zC9nIoGgVMwIDAQAB -AoGBALXFwfUf8vHTSmGlrdZS2AGFPvEtuvldyoxi9K5u8xmdFCvxnOcLsF2RsTHt -Mu5QYWhUpNJoG+IGLTPf7RJdj/kNtEs7xXqWy4jR36kt5z5MJzqiK+QIgiO9UFWZ -fjUb6oeDnTIJA9YFBdYi97MDuL89iU/UK3LkJN3hd4rciSbpAkEA+MCkowF5kSFb -rkOTBYBXZfiAG78itDXN6DXmqb9XYY+YBh3BiQM28oxCeQYyFy6pk/nstnd4TXk6 -V/ryA2g5NwJBAMgRKTY9KvxJWbESeMEFe2iBIV0c26/72Amgi7ZKUCLukLfD4tLF -+WSZdmTbbqI1079YtwaiOVfiLm45Q/3B0eUCQAaQ/0eWSGE+Yi8tdXoVszjr4GXb -G81qBi91DMu6U1It+jNfIba+MPsiHLcZJMVb4/oWBNukN7bD1nhwFWdlnu0CQQCf -Is9WHkdvz2RxbZDxb8verz/7kXXJQJhx5+rZf7jIYFxqX3yvTNv3wf2jcctJaWlZ -fVZwB193YSivcgt778xlAkEAprYUz3jczjF5r2hrgbizPzPDR94tM5BTO3ki2v3w -kbf+j2g7FNAx6kZiVN8XwfLc8xEeUGiPKwtq3ddPDFh17w== ------END RSA PRIVATE KEY----- diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-body.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-body.js deleted file mode 100644 index 9d2e188..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-body.js +++ /dev/null @@ -1,95 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetBuffer : - { resp : server.createGetResponse(new Buffer("TESTING!")) - , encoding: null - , expectBody: new Buffer("TESTING!") - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--frontier\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--frontier\r\n\r\n' + - 'Oh hi.' + - '\r\n--frontier--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - test.uri = s.url + '/' + i - request(test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-cookie.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-cookie.js deleted file mode 100644 index f17cfb3..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-cookie.js +++ /dev/null @@ -1,29 +0,0 @@ -var Cookie = require('../vendor/cookie') - , assert = require('assert'); - -var str = 'sid="s543qactge.wKE61E01Bs%2BKhzmxrwrnug="; path=/; httpOnly; expires=Sat, 04 Dec 2010 23:27:28 GMT'; -var cookie = new Cookie(str); - -// test .toString() -assert.equal(cookie.toString(), str); - -// test .path -assert.equal(cookie.path, '/'); - -// test .httpOnly -assert.equal(cookie.httpOnly, true); - -// test .name -assert.equal(cookie.name, 'sid'); - -// test .value -assert.equal(cookie.value, '"s543qactge.wKE61E01Bs%2BKhzmxrwrnug="'); - -// test .expires -assert.equal(cookie.expires instanceof Date, true); - -// test .path default -var cookie = new Cookie('foo=bar', { url: 'http://foo.com/bar' }); -assert.equal(cookie.path, '/bar'); - -console.log('All tests passed'); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-cookiejar.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-cookiejar.js deleted file mode 100644 index 76fcd71..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-cookiejar.js +++ /dev/null @@ -1,90 +0,0 @@ -var Cookie = require('../vendor/cookie') - , Jar = require('../vendor/cookie/jar') - , assert = require('assert'); - -function expires(ms) { - return new Date(Date.now() + ms).toUTCString(); -} - -// test .get() expiration -(function() { - var jar = new Jar; - var cookie = new Cookie('sid=1234; path=/; expires=' + expires(1000)); - jar.add(cookie); - setTimeout(function(){ - var cookies = jar.get({ url: 'http://foo.com/foo' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], cookie); - setTimeout(function(){ - var cookies = jar.get({ url: 'http://foo.com/foo' }); - assert.equal(cookies.length, 0); - }, 1000); - }, 5); -})(); - -// test .get() path support -(function() { - var jar = new Jar; - var a = new Cookie('sid=1234; path=/'); - var b = new Cookie('sid=1111; path=/foo/bar'); - var c = new Cookie('sid=2222; path=/'); - jar.add(a); - jar.add(b); - jar.add(c); - - // should remove the duplicates - assert.equal(jar.cookies.length, 2); - - // same name, same path, latter prevails - var cookies = jar.get({ url: 'http://foo.com/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], c); - - // same name, diff path, path specifity prevails, latter prevails - var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], b); - - var jar = new Jar; - var a = new Cookie('sid=1111; path=/foo/bar'); - var b = new Cookie('sid=1234; path=/'); - jar.add(a); - jar.add(b); - - var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], a); - - var cookies = jar.get({ url: 'http://foo.com/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], b); - - var jar = new Jar; - var a = new Cookie('sid=1111; path=/foo/bar'); - var b = new Cookie('sid=3333; path=/foo/bar'); - var c = new Cookie('pid=3333; path=/foo/bar'); - var d = new Cookie('sid=2222; path=/foo/'); - var e = new Cookie('sid=1234; path=/'); - jar.add(a); - jar.add(b); - jar.add(c); - jar.add(d); - jar.add(e); - - var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); - assert.equal(cookies.length, 2); - assert.equal(cookies[0], b); - assert.equal(cookies[1], c); - - var cookies = jar.get({ url: 'http://foo.com/foo/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], d); - - var cookies = jar.get({ url: 'http://foo.com/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], e); -})(); - -setTimeout(function() { - console.log('All tests passed'); -}, 1200); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-defaults.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-defaults.js deleted file mode 100644 index 6c8b58f..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-defaults.js +++ /dev/null @@ -1,68 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); - -s.listen(s.port, function () { - var counter = 0; - s.on('/get', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.method, 'GET') - resp.writeHead(200, {'Content-Type': 'text/plain'}); - resp.end('TESTING!'); - }); - - // test get(string, function) - request.defaults({headers:{foo:"bar"}})(s.url + '/get', function (e, r, b){ - if (e) throw e; - assert.deepEqual("TESTING!", b); - counter += 1; - }); - - s.on('/post', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.headers['content-type'], 'application/json'); - assert.equal(req.method, 'POST') - resp.writeHead(200, {'Content-Type': 'application/json'}); - resp.end(JSON.stringify({foo:'bar'})); - }); - - // test post(string, object, function) - request.defaults({headers:{foo:"bar"}}).post(s.url + '/post', {json: true}, function (e, r, b){ - if (e) throw e; - assert.deepEqual('bar', b.foo); - counter += 1; - }); - - s.on('/del', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.method, 'DELETE') - resp.writeHead(200, {'Content-Type': 'application/json'}); - resp.end(JSON.stringify({foo:'bar'})); - }); - - // test .del(string, function) - request.defaults({headers:{foo:"bar"}, json:true}).del(s.url + '/del', function (e, r, b){ - if (e) throw e; - assert.deepEqual('bar', b.foo); - counter += 1; - }); - - s.on('/head', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.method, 'HEAD') - resp.writeHead(200, {'Content-Type': 'text/plain'}); - resp.end(); - }); - - // test head.(object, function) - request.defaults({headers:{foo:"bar"}}).head({uri: s.url + '/head'}, function (e, r, b){ - if (e) throw e; - counter += 1; - console.log(counter.toString() + " tests passed.") - s.close() - }); - -}) diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-errors.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-errors.js deleted file mode 100644 index 1986a59..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-errors.js +++ /dev/null @@ -1,37 +0,0 @@ -var server = require('./server') - , events = require('events') - , assert = require('assert') - , request = require('../main.js') - ; - -var local = 'http://localhost:8888/asdf' - -try { - request({uri:local, body:{}}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Argument error, options.body.') -} - -try { - request({uri:local, multipart: 'foo'}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Argument error, options.multipart.') -} - -try { - request({uri:local, multipart: [{}]}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Body attribute missing in multipart.') -} - -try { - request(local, {multipart: [{}]}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Body attribute missing in multipart.') -} - -console.log("All tests passed.") diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-headers.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-headers.js deleted file mode 100644 index 31fe3f4..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-headers.js +++ /dev/null @@ -1,52 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , Cookie = require('../vendor/cookie') - , Jar = require('../vendor/cookie/jar') - , s = server.createServer() - -s.listen(s.port, function () { - var serverUri = 'http://localhost:' + s.port - , numTests = 0 - , numOutstandingTests = 0 - - function createTest(requestObj, serverAssertFn) { - var testNumber = numTests; - numTests += 1; - numOutstandingTests += 1; - s.on('/' + testNumber, function (req, res) { - serverAssertFn(req, res); - res.writeHead(200); - res.end(); - }); - requestObj.url = serverUri + '/' + testNumber - request(requestObj, function (err, res, body) { - assert.ok(!err) - assert.equal(res.statusCode, 200) - numOutstandingTests -= 1 - if (numOutstandingTests === 0) { - console.log(numTests + ' tests passed.') - s.close() - } - }) - } - - // Issue #125: headers.cookie shouldn't be replaced when a cookie jar isn't specified - createTest({headers: {cookie: 'foo=bar'}}, function (req, res) { - assert.ok(req.headers.cookie) - assert.equal(req.headers.cookie, 'foo=bar') - }) - - // Issue #125: headers.cookie + cookie jar - var jar = new Jar() - jar.add(new Cookie('quux=baz')); - createTest({jar: jar, headers: {cookie: 'foo=bar'}}, function (req, res) { - assert.ok(req.headers.cookie) - assert.equal(req.headers.cookie, 'foo=bar; quux=baz') - }) - - // There should be no cookie header when neither headers.cookie nor a cookie jar is specified - createTest({}, function (req, res) { - assert.ok(!req.headers.cookie) - }) -}) diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-httpModule.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-httpModule.js deleted file mode 100644 index 1866de2..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-httpModule.js +++ /dev/null @@ -1,94 +0,0 @@ -var http = require('http') - , https = require('https') - , server = require('./server') - , assert = require('assert') - , request = require('../main.js') - - -var faux_requests_made = {'http':0, 'https':0} -function wrap_request(name, module) { - // Just like the http or https module, but note when a request is made. - var wrapped = {} - Object.keys(module).forEach(function(key) { - var value = module[key]; - - if(key != 'request') - wrapped[key] = value; - else - wrapped[key] = function(options, callback) { - faux_requests_made[name] += 1 - return value.apply(this, arguments) - } - }) - - return wrapped; -} - - -var faux_http = wrap_request('http', http) - , faux_https = wrap_request('https', https) - , plain_server = server.createServer() - , https_server = server.createSSLServer() - - -plain_server.listen(plain_server.port, function() { - plain_server.on('/plain', function (req, res) { - res.writeHead(200) - res.end('plain') - }) - plain_server.on('/to_https', function (req, res) { - res.writeHead(301, {'location':'https://localhost:'+https_server.port + '/https'}) - res.end() - }) - - https_server.listen(https_server.port, function() { - https_server.on('/https', function (req, res) { - res.writeHead(200) - res.end('https') - }) - https_server.on('/to_plain', function (req, res) { - res.writeHead(302, {'location':'http://localhost:'+plain_server.port + '/plain'}) - res.end() - }) - - run_tests() - run_tests({}) - run_tests({'http:':faux_http}) - run_tests({'https:':faux_https}) - run_tests({'http:':faux_http, 'https:':faux_https}) - }) -}) - -function run_tests(httpModules) { - var to_https = 'http://localhost:'+plain_server.port+'/to_https' - var to_plain = 'https://localhost:'+https_server.port+'/to_plain' - - request(to_https, {'httpModules':httpModules}, function (er, res, body) { - assert.ok(!er, 'Bounce to SSL worked') - assert.equal(body, 'https', 'Received HTTPS server body') - done() - }) - - request(to_plain, {'httpModules':httpModules}, function (er, res, body) { - assert.ok(!er, 'Bounce to plaintext server worked') - assert.equal(body, 'plain', 'Received HTTPS server body') - done() - }) -} - - -var passed = 0; -function done() { - passed += 1 - var expected = 10 - - if(passed == expected) { - plain_server.close() - https_server.close() - - assert.equal(faux_requests_made.http, 4, 'Wrapped http module called appropriately') - assert.equal(faux_requests_made.https, 4, 'Wrapped https module called appropriately') - - console.log((expected+2) + ' tests passed.') - } -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-https-strict.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-https-strict.js deleted file mode 100644 index f53fc14..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-https-strict.js +++ /dev/null @@ -1,97 +0,0 @@ -// a test where we validate the siguature of the keys -// otherwise exactly the same as the ssl test - -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , fs = require('fs') - , path = require('path') - , opts = { key: path.resolve(__dirname, 'ssl/ca/server.key') - , cert: path.resolve(__dirname, 'ssl/ca/server.crt') } - , s = server.createSSLServer(null, opts) - , caFile = path.resolve(__dirname, 'ssl/ca/ca.crt') - , ca = fs.readFileSync(caFile) - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--frontier\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--frontier\r\n\r\n' + - 'Oh hi.' + - '\r\n--frontier--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - test.uri = s.url + '/' + i - test.strictSSL = true - test.ca = ca - test.headers = { host: 'testing.request.mikealrogers.com' } - request(test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-https.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-https.js deleted file mode 100644 index df7330b..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-https.js +++ /dev/null @@ -1,86 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - -var s = server.createSSLServer(); - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--frontier\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--frontier\r\n\r\n' + - 'Oh hi.' + - '\r\n--frontier--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - test.uri = s.url + '/' + i - request(test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-oauth.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-oauth.js deleted file mode 100644 index e9d3290..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-oauth.js +++ /dev/null @@ -1,117 +0,0 @@ -var hmacsign = require('../oauth').hmacsign - , assert = require('assert') - , qs = require('querystring') - , request = require('../main') - ; - -function getsignature (r) { - var sign - r.headers.authorization.slice('OAuth '.length).replace(/,\ /g, ',').split(',').forEach(function (v) { - if (v.slice(0, 'oauth_signature="'.length) === 'oauth_signature="') sign = v.slice('oauth_signature="'.length, -1) - }) - return decodeURIComponent(sign) -} - -// Tests from Twitter documentation https://dev.twitter.com/docs/auth/oauth - -var reqsign = hmacsign('POST', 'https://api.twitter.com/oauth/request_token', - { oauth_callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11' - , oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g' - , oauth_nonce: 'QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk' - , oauth_signature_method: 'HMAC-SHA1' - , oauth_timestamp: '1272323042' - , oauth_version: '1.0' - }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98") - -console.log(reqsign) -console.log('8wUi7m5HFQy76nowoCThusfgB+Q=') -assert.equal(reqsign, '8wUi7m5HFQy76nowoCThusfgB+Q=') - -var accsign = hmacsign('POST', 'https://api.twitter.com/oauth/access_token', - { oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g' - , oauth_nonce: '9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8' - , oauth_signature_method: 'HMAC-SHA1' - , oauth_token: '8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc' - , oauth_timestamp: '1272323047' - , oauth_verifier: 'pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY' - , oauth_version: '1.0' - }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "x6qpRnlEmW9JbQn4PQVVeVG8ZLPEx6A0TOebgwcuA") - -console.log(accsign) -console.log('PUw/dHA4fnlJYM6RhXk5IU/0fCc=') -assert.equal(accsign, 'PUw/dHA4fnlJYM6RhXk5IU/0fCc=') - -var upsign = hmacsign('POST', 'http://api.twitter.com/1/statuses/update.json', - { oauth_consumer_key: "GDdmIQH6jhtmLUypg82g" - , oauth_nonce: "oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y" - , oauth_signature_method: "HMAC-SHA1" - , oauth_token: "819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw" - , oauth_timestamp: "1272325550" - , oauth_version: "1.0" - , status: 'setting up my twitter 私のさえずりを設定する' - }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA") - -console.log(upsign) -console.log('yOahq5m0YjDDjfjxHaXEsW9D+X0=') -assert.equal(upsign, 'yOahq5m0YjDDjfjxHaXEsW9D+X0=') - - -var rsign = request.post( - { url: 'https://api.twitter.com/oauth/request_token' - , oauth: - { callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11' - , consumer_key: 'GDdmIQH6jhtmLUypg82g' - , nonce: 'QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk' - , timestamp: '1272323042' - , version: '1.0' - , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" - } - }) - -setTimeout(function () { - console.log(getsignature(rsign)) - assert.equal(reqsign, getsignature(rsign)) -}) - -var raccsign = request.post( - { url: 'https://api.twitter.com/oauth/access_token' - , oauth: - { consumer_key: 'GDdmIQH6jhtmLUypg82g' - , nonce: '9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8' - , signature_method: 'HMAC-SHA1' - , token: '8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc' - , timestamp: '1272323047' - , verifier: 'pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY' - , version: '1.0' - , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" - , token_secret: "x6qpRnlEmW9JbQn4PQVVeVG8ZLPEx6A0TOebgwcuA" - } - }) - -setTimeout(function () { - console.log(getsignature(raccsign)) - assert.equal(accsign, getsignature(raccsign)) -}, 1) - -var rupsign = request.post( - { url: 'http://api.twitter.com/1/statuses/update.json' - , oauth: - { consumer_key: "GDdmIQH6jhtmLUypg82g" - , nonce: "oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y" - , signature_method: "HMAC-SHA1" - , token: "819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw" - , timestamp: "1272325550" - , version: "1.0" - , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" - , token_secret: "J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA" - } - , form: {status: 'setting up my twitter 私のさえずりを設定する'} - }) -setTimeout(function () { - console.log(getsignature(rupsign)) - assert.equal(upsign, getsignature(rupsign)) -}, 1) - - - - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-params.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-params.js deleted file mode 100644 index 8354f6d..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-params.js +++ /dev/null @@ -1,92 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetBuffer : - { resp : server.createGetResponse(new Buffer("TESTING!")) - , encoding: null - , expectBody: new Buffer("TESTING!") - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--frontier\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--frontier\r\n\r\n' + - 'Oh hi.' + - '\r\n--frontier--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - //test.uri = s.url + '/' + i - request(s.url + '/' + i, test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-pipes.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-pipes.js deleted file mode 100644 index 1869874..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-pipes.js +++ /dev/null @@ -1,202 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , fs = require('fs') - , request = require('../main.js') - , path = require('path') - , util = require('util') - ; - -var s = server.createServer(3453); - -function ValidationStream(str) { - this.str = str - this.buf = '' - this.on('data', function (data) { - this.buf += data - }) - this.on('end', function () { - assert.equal(this.str, this.buf) - }) - this.writable = true -} -util.inherits(ValidationStream, stream.Stream) -ValidationStream.prototype.write = function (chunk) { - this.emit('data', chunk) -} -ValidationStream.prototype.end = function (chunk) { - if (chunk) emit('data', chunk) - this.emit('end') -} - -s.listen(s.port, function () { - counter = 0; - - var check = function () { - counter = counter - 1 - if (counter === 0) { - console.log('All tests passed.') - setTimeout(function () { - process.exit(); - }, 500) - } - } - - // Test pipeing to a request object - s.once('/push', server.createPostValidator("mydata")); - - var mydata = new stream.Stream(); - mydata.readable = true - - counter++ - var r1 = request.put({url:'http://localhost:3453/push'}, function () { - check(); - }) - mydata.pipe(r1) - - mydata.emit('data', 'mydata'); - mydata.emit('end'); - - - // Test pipeing from a request object. - s.once('/pull', server.createGetResponse("mypulldata")); - - var mypulldata = new stream.Stream(); - mypulldata.writable = true - - counter++ - request({url:'http://localhost:3453/pull'}).pipe(mypulldata) - - var d = ''; - - mypulldata.write = function (chunk) { - d += chunk; - } - mypulldata.end = function () { - assert.equal(d, 'mypulldata'); - check(); - }; - - - s.on('/cat', function (req, resp) { - if (req.method === "GET") { - resp.writeHead(200, {'content-type':'text/plain-test', 'content-length':4}); - resp.end('asdf') - } else if (req.method === "PUT") { - assert.equal(req.headers['content-type'], 'text/plain-test'); - assert.equal(req.headers['content-length'], 4) - var validate = ''; - - req.on('data', function (chunk) {validate += chunk}) - req.on('end', function () { - resp.writeHead(201); - resp.end(); - assert.equal(validate, 'asdf'); - check(); - }) - } - }) - s.on('/pushjs', function (req, resp) { - if (req.method === "PUT") { - assert.equal(req.headers['content-type'], 'text/javascript'); - check(); - } - }) - s.on('/catresp', function (req, resp) { - request.get('http://localhost:3453/cat').pipe(resp) - }) - s.on('/doodle', function (req, resp) { - if (req.headers['x-oneline-proxy']) { - resp.setHeader('x-oneline-proxy', 'yup') - } - resp.writeHead('200', {'content-type':'image/png'}) - fs.createReadStream(path.join(__dirname, 'googledoodle.png')).pipe(resp) - }) - s.on('/onelineproxy', function (req, resp) { - var x = request('http://localhost:3453/doodle') - req.pipe(x) - x.pipe(resp) - }) - - counter++ - fs.createReadStream(__filename).pipe(request.put('http://localhost:3453/pushjs')) - - counter++ - request.get('http://localhost:3453/cat').pipe(request.put('http://localhost:3453/cat')) - - counter++ - request.get('http://localhost:3453/catresp', function (e, resp, body) { - assert.equal(resp.headers['content-type'], 'text/plain-test'); - assert.equal(resp.headers['content-length'], 4) - check(); - }) - - var doodleWrite = fs.createWriteStream(path.join(__dirname, 'test.png')) - - counter++ - request.get('http://localhost:3453/doodle').pipe(doodleWrite) - - doodleWrite.on('close', function () { - assert.deepEqual(fs.readFileSync(path.join(__dirname, 'googledoodle.png')), fs.readFileSync(path.join(__dirname, 'test.png'))) - check() - }) - - process.on('exit', function () { - fs.unlinkSync(path.join(__dirname, 'test.png')) - }) - - counter++ - request.get({uri:'http://localhost:3453/onelineproxy', headers:{'x-oneline-proxy':'nope'}}, function (err, resp, body) { - assert.equal(resp.headers['x-oneline-proxy'], 'yup') - check() - }) - - s.on('/afterresponse', function (req, resp) { - resp.write('d') - resp.end() - }) - - counter++ - var afterresp = request.post('http://localhost:3453/afterresponse').on('response', function () { - var v = new ValidationStream('d') - afterresp.pipe(v) - v.on('end', check) - }) - - s.on('/forward1', function (req, resp) { - resp.writeHead(302, {location:'/forward2'}) - resp.end() - }) - s.on('/forward2', function (req, resp) { - resp.writeHead('200', {'content-type':'image/png'}) - resp.write('d') - resp.end() - }) - - counter++ - var validateForward = new ValidationStream('d') - validateForward.on('end', check) - request.get('http://localhost:3453/forward1').pipe(validateForward) - - // Test pipe options - s.once('/opts', server.createGetResponse('opts response')); - - var optsStream = new stream.Stream(); - optsStream.writable = true - - var optsData = ''; - optsStream.write = function (buf) { - optsData += buf; - if (optsData === 'opts response') { - setTimeout(check, 10); - } - } - - optsStream.end = function () { - assert.fail('end called') - }; - - counter++ - request({url:'http://localhost:3453/opts'}).pipe(optsStream, { end : false }) -}) diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-proxy.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-proxy.js deleted file mode 100644 index 647157c..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-proxy.js +++ /dev/null @@ -1,39 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , fs = require('fs') - , request = require('../main.js') - , path = require('path') - , util = require('util') - ; - -var port = 6768 - , called = false - , proxiedHost = 'google.com' - ; - -var s = server.createServer(port) -s.listen(port, function () { - s.on('http://google.com/', function (req, res) { - called = true - assert.equal(req.headers.host, proxiedHost) - res.writeHeader(200) - res.end() - }) - request ({ - url: 'http://'+proxiedHost, - proxy: 'http://localhost:'+port - /* - //should behave as if these arguments where passed: - url: 'http://localhost:'+port, - headers: {host: proxiedHost} - //*/ - }, function (err, res, body) { - s.close() - }) -}) - -process.on('exit', function () { - assert.ok(called, 'the request must be made to the proxy server') -}) diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-qs.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-qs.js deleted file mode 100644 index 1aac22b..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-qs.js +++ /dev/null @@ -1,28 +0,0 @@ -var request = request = require('../main.js') - , assert = require('assert') - ; - - -// Test adding a querystring -var req1 = request.get({ uri: 'http://www.google.com', qs: { q : 'search' }}) -setTimeout(function() { - assert.equal('/?q=search', req1.path) -}, 1) - -// Test replacing a querystring value -var req2 = request.get({ uri: 'http://www.google.com?q=abc', qs: { q : 'search' }}) -setTimeout(function() { - assert.equal('/?q=search', req2.path) -}, 1) - -// Test appending a querystring value to the ones present in the uri -var req3 = request.get({ uri: 'http://www.google.com?x=y', qs: { q : 'search' }}) -setTimeout(function() { - assert.equal('/?x=y&q=search', req3.path) -}, 1) - -// Test leaving a querystring alone -var req4 = request.get({ uri: 'http://www.google.com?x=y'}) -setTimeout(function() { - assert.equal('/?x=y', req4.path) -}, 1) diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-redirect.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-redirect.js deleted file mode 100644 index 54fc19b..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-redirect.js +++ /dev/null @@ -1,159 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , Cookie = require('../vendor/cookie') - , Jar = require('../vendor/cookie/jar') - -var s = server.createServer() - -s.listen(s.port, function () { - var server = 'http://localhost:' + s.port; - var hits = {} - var passed = 0; - - bouncer(301, 'temp') - bouncer(302, 'perm') - bouncer(302, 'nope') - - function bouncer(code, label) { - var landing = label+'_landing'; - - s.on('/'+label, function (req, res) { - hits[label] = true; - res.writeHead(code, {'location':server + '/'+landing}) - res.end() - }) - - s.on('/'+landing, function (req, res) { - if (req.method !== 'GET') { // We should only accept GET redirects - console.error("Got a non-GET request to the redirect destination URL"); - resp.writeHead(400); - resp.end(); - return; - } - // Make sure the cookie doesn't get included twice, see #139: - assert.equal(req.headers.cookie, 'foo=bar; quux=baz'); - hits[landing] = true; - res.writeHead(200) - res.end(landing) - }) - } - - // Permanent bounce - var jar = new Jar() - jar.add(new Cookie('quux=baz')) - request({uri: server+'/perm', jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.perm, 'Original request is to /perm') - assert.ok(hits.perm_landing, 'Forward to permanent landing URL') - assert.equal(body, 'perm_landing', 'Got permanent landing content') - passed += 1 - } finally { - done() - } - }) - - // Temporary bounce - request({uri: server+'/temp', jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(hits.temp_landing, 'Forward to temporary landing URL') - assert.equal(body, 'temp_landing', 'Got temporary landing content') - passed += 1 - } finally { - done() - } - }) - - // Prevent bouncing. - request({uri:server+'/nope', jar: jar, headers: {cookie: 'foo=bar'}, followRedirect:false}, function (er, res, body) { - try { - assert.ok(hits.nope, 'Original request to /nope') - assert.ok(!hits.nope_landing, 'No chasing the redirect') - assert.equal(res.statusCode, 302, 'Response is the bounce itself') - passed += 1 - } finally { - done() - } - }) - - // Should not follow post redirects by default - request.post(server+'/temp', { jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect when post') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - } finally { - done() - } - }) - - // Should follow post redirects when followAllRedirects true - request.post({uri:server+'/temp', followAllRedirects:true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(hits.temp_landing, 'Forward to temporary landing URL') - assert.equal(body, 'temp_landing', 'Got temporary landing content') - passed += 1 - } finally { - done() - } - }) - - request.post({uri:server+'/temp', followAllRedirects:false, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - } finally { - done() - } - }) - - // Should not follow delete redirects by default - request.del(server+'/temp', { jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect when delete') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - } finally { - done() - } - }) - - // Should not follow delete redirects even if followRedirect is set to true - request.del(server+'/temp', { followRedirect: true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect when delete') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - } finally { - done() - } - }) - - // Should follow delete redirects when followAllRedirects true - request.del(server+'/temp', {followAllRedirects:true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(hits.temp_landing, 'Forward to temporary landing URL') - assert.equal(body, 'temp_landing', 'Got temporary landing content') - passed += 1 - } finally { - done() - } - }) - - var reqs_done = 0; - function done() { - reqs_done += 1; - if(reqs_done == 9) { - console.log(passed + ' tests passed.') - s.close() - } - } -}) diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-timeout.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-timeout.js deleted file mode 100644 index 673f8ad..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-timeout.js +++ /dev/null @@ -1,87 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); -var expectedBody = "waited"; -var remainingTests = 5; - -s.listen(s.port, function () { - // Request that waits for 200ms - s.on('/timeout', function (req, resp) { - setTimeout(function(){ - resp.writeHead(200, {'content-type':'text/plain'}) - resp.write(expectedBody) - resp.end() - }, 200); - }); - - // Scenario that should timeout - var shouldTimeout = { - url: s.url + "/timeout", - timeout:100 - } - - - request(shouldTimeout, function (err, resp, body) { - assert.equal(err.code, "ETIMEDOUT"); - checkDone(); - }) - - - // Scenario that shouldn't timeout - var shouldntTimeout = { - url: s.url + "/timeout", - timeout:300 - } - - request(shouldntTimeout, function (err, resp, body) { - assert.equal(err, null); - assert.equal(expectedBody, body) - checkDone(); - }) - - // Scenario with no timeout set, so shouldn't timeout - var noTimeout = { - url: s.url + "/timeout" - } - - request(noTimeout, function (err, resp, body) { - assert.equal(err); - assert.equal(expectedBody, body) - checkDone(); - }) - - // Scenario with a negative timeout value, should be treated a zero or the minimum delay - var negativeTimeout = { - url: s.url + "/timeout", - timeout:-1000 - } - - request(negativeTimeout, function (err, resp, body) { - assert.equal(err.code, "ETIMEDOUT"); - checkDone(); - }) - - // Scenario with a float timeout value, should be rounded by setTimeout anyway - var floatTimeout = { - url: s.url + "/timeout", - timeout: 100.76 - } - - request(floatTimeout, function (err, resp, body) { - assert.equal(err.code, "ETIMEDOUT"); - checkDone(); - }) - - function checkDone() { - if(--remainingTests == 0) { - s.close(); - console.log("All tests passed."); - } - } -}) - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-tunnel.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-tunnel.js deleted file mode 100644 index 58131b9..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-tunnel.js +++ /dev/null @@ -1,61 +0,0 @@ -// test that we can tunnel a https request over an http proxy -// keeping all the CA and whatnot intact. -// -// Note: this requires that squid is installed. -// If the proxy fails to start, we'll just log a warning and assume success. - -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , fs = require('fs') - , path = require('path') - , caFile = path.resolve(__dirname, 'ssl/npm-ca.crt') - , ca = fs.readFileSync(caFile) - , child_process = require('child_process') - , sqConf = path.resolve(__dirname, 'squid.conf') - , sqArgs = ['-f', sqConf, '-N', '-d', '5'] - , proxy = 'http://localhost:3128' - , hadError = null - -var squid = child_process.spawn('squid', sqArgs); -var ready = false - -squid.stderr.on('data', function (c) { - console.error('SQUIDERR ' + c.toString().trim().split('\n') - .join('\nSQUIDERR ')) - ready = c.toString().match(/ready to serve requests/i) -}) - -squid.stdout.on('data', function (c) { - console.error('SQUIDOUT ' + c.toString().trim().split('\n') - .join('\nSQUIDOUT ')) -}) - -squid.on('exit', function (c) { - console.error('exit '+c) - if (c && !ready) { - console.error('squid must be installed to run this test.') - c = null - hadError = null - process.exit(0) - return - } - - if (c) { - hadError = hadError || new Error('Squid exited with '+c) - } - if (hadError) throw hadError -}) - -setTimeout(function F () { - if (!ready) return setTimeout(F, 100) - request({ uri: 'https://registry.npmjs.org/request/' - , proxy: 'http://localhost:3128' - , ca: ca - , json: true }, function (er, body) { - hadError = er - console.log(er || typeof body) - if (!er) console.log("ok") - squid.kill('SIGKILL') - }) -}, 100) diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tunnel.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tunnel.js deleted file mode 100644 index 453786c..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/tunnel.js +++ /dev/null @@ -1,229 +0,0 @@ -'use strict'; - -var net = require('net'); -var tls = require('tls'); -var http = require('http'); -var https = require('https'); -var events = require('events'); -var assert = require('assert'); -var util = require('util'); - - -exports.httpOverHttp = httpOverHttp; -exports.httpsOverHttp = httpsOverHttp; -exports.httpOverHttps = httpOverHttps; -exports.httpsOverHttps = httpsOverHttps; - - -function httpOverHttp(options) { - var agent = new TunnelingAgent(options); - agent.request = http.request; - return agent; -} - -function httpsOverHttp(options) { - var agent = new TunnelingAgent(options); - agent.request = http.request; - agent.createSocket = createSecureSocket; - return agent; -} - -function httpOverHttps(options) { - var agent = new TunnelingAgent(options); - agent.request = https.request; - return agent; -} - -function httpsOverHttps(options) { - var agent = new TunnelingAgent(options); - agent.request = https.request; - agent.createSocket = createSecureSocket; - return agent; -} - - -function TunnelingAgent(options) { - var self = this; - self.options = options || {}; - self.proxyOptions = self.options.proxy || {}; - self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; - self.requests = []; - self.sockets = []; - - self.on('free', function onFree(socket, host, port) { - for (var i = 0, len = self.requests.length; i < len; ++i) { - var pending = self.requests[i]; - if (pending.host === host && pending.port === port) { - // Detect the request to connect same origin server, - // reuse the connection. - self.requests.splice(i, 1); - pending.request.onSocket(socket); - return; - } - } - socket.destroy(); - self.removeSocket(socket); - }); -} -util.inherits(TunnelingAgent, events.EventEmitter); - -TunnelingAgent.prototype.addRequest = function addRequest(req, host, port) { - var self = this; - - if (self.sockets.length >= this.maxSockets) { - // We are over limit so we'll add it to the queue. - self.requests.push({host: host, port: port, request: req}); - return; - } - - // If we are under maxSockets create a new one. - self.createSocket({host: host, port: port, request: req}, function(socket) { - socket.on('free', onFree); - socket.on('close', onCloseOrRemove); - socket.on('agentRemove', onCloseOrRemove); - req.onSocket(socket); - - function onFree() { - self.emit('free', socket, host, port); - } - - function onCloseOrRemove(err) { - self.removeSocket(); - socket.removeListener('free', onFree); - socket.removeListener('close', onCloseOrRemove); - socket.removeListener('agentRemove', onCloseOrRemove); - } - }); -}; - -TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { - var self = this; - var placeholder = {}; - self.sockets.push(placeholder); - - var connectOptions = mergeOptions({}, self.proxyOptions, { - method: 'CONNECT', - path: options.host + ':' + options.port, - agent: false - }); - if (connectOptions.proxyAuth) { - connectOptions.headers = connectOptions.headers || {}; - connectOptions.headers['Proxy-Authorization'] = 'Basic ' + - new Buffer(connectOptions.proxyAuth).toString('base64'); - } - - debug('making CONNECT request'); - var connectReq = self.request(connectOptions); - connectReq.useChunkedEncodingByDefault = false; // for v0.6 - connectReq.once('response', onResponse); // for v0.6 - connectReq.once('upgrade', onUpgrade); // for v0.6 - connectReq.once('connect', onConnect); // for v0.7 or later - connectReq.once('error', onError); - connectReq.end(); - - function onResponse(res) { - // Very hacky. This is necessary to avoid http-parser leaks. - res.upgrade = true; - } - - function onUpgrade(res, socket, head) { - // Hacky. - process.nextTick(function() { - onConnect(res, socket, head); - }); - } - - function onConnect(res, socket, head) { - connectReq.removeAllListeners(); - socket.removeAllListeners(); - - if (res.statusCode === 200) { - assert.equal(head.length, 0); - debug('tunneling connection has established'); - self.sockets[self.sockets.indexOf(placeholder)] = socket; - cb(socket); - } else { - debug('tunneling socket could not be established, statusCode=%d', - res.statusCode); - var error = new Error('tunneling socket could not be established, ' + - 'sutatusCode=' + res.statusCode); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - } - } - - function onError(cause) { - connectReq.removeAllListeners(); - - debug('tunneling socket could not be established, cause=%s\n', - cause.message, cause.stack); - var error = new Error('tunneling socket could not be established, ' + - 'cause=' + cause.message); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - } -}; - -TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { - var pos = this.sockets.indexOf(socket) - if (pos === -1) { - return; - } - this.sockets.splice(pos, 1); - - var pending = this.requests.shift(); - if (pending) { - // If we have pending requests and a socket gets closed a new one - // needs to be created to take over in the pool for the one that closed. - this.createSocket(pending, function(socket) { - pending.request.onSocket(socket); - }); - } -}; - -function createSecureSocket(options, cb) { - var self = this; - TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { - // 0 is dummy port for v0.6 - var secureSocket = tls.connect(0, mergeOptions({}, self.options, { - socket: socket - })); - cb(secureSocket); - }); -} - - -function mergeOptions(target) { - for (var i = 1, len = arguments.length; i < len; ++i) { - var overrides = arguments[i]; - if (typeof overrides === 'object') { - var keys = Object.keys(overrides); - for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { - var k = keys[j]; - if (overrides[k] !== undefined) { - target[k] = overrides[k]; - } - } - } - } - return target; -} - - -var debug; -if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { - debug = function() { - var args = Array.prototype.slice.call(arguments); - if (typeof args[0] === 'string') { - args[0] = 'TUNNEL: ' + args[0]; - } else { - args.unshift('TUNNEL:'); - } - console.error.apply(console, args); - } -} else { - debug = function() {}; -} -exports.debug = debug; // for test diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/uuid.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/uuid.js deleted file mode 100644 index 1d83bd5..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/uuid.js +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = function () { - var s = [], itoh = '0123456789ABCDEF'; - - // Make array of random hex digits. The UUID only has 32 digits in it, but we - // allocate an extra items to make room for the '-'s we'll be inserting. - for (var i = 0; i <36; i++) s[i] = Math.floor(Math.random()*0x10); - - // Conform to RFC-4122, section 4.4 - s[14] = 4; // Set 4 high bits of time_high field to version - s[19] = (s[19] & 0x3) | 0x8; // Specify 2 high bits of clock sequence - - // Convert to hex chars - for (var i = 0; i <36; i++) s[i] = itoh[s[i]]; - - // Insert '-'s - s[8] = s[13] = s[18] = s[23] = '-'; - - return s.join(''); -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/vendor/cookie/index.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/vendor/cookie/index.js deleted file mode 100644 index 1eb2eaa..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/vendor/cookie/index.js +++ /dev/null @@ -1,60 +0,0 @@ -/*! - * Tobi - Cookie - * Copyright(c) 2010 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var url = require('url'); - -/** - * Initialize a new `Cookie` with the given cookie `str` and `req`. - * - * @param {String} str - * @param {IncomingRequest} req - * @api private - */ - -var Cookie = exports = module.exports = function Cookie(str, req) { - this.str = str; - - // First key is the name - this.name = str.substr(0, str.indexOf('=')).trim(); - - // Map the key/val pairs - str.split(/ *; */).reduce(function(obj, pair){ - var p = pair.indexOf('='); - if(p > 0) - obj[pair.substring(0, p).trim()] = pair.substring(p + 1).trim(); - else - obj[pair.trim()] = true; - return obj; - }, this); - - // Assign value - this.value = this[this.name]; - - // Expires - this.expires = this.expires - ? new Date(this.expires) - : Infinity; - - // Default or trim path - this.path = this.path - ? this.path.trim(): req - ? url.parse(req.url).pathname: '/'; -}; - -/** - * Return the original cookie string. - * - * @return {String} - * @api public - */ - -Cookie.prototype.toString = function(){ - return this.str; -}; diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/vendor/cookie/jar.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/vendor/cookie/jar.js deleted file mode 100644 index 34920e0..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/request/vendor/cookie/jar.js +++ /dev/null @@ -1,72 +0,0 @@ -/*! -* Tobi - CookieJar -* Copyright(c) 2010 LearnBoost -* MIT Licensed -*/ - -/** -* Module dependencies. -*/ - -var url = require('url'); - -/** -* Initialize a new `CookieJar`. -* -* @api private -*/ - -var CookieJar = exports = module.exports = function CookieJar() { - this.cookies = []; -}; - -/** -* Add the given `cookie` to the jar. -* -* @param {Cookie} cookie -* @api private -*/ - -CookieJar.prototype.add = function(cookie){ - this.cookies = this.cookies.filter(function(c){ - // Avoid duplication (same path, same name) - return !(c.name == cookie.name && c.path == cookie.path); - }); - this.cookies.push(cookie); -}; - -/** -* Get cookies for the given `req`. -* -* @param {IncomingRequest} req -* @return {Array} -* @api private -*/ - -CookieJar.prototype.get = function(req){ - var path = url.parse(req.url).pathname - , now = new Date - , specificity = {}; - return this.cookies.filter(function(cookie){ - if (0 == path.indexOf(cookie.path) && now < cookie.expires - && cookie.path.length > (specificity[cookie.name] || 0)) - return specificity[cookie.name] = cookie.path.length; - }); -}; - -/** -* Return Cookie string for the given `req`. -* -* @param {IncomingRequest} req -* @return {String} -* @api private -*/ - -CookieJar.prototype.cookieString = function(req){ - var cookies = this.get(req); - if (cookies.length) { - return cookies.map(function(cookie){ - return cookie.name + '=' + cookie.value; - }).join('; '); - } -}; diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/.npmignore b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/.npmignore deleted file mode 100644 index e3bc275..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules/ -node_modules/* -npm-debug.log \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/CHANGELOG.md b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/CHANGELOG.md deleted file mode 100644 index 1effdd2..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/CHANGELOG.md +++ /dev/null @@ -1,15 +0,0 @@ -#VERSION HISTORY - -##2.0 -* [Breaking] Refactored this to work in node.js. Backwards compatibility to existing browser API coming in future 2.x releases. (indexzero) - -## 1.2 -* Added TimeSpan.FromDates Constructor to take two dates - and create a TimeSpan from the difference. (mstum) - -## 1.1 -* Changed naming to follow JavaScript standards (mstum) -* Added Documentation (mstum) - -## 1.0 -* Initial Revision (mstum) diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/LICENSE b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/LICENSE deleted file mode 100644 index 071d8fb..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010 Michael Stum, Charlie Robbins - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/README.md b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/README.md deleted file mode 100644 index 2bb9904..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/README.md +++ /dev/null @@ -1,199 +0,0 @@ -# timespan - -A simple implementation of TimeSpans in Javascript. - -## Installation in node.js - -### Installing npm (node package manager) -``` bash - $ curl http://npmjs.org/install.sh | sh -``` - -### Installing timespan -``` bash - [sudo] npm install timespan -``` - -## Usage -You have two options when creating a new TimeSpan object: either explicitly instantiate it using the TimeSpan constructor function or use a helper method to create from a specific length of time. - -### Using the new constructor - -``` js - var timespan = require('timespan'); - var ts = new timespan.TimeSpan(); -``` - -The constructor takes 5 parameters, all which are optional and which can be used to initialize the TimeSpan to a given value. These parameters are: `milliseconds`, `seconds`, `minutes`, `hours`, `days`. - -``` js - // - // Initializes the TimeSpan to 4 Minutes, 16 Seconds and 0 Milliseconds. - // - var ts = new TimeSpan(0,16,4) - - // - // Initializes the TimeSpan to 3 hours, 4 minutes, 10 seconds and 0 msecs. - // - var ts = new TimeSpan(0,10,64,2); -``` - -### Using Construction Helper Method(s) -You can initialize a new TimeSpan by calling one of these Functions: - -``` js - timespan.FromSeconds(/* seconds */); - timespan.FromMinutes(/* minutes */); - timespan.FromHours(/* hours */); - timespan.FromDays(/* hours */); - - // - // This behaves differently, see below - // - timespan.FromDates(start, end); -``` - -The first four helper methods take a single numeric parameter and create a new TimeSpan instance. e.g. `timespan.FromSeconds(45)` is equivalent to `new TimeSpan(0,45)`. If the parameter is invalid/not a number, it will just be treated as 0 no error will be thrown. - -`timespan.FromDates()` is different as it takes two dates. The TimeSpan will be the difference between these dates. - -If the second date is earlier than the first date, the TimeSpan will have a negative value. You can pass in "true" as the third parameter to force the TimeSpan to be positive always. - -``` js - var date1 = new Date(2010, 3, 1, 10, 10, 5, 0); - var date2 = new Date(2010, 3, 1, 10, 10, 10, 0); - var ts = TimeSpan.FromDates(date2, date1); - var ts2 = TimeSpan.FromDates(date2, date1, true); - - // - // -5, because we put the later date first - // - console.log(ts.totalSeconds()); - - // - // 5, because we passed true as third parameter - // - console.log(ts2.totalSeconds()); -``` - - -### Adding / Subtracting TimeSpans -There are several functions to add or subtract time: - -``` js - ts.addMilliseconds() - ts.addSeconds() - ts.addMinutes() - ts.addHours() - ts.addDays() - ts.subtractMilliseconds() - ts.subtractSeconds() - ts.subtractMinutes() - ts.subtractHours() - ts.subtractDays() -``` - -All these functions take a single numeric parameter. If the parameter is invalid, not a number, or missing it will be ignored and no Error is thrown. - -``` js - var ts = new TimeSpan(); - ts.addSeconds(30); - ts.addMinutes(2); - ts.subtractSeconds(60); - - // - // ts will now be a timespan of 1 minute and 30 seconds - // -``` - -The parameter can be negative to negate the operation `ts.addSeconds(-30)` is equivalent to `ts.subtractSeconds(30)`. - -### Interacting with Other TimeSpan instances -These are the functions that interact with another TimeSpan: - -``` js - ts.add() - ts.subtract() - ts.equals() -``` - -add and subtract add/subtract the other TimeSpan to the current one: - -``` js - var ts = TimeSpan.FromSeconds(30); - var ts2 = TimeSpan.FromMinutes(2); - ts.add(ts2); - - // - // ts is now a TimeSpan of 2 Minutes, 30 Seconds - // ts2 is unchanged - // -``` - -equals checks if two TimeSpans have the same time: - -``` js - var ts = TimeSpan.FromSeconds(30); - var ts2 = TimeSpan.FromSeconds(30); - var eq = ts.equals(ts2); // true - ts2.addSeconds(1); - var eq2 = ts.equals(ts2); // false -``` - -### Retrieving the Value of a TimeSpan -There are two sets of functions to retreive the function of the TimeSpan: those that deal with the full value in various measurements and another that gets the individual components. - -#### Retrieve the full value - -``` js - ts.totalMilliseconds() - ts.totalSeconds() - ts.totalMinutes() - ts.totalHours() - ts.totalDays() -``` - -These functions convert the value to the given format and return it. The result can be a floating point number. These functions take a single parameter roundDown which can be set to true to round the value down to an Integer. - -``` js - var ts = TimeSpan.fromSeconds(90); - console.log(ts.totalMilliseconds()); // 90000 - console.log(ts.totalSeconds()); // 90 - console.log(ts.totalMinutes()); // 1.5 - console.log(ts.totalMinutes(true)); // 1 -``` - -#### Retrieve a component of the TimeSpan - -``` js - ts.milliseconds - ts.seconds - ts.minutes - ts.hours - ts.days -``` - -These functions return a component of the TimeSpan that could be used to represent a clock. - -``` js - var ts = TimeSpan.FromSeconds(90); - console.log(ts.seconds()); // 30 - console.log(ts.minutes()); // 1 -``` - -Basically these value never "overflow" - seconds will only return 0 to 59, hours only 0 to 23 etc. Days could grow infinitely. All of these functions automatically round down the result: - -``` js - var ts = TimeSpan.FromDays(2); - ts.addHours(12); - console.log(ts.days()); // 2 - console.log(ts.hours()); // 12 -``` - -## Remark about Backwards Compatibility -Version 0.2.x was designed to work with [node.js][0] and backwards compatibility to the browser-based usage was not considered a high priority. This will be fixed in future versions, but for now if you need to use this in the browser, you can find the 0.1.x code under `/browser`. - -#### Author: [Michael Stum](http://www.stum.de) -#### Contributors: [Charlie Robbins](http://github.com/indexzero) - -[0]: http://nodejs.org \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/browser/TimeSpan-1.2.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/browser/TimeSpan-1.2.js deleted file mode 100644 index bc8149d..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/browser/TimeSpan-1.2.js +++ /dev/null @@ -1,226 +0,0 @@ -/*! -* JavaScript TimeSpan Library -* -* Copyright (c) 2010 Michael Stum, http://www.Stum.de/ -* -* Permission is hereby granted, free of charge, to any person obtaining -* a copy of this software and associated documentation files (the -* "Software"), to deal in the Software without restriction, including -* without limitation the rights to use, copy, modify, merge, publish, -* distribute, sublicense, and/or sell copies of the Software, and to -* permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice shall be -* included in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -/*global window: false */ -"use strict"; -(function () { - // Constructor function, all parameters are optional - var TimeSpan = window.TimeSpan = function (milliseconds, seconds, minutes, hours, days) { - var version = "1.2", - // Millisecond-constants - msecPerSecond = 1000, - msecPerMinute = 60000, - msecPerHour = 3600000, - msecPerDay = 86400000, - // Internally we store the TimeSpan as Milliseconds - msecs = 0, - - // Helper functions - isNumeric = function (input) { - return !isNaN(parseFloat(input)) && isFinite(input); - }; - - // Constructor Logic - if (isNumeric(days)) { - msecs += (days * msecPerDay); - } - if (isNumeric(hours)) { - msecs += (hours * msecPerHour); - } - if (isNumeric(minutes)) { - msecs += (minutes * msecPerMinute); - } - if (isNumeric(seconds)) { - msecs += (seconds * msecPerSecond); - } - if (isNumeric(milliseconds)) { - msecs += milliseconds; - } - - // Addition Functions - this.addMilliseconds = function (milliseconds) { - if (!isNumeric(milliseconds)) { - return; - } - msecs += milliseconds; - }; - this.addSeconds = function (seconds) { - if (!isNumeric(seconds)) { - return; - } - msecs += (seconds * msecPerSecond); - }; - this.addMinutes = function (minutes) { - if (!isNumeric(minutes)) { - return; - } - msecs += (minutes * msecPerMinute); - }; - this.addHours = function (hours) { - if (!isNumeric(hours)) { - return; - } - msecs += (hours * msecPerHour); - }; - this.addDays = function (days) { - if (!isNumeric(days)) { - return; - } - msecs += (days * msecPerDay); - }; - - // Subtraction Functions - this.subtractMilliseconds = function (milliseconds) { - if (!isNumeric(milliseconds)) { - return; - } - msecs -= milliseconds; - }; - this.subtractSeconds = function (seconds) { - if (!isNumeric(seconds)) { - return; - } - msecs -= (seconds * msecPerSecond); - }; - this.subtractMinutes = function (minutes) { - if (!isNumeric(minutes)) { - return; - } - msecs -= (minutes * msecPerMinute); - }; - this.subtractHours = function (hours) { - if (!isNumeric(hours)) { - return; - } - msecs -= (hours * msecPerHour); - }; - this.subtractDays = function (days) { - if (!isNumeric(days)) { - return; - } - msecs -= (days * msecPerDay); - }; - - // Functions to interact with other TimeSpans - this.isTimeSpan = true; - this.add = function (otherTimeSpan) { - if (!otherTimeSpan.isTimeSpan) { - return; - } - msecs += otherTimeSpan.totalMilliseconds(); - }; - this.subtract = function (otherTimeSpan) { - if (!otherTimeSpan.isTimeSpan) { - return; - } - msecs -= otherTimeSpan.totalMilliseconds(); - }; - this.equals = function (otherTimeSpan) { - if (!otherTimeSpan.isTimeSpan) { - return; - } - return msecs === otherTimeSpan.totalMilliseconds(); - }; - - // Getters - this.totalMilliseconds = function (roundDown) { - var result = msecs; - if (roundDown === true) { - result = Math.floor(result); - } - return result; - }; - this.totalSeconds = function (roundDown) { - var result = msecs / msecPerSecond; - if (roundDown === true) { - result = Math.floor(result); - } - return result; - }; - this.totalMinutes = function (roundDown) { - var result = msecs / msecPerMinute; - if (roundDown === true) { - result = Math.floor(result); - } - return result; - }; - this.totalHours = function (roundDown) { - var result = msecs / msecPerHour; - if (roundDown === true) { - result = Math.floor(result); - } - return result; - }; - this.totalDays = function (roundDown) { - var result = msecs / msecPerDay; - if (roundDown === true) { - result = Math.floor(result); - } - return result; - }; - // Return a Fraction of the TimeSpan - this.milliseconds = function () { - return msecs % 1000; - }; - this.seconds = function () { - return Math.floor(msecs / msecPerSecond) % 60; - }; - this.minutes = function () { - return Math.floor(msecs / msecPerMinute) % 60; - }; - this.hours = function () { - return Math.floor(msecs / msecPerHour) % 24; - }; - this.days = function () { - return Math.floor(msecs / msecPerDay); - }; - - // Misc. Functions - this.getVersion = function () { - return version; - }; - }; - - // "Static Constructors" - TimeSpan.FromSeconds = function (seconds) { - return new TimeSpan(0, seconds, 0, 0, 0); - }; - TimeSpan.FromMinutes = function (minutes) { - return new TimeSpan(0, 0, minutes, 0, 0); - }; - TimeSpan.FromHours = function (hours) { - return new TimeSpan(0, 0, 0, hours, 0); - }; - TimeSpan.FromDays = function (days) { - return new TimeSpan(0, 0, 0, 0, days); - }; - TimeSpan.FromDates = function (firstDate, secondDate, forcePositive) { - var differenceMsecs = secondDate.valueOf() - firstDate.valueOf(); - if(forcePositive === true) { - differenceMsecs = Math.abs(differenceMsecs); - } - return new TimeSpan(differenceMsecs, 0, 0, 0, 0); - }; -}()); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/browser/TimeSpan-1.2.min.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/browser/TimeSpan-1.2.min.js deleted file mode 100644 index 0326cbb..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/browser/TimeSpan-1.2.min.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(function(){var a=window.TimeSpan=function(g,i,h,j,k){var l="1.2",d=1e3,c=6e4,e=3.6e6,f=8.64e7,a=0,b=function(a){return !isNaN(parseFloat(a))&&isFinite(a)};if(b(k))a+=k*f;if(b(j))a+=j*e;if(b(h))a+=h*c;if(b(i))a+=i*d;if(b(g))a+=g;this.addMilliseconds=function(c){if(!b(c))return;a+=c};this.addSeconds=function(c){if(!b(c))return;a+=c*d};this.addMinutes=function(d){if(!b(d))return;a+=d*c};this.addHours=function(c){if(!b(c))return;a+=c*e};this.addDays=function(c){if(!b(c))return;a+=c*f};this.subtractMilliseconds=function(c){if(!b(c))return;a-=c};this.subtractSeconds=function(c){if(!b(c))return;a-=c*d};this.subtractMinutes=function(d){if(!b(d))return;a-=d*c};this.subtractHours=function(c){if(!b(c))return;a-=c*e};this.subtractDays=function(c){if(!b(c))return;a-=c*f};this.isTimeSpan=true;this.add=function(b){if(!b.isTimeSpan)return;a+=b.totalMilliseconds()};this.subtract=function(b){if(!b.isTimeSpan)return;a-=b.totalMilliseconds()};this.equals=function(b){if(!b.isTimeSpan)return;return a===b.totalMilliseconds()};this.totalMilliseconds=function(c){var b=a;if(c===true)b=Math.floor(b);return b};this.totalSeconds=function(c){var b=a/d;if(c===true)b=Math.floor(b);return b};this.totalMinutes=function(d){var b=a/c;if(d===true)b=Math.floor(b);return b};this.totalHours=function(c){var b=a/e;if(c===true)b=Math.floor(b);return b};this.totalDays=function(c){var b=a/f;if(c===true)b=Math.floor(b);return b};this.milliseconds=function(){return a%1e3};this.seconds=function(){return Math.floor(a/d)%60};this.minutes=function(){return Math.floor(a/c)%60};this.hours=function(){return Math.floor(a/e)%24};this.days=function(){return Math.floor(a/f)};this.getVersion=function(){return l}};a.FromSeconds=function(b){return new a(0,b,0,0,0)};a.FromMinutes=function(b){return new a(0,0,b,0,0)};a.FromHours=function(b){return new a(0,0,0,b,0)};a.FromDays=function(b){return new a(0,0,0,0,b)};a.FromDates=function(e,d,c){var b=d.valueOf()-e.valueOf();if(c===true)b=Math.abs(b);return new a(b,0,0,0,0)}})() \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/docs/docco.css b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/docs/docco.css deleted file mode 100644 index bd54134..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/docs/docco.css +++ /dev/null @@ -1,194 +0,0 @@ -/*--------------------- Layout and Typography ----------------------------*/ -body { - font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; - font-size: 15px; - line-height: 22px; - color: #252519; - margin: 0; padding: 0; -} -a { - color: #261a3b; -} - a:visited { - color: #261a3b; - } -p { - margin: 0 0 15px 0; -} -h4, h5, h6 { - color: #333; - margin: 6px 0 6px 0; - font-size: 13px; -} - h2, h3 { - margin-bottom: 0; - color: #000; - } - h1 { - margin-top: 40px; - margin-bottom: 15px; - color: #000; - } -#container { - position: relative; -} -#background { - position: fixed; - top: 0; left: 525px; right: 0; bottom: 0; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - z-index: -1; -} -#jump_to, #jump_page { - background: white; - -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; - -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; - font: 10px Arial; - text-transform: uppercase; - cursor: pointer; - text-align: right; -} -#jump_to, #jump_wrapper { - position: fixed; - right: 0; top: 0; - padding: 5px 10px; -} - #jump_wrapper { - padding: 0; - display: none; - } - #jump_to:hover #jump_wrapper { - display: block; - } - #jump_page { - padding: 5px 0 3px; - margin: 0 0 25px 25px; - } - #jump_page .source { - display: block; - padding: 5px 10px; - text-decoration: none; - border-top: 1px solid #eee; - } - #jump_page .source:hover { - background: #f5f5ff; - } - #jump_page .source:first-child { - } -table td { - border: 0; - outline: 0; -} - td.docs, th.docs { - max-width: 450px; - min-width: 450px; - min-height: 5px; - padding: 10px 25px 1px 50px; - overflow-x: hidden; - vertical-align: top; - text-align: left; - } - .docs pre { - margin: 15px 0 15px; - padding-left: 15px; - } - .docs p tt, .docs p code { - background: #f8f8ff; - border: 1px solid #dedede; - font-size: 12px; - padding: 0 0.2em; - } - .pilwrap { - position: relative; - } - .pilcrow { - font: 12px Arial; - text-decoration: none; - color: #454545; - position: absolute; - top: 3px; left: -20px; - padding: 1px 2px; - opacity: 0; - -webkit-transition: opacity 0.2s linear; - } - td.docs:hover .pilcrow { - opacity: 1; - } - td.code, th.code { - padding: 14px 15px 16px 25px; - width: 100%; - vertical-align: top; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - } - pre, tt, code { - font-size: 12px; line-height: 18px; - font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; - margin: 0; padding: 0; - } - - -/*---------------------- Syntax Highlighting -----------------------------*/ -td.linenos { background-color: #f0f0f0; padding-right: 10px; } -span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } -body .hll { background-color: #ffffcc } -body .c { color: #408080; font-style: italic } /* Comment */ -body .err { border: 1px solid #FF0000 } /* Error */ -body .k { color: #954121 } /* Keyword */ -body .o { color: #666666 } /* Operator */ -body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ -body .cp { color: #BC7A00 } /* Comment.Preproc */ -body .c1 { color: #408080; font-style: italic } /* Comment.Single */ -body .cs { color: #408080; font-style: italic } /* Comment.Special */ -body .gd { color: #A00000 } /* Generic.Deleted */ -body .ge { font-style: italic } /* Generic.Emph */ -body .gr { color: #FF0000 } /* Generic.Error */ -body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -body .gi { color: #00A000 } /* Generic.Inserted */ -body .go { color: #808080 } /* Generic.Output */ -body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -body .gs { font-weight: bold } /* Generic.Strong */ -body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -body .gt { color: #0040D0 } /* Generic.Traceback */ -body .kc { color: #954121 } /* Keyword.Constant */ -body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ -body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ -body .kp { color: #954121 } /* Keyword.Pseudo */ -body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ -body .kt { color: #B00040 } /* Keyword.Type */ -body .m { color: #666666 } /* Literal.Number */ -body .s { color: #219161 } /* Literal.String */ -body .na { color: #7D9029 } /* Name.Attribute */ -body .nb { color: #954121 } /* Name.Builtin */ -body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ -body .no { color: #880000 } /* Name.Constant */ -body .nd { color: #AA22FF } /* Name.Decorator */ -body .ni { color: #999999; font-weight: bold } /* Name.Entity */ -body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -body .nf { color: #0000FF } /* Name.Function */ -body .nl { color: #A0A000 } /* Name.Label */ -body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -body .nt { color: #954121; font-weight: bold } /* Name.Tag */ -body .nv { color: #19469D } /* Name.Variable */ -body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -body .w { color: #bbbbbb } /* Text.Whitespace */ -body .mf { color: #666666 } /* Literal.Number.Float */ -body .mh { color: #666666 } /* Literal.Number.Hex */ -body .mi { color: #666666 } /* Literal.Number.Integer */ -body .mo { color: #666666 } /* Literal.Number.Oct */ -body .sb { color: #219161 } /* Literal.String.Backtick */ -body .sc { color: #219161 } /* Literal.String.Char */ -body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ -body .s2 { color: #219161 } /* Literal.String.Double */ -body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -body .sh { color: #219161 } /* Literal.String.Heredoc */ -body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -body .sx { color: #954121 } /* Literal.String.Other */ -body .sr { color: #BB6688 } /* Literal.String.Regex */ -body .s1 { color: #219161 } /* Literal.String.Single */ -body .ss { color: #19469D } /* Literal.String.Symbol */ -body .bp { color: #954121 } /* Name.Builtin.Pseudo */ -body .vc { color: #19469D } /* Name.Variable.Class */ -body .vg { color: #19469D } /* Name.Variable.Global */ -body .vi { color: #19469D } /* Name.Variable.Instance */ -body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/docs/time-span.html b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/docs/time-span.html deleted file mode 100644 index 9eb2cc9..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/docs/time-span.html +++ /dev/null @@ -1,692 +0,0 @@ - time-span.js

      time-span.js

      /*
      -* JavaScript TimeSpan Library
      -*
      -* Copyright (c) 2010 Michael Stum, Charlie Robbins
      -* 
      -* Permission is hereby granted, free of charge, to any person obtaining
      -* a copy of this software and associated documentation files (the
      -* "Software"), to deal in the Software without restriction, including
      -* without limitation the rights to use, copy, modify, merge, publish,
      -* distribute, sublicense, and/or sell copies of the Software, and to
      -* permit persons to whom the Software is furnished to do so, subject to
      -* the following conditions:
      -* 
      -* The above copyright notice and this permission notice shall be
      -* included in all copies or substantial portions of the Software.
      -* 
      -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
      -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
      -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
      -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
      -* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
      -* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
      -* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
      -*/

      Time constants

      var msecPerSecond = 1000,
      -    msecPerMinute = 60000,
      -    msecPerHour = 3600000,
      -    msecPerDay = 86400000;

      Timespan Parsers

      var timeSpanWithDays = /^(\d+):(\d+):(\d+):(\d+)(\.\d+)?/,
      -    timeSpanNoDays = /^(\d+):(\d+):(\d+)(\.\d+)?/;

      function TimeSpan (milliseconds, seconds, minutes, hours, days)

      - -

      @milliseconds {Number} Number of milliseconds for this instance.

      - -

      @seconds {Number} Number of seconds for this instance.

      - -

      @minutes {Number} Number of minutes for this instance.

      - -

      @hours {Number} Number of hours for this instance.

      - -

      @days {Number} Number of days for this instance.

      - -

      Constructor function for the TimeSpan object which represents a length -of positive or negative milliseconds componentized into milliseconds, -seconds, hours, and days.

      var TimeSpan = exports.TimeSpan = function (milliseconds, seconds, minutes, hours, days) {
      -  this.msecs = 0;
      -  
      -  if (isNumeric(days)) {
      -    this.msecs += (days * msecPerDay);
      -  }
      -  
      -  if (isNumeric(hours)) {
      -    this.msecs += (hours * msecPerHour);
      -  }
      -  
      -  if (isNumeric(minutes)) {
      -    this.msecs += (minutes * msecPerMinute);
      -  }
      -  
      -  if (isNumeric(seconds)) {
      -    this.msecs += (seconds * msecPerSecond);
      -  }
      -  
      -  if (isNumeric(milliseconds)) {
      -    this.msecs += milliseconds;
      -  }
      -};

      Factory methods

      - -

      Helper methods for creating new TimeSpan objects -from various criteria: milliseconds, seconds, minutes, -hours, days, strings and other TimeSpan instances.

      function fromMilliseconds (milliseconds)

      - -

      @milliseconds {Number} Amount of milliseconds for the new TimeSpan instance.

      - -

      Creates a new TimeSpan instance with the specified milliseconds.

      exports.fromMilliseconds = function (milliseconds) {
      -  if (!isNumeric(milliseconds)) {
      -    return;
      -  }
      -  
      -  return new TimeSpan(milliseconds, 0, 0, 0, 0);
      -}

      function fromSeconds (seconds)

      - -

      @milliseconds {Number} Amount of seconds for the new TimeSpan instance.

      - -

      Creates a new TimeSpan instance with the specified seconds.

      exports.fromSeconds = function (seconds) {
      -  if (!isNumeric(seconds)) {
      -    return;
      -  }
      -  
      -  return new TimeSpan(0, seconds, 0, 0, 0);
      -};

      function fromMinutes (milliseconds)

      - -

      @milliseconds {Number} Amount of minutes for the new TimeSpan instance.

      - -

      Creates a new TimeSpan instance with the specified minutes.

      exports.fromMinutes = function (minutes) {
      -  if (!isNumeric(minutes)) {
      -    return;
      -  }
      -  
      -  return new TimeSpan(0, 0, minutes, 0, 0);
      -};

      function fromHours (hours)

      - -

      @milliseconds {Number} Amount of hours for the new TimeSpan instance.

      - -

      Creates a new TimeSpan instance with the specified hours.

      exports.fromHours = function (hours) {
      -  if (!isNumeric(hours)) {
      -    return;
      -  }
      -  
      -  return new TimeSpan(0, 0, 0, hours, 0);
      -};

      function fromDays (days)

      - -

      @milliseconds {Number} Amount of days for the new TimeSpan instance.

      - -

      Creates a new TimeSpan instance with the specified days.

      exports.fromDays = function (days) {
      -  if (!isNumeric(days)) {
      -    return;
      -  }
      -  
      -  return new TimeSpan(0, 0, 0, 0, days);
      -};

      function parse (str)

      - -

      @str {string} Timespan string to parse.

      - -

      Creates a new TimeSpan instance from the specified -string, str.

      exports.parse = function (str) {
      -  var match, milliseconds;
      -  
      -  function parseMilliseconds (value) {
      -    return value ? parseFloat('0' + value) * 1000 : 0;
      -  }
      -  

      If we match against a full TimeSpan:

        if ((match = str.match(timeSpanWithDays))) {
      -    return new TimeSpan(parseMilliseconds(match[5]), match[4], match[3], match[2], match[1]);
      -  }
      -  

      If we match against a partial TimeSpan:

        if ((match = str.match(timeSpanNoDays))) {
      -    return new TimeSpan(parseMilliseconds(match[4]), match[3], match[2], match[1], 0);
      -  }
      -  
      -  return null;
      -};
      -
      -var months  = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

      List of default singular time modifiers and associated -computation algoritm. Assumes in order, smallest to greatest -performing carry forward additiona / subtraction for each -Date-Time component.

      var parsers = {
      -  'milliseconds': {
      -    exp: /(\d+)milli[second]?[s]?/i,
      -    get: function (date) { return date.getMilliseconds(date) },
      -    set: function (val, date) { date.setMilliseconds(val) },
      -    compute: function (delta, date, computed) {
      -      var round = delta > 0 ? Math.floor : Math.ceil;
      -      if (delta) {
      -        computed.seconds += round.call(null, delta / 1000);
      -        computed.milliseconds += delta % 1000;
      -      }
      -      
      -      if (Math.abs(computed.milliseconds) >= 1000) {
      -        computed.seconds += round.call(null, computed.milliseconds / 1000)
      -        computed.milliseconds = computed.milliseconds % 1000;
      -      }
      -
      -      return computed;
      -    }
      -  },
      -  'seconds': {
      -    exp: /(\d+)second[s]?/i,
      -    get: function (date) { return date.getSeconds(date) },
      -    set: function (val, date) { date.setSeconds(val) },
      -    compute: function (delta, date, computed) {
      -      var round = delta > 0 ? Math.floor : Math.ceil;
      -      if (delta) {
      -        computed.minutes += round.call(null, delta / 60);
      -        computed.seconds += delta % 60;
      -      }
      -      
      -      if (Math.abs(computed.seconds) >= 60) {
      -        computed.minutes += round.call(null, computed.seconds / 60);
      -        computed.seconds = computed.seconds % 60; 
      -      }
      -      
      -      return computed;
      -    }
      -  },
      -  'minutes': {
      -    exp: /(\d+)minute[s]?/i,
      -    get: function (date) { return date.getMinutes(date) },
      -    set: function (val, date) { date.setMinutes(val) },
      -    compute: function (delta, date, computed) {
      -      var round = delta > 0 ? Math.floor : Math.ceil;
      -      if (delta) { 
      -        computed.hours += round.call(null, delta / 60);
      -        computed.minutes += delta % 60;
      -      }
      -      
      -      if (Math.abs(computed.minutes) >= 60) {
      -        computed.hours += round.call(null, computed.minutes / 60);
      -        computed.minutes = computed.minutes % 60; 
      -      }
      -      
      -      return computed;
      -    }
      -  },
      -  'hours': {
      -    exp: /(\d+)hour[s]?/i,
      -    get: function (date) { return date.getHours(date) },
      -    set: function (val, date) { date.setHours(val) },
      -    compute: function (delta, date, computed) {
      -      var round = delta > 0 ? Math.floor : Math.ceil;
      -      if (delta) { 
      -        computed.days += round.call(null, delta / 24);
      -        computed.hours += delta % 24;
      -      }
      -      
      -      if (Math.abs(computed.hours) >= 24) {
      -        computed.days += round.call(null, computed.hours / 24);
      -        computed.hours = computed.hours % 24;
      -      }
      -      
      -      return computed;
      -    }
      -  },
      -  'days': {
      -    exp: /(\d+)day[s]?/i,
      -    get: function (date) { return date.getDate(date) },
      -    set: function (val, date) { date.setDate(val) },
      -    compute: function (delta, date, computed) {
      -      var sign     = delta >= 0 ? 1 : -1,
      -          opsign   = delta >= 0 ? -1 : 1,
      -          clean    = 0,
      -          original = delta,
      -          month    = computed.months,
      -          days     = months[month];
      -      
      -      if (delta) {          
      -        while (Math.abs(delta) >= days) {
      -          month += sign * 1;
      -          computed.months += sign * 1;
      -          delta += opsign * days;
      -        
      -          if (month < 0) { month = 11 }
      -          else if (month > 11) { month = 0 }
      -        
      -          days = months[month];
      -        }
      -      
      -        computed.days += (sign * delta);
      -      }
      -      
      -      if (computed.days < 0) {
      -        clean = -1;
      -      }
      -      else if (computed.days > months[computed.months]) {
      -        clean = 1;
      -      }
      -      
      -      if (clean !== 0) {
      -        computed.months += clean;
      -        if (computed.months < 0) { computed.months = 11 }
      -        else if (computed.months > 11) { computed.months = 0 }
      -        computed.days = months[computed.months] + computed.days;
      -      }
      -            
      -      return computed;
      -    }
      -  },
      -  'months': {
      -    exp: /(\d+)month[s]?/i,
      -    get: function (date) { return date.getMonth(date) },
      -    set: function (val, date) { date.setMonth(val) },
      -    compute: function (delta, date, computed) {
      -      var round = delta > 0 ? Math.floor : Math.ceil;
      -      if (delta) { 
      -        computed.years += round.call(null, delta / 12);
      -        computed.months += delta % 12;
      -      }
      -      
      -      if (computed.months > 11) {
      -        computed.years += Math.floor((computed.months + 1) / 12);
      -        computed.months = ((computed.months + 1) % 12) - 1;
      -      }
      -      
      -      return computed;
      -    }
      -  },
      -  'years': {
      -    exp: /(\d+)year[s]?/i,
      -    get: function (date) { return date.getFullYear(date) },
      -    set: function (val, date) { date.setFullYear(val) },
      -    compute: function (delta, date, computed) {
      -      if (delta) { 
      -        computed.years += delta;
      -      }
      -      
      -      return computed;
      -    }
      -  }
      -};

      Compute the list of parser names for -later use.

      var parserNames = Object.keys(parsers);

      function parseDate (str)

      - -

      @str {string} String to parse into a date

      - -

      Parses the specified liberal Date-Time string according to -ISO8601 and:

      - -
        -
      1. 2010-04-03T12:34:15Z+12MINUTES
      2. -
      3. NOW-4HOURS
      4. -
      - -

      Valid modifiers for the more liberal Date-Time string(s):

      - -
      YEAR, YEARS
      -MONTH, MONTHS
      -DAY, DAYS
      -HOUR, HOURS
      -MINUTE, MINUTES
      -SECOND, SECONDS
      -MILLI, MILLIS, MILLISECOND, MILLISECONDS
      -
      exports.parseDate = function (str) {
      -  var simple = Date.parse(str),
      -      iso = '^([^Z]+)',
      -      zulu = 'Z([\\+|\\-])?',
      -      diff = {},
      -      base,
      -      sign,
      -      complex,
      -      inspect,
      -      dateTime,
      -      modifiers;
      -
      -  if (/now/i.test(str)) {
      -    iso = '^(NOW)';
      -    zulu = zulu.replace(/Z/, 'NOW');
      -  }

      If Date string supplied actually conforms -to UTC Time (ISO8601), return a new Date.

        if (!isNaN(simple)) {
      -    return new Date(simple);
      -  }
      -  

      Create the RegExp for the end component -of the target str to parse.

        parserNames.forEach(function (group) {
      -    zulu += '(\\d+[a-zA-Z]+)?';
      -  });
      -  

      Parse the ISO8601 component, and the end -component from the target str.

        dateTime = str.match(new RegExp(iso, 'i'));
      -  modifiers = str.match(new RegExp(zulu, 'i'));
      -  

      If there was no match on either part then -it must be a bad value.

        if (!dateTime || !modifiers) {
      -    return null;
      -  }
      -    

      Create a new Date object from the ISO8601 -component of the target str.

        base = /now/i.test(dateTime[1]) ? Date.now() : Date.parse(dateTime[1]);
      -  complex = new Date(base);
      -  sign = modifiers[1] === '+' ? 1 : -1;
      -  

      Parse the individual component spans (months, years, etc) -from the modifier strings that we parsed from the end -of the target str.

        modifiers.slice(2).filter(Boolean).forEach(function (modifier) {
      -    parserNames.forEach(function (name) {
      -      var match;
      -      if (!(match = modifier.match(parsers[name].exp))) {
      -        return;
      -      }
      -      
      -      diff[name] = sign * parseInt(match[1], 10);
      -    })
      -  });
      -  

      Compute the total diff by iteratively computing -the partial components from smallest to largest.

        var computed = {
      -    milliseconds: complex.getMilliseconds(),
      -    seconds: complex.getSeconds(),
      -    minutes: complex.getMinutes(),
      -    hours: complex.getHours(),
      -    days: complex.getDate(),
      -    months: complex.getMonth(),
      -    years: complex.getFullYear()
      -  };
      -  
      -  parserNames.forEach(function (name) {    
      -    computed = parsers[name].compute(diff[name], complex, computed);
      -  });
      -  
      -  return new Date(
      -    Date.UTC(
      -      computed.years,
      -      computed.months,
      -      computed.days,
      -      computed.hours,
      -      computed.minutes,
      -      computed.seconds,
      -      computed.milliseconds
      -    )
      -  );
      -};

      function fromDates (start, end, abs)

      - -

      @start {Date} Start date of the TimeSpan instance to return

      - -

      @end {Date} End date of the TimeSpan instance to return

      - -

      @abs {boolean} Value indicating to return an absolute value

      - -

      Returns a new TimeSpan instance representing the difference between -the start and end Dates.

      exports.fromDates = function (start, end, abs) {
      -  if (!start instanceof Date) {
      -    start = exports.parseDate(start);
      -  }
      -  
      -  if (!end instanceof Date) {
      -    end = exports.parseDate(end);
      -  }
      -  
      -  var differenceMsecs = end.valueOf() - start.valueOf();
      -  if (abs) {
      -    differenceMsecs = Math.abs(differenceMsecs);
      -  }
      -
      -  return new TimeSpan(differenceMsecs, 0, 0, 0, 0);
      -};

      Module Helpers

      - -

      Module-level helpers for various utilities such as: -instanceOf, parsability, and cloning.

      function test (str)

      - -

      @str {string} String value to test if it is a TimeSpan

      - -

      Returns a value indicating if the specified string, str, -is a parsable TimeSpan value.

      exports.test = function (str) {
      -  return timeSpanWithDays.test(str) || timeSpanNoDays.test(str);
      -};

      function instanceOf (timeSpan)

      - -

      @timeSpan {Object} Object to check TimeSpan quality.

      - -

      Returns a value indicating if the specified timeSpan is -in fact a TimeSpan instance.

      exports.instanceOf = function (timeSpan) {
      -  return timeSpan instanceof TimeSpan;
      -};

      function clone (timeSpan)

      - -

      @timeSpan {TimeSpan} TimeSpan object to clone.

      - -

      Returns a new TimeSpan instance with the same value -as the timeSpan object supplied.

      exports.clone = function (timeSpan) {
      -  if (!(timeSpan instanceof TimeSpan)) {
      -    return;
      -  }
      -  
      -  return exports.fromMilliseconds(timeSpan.totalMilliseconds());
      -};

      Addition

      - -

      Methods for adding TimeSpan instances, -milliseconds, seconds, hours, and days to other -TimeSpan instances.

      function add (timeSpan)

      - -

      @timeSpan {TimeSpan} TimeSpan to add to this instance

      - -

      Adds the specified timeSpan to this instance.

      TimeSpan.prototype.add = function (timeSpan) {
      -  if (!(timeSpan instanceof TimeSpan)) {
      -    return;
      -  }
      -  
      -  this.msecs += timeSpan.totalMilliseconds();
      -};

      function addMilliseconds (milliseconds)

      - -

      @milliseconds {Number} Number of milliseconds to add.

      - -

      Adds the specified milliseconds to this instance.

      TimeSpan.prototype.addMilliseconds = function (milliseconds) {
      -  if (!isNumeric(milliseconds)) {
      -    return;
      -  }
      -  
      -  this.msecs += milliseconds;
      -};

      function addSeconds (seconds)

      - -

      @seconds {Number} Number of seconds to add.

      - -

      Adds the specified seconds to this instance.

      TimeSpan.prototype.addSeconds = function (seconds) {
      -  if (!isNumeric(seconds)) {
      -    return;
      -  }
      -  
      -  this.msecs += (seconds * msecPerSecond);
      -};

      function addMinutes (minutes)

      - -

      @minutes {Number} Number of minutes to add.

      - -

      Adds the specified minutes to this instance.

      TimeSpan.prototype.addMinutes = function (minutes) {
      -  if (!isNumeric(minutes)) {
      -    return;
      -  }
      -  
      -  this.msecs += (minutes * msecPerMinute);
      -};

      function addHours (hours)

      - -

      @hours {Number} Number of hours to add.

      - -

      Adds the specified hours to this instance.

      TimeSpan.prototype.addHours = function (hours) {
      -  if (!isNumeric(hours)) {
      -    return;
      -  }
      -  
      -  this.msecs += (hours * msecPerHour);
      -};

      function addDays (days)

      - -

      @days {Number} Number of days to add.

      - -

      Adds the specified days to this instance.

      TimeSpan.prototype.addDays = function (days) {
      -  if (!isNumeric(days)) {
      -    return;
      -  }
      -  
      -  this.msecs += (days * msecPerDay);
      -};

      Subtraction

      - -

      Methods for subtracting TimeSpan instances, -milliseconds, seconds, hours, and days from other -TimeSpan instances.

      function subtract (timeSpan)

      - -

      @timeSpan {TimeSpan} TimeSpan to subtract from this instance.

      - -

      Subtracts the specified timeSpan from this instance.

      TimeSpan.prototype.subtract = function (timeSpan) {
      -  if (!(timeSpan instanceof TimeSpan)) {
      -    return;
      -  }
      -  
      -  this.msecs -= timeSpan.totalMilliseconds();
      -};

      function subtractMilliseconds (milliseconds)

      - -

      @milliseconds {Number} Number of milliseconds to subtract.

      - -

      Subtracts the specified milliseconds from this instance.

      TimeSpan.prototype.subtractMilliseconds = function (milliseconds) {
      -  if (!isNumeric(milliseconds)) {
      -    return;
      -  }
      -  
      -  this.msecs -= milliseconds;
      -};

      function subtractSeconds (seconds)

      - -

      @seconds {Number} Number of seconds to subtract.

      - -

      Subtracts the specified seconds from this instance.

      TimeSpan.prototype.subtractSeconds = function (seconds) {
      -  if (!isNumeric(seconds)) {
      -    return;
      -  }
      -  
      -  this.msecs -= (seconds * msecPerSecond);
      -};

      function subtractMinutes (minutes)

      - -

      @minutes {Number} Number of minutes to subtract.

      - -

      Subtracts the specified minutes from this instance.

      TimeSpan.prototype.subtractMinutes = function (minutes) {
      -  if (!isNumeric(minutes)) {
      -    return;
      -  }
      -  
      -  this.msecs -= (minutes * msecPerMinute);
      -};

      function subtractHours (hours)

      - -

      @hours {Number} Number of hours to subtract.

      - -

      Subtracts the specified hours from this instance.

      TimeSpan.prototype.subtractHours = function (hours) {
      -  if (!isNumeric(hours)) {
      -    return;
      -  }
      -  
      -  this.msecs -= (hours * msecPerHour);
      -};

      function subtractDays (days)

      - -

      @days {Number} Number of days to subtract.

      - -

      Subtracts the specified days from this instance.

      TimeSpan.prototype.subtractDays = function (days) {
      -  if (!isNumeric(days)) {
      -    return;
      -  }
      -  
      -  this.msecs -= (days * msecPerDay);
      -};

      Getters

      - -

      Methods for retrieving components of a TimeSpan -instance: milliseconds, seconds, minutes, hours, and days.

      function totalMilliseconds (roundDown)

      - -

      @roundDown {boolean} Value indicating if the value should be rounded down.

      - -

      Returns the total number of milliseconds for this instance, rounding down -to the nearest integer if roundDown is set.

      TimeSpan.prototype.totalMilliseconds = function (roundDown) {
      -  var result = this.msecs;
      -  if (roundDown === true) {
      -    result = Math.floor(result);
      -  }
      -  
      -  return result;
      -};

      function totalSeconds (roundDown)

      - -

      @roundDown {boolean} Value indicating if the value should be rounded down.

      - -

      Returns the total number of seconds for this instance, rounding down -to the nearest integer if roundDown is set.

      TimeSpan.prototype.totalSeconds = function (roundDown) {
      -  var result = this.msecs / msecPerSecond;
      -  if (roundDown === true) {
      -    result = Math.floor(result);
      -  }
      -  
      -  return result;
      -};

      function totalMinutes (roundDown)

      - -

      @roundDown {boolean} Value indicating if the value should be rounded down.

      - -

      Returns the total number of minutes for this instance, rounding down -to the nearest integer if roundDown is set.

      TimeSpan.prototype.totalMinutes = function (roundDown) {
      -  var result = this.msecs / msecPerMinute;
      -  if (roundDown === true) {
      -    result = Math.floor(result);
      -  }
      -  
      -  return result;
      -};

      function totalHours (roundDown)

      - -

      @roundDown {boolean} Value indicating if the value should be rounded down.

      - -

      Returns the total number of hours for this instance, rounding down -to the nearest integer if roundDown is set.

      TimeSpan.prototype.totalHours = function (roundDown) {
      -  var result = this.msecs / msecPerHour;
      -  if (roundDown === true) {
      -    result = Math.floor(result);
      -  }
      -  
      -  return result;
      -};

      function totalDays (roundDown)

      - -

      @roundDown {boolean} Value indicating if the value should be rounded down.

      - -

      Returns the total number of days for this instance, rounding down -to the nearest integer if roundDown is set.

      TimeSpan.prototype.totalDays = function (roundDown) {
      -  var result = this.msecs / msecPerDay;
      -  if (roundDown === true) {
      -    result = Math.floor(result);
      -  }
      -  
      -  return result;
      -};

      @milliseconds

      - -

      Returns the length of this TimeSpan instance in milliseconds.

      TimeSpan.prototype.__defineGetter__('milliseconds', function () {
      -  return this.msecs % 1000;
      -});

      @seconds

      - -

      Returns the length of this TimeSpan instance in seconds.

      TimeSpan.prototype.__defineGetter__('seconds', function () {
      -  return Math.floor(this.msecs / msecPerSecond) % 60;
      -});

      @minutes

      - -

      Returns the length of this TimeSpan instance in minutes.

      TimeSpan.prototype.__defineGetter__('minutes', function () {
      -  return Math.floor(this.msecs / msecPerMinute) % 60;
      -});

      @hours

      - -

      Returns the length of this TimeSpan instance in hours.

      TimeSpan.prototype.__defineGetter__('hours', function () {
      -  return Math.floor(this.msecs / msecPerHour) % 24;
      -});

      @days

      - -

      Returns the length of this TimeSpan instance in days.

      TimeSpan.prototype.__defineGetter__('days', function () {
      -  return Math.floor(this.msecs / msecPerDay);
      -});

      Instance Helpers

      - -

      Various help methods for performing utilities -such as equality and serialization

      function equals (timeSpan)

      - -

      @timeSpan {TimeSpan} TimeSpan instance to assert equal

      - -

      Returns a value indicating if the specified timeSpan is equal -in milliseconds to this instance.

      TimeSpan.prototype.equals = function (timeSpan) {
      -  if (!(timeSpan instanceof TimeSpan)) {
      -    return;
      -  }
      -  
      -  return this.msecs === timeSpan.totalMilliseconds();
      -};

      function toString ()

      - -

      Returns a string representation of this TimeSpan -instance according to current format.

      TimeSpan.prototype.toString = function () {
      -  if (!this.format) {
      -    return this._format();
      -  };
      -  
      -  return this.format(this);
      -};

      @private function _format ()

      - -

      Returns the default string representation of this instance.

      TimeSpan.prototype._format = function () {
      -  return [
      -    this.days,
      -    this.hours,
      -    this.minutes,
      -    this.seconds + '.' + this.milliseconds
      -  ].join(':')
      -};

      @private function isNumeric (input)

      - -

      @input {Number} Value to check numeric quality of.

      - -

      Returns a value indicating the numeric quality of the -specified input.

      function isNumeric (input) {
      -  return input && !isNaN(parseFloat(input)) && isFinite(input);
      -};
      -
      -
      \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/lib/time-span.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/lib/time-span.js deleted file mode 100644 index 23a9cc8..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/lib/time-span.js +++ /dev/null @@ -1,827 +0,0 @@ -/* -* JavaScript TimeSpan Library -* -* Copyright (c) 2010 Michael Stum, Charlie Robbins -* -* Permission is hereby granted, free of charge, to any person obtaining -* a copy of this software and associated documentation files (the -* "Software"), to deal in the Software without restriction, including -* without limitation the rights to use, copy, modify, merge, publish, -* distribute, sublicense, and/or sell copies of the Software, and to -* permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice shall be -* included in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -// -// ### Time constants -// -var msecPerSecond = 1000, - msecPerMinute = 60000, - msecPerHour = 3600000, - msecPerDay = 86400000; - -// -// ### Timespan Parsers -// -var timeSpanWithDays = /^(\d+):(\d+):(\d+):(\d+)(\.\d+)?/, - timeSpanNoDays = /^(\d+):(\d+):(\d+)(\.\d+)?/; - -// -// ### function TimeSpan (milliseconds, seconds, minutes, hours, days) -// #### @milliseconds {Number} Number of milliseconds for this instance. -// #### @seconds {Number} Number of seconds for this instance. -// #### @minutes {Number} Number of minutes for this instance. -// #### @hours {Number} Number of hours for this instance. -// #### @days {Number} Number of days for this instance. -// Constructor function for the `TimeSpan` object which represents a length -// of positive or negative milliseconds componentized into milliseconds, -// seconds, hours, and days. -// -var TimeSpan = exports.TimeSpan = function (milliseconds, seconds, minutes, hours, days) { - this.msecs = 0; - - if (isNumeric(days)) { - this.msecs += (days * msecPerDay); - } - - if (isNumeric(hours)) { - this.msecs += (hours * msecPerHour); - } - - if (isNumeric(minutes)) { - this.msecs += (minutes * msecPerMinute); - } - - if (isNumeric(seconds)) { - this.msecs += (seconds * msecPerSecond); - } - - if (isNumeric(milliseconds)) { - this.msecs += milliseconds; - } -}; - -// -// ## Factory methods -// Helper methods for creating new TimeSpan objects -// from various criteria: milliseconds, seconds, minutes, -// hours, days, strings and other `TimeSpan` instances. -// - -// -// ### function fromMilliseconds (milliseconds) -// #### @milliseconds {Number} Amount of milliseconds for the new TimeSpan instance. -// Creates a new `TimeSpan` instance with the specified `milliseconds`. -// -exports.fromMilliseconds = function (milliseconds) { - if (!isNumeric(milliseconds)) { return } - return new TimeSpan(milliseconds, 0, 0, 0, 0); -} - -// -// ### function fromSeconds (seconds) -// #### @milliseconds {Number} Amount of seconds for the new TimeSpan instance. -// Creates a new `TimeSpan` instance with the specified `seconds`. -// -exports.fromSeconds = function (seconds) { - if (!isNumeric(seconds)) { return } - return new TimeSpan(0, seconds, 0, 0, 0); -}; - -// -// ### function fromMinutes (milliseconds) -// #### @milliseconds {Number} Amount of minutes for the new TimeSpan instance. -// Creates a new `TimeSpan` instance with the specified `minutes`. -// -exports.fromMinutes = function (minutes) { - if (!isNumeric(minutes)) { return } - return new TimeSpan(0, 0, minutes, 0, 0); -}; - -// -// ### function fromHours (hours) -// #### @milliseconds {Number} Amount of hours for the new TimeSpan instance. -// Creates a new `TimeSpan` instance with the specified `hours`. -// -exports.fromHours = function (hours) { - if (!isNumeric(hours)) { return } - return new TimeSpan(0, 0, 0, hours, 0); -}; - -// -// ### function fromDays (days) -// #### @milliseconds {Number} Amount of days for the new TimeSpan instance. -// Creates a new `TimeSpan` instance with the specified `days`. -// -exports.fromDays = function (days) { - if (!isNumeric(days)) { return } - return new TimeSpan(0, 0, 0, 0, days); -}; - -// -// ### function parse (str) -// #### @str {string} Timespan string to parse. -// Creates a new `TimeSpan` instance from the specified -// string, `str`. -// -exports.parse = function (str) { - var match, milliseconds; - - function parseMilliseconds (value) { - return value ? parseFloat('0' + value) * 1000 : 0; - } - - // If we match against a full TimeSpan: - // [days]:[hours]:[minutes]:[seconds].[milliseconds]? - if ((match = str.match(timeSpanWithDays))) { - return new TimeSpan(parseMilliseconds(match[5]), match[4], match[3], match[2], match[1]); - } - - // If we match against a partial TimeSpan: - // [hours]:[minutes]:[seconds].[milliseconds]? - if ((match = str.match(timeSpanNoDays))) { - return new TimeSpan(parseMilliseconds(match[4]), match[3], match[2], match[1], 0); - } - - return null; -}; - -// -// List of default singular time modifiers and associated -// computation algoritm. Assumes in order, smallest to greatest -// performing carry forward additiona / subtraction for each -// Date-Time component. -// -var parsers = { - 'milliseconds': { - exp: /(\d+)milli(?:second)?[s]?/i, - compute: function (delta, computed) { - return _compute(delta, computed, { - current: 'milliseconds', - next: 'seconds', - max: 1000 - }); - } - }, - 'seconds': { - exp: /(\d+)second[s]?/i, - compute: function (delta, computed) { - return _compute(delta, computed, { - current: 'seconds', - next: 'minutes', - max: 60 - }); - } - }, - 'minutes': { - exp: /(\d+)minute[s]?/i, - compute: function (delta, computed) { - return _compute(delta, computed, { - current: 'minutes', - next: 'hours', - max: 60 - }); - } - }, - 'hours': { - exp: /(\d+)hour[s]?/i, - compute: function (delta, computed) { - return _compute(delta, computed, { - current: 'hours', - next: 'days', - max: 24 - }); - } - }, - 'days': { - exp: /(\d+)day[s]?/i, - compute: function (delta, computed) { - var days = monthDays(computed.months, computed.years), - sign = delta >= 0 ? 1 : -1, - opsign = delta >= 0 ? -1 : 1, - clean = 0; - - function update (months) { - if (months < 0) { - computed.years -= 1; - return 11; - } - else if (months > 11) { - computed.years += 1; - return 0 - } - - return months; - } - - if (delta) { - while (Math.abs(delta) >= days) { - computed.months += sign * 1; - computed.months = update(computed.months); - delta += opsign * days; - days = monthDays(computed.months, computed.years); - } - - computed.days += (opsign * delta); - } - - if (computed.days < 0) { clean = -1 } - else if (computed.days > months[computed.months]) { clean = 1 } - - if (clean === -1 || clean === 1) { - computed.months += clean; - computed.months = update(computed.months); - computed.days = months[computed.months] + computed.days; - } - - return computed; - } - }, - 'months': { - exp: /(\d+)month[s]?/i, - compute: function (delta, computed) { - var round = delta > 0 ? Math.floor : Math.ceil; - if (delta) { - computed.years += round.call(null, delta / 12); - computed.months += delta % 12; - } - - if (computed.months > 11) { - computed.years += Math.floor((computed.months + 1) / 12); - computed.months = ((computed.months + 1) % 12) - 1; - } - - return computed; - } - }, - 'years': { - exp: /(\d+)year[s]?/i, - compute: function (delta, computed) { - if (delta) { computed.years += delta; } - return computed; - } - } -}; - -// -// Compute the list of parser names for -// later use. -// -var parserNames = Object.keys(parsers); - -// -// ### function parseDate (str) -// #### @str {string} String to parse into a date -// Parses the specified liberal Date-Time string according to -// ISO8601 **and**: -// -// 1. `2010-04-03T12:34:15Z+12MINUTES` -// 2. `NOW-4HOURS` -// -// Valid modifiers for the more liberal Date-Time string(s): -// -// YEAR, YEARS -// MONTH, MONTHS -// DAY, DAYS -// HOUR, HOURS -// MINUTE, MINUTES -// SECOND, SECONDS -// MILLI, MILLIS, MILLISECOND, MILLISECONDS -// -exports.parseDate = function (str) { - var dateTime = Date.parse(str), - iso = '^([^Z]+)', - zulu = 'Z([\\+|\\-])?', - diff = {}, - computed, - modifiers, - sign; - - // - // If Date string supplied actually conforms - // to UTC Time (ISO8601), return a new Date. - // - if (!isNaN(dateTime)) { - return new Date(dateTime); - } - - // - // Create the `RegExp` for the end component - // of the target `str` to parse. - // - parserNames.forEach(function (group) { - zulu += '(\\d+[a-zA-Z]+)?'; - }); - - if (/^NOW/i.test(str)) { - // - // If the target `str` is a liberal `NOW-*`, - // then set the base `dateTime` appropriately. - // - dateTime = Date.now(); - zulu = zulu.replace(/Z/, 'NOW'); - } - else { - // - // Parse the `ISO8601` component, and the end - // component from the target `str`. - // - dateTime = str.match(new RegExp(iso, 'i')); - dateTime = Date.parse(dateTime[1]); - } - - // - // If there was no match on either part then - // it must be a bad value. - // - if (!dateTime || !(modifiers = str.match(new RegExp(zulu, 'i')))) { - return null; - } - - // - // Create a new `Date` object from the `ISO8601` - // component of the target `str`. - // - dateTime = new Date(dateTime); - sign = modifiers[1] === '+' ? 1 : -1; - - // - // Create an Object-literal for consistently accessing - // the various components of the computed Date. - // - var computed = { - milliseconds: dateTime.getMilliseconds(), - seconds: dateTime.getSeconds(), - minutes: dateTime.getMinutes(), - hours: dateTime.getHours(), - days: dateTime.getDate(), - months: dateTime.getMonth(), - years: dateTime.getFullYear() - }; - - // - // Parse the individual component spans (months, years, etc) - // from the modifier strings that we parsed from the end - // of the target `str`. - // - modifiers.slice(2).filter(Boolean).forEach(function (modifier) { - parserNames.forEach(function (name) { - var match; - if (!(match = modifier.match(parsers[name].exp))) { - return; - } - - diff[name] = sign * parseInt(match[1], 10); - }) - }); - - // - // Compute the total `diff` by iteratively computing - // the partial components from smallest to largest. - // - parserNames.forEach(function (name) { - computed = parsers[name].compute(diff[name], computed); - }); - - return new Date( - Date.UTC( - computed.years, - computed.months, - computed.days, - computed.hours, - computed.minutes, - computed.seconds, - computed.milliseconds - ) - ); -}; - -// -// ### function fromDates (start, end, abs) -// #### @start {Date} Start date of the `TimeSpan` instance to return -// #### @end {Date} End date of the `TimeSpan` instance to return -// #### @abs {boolean} Value indicating to return an absolute value -// Returns a new `TimeSpan` instance representing the difference between -// the `start` and `end` Dates. -// -exports.fromDates = function (start, end, abs) { - if (typeof start === 'string') { - start = exports.parseDate(start); - } - - if (typeof end === 'string') { - end = exports.parseDate(end); - } - - if (!(start instanceof Date && end instanceof Date)) { - return null; - } - - var differenceMsecs = end.valueOf() - start.valueOf(); - if (abs) { - differenceMsecs = Math.abs(differenceMsecs); - } - - return new TimeSpan(differenceMsecs, 0, 0, 0, 0); -}; - -// -// ## Module Helpers -// Module-level helpers for various utilities such as: -// instanceOf, parsability, and cloning. -// - -// -// ### function test (str) -// #### @str {string} String value to test if it is a TimeSpan -// Returns a value indicating if the specified string, `str`, -// is a parsable `TimeSpan` value. -// -exports.test = function (str) { - return timeSpanWithDays.test(str) || timeSpanNoDays.test(str); -}; - -// -// ### function instanceOf (timeSpan) -// #### @timeSpan {Object} Object to check TimeSpan quality. -// Returns a value indicating if the specified `timeSpan` is -// in fact a `TimeSpan` instance. -// -exports.instanceOf = function (timeSpan) { - return timeSpan instanceof TimeSpan; -}; - -// -// ### function clone (timeSpan) -// #### @timeSpan {TimeSpan} TimeSpan object to clone. -// Returns a new `TimeSpan` instance with the same value -// as the `timeSpan` object supplied. -// -exports.clone = function (timeSpan) { - if (!(timeSpan instanceof TimeSpan)) { return } - return exports.fromMilliseconds(timeSpan.totalMilliseconds()); -}; - -// -// ## Addition -// Methods for adding `TimeSpan` instances, -// milliseconds, seconds, hours, and days to other -// `TimeSpan` instances. -// - -// -// ### function add (timeSpan) -// #### @timeSpan {TimeSpan} TimeSpan to add to this instance -// Adds the specified `timeSpan` to this instance. -// -TimeSpan.prototype.add = function (timeSpan) { - if (!(timeSpan instanceof TimeSpan)) { return } - this.msecs += timeSpan.totalMilliseconds(); -}; - -// -// ### function addMilliseconds (milliseconds) -// #### @milliseconds {Number} Number of milliseconds to add. -// Adds the specified `milliseconds` to this instance. -// -TimeSpan.prototype.addMilliseconds = function (milliseconds) { - if (!isNumeric(milliseconds)) { return } - this.msecs += milliseconds; -}; - -// -// ### function addSeconds (seconds) -// #### @seconds {Number} Number of seconds to add. -// Adds the specified `seconds` to this instance. -// -TimeSpan.prototype.addSeconds = function (seconds) { - if (!isNumeric(seconds)) { return } - - this.msecs += (seconds * msecPerSecond); -}; - -// -// ### function addMinutes (minutes) -// #### @minutes {Number} Number of minutes to add. -// Adds the specified `minutes` to this instance. -// -TimeSpan.prototype.addMinutes = function (minutes) { - if (!isNumeric(minutes)) { return } - this.msecs += (minutes * msecPerMinute); -}; - -// -// ### function addHours (hours) -// #### @hours {Number} Number of hours to add. -// Adds the specified `hours` to this instance. -// -TimeSpan.prototype.addHours = function (hours) { - if (!isNumeric(hours)) { return } - this.msecs += (hours * msecPerHour); -}; - -// -// ### function addDays (days) -// #### @days {Number} Number of days to add. -// Adds the specified `days` to this instance. -// -TimeSpan.prototype.addDays = function (days) { - if (!isNumeric(days)) { return } - this.msecs += (days * msecPerDay); -}; - -// -// ## Subtraction -// Methods for subtracting `TimeSpan` instances, -// milliseconds, seconds, hours, and days from other -// `TimeSpan` instances. -// - -// -// ### function subtract (timeSpan) -// #### @timeSpan {TimeSpan} TimeSpan to subtract from this instance. -// Subtracts the specified `timeSpan` from this instance. -// -TimeSpan.prototype.subtract = function (timeSpan) { - if (!(timeSpan instanceof TimeSpan)) { return } - this.msecs -= timeSpan.totalMilliseconds(); -}; - -// -// ### function subtractMilliseconds (milliseconds) -// #### @milliseconds {Number} Number of milliseconds to subtract. -// Subtracts the specified `milliseconds` from this instance. -// -TimeSpan.prototype.subtractMilliseconds = function (milliseconds) { - if (!isNumeric(milliseconds)) { return } - this.msecs -= milliseconds; -}; - -// -// ### function subtractSeconds (seconds) -// #### @seconds {Number} Number of seconds to subtract. -// Subtracts the specified `seconds` from this instance. -// -TimeSpan.prototype.subtractSeconds = function (seconds) { - if (!isNumeric(seconds)) { return } - this.msecs -= (seconds * msecPerSecond); -}; - -// -// ### function subtractMinutes (minutes) -// #### @minutes {Number} Number of minutes to subtract. -// Subtracts the specified `minutes` from this instance. -// -TimeSpan.prototype.subtractMinutes = function (minutes) { - if (!isNumeric(minutes)) { return } - this.msecs -= (minutes * msecPerMinute); -}; - -// -// ### function subtractHours (hours) -// #### @hours {Number} Number of hours to subtract. -// Subtracts the specified `hours` from this instance. -// -TimeSpan.prototype.subtractHours = function (hours) { - if (!isNumeric(hours)) { return } - this.msecs -= (hours * msecPerHour); -}; - -// -// ### function subtractDays (days) -// #### @days {Number} Number of days to subtract. -// Subtracts the specified `days` from this instance. -// -TimeSpan.prototype.subtractDays = function (days) { - if (!isNumeric(days)) { return } - this.msecs -= (days * msecPerDay); -}; - -// -// ## Getters -// Methods for retrieving components of a `TimeSpan` -// instance: milliseconds, seconds, minutes, hours, and days. -// - -// -// ### function totalMilliseconds (roundDown) -// #### @roundDown {boolean} Value indicating if the value should be rounded down. -// Returns the total number of milliseconds for this instance, rounding down -// to the nearest integer if `roundDown` is set. -// -TimeSpan.prototype.totalMilliseconds = function (roundDown) { - var result = this.msecs; - if (roundDown === true) { - result = Math.floor(result); - } - - return result; -}; - -// -// ### function totalSeconds (roundDown) -// #### @roundDown {boolean} Value indicating if the value should be rounded down. -// Returns the total number of seconds for this instance, rounding down -// to the nearest integer if `roundDown` is set. -// -TimeSpan.prototype.totalSeconds = function (roundDown) { - var result = this.msecs / msecPerSecond; - if (roundDown === true) { - result = Math.floor(result); - } - - return result; -}; - -// -// ### function totalMinutes (roundDown) -// #### @roundDown {boolean} Value indicating if the value should be rounded down. -// Returns the total number of minutes for this instance, rounding down -// to the nearest integer if `roundDown` is set. -// -TimeSpan.prototype.totalMinutes = function (roundDown) { - var result = this.msecs / msecPerMinute; - if (roundDown === true) { - result = Math.floor(result); - } - - return result; -}; - -// -// ### function totalHours (roundDown) -// #### @roundDown {boolean} Value indicating if the value should be rounded down. -// Returns the total number of hours for this instance, rounding down -// to the nearest integer if `roundDown` is set. -// -TimeSpan.prototype.totalHours = function (roundDown) { - var result = this.msecs / msecPerHour; - if (roundDown === true) { - result = Math.floor(result); - } - - return result; -}; - -// -// ### function totalDays (roundDown) -// #### @roundDown {boolean} Value indicating if the value should be rounded down. -// Returns the total number of days for this instance, rounding down -// to the nearest integer if `roundDown` is set. -// -TimeSpan.prototype.totalDays = function (roundDown) { - var result = this.msecs / msecPerDay; - if (roundDown === true) { - result = Math.floor(result); - } - - return result; -}; - -// -// ### @milliseconds -// Returns the length of this `TimeSpan` instance in milliseconds. -// -TimeSpan.prototype.__defineGetter__('milliseconds', function () { - return this.msecs % 1000; -}); - -// -// ### @seconds -// Returns the length of this `TimeSpan` instance in seconds. -// -TimeSpan.prototype.__defineGetter__('seconds', function () { - return Math.floor(this.msecs / msecPerSecond) % 60; -}); - -// -// ### @minutes -// Returns the length of this `TimeSpan` instance in minutes. -// -TimeSpan.prototype.__defineGetter__('minutes', function () { - return Math.floor(this.msecs / msecPerMinute) % 60; -}); - -// -// ### @hours -// Returns the length of this `TimeSpan` instance in hours. -// -TimeSpan.prototype.__defineGetter__('hours', function () { - return Math.floor(this.msecs / msecPerHour) % 24; -}); - -// -// ### @days -// Returns the length of this `TimeSpan` instance in days. -// -TimeSpan.prototype.__defineGetter__('days', function () { - return Math.floor(this.msecs / msecPerDay); -}); - -// -// ## Instance Helpers -// Various help methods for performing utilities -// such as equality and serialization -// - -// -// ### function equals (timeSpan) -// #### @timeSpan {TimeSpan} TimeSpan instance to assert equal -// Returns a value indicating if the specified `timeSpan` is equal -// in milliseconds to this instance. -// -TimeSpan.prototype.equals = function (timeSpan) { - if (!(timeSpan instanceof TimeSpan)) { return } - return this.msecs === timeSpan.totalMilliseconds(); -}; - -// -// ### function toString () -// Returns a string representation of this `TimeSpan` -// instance according to current `format`. -// -TimeSpan.prototype.toString = function () { - if (!this.format) { return this._format() } - return this.format(this); -}; - -// -// ### @private function _format () -// Returns the default string representation of this instance. -// -TimeSpan.prototype._format = function () { - return [ - this.days, - this.hours, - this.minutes, - this.seconds + '.' + this.milliseconds - ].join(':') -}; - -// -// ### @private function isNumeric (input) -// #### @input {Number} Value to check numeric quality of. -// Returns a value indicating the numeric quality of the -// specified `input`. -// -function isNumeric (input) { - return input && !isNaN(parseFloat(input)) && isFinite(input); -}; - -// -// ### @private function _compute (delta, date, computed, options) -// #### @delta {Number} Channge in this component of the date -// #### @computed {Object} Currently computed date. -// #### @options {Object} Options for the computation -// Performs carry forward addition or subtraction for the -// `options.current` component of the `computed` date, carrying -// it forward to `options.next` depending on the maximum value, -// `options.max`. -// -function _compute (delta, computed, options) { - var current = options.current, - next = options.next, - max = options.max, - round = delta > 0 ? Math.floor : Math.ceil; - - if (delta) { - computed[next] += round.call(null, delta / max); - computed[current] += delta % max; - } - - if (Math.abs(computed[current]) >= max) { - computed[next] += round.call(null, computed[current] / max) - computed[current] = computed[current] % max; - } - - return computed; -} - - -// -// ### @private monthDays (month, year) -// #### @month {Number} Month to get days for. -// #### @year {Number} Year of the month to get days for. -// Returns the number of days in the specified `month` observing -// leap years. -// -var months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; -function monthDays (month, year) { - if (((year % 100 !== 0 && year % 4 === 0) - || year % 400 === 0) && month === 1) { - return 29; - } - - return months[month]; -} \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/package.json b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/package.json deleted file mode 100644 index e373ded..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "timespan", - "description": "A JavaScript TimeSpan library for node.js (and soon the browser)", - "version": "2.2.0", - "author": { - "name": "Michael Stum", - "email": "blog@stum.de" - }, - "contributors": [ - { - "name": "Charlie Robbins", - "email": "charlie.robbins@gmail.com" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/indexzero/timespan.git" - }, - "keywords": [ - "time", - "dates", - "utilities", - "timespan" - ], - "devDependencies": { - "vows": ">= 0.5.2" - }, - "main": "./lib/time-span.js", - "scripts": { - "test": "vows test/*-test.js --spec" - }, - "engines": { - "node": ">= 0.2.0" - }, - "_id": "timespan@2.2.0", - "dependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "timespan@2.x.x" -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/test/date-parser-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/test/date-parser-test.js deleted file mode 100644 index 6f08973..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/test/date-parser-test.js +++ /dev/null @@ -1,72 +0,0 @@ -/* - * time-span-test.js: Tests for the TimeSpan module. - * - * (C) Charlie Robbins - * MIT LICENSE - * - */ - -var vows = require('vows'), - assert = require('assert'), - timeSpan = require('../lib/time-span'); - -vows.describe('time-span/date-time').addBatch({ - "When using the TimeSpan module": { - "the parseDate() method": { - "when passed a TimeSpan string using ISO8601 with explicit time modifiers": { - "which do not carry over": { - "should return the correct value": function () { - var target = new Date(Date.parse('2010-04-03T10:04:15Z')), - parsed = timeSpan.parseDate('2010-04-03T12:34:15Z-2HOURS30MINUTES'); - - assert.equal(target.toString(), parsed.toString()); - } - }, - "which carry under": { - "should return the correct value": function () { - var target = new Date(Date.parse('2010-03-29T12:34:15Z')), - parsed = timeSpan.parseDate('2010-04-01T12:34:15Z-72HOURS'); - - assert.equal(target.toString(), parsed.toString()); - } - }, - "which carry under a leap year": { - "should return the correct value": function () { - var target = new Date(Date.parse('2007-03-31T12:00:00Z')), - parsed = timeSpan.parseDate('2010-03-31T12:00:00Z-1096DAYS'); - - assert.equal(target.toString(), parsed.toString()); - } - }, - "which carry over": { - "should return the correct value": function () { - var target = new Date(Date.parse('2013-04-03T12:34:15Z')), - parsed = timeSpan.parseDate('2010-04-03T12:34:15Z+2YEARS365DAYS'); - - assert.equal(target.toString(), parsed.toString()); - } - } - }, - "when passed a TimeSpan string using NOW with explicit time modifiers": { - "which do not carry over": { - "should return the correct value": function () { - var now = new Date(Date.now()), - parsed = timeSpan.parseDate('NOW-2HOURS'); - - now.setHours(now.getHours() - 2 - (now.getTimezoneOffset() / 60)); - assert.equal(now.getHours(), parsed.getHours()); - } - }, - "which carry under": { - "should return the correct value": function () { - var now = new Date(Date.now()), - parsed = timeSpan.parseDate('NOW-72HOURS'); - - now.setHours(now.getHours() - 72 - (now.getTimezoneOffset() / 60)); - assert.equal(now.getHours(), parsed.getHours()); - } - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/test/helpers.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/test/helpers.js deleted file mode 100644 index 4a1b84a..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/test/helpers.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * helpers.js: Tests helpers for the TimeSpan module. - * - * (C) Charlie Robbins - * MIT LICENSE - * - */ - -var assert = require('assert'), - timeSpan = require('../lib/time-span') - -function capitalize(str) { - return str.charAt(0).toUpperCase() + str.slice(1); -} - -var helpers = exports, - components = ['milliseconds', 'seconds', 'minutes', 'hours', 'days']; - -// -// Tests all of the factory methods for the `TimeSpan` object: -// `fromMilliseconds`, `fromSeconds`, etc. -// -exports.testFactories = function (num) { - var context = {}; - - components.forEach(function (component) { - var method = 'from' + capitalize(component); - - context['the ' + method + '() method'] = function () { - var value = timeSpan[method](num); - assert.equal(value[component], num); - } - }); - - return context; -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/test/time-span-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/test/time-span-test.js deleted file mode 100644 index 66a7be5..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/node_modules/timespan/test/time-span-test.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * time-span-test.js: Tests for the TimeSpan module. - * - * (C) Charlie Robbins - * MIT LICENSE - * - */ - -var vows = require('vows'), - assert = require('assert'), - timeSpan = require('../lib/time-span'), - helpers = require('./helpers'); - -vows.describe('time-span').addBatch({ - "When using the TimeSpan module": { - "the parse() method": { - "when passed a TimeSpan string with no days": { - "should return a valid TimeSpan object": function () { - var ts = timeSpan.parse("04:03:02.10"); - assert.equal(ts.hours, 4); - assert.equal(ts.minutes, 3); - assert.equal(ts.seconds, 2); - assert.equal(ts.milliseconds, 100); - } - }, - "when passed a TimeSpan string with days": { - "should return a valid TimeSpan object": function () { - var ts = timeSpan.parse("01:04:03:02.10"); - assert.equal(ts.days, 1); - assert.equal(ts.hours, 4); - assert.equal(ts.minutes, 3); - assert.equal(ts.seconds, 2); - assert.equal(ts.milliseconds, 100); - } - } - }, - "the test() method": { - "when passed a TimeSpan string with no days": { - "should return true": function () { - assert.isTrue(timeSpan.test("04:03:02.10")); - } - }, - "when passed a TimeSpan string with days": { - "should return true": function () { - assert.isTrue(timeSpan.test("01:04:03:02.10")); - } - }, - "when passed an invalid TimeSpan string": { - "should return false": function () { - assert.isFalse(timeSpan.test('xx:00:invalid')); - } - } - }, - "the fromDates() method": { - "with two Date values": function () { - var diff = 1000 * 60 * 60 * 12, - end = new Date(), - start = new Date(end.getTime() - diff); - - assert.equal(12, timeSpan.fromDates(start, end).hours); - }, - "with two string values": function () { - assert.equal(2, timeSpan.fromDates('NOW-4DAYS', 'NOW-2DAYS').days); - } - }, - "the factory methods": helpers.testFactories(10) - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/package.json b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/package.json deleted file mode 100644 index 8cc20bb..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "loggly", - "description": "A client implementation for Loggly cloud Logging-as-a-Service API", - "version": "0.3.11", - "author": { - "name": "Charlie Robbins", - "email": "charlie.robbins@gmail.com" - }, - "contributors": [ - { - "name": "Marak Squires", - "email": "marak.squires@gmail.com" - }, - { - "name": "hij1nx", - "email": "hij1nx@me.com" - }, - { - "name": "Kord Campbell", - "email": "kordless@loggly.com" - }, - { - "name": "Erik Hedenstrom", - "email": "erik@hedenstroem.com" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/nodejitsu/node-loggly.git" - }, - "keywords": [ - "cloud computing", - "api", - "logging", - "loggly" - ], - "dependencies": { - "request": "2.9.x", - "timespan": "2.x.x" - }, - "devDependencies": { - "vows": "0.6.x" - }, - "main": "./lib/loggly", - "scripts": { - "test": "vows test/*-test.js --spec" - }, - "engines": { - "node": ">= 0.4.0" - }, - "_id": "loggly@0.3.11", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "loggly@0.3.x >=0.3.7" -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/test/common-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/test/common-test.js deleted file mode 100644 index 51c6b4a..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/test/common-test.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * common-test.js: Tests for Loggly `common` utility module - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - common = require('../lib/loggly/common'); - -vows.describe('node-loggly/common').addBatch({ - "When using the common module": { - "the clone() method": { - topic: function () { - this.obj = { - name: 'common', - deep: { - first: 'first', - second: 'second' - } - }; - return common.clone(this.obj); - }, - "should return a deep clone of the object": function (clone) { - assert.isFalse(this.obj.deep === clone.deep); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/test/device-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/test/device-test.js deleted file mode 100644 index 8124180..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/test/device-test.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * device-test.js: Tests for Loggly device requests - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - helpers = require('./helpers'); - -var options = {}, - config = helpers.loadConfig(), - loggly = require('../lib/loggly').createClient(config); - -vows.describe('node-loggly/devices').addBatch({ - "When using the node-loggly client": { - "the getDevices() method": { - topic: function () { - loggly.getDevices(this.callback); - }, - "should return a list of valid devices": function (err, devices) { - assert.isNull(err); - devices.forEach(function (device) { - helpers.assertDevice(device); - }); - } - }, - "the addDeviceToInput() method": { - topic: function () { - loggly.addDeviceToInput(config.inputs.test.id, '127.0.0.1', this.callback); - }, - "should respond with 200 status code": function (err, res) { - assert.isNull(err); - assert.equal(res.statusCode, 200); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/test/helpers.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/test/helpers.js deleted file mode 100644 index b8ed45c..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/test/helpers.js +++ /dev/null @@ -1,79 +0,0 @@ -/* - * helpers.js: Test helpers for node-loggly - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var fs = require('fs'), - util = require('util'), - path = require('path'), - vows = require('vows'), - assert = require('assert'), - loggly = require('../lib/loggly'); - -var helpers = exports; - -helpers.validConfig = function (config) { - return config - && config.subdomain !== 'test-subdomain' - && config.auth - && config.auth.username !== 'test-username' - && config.auth.password !== 'test-password' - && config.inputs - && config.inputs.test - && config.inputs.test_json; -}; - -helpers.loadConfig = function () { - try { - var configFile = path.join(__dirname, 'data', 'test-config.json'), - stats = fs.statSync(configFile) - config = JSON.parse(fs.readFileSync(configFile).toString()); - - if (!helpers.validConfig(config)) { - util.puts('Config file test-config.json must be updated with valid data before running tests'); - process.exit(0); - } - - helpers.config = config || {} - return config || {}; - } - catch (ex) { - util.puts('Error parsing test-config.json'); - ex.stack.split('\n').forEach(function (line) { - console.log(line); - }); - - process.exit(0); - } -}; - -helpers.assertInput = function (input) { - assert.instanceOf(input, loggly.Input); - assert.isNotNull(input.id); - assert.isNotNull(input.name); - assert.isNotNull(input.service); - assert.isNotNull(input.create); - assert.isNotNull(input.discover); - assert.isNotNull(input.discoverTime); - assert.isNotNull(input.description); -}; - -helpers.assertDevice = function (device) { - assert.instanceOf(device, loggly.Device); - assert.isNotNull(device.id); - assert.isNotNull(device.input); - assert.isNotNull(device.ipAddress); - assert.isNotNull(device.launched); - assert.isNotNull(device.resourceUri); -}; - -helpers.assertSearch = function (err, results) { - assert.isNull(err); - assert.isObject(results); - assert.isTrue(typeof results.data !== 'undefined'); - assert.isTrue(typeof results.numFound !== 'undefined'); - assert.isTrue(typeof results.context !== 'undefined'); -}; diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/test/input-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/test/input-test.js deleted file mode 100644 index 06cd763..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/test/input-test.js +++ /dev/null @@ -1,197 +0,0 @@ -/* - * input-test.js: Tests for Loggly input requests - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - helpers = require('./helpers'); - -var options = {}, - testContext = {}, - config = helpers.loadConfig(), - loggly = require('../lib/loggly').createClient(config), - logglyJSON = require('../lib/loggly').createClient(config); - -logglyJSON.config.json = true; - -vows.describe('node-loggly/inputs').addBatch({ - "When using the node-loggly client": { - "the getInputs() method": { - topic: function () { - loggly.getInputs(this.callback); - }, - "should return a list of valid inputs": function (err, inputs) { - assert.isNull(err); - inputs.forEach(function (input) { - helpers.assertInput(input); - }); - } - }, - "the getInput method": { - "when called with a plaintext input": { - topic: function () { - loggly.getInput('test', this.callback); - }, - "should return a valid input": function (err, input) { - assert.isNull(err); - helpers.assertInput(input); - }, - "of the format 'text'": function (err, input) { - assert.isNull(err); - assert.equal(input.format, 'text'); - }, - "that matches the first input in the test configuration": function (err, input) { - assert.equal(config.inputs.test.token,input.input_token); - assert.equal(config.inputs.test.id,input.id); - testContext.input = input; - } - }, - "when called with a json input": { - topic: function () { - logglyJSON.getInput('test_json', this.callback); - }, - "should return a valid input": function (err, input) { - assert.isNull(err); - helpers.assertInput(input); - }, - "of the format 'json'": function (err, input) { - assert.isNull(err); - assert.equal(input.format, 'json'); - }, - "that matches the second input in the test configuration": function (err, input) { - assert.equal(config.inputs.test_json.token,input.input_token); - assert.equal(config.inputs.test_json.id,input.id); - testContext.inputJSON = input; - } - } - } - } -}).addBatch({ - "When using the node-loggly client": { - "the log() method": { - "to a 'text' input": { - "when passed a callback": { - topic: function () { - loggly.log( - config.inputs.test.token, - 'this is a test logging message from /test/input-test.js', - this.callback); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - }, - "when not passed a callback": { - topic: function () { - var emitter = loggly.log(config.inputs.test.token, 'this is a test logging message from /test/input-test.js'); - emitter.on('log', this.callback.bind(null, null)); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - } - }, - "to a 'json' input": { - "when passed a callback": { - topic: function () { - logglyJSON.log( - config.inputs.test_json.token, - { - timestamp: new Date().getTime(), - message: 'this is a test logging message from /test/input-test.js' - }, - this.callback); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - }, - "when not passed a callback": { - topic: function () { - var emitter = logglyJSON.log( - config.inputs.test_json.token, - { - timestamp: new Date().getTime(), - message: 'this is a test logging message from /test/input-test.js' - } - ); - emitter.on('log', this.callback.bind(null, null)); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - } - } - } - } -}).addBatch({ - "When using an instance of an input": { - "the log() method of the 'text' instance": { - "when passed a callback": { - topic: function () { - testContext.input.log('this is a test logging message from /test/input-test.js', this.callback); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - }, - "when not passed a callback": { - topic: function () { - var emitter = testContext.input.log('this is a test logging message from /test/input-test.js'); - emitter.on('log', this.callback.bind(null, null)); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - } - }, - "the log() method of the 'json' instance": { - "when passed a callback": { - topic: function () { - testContext.inputJSON.log( - { - timestamp: new Date().getTime(), - message: 'this is a test logging message from /test/input-test.js' - }, - this.callback); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - }, - "when not passed a callback": { - topic: function () { - var emitter = testContext.inputJSON.log({ - timestamp: new Date().getTime(), - message: 'this is a test logging message from /test/input-test.js' - }); - emitter.on('log', this.callback.bind(null, null)); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/test/log-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/test/log-test.js deleted file mode 100644 index 876db63..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/test/log-test.js +++ /dev/null @@ -1,84 +0,0 @@ -/* - * log-test.js: Tests for vanilla logging with no authentication. - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - helpers = require('./helpers'); - -var config = helpers.loadConfig(), - loggly = require('../lib/loggly').createClient({ subdomain: config.subdomain }), - logglyJSON = require('../lib/loggly').createClient({ subdomain: config.subdomain, json: true }); - -vows.describe('node-loggly/inputs (no auth)').addBatch({ - "When using the node-loggly client without authentication": { - "the log() method": { - "to a 'text' input": { - "when passed a callback": { - topic: function () { - loggly.log( - config.inputs.test.token, - 'this is a test logging message from /test/input-test.js', - this.callback); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - }, - "when not passed a callback": { - topic: function () { - var emitter = loggly.log(config.inputs.test.token, 'this is a test logging message from /test/input-test.js'); - emitter.on('log', this.callback.bind(null, null)); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - } - }, - "to a 'json' input": { - "when passed a callback": { - topic: function () { - logglyJSON.log( - config.inputs.test_json.token, - { - timestamp: new Date().getTime(), - message: 'this is a test logging message from /test/input-test.js' - }, - this.callback); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - }, - "when not passed a callback": { - topic: function () { - var emitter = logglyJSON.log( - config.inputs.test_json.token, - { - timestamp: new Date().getTime(), - message: 'this is a test logging message from /test/input-test.js' - } - ); - emitter.on('log', this.callback.bind(null, null)); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/test/search-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/test/search-test.js deleted file mode 100644 index dac9da7..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/loggly/test/search-test.js +++ /dev/null @@ -1,84 +0,0 @@ -/* - * input-test.js: Tests for Loggly input requests - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - helpers = require('./helpers'); - -var options = {}, - testContext = {}, - config = helpers.loadConfig(), - loggly = require('../lib/loggly').createClient(config); - -vows.describe('node-loggly/search').addBatch({ - "When using the node-loggly client": { - "the search() method": { - "when searching without chaining": { - topic: function () { - loggly.search('logging message', this.callback); - }, - "should return a set of valid search results": function (err, results) { - helpers.assertSearch(err, results); - } - }, - "when searching with chaining": { - topic: function () { - loggly.search('logging message') - .meta({ inputname: 'test' }) - .run(this.callback); - }, - "should return a set of valid search results": function (err, results) { - helpers.assertSearch(err, results); - } - } - }, - "the facet() method": { - "when searching by ip": { - topic: function () { - loggly.facet('ip', 'test', this.callback); - }, - "should return a set of valid search results": function (err, results) { - helpers.assertSearch(err, results); - } - }, - "when using chained searches": { - topic: function () { - loggly.facet('ip', 'test') - .context({ from: 'NOW-1MONTH' }) - .run(this.callback); - }, - "should return a set of valid search results": function (err, results) { - helpers.assertSearch(err, results); - } - } - }, - "the _checkRange() method": { - "with invalid options set": { - "should correct them": function () { - var search = loggly.search('logging message') - .context({ from: 'NOW', until: '1DAY' }) - ._checkRange(); - - assert.equal(search._context.from, 'NOW-24HOURS'); - assert.equal(search._context.until, 'NOW'); - } - }, - "with valid options set": { - "should not modify them": function () { - var search = loggly.search('logging message') - .context({ from: 'NOW-2MONTHS', until: 'NOW' }) - ._checkRange(); - - assert.equal(search._context.from, 'NOW-2MONTHS'); - assert.equal(search._context.until, 'NOW'); - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/.npmignore b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/.npmignore deleted file mode 100644 index 3f31ac2..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -*.un~ -/node_modules diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/License b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/License deleted file mode 100644 index 11ec094..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/License +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011 Felix Geisendörfer (felix@debuggable.com) - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/Makefile b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/Makefile deleted file mode 100644 index a7ce31d..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -SHELL := /bin/bash - -test: - @./test/run.js - -release: - git push - git push --tags - npm publish . - -.PHONY: test diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/Readme.md b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/Readme.md deleted file mode 100644 index fcd1b97..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/Readme.md +++ /dev/null @@ -1,98 +0,0 @@ -# stack-trace - -Get v8 stack traces as an array of CallSite objects. - -## Install - -``` bash -npm install stack-trace -``` - -## Usage - -The stack-trace module makes it easy for you to capture the current stack: - -``` javascript -var stackTrace = require('stack-trace'); -var trace = stackTrace.get(); - -require('assert').strictEqual(trace[0].getFileName(), __filename); -``` - -However, sometimes you have already popped the stack you are interested in, -and all you have left is an `Error` object. This module can help: - -``` javascript -var stackTrace = require('stack-trace'); -var err = new Error('something went wrong'); -var trace = stackTrace.parse(err); - -require('assert').strictEqual(trace[0].getFileName(), __filename); -``` - -Please note that parsing the `Error#stack` property is not perfect, only -certain properties can be retrieved with it as noted in the API docs below. - -## Long stack traces - -stack-trace works great with [long-stack-traces][], when parsing an `err.stack` -that has crossed the event loop boundary, a `CallSite` object returning -`'----------------------------------------'` for `getFileName()` is created. -All other methods of the event loop boundary call site return `null`. - -[long-stack-traces]: https://github.com/tlrobinson/long-stack-traces - -## API - -### stackTrace.get([belowFn]) - -Returns an array of `CallSite` objects, where element `0` is the current call -site. - -When passing a function on the current stack as the `belowFn` parameter, the -returned array will only include `CallSite` objects below this function. - -### stackTrace.parse(err) - -Parses the `err.stack` property of an `Error` object into an array compatible -with those returned by `stackTrace.get()`. However, only the following methods -are implemented on the returned `CallSite` objects. - -* getTypeName -* getFunctionName -* getMethodName -* getFileName -* getLineNumber -* getColumnNumber -* isNative - -Note: Except `getFunctionName()`, all of the above methods return exactly the -same values as you would get from `stackTrace.get()`. `getFunctionName()` -is sometimes a little different, but still useful. - -### CallSite - -The official v8 CallSite object API can be found [here][v8stackapi]. A quick -excerpt: - -> A CallSite object defines the following methods: -> -> * **getThis**: returns the value of this -> * **getTypeName**: returns the type of this as a string. This is the name of the function stored in the constructor field of this, if available, otherwise the object's [[Class]] internal property. -> * **getFunction**: returns the current function -> * **getFunctionName**: returns the name of the current function, typically its name property. If a name property is not available an attempt will be made to try to infer a name from the function's context. -> * **getMethodName**: returns the name of the property of this or one of its prototypes that holds the current function -> * **getFileName**: if this function was defined in a script returns the name of the script -> * **getLineNumber**: if this function was defined in a script returns the current line number -> * **getColumnNumber**: if this function was defined in a script returns the current column number -> * **getEvalOrigin**: if this function was created using a call to eval returns a CallSite object representing the location where eval was called -> * **isToplevel**: is this a toplevel invocation, that is, is this the global object? -> * **isEval**: does this call take place in code defined by a call to eval? -> * **isNative**: is this call in native V8 code? -> * **isConstructor**: is this a constructor call? - -[v8stackapi]: http://code.google.com/p/v8/wiki/JavaScriptStackTraceApi - -## License - -stack-trace is licensed under the MIT license. diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/lib/stack-trace.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/lib/stack-trace.js deleted file mode 100644 index 085ff40..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/lib/stack-trace.js +++ /dev/null @@ -1,111 +0,0 @@ -exports.get = function(belowFn) { - var oldLimit = Error.stackTraceLimit; - Error.stackTraceLimit = Infinity; - - var dummyObject = {}; - Error.captureStackTrace(dummyObject, belowFn || exports.get); - - var v8Handler = Error.prepareStackTrace; - Error.prepareStackTrace = function(dummyObject, v8StackTrace) { - return v8StackTrace; - }; - - var v8StackTrace = dummyObject.stack; - Error.prepareStackTrace = v8Handler; - Error.stackTraceLimit = oldLimit; - - return v8StackTrace; -}; - -exports.parse = function(err) { - if (!err.stack) { - return []; - } - - var self = this; - var lines = err.stack.split('\n').slice(1); - - return lines - .map(function(line) { - if (line.match(/^\s*[-]{4,}$/)) { - return self._createParsedCallSite({ - fileName: line, - lineNumber: null, - functionName: null, - typeName: null, - methodName: null, - columnNumber: null, - 'native': null, - }); - } - - var lineMatch = line.match(/at (?:([^\s]+)\s+)?\(?(?:(.+?):(\d+):(\d+)|([^)]+))\)?/); - if (!lineMatch) { - return; - } - - var object = null; - var method = null; - var functionName = null; - var typeName = null; - var methodName = null; - var isNative = (lineMatch[5] === 'native'); - - if (lineMatch[1]) { - var methodMatch = lineMatch[1].match(/([^\.]+)(?:\.(.+))?/); - object = methodMatch[1]; - method = methodMatch[2]; - functionName = lineMatch[1]; - typeName = 'Object'; - } - - if (method) { - typeName = object; - methodName = method; - } - - if (method === '') { - methodName = null; - functionName = ''; - } - - var properties = { - fileName: lineMatch[2] || null, - lineNumber: parseInt(lineMatch[3], 10) || null, - functionName: functionName, - typeName: typeName, - methodName: methodName, - columnNumber: parseInt(lineMatch[4], 10) || null, - 'native': isNative, - }; - - return self._createParsedCallSite(properties); - }) - .filter(function(callSite) { - return !!callSite; - }); -}; - -exports._createParsedCallSite = function(properties) { - var methods = {}; - for (var property in properties) { - var prefix = 'get'; - if (property === 'native') { - prefix = 'is'; - } - var method = prefix + property.substr(0, 1).toUpperCase() + property.substr(1); - - (function(property) { - methods[method] = function() { - return properties[property]; - } - })(property); - } - - var callSite = Object.create(methods); - for (var property in properties) { - callSite[property] = properties[property]; - } - - return callSite; -}; diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/package.json b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/package.json deleted file mode 100644 index c97d0af..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "author": { - "name": "Felix Geisendörfer", - "email": "felix@debuggable.com", - "url": "http://debuggable.com/" - }, - "name": "stack-trace", - "description": "Get v8 stack traces as an array of CallSite objects.", - "version": "0.0.6", - "homepage": "https://github.com/felixge/node-stack-trace", - "repository": { - "type": "git", - "url": "git://github.com/felixge/node-stack-trace.git" - }, - "main": "./lib/stack-trace", - "engines": { - "node": "*" - }, - "dependencies": {}, - "devDependencies": { - "far": "0.0.3", - "long-stack-traces": "0.1.2" - }, - "_id": "stack-trace@0.0.6", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "stack-trace@0.0.x" -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/test/common.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/test/common.js deleted file mode 100644 index 2985c2f..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/test/common.js +++ /dev/null @@ -1,10 +0,0 @@ -var common = exports; - -var path = require('path'); -var root = path.dirname(__dirname); - -common.dir = { - lib: root + '/lib', -}; - -common.assert = require('assert'); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/test/integration/test-get.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/test/integration/test-get.js deleted file mode 100644 index 53b2e61..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/test/integration/test-get.js +++ /dev/null @@ -1,49 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var stackTrace = require(common.dir.lib + '/stack-trace'); - -(function testBasic() { - var trace = stackTrace.get(); - - assert.strictEqual(trace[0].getFunction(), testBasic); - assert.strictEqual(trace[0].getFunctionName(), 'testBasic'); - assert.strictEqual(trace[0].getFileName(), __filename); -})(); - -(function testWrapper() { - (function testBelowFn() { - var trace = stackTrace.get(testBelowFn); - assert.strictEqual(trace[0].getFunction(), testWrapper); - assert.strictEqual(trace[0].getFunctionName(), 'testWrapper'); - })(); -})(); - - -(function deep1() { - (function deep2() { - (function deep3() { - (function deep4() { - (function deep5() { - (function deep6() { - (function deep7() { - (function deep8() { - (function deep9() { - (function deep10() { - (function deep10() { - var trace = stackTrace.get(); - var hasFirstCallSite = trace.some(function(callSite) { - return callSite.getFunctionName() === 'deep1'; - }); - - assert.ok(hasFirstCallSite); - })(); - })(); - })(); - })(); - })(); - })(); - })(); - })(); - })(); - })(); -})(); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/test/integration/test-long-stack-trace.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/test/integration/test-long-stack-trace.js deleted file mode 100644 index 6106c4a..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/test/integration/test-long-stack-trace.js +++ /dev/null @@ -1,14 +0,0 @@ -var common = require('../common'); - -require('long-stack-traces'); -var assert = common.assert; -var stackTrace = require(common.dir.lib + '/stack-trace'); - -function badFn() { - var err = new Error('oh no'); - var trace = stackTrace.parse(err); - - assert.ok(trace[2].getFileName().match(/-----/)); -}; - -setTimeout(badFn, 10); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/test/integration/test-parse.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/test/integration/test-parse.js deleted file mode 100644 index 4171a68..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/test/integration/test-parse.js +++ /dev/null @@ -1,135 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var stackTrace = require(common.dir.lib + '/stack-trace'); - -(function testBasic() { - var err = new Error('something went wrong'); - var trace = stackTrace.parse(err); - - assert.strictEqual(trace[0].getFileName(), __filename); - assert.strictEqual(trace[0].getFunctionName(), 'testBasic'); -})(); - -(function testWrapper() { - (function testBelowFn() { - var err = new Error('something went wrong'); - var trace = stackTrace.parse(err); - assert.strictEqual(trace[0].getFunctionName(), 'testBelowFn'); - assert.strictEqual(trace[1].getFunctionName(), 'testWrapper'); - })(); -})(); - -(function testNoStack() { - var err = {stack: undefined}; - var trace = stackTrace.parse(err); - - assert.deepEqual(trace, []); -})(); - - -(function testCorruptStack() { - var err = {}; - err.stack = -'AssertionError: true == false\n' + -' fuck' + -' at Test.run (/Users/felix/code/node-fast-or-slow/lib/test.js:45:10)\n' + -'oh no' + -' at TestCase.run (/Users/felix/code/node-fast-or-slow/lib/test_case.js:61:8)\n'; - - var trace = stackTrace.parse(err); - assert.equal(trace.length, 2); -})(); - -(function testCompareRealWithParsedStackTrace() { - var realTrace = stackTrace.get(); var err = new Error('something went wrong'); - var parsedTrace = stackTrace.parse(err); - - realTrace.forEach(function(real, i) { - var parsed = parsedTrace[i]; - - function compare(method, exceptions) { - var realValue = real[method](); - var parsedValue = parsed[method](); - - if (exceptions && exceptions[i]) { - realValue = exceptions[i]; - } - - var realJson = JSON.stringify(realValue); - var parsedJson = JSON.stringify(parsedValue); - - var message = - method + ': ' + realJson + ' != ' + parsedJson + ' (#' + i + ')'; - - assert.strictEqual(realValue, parsedValue, message); - } - - compare('getFileName'); - compare('getFunctionName', { - 3: 'Object..js', - 5: 'Function._load', - 6: 'Array.0', - 7: 'EventEmitter._tickCallback', - }); - compare('getTypeName'); - compare('getMethodName'); - compare('getLineNumber'); - compare('getColumnNumber', { - 0: 47 - }); - compare('isNative'); - }); -})(); - -(function testStackWithNativeCall() { - var err = {}; - err.stack = -'AssertionError: true == false\n' + -' at Test.fn (/Users/felix/code/node-fast-or-slow/test/fast/example/test-example.js:6:10)\n' + -' at Test.run (/Users/felix/code/node-fast-or-slow/lib/test.js:45:10)\n' + -' at TestCase.runNext (/Users/felix/code/node-fast-or-slow/lib/test_case.js:73:8)\n' + -' at TestCase.run (/Users/felix/code/node-fast-or-slow/lib/test_case.js:61:8)\n' + -' at Array.0 (native)\n' + -' at EventEmitter._tickCallback (node.js:126:26)'; - - var trace = stackTrace.parse(err); - var nativeCallSite = trace[4]; - - assert.strictEqual(nativeCallSite.getFileName(), null); - assert.strictEqual(nativeCallSite.getFunctionName(), 'Array.0'); - assert.strictEqual(nativeCallSite.getTypeName(), 'Array'); - assert.strictEqual(nativeCallSite.getMethodName(), '0'); - assert.strictEqual(nativeCallSite.getLineNumber(), null); - assert.strictEqual(nativeCallSite.getColumnNumber(), null); - assert.strictEqual(nativeCallSite.isNative(), true); -})(); - -(function testStackWithFileOnly() { - var err = {}; - err.stack = -'AssertionError: true == false\n' + -' at /Users/felix/code/node-fast-or-slow/lib/test_case.js:80:10'; - - var trace = stackTrace.parse(err); - var callSite = trace[0]; - - assert.strictEqual(callSite.getFileName(), '/Users/felix/code/node-fast-or-slow/lib/test_case.js'); - assert.strictEqual(callSite.getFunctionName(), null); - assert.strictEqual(callSite.getTypeName(), null); - assert.strictEqual(callSite.getMethodName(), null); - assert.strictEqual(callSite.getLineNumber(), 80); - assert.strictEqual(callSite.getColumnNumber(), 10); - assert.strictEqual(callSite.isNative(), false); -})(); - -(function testStackWithMultilineMessage() { - var err = {}; - err.stack = -'AssertionError: true == false\nAnd some more shit\n' + -' at /Users/felix/code/node-fast-or-slow/lib/test_case.js:80:10'; - - var trace = stackTrace.parse(err); - var callSite = trace[0]; - - assert.strictEqual(callSite.getFileName(), '/Users/felix/code/node-fast-or-slow/lib/test_case.js'); -})(); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/test/run.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/test/run.js deleted file mode 100755 index 0bb8e82..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/node_modules/stack-trace/test/run.js +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node -var far = require('far').create(); - -far.add(__dirname); -far.include(/test-.*\.js$/); - -far.execute(); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/package.json b/node_modules/flatiron/node_modules/broadway/node_modules/winston/package.json deleted file mode 100644 index aab2539..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "winston", - "description": "A multi-transport async logging library for Node.js", - "version": "0.5.10", - "author": { - "name": "Charlie Robbins", - "email": "charlie.robbins@gmail.com" - }, - "contributors": [ - { - "name": "Matthew Bergman", - "email": "mzbphoto@gmail.com" - }, - { - "name": "Marak Squires", - "email": "marak@nodejitsu.com" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/flatiron/winston.git" - }, - "keywords": [ - "logging", - "sysadmin", - "tools" - ], - "dependencies": { - "async": "0.1.x", - "colors": "0.x.x", - "eyes": "0.1.x", - "loggly": "0.3.x >=0.3.7", - "pkginfo": "0.2.x", - "stack-trace": "0.0.x" - }, - "devDependencies": { - "vows": "0.6.x" - }, - "main": "./lib/winston", - "scripts": { - "test": "vows --spec --isolate" - }, - "engines": { - "node": ">= 0.4.0" - }, - "_id": "winston@0.5.10", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "winston@0.5.10" -} diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/cli-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/cli-test.js deleted file mode 100644 index 365fba3..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/cli-test.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * cli-test.js: Tests for the cli levels available in winston. - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -vows.describe('winston/logger/cli').addBatch({ - "When an instance of winston.Logger": { - topic: function () { - return new winston.Logger({ - transports: [ - new winston.transports.Console() - ] - }) - }, - "the cli() method": { - "should set the appropriate values on the logger": function (logger) { - logger.cli(); - assert.isTrue(logger.padLevels); - assert.isTrue(logger.transports.console.colorize); - assert.isFalse(logger.transports.console.timestamp); - Object.keys(winston.config.cli.levels).forEach(function (level) { - assert.isNumber(logger.levels[level]); - }); - - Object.keys(winston.config.cli.colors).forEach(function (color) { - assert.isString(winston.config.allColors[color]); - }); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/container-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/container-test.js deleted file mode 100644 index 2fcc26a..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/container-test.js +++ /dev/null @@ -1,99 +0,0 @@ -/* - * container-test.js: Tests for the Container object - * - * (C) 2011 Charlie Robbins - * MIT LICENSE - * - */ - -var assert = require('assert'), - fs = require('fs'), - http = require('http'), - path = require('path'), - vows = require('vows'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -vows.describe('winston/container').addBatch({ - "An instance of winston.Container": { - topic: new winston.Container(), - "the add() method": { - topic: function (container) { - return container.add('default-test'); - }, - "should correctly instantiate a Logger": function (logger) { - assert.instanceOf(logger, winston.Logger); - }, - "the get() method": { - topic: function (logger, container) { - this.callback.apply(this, arguments); - }, - "should respond with the logger previously created": function (existing, container) { - var logger = container.get('default-test'); - assert.isTrue(existing === logger); - } - }, - "the has() method": { - topic: function (logger, container) { - this.callback.apply(this, arguments); - }, - "should indicate `default-test` logger exists": function (existing, container) { - assert.isTrue(container.has('default-test')); - }, - "should indicate `not-has` logger doesnt exists": function (existing, container) { - assert.isFalse(container.has('not-has')); - } - }, - "the close() method": { - topic: function (logger, container) { - this.callback.apply(this, arguments); - }, - "should remove the specified logger": function (logger, container) { - container.close('default-test'); - assert.isTrue(!container.loggers['default-test']); - } - } - } - }, - "An instance of winston.Container with explicit transports": { - topic: function () { - this.port = 9412; - this.transports = [ - new winston.transports.Webhook({ - port: this.port - }) - ]; - - this.container = new winston.Container({ - transports: this.transports - }); - - return null; - }, - "the get() method": { - topic: function (container) { - var server = http.createServer(function (req, res) { - res.end(); - }); - - server.listen(this.port, this.callback.bind(this, null)); - }, - "should add the logger correctly": function () { - this.someLogger = this.container.get('some-logger'); - assert.isObject(this.someLogger.transports); - assert.instanceOf(this.someLogger.transports['webhook'], winston.transports.Webhook); - assert.strictEqual(this.someLogger.transports['webhook'], this.transports[0]); - }, - "a second call to get()": { - "should respond with the same transport object": function () { - this.someOtherLogger = this.container.get('some-other-logger'); - - assert.isObject(this.someOtherLogger.transports); - assert.instanceOf(this.someOtherLogger.transports['webhook'], winston.transports.Webhook); - assert.strictEqual(this.someOtherLogger.transports['webhook'], this.transports[0]); - assert.strictEqual(this.someOtherLogger.transports['webhook'], this.someLogger.transports['webhook']); - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/custom-timestamp-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/custom-timestamp-test.js deleted file mode 100644 index c9753e2..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/custom-timestamp-test.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * custom-timestamp-test.js: Test function as timestamp option for transport `{ timestamp: function () {} }` - * - * (C) 2011 Charlie Robbins, Tom Shinnick - * MIT LICENSE - * - */ - -var assert = require('assert'), - events = require('events'), - fs = require('fs'), - path = require('path'), - vows = require('vows'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -function assertTimestamp (basename, options) { - var filename = path.join(__dirname, 'fixtures', 'logs', basename + '.log'); - - try { fs.unlinkSync(filename) } - catch (ex) { } - - return { - topic: function () { - options.filename = filename; - var transport = new (winston.transports.File)(options); - - // We must wait until transport file has emitted the 'flush' - // event to be sure the file has been created and written - transport.once('flush', this.callback.bind(this, null, filename)); - transport.log('info', 'When a fake tree falls in the forest...', null, function () {}); - }, - "should log with the appropriate timestamp": function (_, filename) { - var data = fs.readFileSync(filename, 'utf8'); - assert.isNotNull(data.match(options.pattern)); - } - } -} - -vows.describe('winston/transport/timestamp').addBatch({ - "When timestamp option is used": { - "with file transport": { - "with value set to false": assertTimestamp('noTimestamp', { - pattern: /^info\:/, - json: false, - timestamp: false - }), - "with value set to true ": assertTimestamp('defaultTimestamp', { - pattern: /^\d\d? \w{3}/, - json: false, - timestamp: true - }), - "and function value": assertTimestamp('customTimestamp', { - pattern: /^\d{8}\./, - json: false, - timestamp: function () { - return '20110803.171657'; - } - }) - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/exception-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/exception-test.js deleted file mode 100644 index 6bc8aec..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/exception-test.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * exception-test.js: Tests for exception data gathering in winston. - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -vows.describe('winston/exception').addBatch({ - "When using the winston exception module": { - "the getProcessInfo() method": { - topic: winston.exception.getProcessInfo(), - "should respond with the appropriate data": function (info) { - helpers.assertProcessInfo(info); - } - }, - "the getOsInfo() method": { - topic: winston.exception.getOsInfo(), - "should respond with the appropriate data": function (info) { - helpers.assertOsInfo(info); - } - }, - "the getTrace() method": { - topic: winston.exception.getTrace(new Error()), - "should have the appropriate info": function (trace) { - helpers.assertTrace(trace); - } - }, - "the getAllInfo() method": { - topic: winston.exception.getAllInfo(new Error()), - "should have the appropriate info": function (info) { - assert.isObject(info); - assert.isArray(info.stack); - helpers.assertProcessInfo(info.process); - helpers.assertOsInfo(info.os); - helpers.assertTrace(info.trace); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/fixtures/.gitkeep b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/fixtures/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/fixtures/keys/agent2-cert.pem b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/fixtures/keys/agent2-cert.pem deleted file mode 100644 index 8e4354d..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/fixtures/keys/agent2-cert.pem +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIB7DCCAZYCCQC7gs0MDNn6MTANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJV -UzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQKEwZKb3llbnQxEDAO -BgNVBAsTB05vZGUuanMxDzANBgNVBAMTBmFnZW50MjEgMB4GCSqGSIb3DQEJARYR -cnlAdGlueWNsb3Vkcy5vcmcwHhcNMTEwMzE0MTgyOTEyWhcNMzgwNzI5MTgyOTEy -WjB9MQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYD -VQQKEwZKb3llbnQxEDAOBgNVBAsTB05vZGUuanMxDzANBgNVBAMTBmFnZW50MjEg -MB4GCSqGSIb3DQEJARYRcnlAdGlueWNsb3Vkcy5vcmcwXDANBgkqhkiG9w0BAQEF -AANLADBIAkEAyXb8FrRdKbhrKLgLSsn61i1C7w7fVVVd7OQsmV/7p9WB2lWFiDlC -WKGU9SiIz/A6wNZDUAuc2E+VwtpCT561AQIDAQABMA0GCSqGSIb3DQEBBQUAA0EA -C8HzpuNhFLCI3A5KkBS5zHAQax6TFUOhbpBCR0aTDbJ6F1liDTK1lmU/BjvPoj+9 -1LHwrmh29rK8kBPEjmymCQ== ------END CERTIFICATE----- diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/fixtures/keys/agent2-key.pem b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/fixtures/keys/agent2-key.pem deleted file mode 100644 index 522903c..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/fixtures/keys/agent2-key.pem +++ /dev/null @@ -1,9 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIBOgIBAAJBAMl2/Ba0XSm4ayi4C0rJ+tYtQu8O31VVXezkLJlf+6fVgdpVhYg5 -QlihlPUoiM/wOsDWQ1ALnNhPlcLaQk+etQECAwEAAQJBAMT6Bf34+UHKY1ObpsbH -9u2jsVblFq1rWvs8GPMY6oertzvwm3DpuSUp7PTgOB1nLTLYtCERbQ4ovtN8tn3p -OHUCIQDzIEGsoCr5vlxXvy2zJwu+fxYuhTZWMVuo1397L0VyhwIhANQh+yzqUgaf -WRtSB4T2W7ADtJI35ET61jKBty3CqJY3AiAIwju7dVW3A5WeD6Qc1SZGKZvp9yCb -AFI2BfVwwaY11wIgXF3PeGcvACMyMWsuSv7aPXHfliswAbkWuzcwA4TW01ECIGWa -cgsDvVFxmfM5NPSuT/UDTa6R5BFISB5ea0N0AR3I ------END RSA PRIVATE KEY----- diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/fixtures/logs/.gitkeep b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/fixtures/logs/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/fixtures/scripts/default-exceptions.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/fixtures/scripts/default-exceptions.js deleted file mode 100644 index ab26aa5..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/fixtures/scripts/default-exceptions.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * default-exceptions.js: A test fixture for logging exceptions with the default winston logger. - * - * (C) 2011 Charlie Robbins - * MIT LICENCE - * - */ - -var path = require('path'), - winston = require('../../../lib/winston'); - -winston.handleExceptions([ - new (winston.transports.File)({ - filename: path.join(__dirname, '..', 'logs', 'default-exception.log'), - handleExceptions: true - }) -]); - -setTimeout(function () { - throw new Error('OH NOES! It failed!'); -}, 1000); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/fixtures/scripts/exit-on-error.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/fixtures/scripts/exit-on-error.js deleted file mode 100644 index fa3dd65..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/fixtures/scripts/exit-on-error.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * default-exceptions.js: A test fixture for logging exceptions with the default winston logger. - * - * (C) 2011 Charlie Robbins - * MIT LICENCE - * - */ - -var path = require('path'), - winston = require('../../../lib/winston'); - -winston.exitOnError = function (err) { - return err.message !== 'Ignore this error'; -}; - -winston.handleExceptions([ - new (winston.transports.File)({ - filename: path.join(__dirname, '..', 'logs', 'exit-on-error.log'), - handleExceptions: true - }) -]); - -setTimeout(function () { - throw new Error('Ignore this error'); -}, 1000); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/fixtures/scripts/log-exceptions.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/fixtures/scripts/log-exceptions.js deleted file mode 100644 index 43ce7eb..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/fixtures/scripts/log-exceptions.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * log-exceptions.js: A test fixture for logging exceptions in winston. - * - * (C) 2011 Charlie Robbins - * MIT LICENCE - * - */ - -var path = require('path'), - winston = require('../../../lib/winston'); - -var logger = new (winston.Logger)({ - transports: [ - new (winston.transports.File)({ - filename: path.join(__dirname, '..', 'logs', 'exception.log'), - handleExceptions: true - }) - ] -}); - -logger.handleExceptions(); - -setTimeout(function () { - throw new Error('OH NOES! It failed!'); -}, 1000); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/fixtures/scripts/unhandle-exceptions.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/fixtures/scripts/unhandle-exceptions.js deleted file mode 100644 index 5d722a7..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/fixtures/scripts/unhandle-exceptions.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * unhandle-exceptions.js: A test fixture for using `.unhandleExceptions()` winston. - * - * (C) 2011 Charlie Robbins - * MIT LICENCE - * - */ - -var path = require('path'), - winston = require('../../../lib/winston'); - -var logger = new (winston.Logger)({ - transports: [ - new (winston.transports.File)({ - filename: path.join(__dirname, '..', 'logs', 'unhandle-exception.log'), - handleExceptions: true - }) - ] -}); - -logger.handleExceptions(); -logger.unhandleExceptions(); - -setTimeout(function () { - throw new Error('OH NOES! It failed!'); -}, 1000); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/helpers.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/helpers.js deleted file mode 100644 index f961f85..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/helpers.js +++ /dev/null @@ -1,179 +0,0 @@ -/* - * helpers.js: Test helpers for winston - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var assert = require('assert'), - fs = require('fs'), - path = require('path'), - spawn = require('child_process').spawn, - util = require('util'), - loggly = require('loggly'), - vows = require('vows'), - winston = require('../lib/winston'); - -var helpers = exports; - -helpers.loadConfig = function (dir) { - try { - if (helpers.config) return helpers.config; - var configFile = path.join(dir || __dirname, 'fixtures', 'test-config.json'), - stats = fs.statSync(configFile), - config = JSON.parse(fs.readFileSync(configFile).toString()); - - helpers.config = config; - return config; - } - catch (ex) { - console.error('test/fixtures/test-config.json must be created with valid data before running tests'); - return false; - } -}; - -helpers.size = function (obj) { - var size = 0, key; - for (key in obj) { - if (obj.hasOwnProperty(key)) { - size++; - } - } - - return size; -}; - -helpers.tryUnlink = function (file) { - try { fs.unlinkSync(file) } - catch (ex) { } -}; - -helpers.assertProcessInfo = function (info) { - assert.isNumber(info.pid); - assert.isNumber(info.uid); - assert.isNumber(info.gid); - assert.isString(info.cwd); - assert.isString(info.execPath); - assert.isString(info.version); - assert.isArray(info.argv); - assert.isObject(info.memoryUsage); -}; - -helpers.assertOsInfo = function (info) { - assert.isArray(info.loadavg); - assert.isNumber(info.uptime); -}; - -helpers.assertTrace = function (trace) { - trace.forEach(function (site) { - assert.isTrue(!site.column || typeof site.column === 'number'); - assert.isTrue(!site.line || typeof site.line === 'number'); - assert.isTrue(!site.file || typeof site.file === 'string'); - assert.isTrue(!site.method || typeof site.method === 'string'); - assert.isTrue(!site.function || typeof site.function === 'string'); - assert.isTrue(typeof site.native === 'boolean'); - }); -}; - -helpers.assertLogger = function (logger, level) { - assert.instanceOf(logger, winston.Logger); - assert.isFunction(logger.log); - assert.isFunction(logger.add); - assert.isFunction(logger.remove); - assert.equal(logger.level, level || "info"); - Object.keys(logger.levels).forEach(function (method) { - assert.isFunction(logger[method]); - }); -}; - -helpers.assertConsole = function (transport) { - assert.instanceOf(transport, winston.transports.Console); - assert.isFunction(transport.log); -}; - -helpers.assertFile = function (transport) { - assert.instanceOf(transport, winston.transports.File); - assert.isFunction(transport.log); -} - -helpers.assertLoggly = function (transport) { - assert.instanceOf(transport, winston.transports.Loggly); - assert.isFunction(transport.log); -}; - -helpers.assertWebhook = function (transport) { - assert.instanceOf(transport, winston.transports.Webhook); - assert.isFunction(transport.log); -}; - -helpers.assertCouchdb = function (transport) { - assert.instanceOf(transport, winston.transports.Couchdb); - assert.isFunction(transport.log); -}; - -helpers.assertHandleExceptions = function (options) { - return { - topic: function () { - var that = this, - child = spawn('node', [options.script]); - - helpers.tryUnlink(options.logfile); - child.on('exit', function () { - fs.readFile(options.logfile, that.callback); - }); - }, - "should save the error information to the specified file": function (err, data) { - assert.isTrue(!err); - data = JSON.parse(data); - - assert.isObject(data); - helpers.assertProcessInfo(data.process); - helpers.assertOsInfo(data.os); - helpers.assertTrace(data.trace); - } - } -} - -helpers.testNpmLevels = function (transport, assertMsg, assertFn) { - return helpers.testLevels(winston.config.npm.levels, transport, assertMsg, assertFn); -}; - -helpers.testSyslogLevels = function (transport, assertMsg, assertFn) { - return helpers.testLevels(winston.config.syslog.levels, transport, assertMsg, assertFn); -}; - -helpers.testLevels = function (levels, transport, assertMsg, assertFn) { - var tests = {}; - - Object.keys(levels).forEach(function (level) { - var test = { - topic: function () { - transport.log(level, 'test message', {}, this.callback.bind(this, null)); - } - }; - - test[assertMsg] = assertFn; - tests['with the ' + level + ' level'] = test; - }); - - var metadatatest = { - topic: function () { - transport.log('info', 'test message', { metadata: true }, this.callback.bind(this, null)); - } - }; - - metadatatest[assertMsg] = assertFn; - tests['when passed metadata'] = metadatatest; - - var primmetadatatest = { - topic: function () { - transport.log('info', 'test message', 'metadata', this.callback.bind(this, null)); - } - }; - - primmetadatatest[assertMsg] = assertFn; - tests['when passed primitive metadata'] = primmetadatatest; - - return tests; -}; diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/log-exception-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/log-exception-test.js deleted file mode 100644 index b077a0a..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/log-exception-test.js +++ /dev/null @@ -1,58 +0,0 @@ -/* - * exception-test.js: Tests for exception data gathering in winston. - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var assert = require('assert'), - path = require('path'), - spawn = require('child_process').spawn, - vows = require('vows'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -vows.describe('winston/logger/exceptions').addBatch({ - "When using winston": { - "the handleException() method": { - "with a custom winston.Logger instance": helpers.assertHandleExceptions({ - script: path.join(__dirname, 'fixtures', 'scripts', 'log-exceptions.js'), - logfile: path.join(__dirname, 'fixtures', 'logs', 'exception.log') - }), - "with the default winston logger": helpers.assertHandleExceptions({ - script: path.join(__dirname, 'fixtures', 'scripts', 'default-exceptions.js'), - logfile: path.join(__dirname, 'fixtures', 'logs', 'default-exception.log') - }), - "when a custom exitOnError function is set": { - topic: function () { - var that = this, - scriptDir = path.join(__dirname, 'fixtures', 'scripts'); - - that.child = spawn('node', [path.join(scriptDir, 'exit-on-error.js')]); - setTimeout(this.callback.bind(this), 1500); - }, - "should not exit the process": function () { - assert.isFalse(this.child.killed); - this.child.kill(); - } - } - }, - "the unhandleException() method": { - topic: function () { - var that = this, - child = spawn('node', [path.join(__dirname, 'fixtures', 'scripts', 'unhandle-exceptions.js')]), - exception = path.join(__dirname, 'fixtures', 'logs', 'unhandle-exception.log'); - - helpers.tryUnlink(exception); - child.on('exit', function () { - path.exists(exception, that.callback.bind(this, null)); - }); - }, - "should not write to the specified error file": function (err, exists) { - assert.isTrue(!err); - assert.isFalse(exists); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/log-rewriter-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/log-rewriter-test.js deleted file mode 100644 index 4753fcc..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/log-rewriter-test.js +++ /dev/null @@ -1,98 +0,0 @@ -/* - * log-rewriter-test.js: Tests for rewriting metadata in winston. - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var assert = require('assert'), - vows = require('vows'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -vows.describe('winston/logger/rewriter').addBatch({ - "An instance of winston.Logger": { - topic: new (winston.Logger)({transports: [ - new (winston.transports.Console)({ level: 'info' }) - ]}), - "the addRewriter() method": { - topic: function(logger) { - logger.addRewriter(function(level, msg, meta) { - meta.level = level; - meta.msg = msg; - meta.foo = 'bar'; - return meta; - }); - return logger; - }, - "should add the rewriter": function(logger) { - assert.equal(helpers.size(logger.rewriters), 1); - }, - "the log() method": { - topic: function(logger) { - logger.once('logging', this.callback); - logger.log('info', 'test message', {"a": "b"}); - }, - "should run the rewriter": function(transport, level, msg, meta) { - assert.equal(meta.a, 'b'); - assert.equal(meta.level, 'info'); - assert.equal(meta.msg, 'test message'); - assert.equal(meta.foo, 'bar'); - } - } - } - } -}).addBatch({ - "An instance of winston.Logger with explicit rewriter": { - topic: new (winston.Logger)({transports: [ - new (winston.transports.Console)({ level: 'info'}) - ], rewriters: [ - function(level, msg, meta) { - meta.level = level; - meta.msg = msg; - meta.foo = 'bar'; - return meta; - } - ]}), - "should add the rewriter": function(logger) { - assert.equal(helpers.size(logger.rewriters), 1); - }, - "the log() method": { - topic: function(logger) { - logger.once('logging', this.callback); - logger.log('info', 'test message', {"a": "b"}); - }, - "should run the rewriter": function(transport, level, msg, meta) { - assert.equal(meta.a, 'b'); - assert.equal(meta.level, 'info'); - assert.equal(meta.msg, 'test message'); - assert.equal(meta.foo, 'bar'); - } - } - } -}).addBatch({ - "An instance of winston.Logger with rewriters": { - topic: new (winston.Logger)({transports: [ - new (winston.transports.Console)({ level: 'info' }) - ], rewriters: [ - function(level, msg, meta) { - meta.numbers.push(1); - return meta; - }, - function(level, msg, meta) { - meta.numbers.push(2); - return meta; - } - ]}), - "the log() method": { - topic: function(logger) { - logger.once('logging', this.callback); - logger.log('info', 'test message', {"numbers": [0]}); - }, - "should run the rewriters in correct order": function(transport, level, msg, meta) { - assert.deepEqual(meta.numbers, [0, 1, 2]); - } - } - } -}).export(module); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/logger-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/logger-test.js deleted file mode 100644 index 0105825..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/logger-test.js +++ /dev/null @@ -1,199 +0,0 @@ -/* - * logger-test.js: Tests for instances of the winston Logger - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -vows.describe('winton/logger').addBatch({ - "An instance of winston.Logger": { - topic: new (winston.Logger)({ transports: [new (winston.transports.Console)({ level: 'info' })] }), - "should have the correct methods / properties defined": function (logger) { - helpers.assertLogger(logger); - }, - "the add() with an unsupported transport": { - "should throw an error": function () { - assert.throws(function () { logger.add('unsupported') }, Error); - } - } - } -}).addBatch({ - "An instance of winston.Logger with no transports": { - topic: new (winston.Logger)({ emitErrs: true }), - "the log() method should throw an error": function (logger) { - assert.throws(function () { logger.log('anything') }, Error); - }, - "the extend() method called on an empty object": { - topic: function (logger) { - var empty = {}; - logger.extend(empty); - return empty; - }, - "should define the appropriate methods": function (extended) { - ['log', 'profile', 'startTimer'].concat(Object.keys(winston.config.npm.levels)).forEach(function (method) { - assert.isFunction(extended[method]); - }); - } - }, - "the add() method with a supported transport": { - topic: function (logger) { - return logger.add(winston.transports.Console); - }, - "should add the console Transport onto transports": function (logger) { - assert.equal(helpers.size(logger.transports), 1); - helpers.assertConsole(logger.transports.console); - }, - "should throw an error when the same Transport is added": function (logger) { - assert.throws(function () { logger.add(winston.transports.Console) }, Error); - }, - "the log() method": { - topic: function (logger) { - logger.once('logging', this.callback); - logger.log('info', 'test message'); - }, - "should emit the 'log' event with the appropriate transport": function (transport, ign) { - helpers.assertConsole(transport); - } - }, - "the profile() method": { - "when passed a callback": { - topic: function (logger) { - var that = this; - logger.profile('test1'); - setTimeout(function () { - logger.profile('test1', function (err, level, msg, meta) { - that.callback(err, level, msg, meta, logger); - }); - }, 1000); - }, - "should respond with the appropriate profile message": function (err, level, msg, meta, logger) { - assert.isNull(err); - assert.equal(level, 'info'); - assert.match(meta.duration, /(\d+)ms/); - assert.isTrue(typeof logger.profilers['test'] === 'undefined'); - } - }, - "when not passed a callback": { - topic: function (logger) { - var that = this; - logger.profile('test2'); - logger.once('logging', that.callback.bind(null, null)); - setTimeout(function () { - logger.profile('test2'); - }, 1000); - }, - "should respond with the appropriate profile message": function (err, transport, level, msg, meta) { - assert.isNull(err); - assert.equal(level, 'info'); - assert.match(meta.duration, /(\d+)ms/); - } - } - }, - "the startTimer() method": { - "when passed a callback": { - topic: function (logger) { - var that = this; - var timer = logger.startTimer() - setTimeout(function () { - timer.done('test', function (err, level, msg, meta) { - that.callback(err, level, msg, meta, logger); - }); - }, 1000); - }, - "should respond with the appropriate message": function (err, level, msg, meta, logger) { - assert.isNull(err); - assert.equal(level, 'info'); - assert.match(meta.duration, /(\d+)ms/); - } - }, - "when not passed a callback": { - topic: function (logger) { - var that = this; - var timer = logger.startTimer() - logger.once('logging', that.callback.bind(null, null)); - setTimeout(function () { - timer.done(); - }, 1000); - }, - "should respond with the appropriate message": function (err, transport, level, msg, meta) { - assert.isNull(err); - assert.equal(level, 'info'); - assert.match(meta.duration, /(\d+)ms/); - - var duration = parseInt(meta.duration); - assert.isNumber(duration); - assert.isTrue(duration > 900 && duration < 1100); - } - } - }, - "and adding an additional transport": { - topic: function (logger) { - return logger.add(winston.transports.File, { - filename: path.join(__dirname, 'fixtures', 'logs', 'testfile2.log') - }); - }, - "should be able to add multiple transports": function (logger) { - assert.equal(helpers.size(logger.transports), 2); - helpers.assertConsole(logger.transports.console); - helpers.assertFile(logger.transports.file); - } - } - } - } -}).addBatch({ - "The winston logger": { - topic: new (winston.Logger)({ - transports: [ - new (winston.transports.Console)(), - new (winston.transports.File)({ filename: path.join(__dirname, 'fixtures', 'logs', 'filelog.log' )}) - ] - }), - "should return have two transports": function (logger) { - assert.equal(helpers.size(logger.transports), 2); - }, - "the remove() with an unadded transport": { - "should throw an Error": function (logger) { - assert.throws(function () { logger.remove(winston.transports.Loggly) }, Error); - } - }, - "the remove() method with an added transport": { - topic: function (logger) { - return logger.remove(winston.transports.Console); - }, - "should remove the Console transport from transports": function (logger) { - assert.equal(helpers.size(logger.transports), 1); - helpers.assertFile(logger.transports.file); - }, - "and removing an additional transport": { - topic: function (logger) { - return logger.remove(winston.transports.File); - }, - "should remove File transport from transports": function (logger) { - assert.equal(helpers.size(logger.transports), 0); - } - } - } - } -}).addBatch({ - "The winston logger": { - topic: new (winston.Logger)({ - transports: [ - new (winston.transports.Console)(), - new (winston.transports.File)({ filename: path.join(__dirname, 'fixtures', 'logs', 'filelog.log' )}) - ] - }), - "the clear() method": { - "should remove all transports": function (logger) { - logger.clear(); - assert.equal(helpers.size(logger.transports), 0); - } - } - } -}).export(module); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/transports/console-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/transports/console-test.js deleted file mode 100644 index 07f5a6e..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/transports/console-test.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * console-test.js: Tests for instances of the Console transport - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - winston = require('../../lib/winston'), - helpers = require('../helpers'); - -var npmTransport = new (winston.transports.Console)(), - syslogTransport = new (winston.transports.Console)({ levels: winston.config.syslog.levels }); - -vows.describe('winston/transports/console').addBatch({ - "An instance of the Console Transport": { - "with npm levels": { - "should have the proper methods defined": function () { - helpers.assertConsole(npmTransport); - }, - "the log() method": helpers.testNpmLevels(npmTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - }, - "with syslog levels": { - "should have the proper methods defined": function () { - helpers.assertConsole(syslogTransport); - }, - "the log() method": helpers.testSyslogLevels(syslogTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/transports/couchdb-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/transports/couchdb-test.js deleted file mode 100644 index d0057e8..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/transports/couchdb-test.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * couchdb-test.js: Tests for instances of the Couchdb transport - * - * (C) 2011 Max Ogden - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - fs = require('fs'), - http = require('http'), - assert = require('assert'), - winston = require('../../lib/winston'), - helpers = require('../helpers'); - -var couchdbTransport = new (winston.transports.Couchdb)({ - "host": "localhost", - "port": 4567, - "db": "logs" -}); - -var server = http.createServer(function (req, res) { - res.end(); -}); - -server.listen(4567); - -vows.describe('winston/transports/couchdb').addBatch({ - "An instance of the Couchdb Transport": { - "when passed valid options": { - "should have the proper methods defined": function () { - helpers.assertCouchdb(couchdbTransport); - }, - "the log() method": helpers.testNpmLevels(couchdbTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - } - } -}).addBatch({ - "When the tests are over": { - "the server should cleanup": function () { - server.close(); - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/transports/file-maxfiles-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/transports/file-maxfiles-test.js deleted file mode 100644 index a9fa89e..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/transports/file-maxfiles-test.js +++ /dev/null @@ -1,102 +0,0 @@ -/* - * file-maxfiles-test.js: Tests for instances of the File transport setting the max file size, - * and setting a number for max files created. - * maxSize * maxFiles = total storage used by winston. - * - * (C) 2011 Daniel Aristizabal - * MIT LICENSE - * - */ - -var assert = require('assert'), - exec = require('child_process').exec, - fs = require('fs'), - path = require('path'), - vows = require('vows'), - winston = require('../../lib/winston'), - helpers = require('../helpers'); - -var maxfilesTransport = new winston.transports.File({ - timestamp: false, - json: false, - filename: path.join(__dirname, '..', 'fixtures', 'logs', 'testmaxfiles.log'), - maxsize: 4096, - maxFiles: 3 -}); - -vows.describe('winston/transports/file/maxfiles').addBatch({ - "An instance of the File Transport": { - "when passed a valid filename": { - topic: maxfilesTransport, - "should be a valid transporter": function (transportTest) { - helpers.assertFile(transportTest); - }, - "should set the maxFiles option correctly": function (transportTest) { - assert.isNumber(transportTest.maxFiles); - } - }, - "when delete old test files": { - topic: function () { - exec('rm -rf ' + path.join(__dirname, '..', 'fixtures', 'logs', 'testmaxfiles*'), this.callback); - }, - "and when passed more files than the maxFiles": { - topic: function () { - var that = this, - created = 0; - - function data(ch) { - return new Array(1018).join(String.fromCharCode(65 + ch)); - }; - - function logKbytes(kbytes, txt) { - // - // With no timestamp and at the info level, - // winston adds exactly 7 characters: - // [info](4)[ :](2)[\n](1) - // - for (var i = 0; i < kbytes; i++) { - maxfilesTransport.log('info', data(txt), null, function () { }); - } - } - - maxfilesTransport.on('logged', function () { - if (++created === 6) { - return that.callback(); - } - - logKbytes(4, created); - }); - - logKbytes(4, created); - }, - "should be only 3 files called 5.log, 4.log and 3.log": function () { - for (var num = 0; num < 6; num++) { - var file = !num ? 'testmaxfiles.log' : 'testmaxfiles' + num + '.log', - fullpath = path.join(__dirname, '..', 'fixtures', 'logs', file); - - // There should be no files with that name - if (num >= 0 && num < 3) { - return assert.throws(function () { - fs.statSync(file); - }, Error); - } - - // The other files should be exist - assert.doesNotThrow(function () { - fs.statSync(file); - }, Error); - } - }, - "should have the correct content": function () { - ['D', 'E', 'F'].forEach(function (name, inx) { - var counter = inx + 3, - logsDir = path.join(__dirname, '..', 'fixtures', 'logs'), - content = fs.readFileSync(path.join(logsDir, 'testmaxfiles' + counter + '.log'), 'utf-8'); - // The content minus the 7 characters added by winston - assert.lengthOf(content.match(new RegExp(name, 'g')), 4068); - }); - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/transports/file-maxsize-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/transports/file-maxsize-test.js deleted file mode 100644 index 7d20e08..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/transports/file-maxsize-test.js +++ /dev/null @@ -1,82 +0,0 @@ -/* - * file-test.js: Tests for instances of the File transport - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var assert = require('assert'), - exec = require('child_process').exec, - fs = require('fs'), - path = require('path'), - vows = require('vows'), - winston = require('../../lib/winston'), - helpers = require('../helpers'); - -var maxsizeTransport = new winston.transports.File({ - timestamp: false, - json: false, - filename: path.join(__dirname, '..', 'fixtures', 'logs', 'testmaxsize.log'), - maxsize: 4096 -}); - -vows.describe('winston/transports/file/maxsize').addBatch({ - "An instance of the File Transport": { - "when passed a valid filename": { - "the log() method": { - topic: function () { - exec('rm -rf ' + path.join(__dirname, '..', 'fixtures', 'logs', 'testmaxsize*'), this.callback); - }, - "when passed more than the maxsize": { - topic: function () { - var that = this, - data = new Array(1018).join('-'); - - // - // Setup a list of files which we will later stat. - // - that.files = []; - - function logKbytes (kbytes) { - // - // With no timestamp and at the info level, - // winston adds exactly 7 characters: - // [info](4)[ :](2)[\n](1) - // - for (var i = 0; i < kbytes; i++) { - maxsizeTransport.log('info', data, null, function () { }); - } - } - - maxsizeTransport.on('open', function (file) { - var match = file.match(/(\d+)\.log$/), - count = match ? match[1] : 0; - - that.files.push(file); - - if (that.files.length === 5) { - return that.callback(); - } - - logKbytes(4); - }); - - logKbytes(4); - }, - "should create multiple files correctly": function () { - this.files.forEach(function (file) { - try { - var stats = fs.statSync(file); - assert.equal(stats.size, 4096); - } - catch (ex) { - assert.isNull(ex); - } - }); - } - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/transports/file-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/transports/file-test.js deleted file mode 100644 index c287794..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/transports/file-test.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * file-test.js: Tests for instances of the File transport - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - fs = require('fs'), - assert = require('assert'), - winston = require('../../lib/winston'), - helpers = require('../helpers'); - -var stream = fs.createWriteStream(path.join(__dirname, '..', 'fixtures', 'logs', 'testfile.log')), - fileTransport = new (winston.transports.File)({ filename: path.join(__dirname, '..', 'fixtures', 'logs', 'testfilename.log') }), - streamTransport = new (winston.transports.File)({ stream: stream }); - -vows.describe('winston/transports/file').addBatch({ - "An instance of the File Transport": { - "when passed a valid filename": { - "should have the proper methods defined": function () { - helpers.assertFile(fileTransport); - }, - "the log() method": helpers.testNpmLevels(fileTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - }, - "when passed a valid file stream": { - "should have the proper methods defined": function () { - helpers.assertFile(streamTransport); - }, - "the log() method": helpers.testNpmLevels(streamTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - } - } -}).addBatch({ - "These tests have a non-deterministic end": { - topic: function () { - setTimeout(this.callback, 200); - }, - "and this should be fixed before releasing": function () { - assert.isTrue(true); - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/transports/loggly-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/transports/loggly-test.js deleted file mode 100644 index 8271b90..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/transports/loggly-test.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * loggly-test.js: Tests for instances of the Loggly transport - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - winston = require('../../lib/winston'), - helpers = require('../helpers'); - -var config = helpers.loadConfig(); - -if (!config) { - return; -} - -var tokenTransport = new (winston.transports.Loggly)({ - subdomain: config.transports.loggly.subdomain, - inputToken: config.transports.loggly.inputToken - }), - nameTransport = new (winston.transports.Loggly)({ - subdomain: config.transports.loggly.subdomain, - inputName: config.transports.loggly.inputName, - auth: config.transports.loggly.auth - }); - -vows.describe('winston/transports/loggly').addBatch({ - "An instance of the Loggly Transport": { - "when passed an input token": { - "should have the proper methods defined": function () { - helpers.assertLoggly(tokenTransport); - }, - "the log() method": helpers.testNpmLevels(tokenTransport, "should log messages to loggly", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }), - "the log() method with no metadata": { - topic: function () { - tokenTransport.log('info', 'test-message', null, this.callback.bind(null, null)); - }, - "should respond immediately": function () { - assert.isTrue(true); - } - } - }, - "when passed an input name": { - "should have the proper methods defined": function () { - helpers.assertLoggly(nameTransport); - }, - "the log() method": helpers.testNpmLevels(nameTransport, "should log messages to loggly", function (ign, err, result) { - assert.isNull(err); - assert.isTrue(result === true || result.response === 'ok'); - }) - } - } -}).export(module); - diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/transports/webhook-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/transports/webhook-test.js deleted file mode 100644 index e106374..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/transports/webhook-test.js +++ /dev/null @@ -1,119 +0,0 @@ -/* - * webhook-test.js: Tests for instances of the Webhook transport - * - * (C) 2011 Marak Squires - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - fs = require('fs'), - http = require('http'), - https = require('https'), - assert = require('assert'), - winston = require('../../lib/winston'), - helpers = require('../helpers'); - -var webhookTransport = new (winston.transports.Webhook)({ - "host": "localhost", - "port": 8080, - "path": "/winston-test" -}); - -var httpsWebhookTransport = new (winston.transports.Webhook)({ - "host": "localhost", - "port": 8081, - "path": "/winston-test", - "ssl": true -}); - -var authWebhookTransport = new (winston.transports.Webhook)({ - "host": "localhost", - "port": 8080, - "path": "/winston-auth-test", - "auth": { - "username": "winston", - "password": "churchill" - } -}); - -var requestsAuthenticated = true; - -var server = http.createServer(function (req, res) { - if (req.url == '/winston-auth-test') { - // - // Test if request has been correctly authenticated - // - // Strip 'Basic' from Authorization header - var signature = req.headers['authorization'].substr(6); - requestsAuthenticated = requestsAuthenticated && - new Buffer(signature, 'base64').toString('utf8') == 'winston:churchill'; - } - res.end(); -}); - -server.listen(8080); - - -var httpsServer = https.createServer({ - cert: fs.readFileSync(path.join(__dirname, '..', 'fixtures', 'keys', 'agent2-cert.pem')), - key: fs.readFileSync(path.join(__dirname, '..', 'fixtures', 'keys', 'agent2-key.pem')) -}, function (req, res) { - res.end(); -}); - -httpsServer.listen(8081); - -vows.describe('winston/transports/webhook').addBatch({ - "An instance of the Webhook Transport": { - "when passed valid options": { - "should have the proper methods defined": function () { - helpers.assertWebhook(webhookTransport); - }, - "the log() method": helpers.testNpmLevels(webhookTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - } - }, - "An https instance of the Webhook Transport": { - "when passed valid options": { - "should have the proper methods defined": function () { - helpers.assertWebhook(httpsWebhookTransport); - }, - "the log() method": helpers.testNpmLevels(httpsWebhookTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - } - }, - "An http Basic Auth instance of the Webhook Transport": { - "when passed valid options": { - "should have the proper methods defined": function () { - helpers.assertWebhook(authWebhookTransport); - }, - "the log() method": helpers.testNpmLevels(authWebhookTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - } - } -}).addBatch({ - "When the tests are over": { - topic: function () { - // - // Delay destruction of the server since the - // WebHook transport responds before the request - // has actually be completed. - // - setTimeout(this.callback, 1000); - }, - "the server should cleanup": function () { - server.close(); - }, - "requests have been correctly authenticated": function () { - assert.ok(requestsAuthenticated); - } - } -}).export(module); diff --git a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/winston-test.js b/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/winston-test.js deleted file mode 100644 index e790cb9..0000000 --- a/node_modules/flatiron/node_modules/broadway/node_modules/winston/test/winston-test.js +++ /dev/null @@ -1,100 +0,0 @@ -/* - * logger-test.js: Tests for instances of the winston Logger - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var fs = require('fs'), - path = require('path'), - vows = require('vows'), - http = require('http'), - assert = require('assert'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -vows.describe('winston').addBatch({ - "The winston module": { - topic: function () { - winston.default.transports.console.level = 'silly'; - return null; - }, - "should have the correct methods defined": function () { - assert.isObject(winston.transports); - assert.isFunction(winston.Transport); - assert.isTrue(!winston.transports.Transport); - assert.isFunction(winston.transports.Console); - assert.isFunction(winston.transports.File); - assert.isFunction(winston.transports.Loggly); - assert.isFunction(winston.transports.Webhook); - assert.isObject(winston.default.transports.console); - assert.isFalse(winston.emitErrs); - assert.isObject(winston.config); - ['Logger', 'add', 'remove', 'extend'] - .concat(Object.keys(winston.config.npm.levels)) - .forEach(function (key) { - assert.isFunction(winston[key]); - }); - }, - "it should": { - topic: function () { - fs.readFile(path.join(__dirname, '..', 'package.json'), this.callback); - }, - "have the correct version set": function (err, data) { - assert.isNull(err); - data = JSON.parse(data.toString()); - assert.equal(winston.version, data.version); - } - }, - "the log() method": helpers.testNpmLevels(winston, "should respond without an error", function (err) { - assert.isNull(err); - }), - "the extend() method called on an empty object": { - topic: function (logger) { - var empty = {}; - winston.extend(empty); - return empty; - }, - "should define the appropriate methods": function (extended) { - ['log', 'profile', 'startTimer'].concat(Object.keys(winston.config.npm.levels)).forEach(function (method) { - assert.isFunction(extended[method]); - }); - } - } - } -}).addBatch({ - "The winston module": { - "the setLevels() method": { - topic: function () { - winston.setLevels(winston.config.syslog.levels); - return null; - }, - "should have the proper methods defined": function () { - assert.isObject(winston.transports); - assert.isFunction(winston.transports.Console); - assert.isFunction(winston.transports.Loggly); - assert.isFunction(winston.transports.Webhook); - assert.isObject(winston.default.transports.console); - assert.isFalse(winston.emitErrs); - assert.isObject(winston.config); - - var newLevels = Object.keys(winston.config.syslog.levels); - ['Logger', 'add', 'remove', 'extend'] - .concat(newLevels) - .forEach(function (key) { - assert.isFunction(winston[key]); - }); - - - Object.keys(winston.config.npm.levels) - .filter(function (key) { - return newLevels.indexOf(key) === -1; - }) - .forEach(function (key) { - assert.isTrue(typeof winston[key] === 'undefined'); - }); - } - } - } -}).export(module); diff --git a/node_modules/flatiron/node_modules/broadway/package.json b/node_modules/flatiron/node_modules/broadway/package.json deleted file mode 100644 index b1bab41..0000000 --- a/node_modules/flatiron/node_modules/broadway/package.json +++ /dev/null @@ -1,51 +0,0 @@ -{ - "name": "broadway", - "description": "Lightweight application extensibility and composition with a twist of feature reflection.", - "author": { - "name": "Nodejitsu Inc.", - "email": "info@nodejitsu.com" - }, - "version": "0.1.14", - "contributors": [ - { - "name": "Charlie Robbins", - "email": "charlie@nodejitsu.com" - }, - { - "name": "Paolo Fragomeni", - "email": "paolo@nodejitsu.com" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/flatiron/broadway.git" - }, - "dependencies": { - "colors": "0.6.0-1", - "cliff": "0.1.7", - "eventemitter2": "0.4.9", - "nconf": "0.5.1", - "optimist": "0.3.1", - "winston": "0.5.10", - "utile": "0.0.10" - }, - "devDependencies": { - "codesurgeon": "0.2.x", - "uglify-js": "1.0.6", - "vows": "0.6.x" - }, - "scripts": { - "test": "vows test/**/*-test.js --spec -i" - }, - "main": "./lib/broadway", - "engines": { - "node": ">= 0.4.0" - }, - "_id": "broadway@0.1.14", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "broadway@0.1.14" -} diff --git a/node_modules/flatiron/node_modules/broadway/test/common/directories-test.js b/node_modules/flatiron/node_modules/broadway/test/common/directories-test.js deleted file mode 100644 index e024cef..0000000 --- a/node_modules/flatiron/node_modules/broadway/test/common/directories-test.js +++ /dev/null @@ -1,66 +0,0 @@ -/* - * directories-test.js: Tests for working with directories in broadway. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - fs = require('fs'), - path = require('path'), - vows = require('vows'), - broadway = require('../../lib/broadway'); - -var fixturesDir = path.join(__dirname, '..', 'fixtures'), - emptyAppDir = path.join(fixturesDir, 'empty-app'), - emptyAppFile = path.join(fixturesDir, 'sample-app.json'), - appConfig = JSON.parse(fs.readFileSync(emptyAppFile, 'utf8')), - directories = appConfig.directories; - -vows.describe('broadway/common/directories').addBatch({ - "When using broadway.common.directories": { - "it should have the correct methods defined": function () { - assert.isObject(broadway.common.directories); - assert.isFunction(broadway.common.directories.create); - assert.isFunction(broadway.common.directories.remove); - }, - "the normalize() method should correctly modify a set of directories": function () { - directories = broadway.common.directories.normalize(emptyAppDir, directories); - - Object.keys(directories).forEach(function (key) { - assert.isTrue(directories[key].indexOf(emptyAppDir) !== -1); - }); - }, - "the create() method": { - topic: function () { - broadway.common.directories.create(directories, this.callback); - }, - "should create the specified directories": function (err, dirs) { - assert.isTrue(!err); - - var exists = false; - dirs.forEach(function (dir) { - exists = path.existsSync(dir); - }); - - assert.isTrue(exists); - }, - "the destroy() method": { - topic: function () { - broadway.common.directories.remove(directories, this.callback); - }, - "should remove the specified directories": function (err, dirs) { - assert.isTrue(!err); - - var exists = true; - dirs.forEach(function (dir) { - exists = path.existsSync(dir); - }); - - assert.isFalse(exists); - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/test/core/app-init-test.js b/node_modules/flatiron/node_modules/broadway/test/core/app-init-test.js deleted file mode 100644 index 9a6554c..0000000 --- a/node_modules/flatiron/node_modules/broadway/test/core/app-init-test.js +++ /dev/null @@ -1,66 +0,0 @@ -/* - * app-test.js: Tests for core App methods and configuration. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var events = require('eventemitter2'), - vows = require('vows'), - assert = require('../helpers/assert'), - broadway = require('../../lib/broadway'); - -vows.describe('broadway/app').addBatch({ - "An initialized instance of broadway.App with two plugins": { - topic: function () { - var app = new broadway.App(); - - // First plugin. Includes an init step. - app.use({ - 'attach': function () { - this.place = 'rackspace'; - }, - - 'init': function (cb) { - var self = this; - - // a nextTick isn't technically necessary, but it does make this - // purely async. - process.nextTick(function () { - self.letsGo = function () { - return 'Let\'s go to '+self.place+'!'; - } - - cb(); - }); - } - }); - - // Second plugin. Only involves an "attach". - app.use({ - 'attach': function () { - this.oneup = function (n) { - n++; - return n; - } - } - }); - - var that = this; - app.init(function (err) { - that.callback(err, app); - }); - }, - "shouldn't throw an error": function (err, app) { - assert.ok(!err); - }, - "should have all its methods attached/defined": function (err, app) { - assert.ok(app.place); - assert.isFunction(app.oneup); - assert.isFunction(app.letsGo); - assert.equal(2, app.oneup(1)); - assert.equal(app.letsGo(), 'Let\'s go to rackspace!'); - }, - } -}).export(module); diff --git a/node_modules/flatiron/node_modules/broadway/test/core/app-test.js b/node_modules/flatiron/node_modules/broadway/test/core/app-test.js deleted file mode 100644 index 90bc477..0000000 --- a/node_modules/flatiron/node_modules/broadway/test/core/app-test.js +++ /dev/null @@ -1,74 +0,0 @@ -/* - * app-test.js: Tests for core App methods and configuration. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var events = require('eventemitter2'), - vows = require('vows'), - assert = require('../helpers/assert'), - broadway = require('../../lib/broadway'); - -vows.describe('broadway/app').addBatch({ - "An instance of broadway.App": { - topic: new broadway.App(), - "should have the correct properties and methods": function (app) { - // - // Instance - // - assert.isObject(app); - assert.instanceOf(app, events.EventEmitter2); - assert.instanceOf(app, broadway.App); - - // - // Properties - // - assert.isObject(app.plugins); - assert.isObject(app.initializers); - assert.isFalse(!!app.initialized); - - // - // Methods - // - assert.isFunction(app.init); - assert.isFunction(app.use); - assert.isFunction(app.remove); - assert.isFunction(app.inspect); - }, - "the init() method": { - topic: function (app) { - this.app = app; - app.init(this.callback); - }, - "should correctly setup the application state": function () { - assert.isTrue(this.app.initialized); - assert.isTrue(this.app.initializers['exceptions']); - assert.isTrue(this.app.initializers['log']); - - assert.plugins.has.config(this.app); - assert.plugins.has.log(this.app); - } - }, - "the detach() method": { - topic: function (app) { - app.use({ - name: "foo", - attach: function () { - this.attached = true; - }, - detach: function () { - this.detached = true; - } - }); - app.remove("foo"); - return app; - }, - "should correctly remove a plugin": function (app) { - assert.isTrue(app.detached); - assert.equal(undefined, app.plugins["foo"]); - } - } - } -}).export(module); diff --git a/node_modules/flatiron/node_modules/broadway/test/core/broadway-test.js b/node_modules/flatiron/node_modules/broadway/test/core/broadway-test.js deleted file mode 100644 index d69bc6f..0000000 --- a/node_modules/flatiron/node_modules/broadway/test/core/broadway-test.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * broadway-test.js: Tests for core App methods and configuration. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - events = require('eventemitter2'), - vows = require('vows'), - broadway = require('../../lib/broadway'); - -vows.describe('broadway').addBatch({ - "The broadway module": { - "should have the appropriate properties and methods defined": function () { - assert.isFunction(broadway.App); - assert.isObject(broadway.common); - assert.isObject(broadway.features); - assert.isObject(broadway.plugins); - assert.isObject(broadway.plugins.log); - assert.isObject(broadway.plugins.config); - assert.isObject(broadway.plugins.exceptions); - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/test/fixtures/.gitkeep b/node_modules/flatiron/node_modules/broadway/test/fixtures/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/flatiron/node_modules/broadway/test/fixtures/empty-app/.gitkeep b/node_modules/flatiron/node_modules/broadway/test/fixtures/empty-app/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/flatiron/node_modules/broadway/test/fixtures/sample-app.json b/node_modules/flatiron/node_modules/broadway/test/fixtures/sample-app.json deleted file mode 100644 index 24545f9..0000000 --- a/node_modules/flatiron/node_modules/broadway/test/fixtures/sample-app.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "directories": { - "app": "#ROOT/app", - "config": "#ROOT/config", - "lib": "#ROOT/lib", - "test": "#ROOT/test" - } -} \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/test/fixtures/sample-app/app/index.js b/node_modules/flatiron/node_modules/broadway/test/fixtures/sample-app/app/index.js deleted file mode 100644 index 7daf464..0000000 --- a/node_modules/flatiron/node_modules/broadway/test/fixtures/sample-app/app/index.js +++ /dev/null @@ -1,2 +0,0 @@ - -var broadway = require("../../../") \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/test/fixtures/sample-app/config/topics.json b/node_modules/flatiron/node_modules/broadway/test/fixtures/sample-app/config/topics.json deleted file mode 100644 index 9a6f6fb..0000000 --- a/node_modules/flatiron/node_modules/broadway/test/fixtures/sample-app/config/topics.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "topics": [ - - ] -} \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/test/helpers/assert.js b/node_modules/flatiron/node_modules/broadway/test/helpers/assert.js deleted file mode 100644 index bad9451..0000000 --- a/node_modules/flatiron/node_modules/broadway/test/helpers/assert.js +++ /dev/null @@ -1,107 +0,0 @@ -/* - * assert.js: Assertion helpers for broadway tests - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = module.exports = require('assert'), - fs = require('fs'), - path = require('path'), - nconf = require('nconf'), - vows = require('vows'); - -// -// ### Assertion helpers for working with `broadway.App` objects. -// -assert.app = {}; - -// -// ### Assertion helpers for working with `broadway.plugins`. -// -assert.plugins = {}; - -// -// ### Assert that an application has various plugins. -// -assert.plugins.has = { - config: function (app, config) { - assert.instanceOf(app.config, nconf.Provider); - if (config) { - // - // TODO: Assert that all configuration has been loaded - // - } - }, - exceptions: function (app) { - - }, - directories: function (app) { - if (app.options['directories']) { - Object.keys(app.options['directories']).forEach(function (key) { - assert.isTrue(path.existsSync(app.options['directories'][key])); - }); - } - //assert.isTrue(!!app.config.get('directories')) - }, - log: function (app) { - assert.isObject(app.log); - - // - // TODO: Assert winston.extend methods - // - } -}; - -// -// ### Assert that an application doesn't have various plugins -// -assert.plugins.notHas = { - config: function (app) { - assert.isTrue(!app.config); - }, - exceptions: function (app) { - - }, - directories: function (app) { - assert.isTrue(!app.config.get('directories')) - }, - log: function (app) { - assert.isTrue(!app.log); - // - // TODO: Assert winston.extend methods - // - } -}; - -assert.log = {}; - -assert.log.levelMsgMeta = function (err, level, msg, meta) { - assert.equal(level, this.event[1]); - assert.equal(msg, this.event[2]); - assert.equal(meta, this.event[3]); -}; - -assert.log.msgMeta = function (err, level, msg, meta) { - assert.equal(level, this.event[0].split('::')[1] || 'info'); - assert.equal(msg, this.event[1]); - assert.equal(meta, this.event[2]); -}; - -assert.log.levelMeta = function (err, level, msg, meta) { - assert.equal(level, this.event[1]); - assert.equal(msg, this.event[0]); - assert.deepEqual(meta, this.event[2]); -}; - -assert.log.levelMsg = function (err, level, msg, meta) { - assert.equal(level, this.event[1]); - assert.equal(msg, this.event[2]); -}; - -assert.log.metaOnly = function (err, level, msg, meta) { - assert.equal(level, 'info'); - assert.equal(msg, this.event[0]); - assert.equal(meta, this.event[1]); -} \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/test/helpers/helpers.js b/node_modules/flatiron/node_modules/broadway/test/helpers/helpers.js deleted file mode 100644 index 9dbdea4..0000000 --- a/node_modules/flatiron/node_modules/broadway/test/helpers/helpers.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * helpers.js: Test helpers for using broadway. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var events = require('eventemitter2'), - broadway = require('../../lib/broadway'); - -var helpers = exports; - -helpers.findApp = function () { - return Array.prototype.slice.call(arguments).filter(function (arg) { - return arg instanceof events.EventEmitter2; - })[0]; -}; - -helpers.mockApp = function () { - var mock = new events.EventEmitter2({ delimiter: '::', wildcard: true }); - mock.options = {}; - return mock; -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/test/helpers/macros.js b/node_modules/flatiron/node_modules/broadway/test/helpers/macros.js deleted file mode 100644 index 8e5e855..0000000 --- a/node_modules/flatiron/node_modules/broadway/test/helpers/macros.js +++ /dev/null @@ -1,74 +0,0 @@ -/* - * macros.js: Test macros for using broadway and vows - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var events = require('eventemitter2'), - assert = require('./assert'), - helpers = require('./helpers'), - broadway = require('../../lib/broadway'); - -var macros = exports; - -macros.shouldExtend = function (app, plugin, vows) { - if (arguments.length === 1) { - plugin = app; - app = vows = null; - } - else if (arguments.length === 2) { - app = helpers.mockApp(); - vows = plugin; - plugin = app; - } - - var context = { - topic: function () { - app = app || helpers.mockApp(); - broadway.plugins[plugin].attach.call(app, app.options[plugin] || {}); - - if (broadway.plugins[plugin].init) { - return broadway.plugins[plugin].init.call(app, this.callback.bind(this, null, app)); - } - - this.callback(null, app); - }, - "should add the appropriate properties and methods": function (_, app) { - assert.plugins.has[plugin](app); - } - } - - return extendContext(context, vows); -}; - -macros.shouldLogEvent = function (app, event, vow) { - return { - topic: function () { - app = app || helpers.findApp.apply(null, arguments); - var logger = app.log.get('default'); - - this.event = event; - app.once('broadway::logged', this.callback.bind(this, null)); - app.emit.apply(app, event); - }, - "should log the appropriate info": vow - }; -}; - -function extendContext (context, vows) { - if (vows) { - if (vows.topic) { - console.log('Cannot include topic at top-level of nested vows:'); - console.dir(vows, 'vows'); - process.exit(1); - } - - Object.keys(vows).forEach(function (key) { - context[key] = vows[key]; - }); - } - - return context; -} \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/test/plugins/config-test.js b/node_modules/flatiron/node_modules/broadway/test/plugins/config-test.js deleted file mode 100644 index 94af81e..0000000 --- a/node_modules/flatiron/node_modules/broadway/test/plugins/config-test.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * log-test.js: Tests for the broadway config plugin - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var vows = require('vows'), - events = require('eventemitter2'), - assert = require('../helpers/assert'), - macros = require('../helpers/macros'), - broadway = require('../../lib/broadway'); - -vows.describe('broadway/plugins/config').addBatch({ - "Using the config plugin": { - "extending an application": macros.shouldExtend('config') - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/test/plugins/directories-test.js b/node_modules/flatiron/node_modules/broadway/test/plugins/directories-test.js deleted file mode 100644 index 72833f4..0000000 --- a/node_modules/flatiron/node_modules/broadway/test/plugins/directories-test.js +++ /dev/null @@ -1,28 +0,0 @@ -/* - * directories-test.js: Tests for working with directories in broadway. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - fs = require('fs'), - path = require('path'), - vows = require('vows'), - broadway = require('../../lib/broadway'), - macros = require('../helpers/macros'); - -var fixturesDir = path.join(__dirname, '..', 'fixtures'), - emptyAppDir = path.join(fixturesDir, 'empty-app'), - emptyAppFile = path.join(fixturesDir, 'sample-app.json'), - appConfig = JSON.parse(fs.readFileSync(emptyAppFile, 'utf8'));; - -vows.describe('broadway/plugins/directories').addBatch({ - "Using the config plugin": { - "extending an application": macros.shouldExtend(new broadway.App({ - root: emptyAppDir, - directories: appConfig.directories - }), 'directories', {}) - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/broadway/test/plugins/log-test.js b/node_modules/flatiron/node_modules/broadway/test/plugins/log-test.js deleted file mode 100644 index 7e2ac3e..0000000 --- a/node_modules/flatiron/node_modules/broadway/test/plugins/log-test.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * log-test.js: Tests for the broadway logger plugin - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var vows = require('vows'), - events = require('eventemitter2'), - assert = require('../helpers/assert'), - helpers = require('../helpers/helpers'), - macros = require('../helpers/macros'), - broadway = require('../../lib/broadway'); - -var app = helpers.mockApp(); -app.options = { - log: { - logAll: true, - namespaces: { - 'apps': 'foo' - } - } -}; - -vows.describe('broadway/plugins/log').addBatch({ - "Using the log plugin": { - "to extend an application": macros.shouldExtend(app, 'log', { - "when the application emits log::# events": macros.shouldLogEvent(app, [ - 'log::warn', - 'some warn message', - { foo: 'bar' } - ], assert.log.msgMeta) - }), - "when the application emits log::#::# events": macros.shouldLogEvent(app, [ - 'log::warn::some-category', - 'some warn message', - { foo: 'bar' } - ], assert.log.msgMeta), - "when the application emits log events with": { - "message and meta": macros.shouldLogEvent(app, [ - 'log', - 'some info message', - { foo: 'bar' }, - ], assert.log.msgMeta), - "level and message": macros.shouldLogEvent(app, [ - 'log', - 'silly', - 'some silly message', - ], assert.log.levelMsg), - "level and meta": macros.shouldLogEvent(app, [ - 'log', - 'info', - { foo: 'bar' }, - ], assert.log.levelMeta) - }, - "when the application emits namespaced events with": { - "level and meta": macros.shouldLogEvent(app, [ - 'apps::start', - 'info', - { foo: 'bar' }, - ], assert.log.levelMeta), - "meta only": macros.shouldLogEvent(app, [ - 'apps::start', - { foo: 'bar' }, - ], assert.log.metaOnly) - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/director/.npmignore b/node_modules/flatiron/node_modules/director/.npmignore deleted file mode 100644 index 9702d10..0000000 --- a/node_modules/flatiron/node_modules/director/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -/.idea/ -node_modules -npm-debug.log -.DS_Store \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/director/.travis.yml b/node_modules/flatiron/node_modules/director/.travis.yml deleted file mode 100644 index c958222..0000000 --- a/node_modules/flatiron/node_modules/director/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 - - 0.7 - -notifications: - email: - - travis@nodejitsu.com - irc: "irc.freenode.org#nodejitsu" - diff --git a/node_modules/flatiron/node_modules/director/LICENSE b/node_modules/flatiron/node_modules/director/LICENSE deleted file mode 100644 index 1f01e2b..0000000 --- a/node_modules/flatiron/node_modules/director/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011 Nodejitsu Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/director/README.md b/node_modules/flatiron/node_modules/director/README.md deleted file mode 100644 index 5f7ce8a..0000000 --- a/node_modules/flatiron/node_modules/director/README.md +++ /dev/null @@ -1,677 +0,0 @@ - - - -# Synopsis -Director is a router. Routing is the process of determining what code to run when a URL is requested. - -# Motivation -A routing library that works in both the browser and node.js environments with as few differences as possible. Simplifies the development of Single Page Apps and Node.js applications. Dependency free (doesn't require jQuery or Express, etc). - -# Status -[![Build Status](https://secure.travis-ci.org/flatiron/director.png)](http://travis-ci.org/flatiron/director) - -# Features -* [Client-Side Routing](#client-side) -* [Server-Side HTTP Routing](#http-routing) -* [Server-Side CLI Routing](#cli-routing) - -# Usage -* [API Documentation](#api-documentation) -* [Frequently Asked Questions](#faq) - - -## Client-side Routing -It simply watches the hash of the URL to determine what to do, for example: - -``` -http://foo.com/#/bar -``` - -Client-side routing (aka hash-routing) allows you to specify some information about the state of the application using the URL. So that when the user visits a specific URL, the application can be transformed accordingly. - - - -Here is a simple example: - -```html - - - - - - - - - -``` - -Director works great with your favorite DOM library, such as jQuery. - -```html - - - - - - - -
      Author Name
      -
      Book1, Book2, Book3
      - - -``` - -You can find a browser-specific build of `director` [here][1] which has all of the server code stripped away. - - -## Server-Side HTTP Routing - -Director handles routing for HTTP requests similar to `journey` or `express`: - -```js - // - // require the native http module, as well as director. - // - var http = require('http'), - director = require('director'); - - // - // create some logic to be routed to. - // - function helloWorld(route) { - this.res.writeHead(200, { 'Content-Type': 'text/plain' }) - this.res.end('hello world from (' + route + ')'); - } - - // - // define a routing table. - // - var router = new director.http.Router({ - '/hello': { - get: helloWorld - } - }); - - // - // setup a server and when there is a request, dispatch the - // route that was requestd in the request object. - // - var server = http.createServer(function (req, res) { - router.dispatch(req, res, function (err) { - if (err) { - res.writeHead(404); - res.end(); - } - }); - }); - - // - // You can also do ad-hoc routing, similar to `journey` or `express`. - // This can be done with a string or a regexp. - // - router.get('/bonjour', helloWorld); - router.get(/hola/, helloWorld); - - // - // set the server to listen on port `8080`. - // - server.listen(8080); -``` - - -## CLI Routing - -Director supports Command Line Interface routing. Routes for cli options are based on command line input (i.e. `process.argv`) instead of a URL. - -``` js - var director = require('director'); - - var router = new director.cli.Router(); - - router.on('create', function () { - console.log('create something'); - }); - - router.on(/destroy/, function () { - console.log('destroy something'); - }); - - // You will need to dispatch the cli arguments yourself - router.dispatch('on', process.argv.slice(2).join(' ')); -``` - -Using the cli router, you can dispatch commands by passing them as a string. For example, if this example is in a file called `foo.js`: - -``` bash -$ node foo.js create -create something -$ node foo.js destroy -destroy something -``` - - -# API Documentation - -* [Constructor](#constructor) -* [Routing Table](#routing-table) -* [Adhoc Routing](#adhoc-routing) -* [Scoped Routing](#scoped-routing) -* [Routing Events](#routing-events) -* [Configuration](#configuration) -* [URL Matching](#url-matching) -* [URL Params](#url-params) -* [Route Recursion](#route-recursion) -* [Async Routing](#async-routing) -* [Resources](#resources) -* [Instance Methods](#instance-methods) - - -## Constructor - -``` js - var router = Router(routes); -``` - - -## Routing Table - -An object literal that contains nested route definitions. A potentially nested set of key/value pairs. The keys in the object literal represent each potential part of the URL. The values in the object literal contain references to the functions that should be associated with them. *bark* and *meow* are two functions that you have defined in your code. - -``` js - // - // Assign routes to an object literal. - // - var routes = { - // - // a route which assigns the function `bark`. - // - '/dog': bark, - // - // a route which assigns the functions `meow` and `scratch`. - // - '/cat': [meow, scratch] - }; - - // - // Instantiate the router. - // - var router = Router(routes); -``` - - -## Adhoc Routing - -When developing large client-side or server-side applications it is not always possible to define routes in one location. Usually individual decoupled components register their own routes with the application router. We refer to this as _Adhoc Routing._ Lets take a look at the API `director` exposes for adhoc routing: - -**Client-side Routing** - -``` js - var router = new Router().init(); - - router.on('/some/resource', function () { - // - // Do something on `/#/some/resource` - // - }); -``` - -**HTTP Routing** - -``` js - var router = new director.http.Router(); - - router.get(/\/some\/resource/, function () { - // - // Do something on an GET to `/some/resource` - // - }); -``` - - -## Scoped Routing - -In large web appliations, both [Client-side](#client-side) and [Server-side](#server-side), routes are often scoped within a few individual resources. Director exposes a simple way to do this for [Adhoc Routing](#adhoc-routing) scenarios: - -``` js - var router = new director.http.Router(); - - // - // Create routes inside the `/users` scope. - // - router.path(/\/users\/(\w+)/, function () { - // - // The `this` context of the function passed to `.path()` - // is the Router itself. - // - - this.post(function (id) { - // - // Create the user with the specified `id`. - // - }); - - this.get(function (id) { - // - // Retreive the user with the specified `id`. - // - }); - - this.get(/\/friends/, function (id) { - // - // Get the friends for the user with the specified `id`. - // - }); - }); -``` - - -## Routing Events - -In `director`, a "routing event" is a named property in the [Routing Table](#routing-table) which can be assigned to a function or an Array of functions to be called when a route is matched in a call to `router.dispatch()`. - -* **on:** A function or Array of functions to execute when the route is matched. -* **before:** A function or Array of functions to execute before calling the `on` method(s). - -**Client-side only** - -* **after:** A function or Array of functions to execute when leaving a particular route. -* **once:** A function or Array of functions to execute only once for a particular route. - - -## Configuration - -Given the flexible nature of `director` there are several options available for both the [Client-side](#client-side) and [Server-side](#server-side). These options can be set using the `.configure()` method: - -``` js - var router = new director.Router(routes).configure(options); -``` - -The `options` are: - -* **recurse:** Controls [route recursion](#route-recursion). Use `forward`, `backward`, or `false`. Default is `false` Client-side, and `backward` Server-side. -* **strict:** If set to `false`, then trailing slashes (or other delimiters) are allowed in routes. Default is `true`. -* **async:** Controls [async routing](#async-routing). Use `true` or `false`. Default is `false`. -* **delimiter:** Character separator between route fragments. Default is `/`. -* **notfound:** A function to call if no route is found on a call to `router.dispatch()`. -* **on:** A function (or list of functions) to call on every call to `router.dispatch()` when a route is found. -* **before:** A function (or list of functions) to call before every call to `router.dispatch()` when a route is found. - -**Client-side only** - -* **resource:** An object to which string-based routes will be bound. This can be especially useful for late-binding to route functions (such as async client-side requires). -* **after:** A function (or list of functions) to call when a given route is no longer the active route. - - -## URL Matching - -``` js - var router = Router({ - // - // given the route '/dog/yella'. - // - '/dog': { - '/:color': { - // - // this function will return the value 'yella'. - // - on: function (color) { console.log(color) } - } - } - }); -``` - -Routes can sometimes become very complex, `simple/:tokens` don't always suffice. Director supports regular expressions inside the route names. The values captured from the regular expressions are passed to your listener function. - -``` js - var router = Router({ - // - // given the route '/hello/world'. - // - '/hello': { - '/(\\w+)': { - // - // this function will return the value 'world'. - // - on: function (who) { console.log(who) } - } - } - }); -``` - -``` js - var router = Router({ - // - // given the route '/hello/world/johny/appleseed'. - // - '/hello': { - '/world/?([^\/]*)\/([^\/]*)/?': function (a, b) { - console.log(a, b); - } - } - }); -``` - - -## URL Parameters - -When you are using the same route fragments it is more descriptive to define these fragments by name and then use them in your [Routing Table](#routing-table) or [Adhoc Routes](#adhoc-routing). Consider a simple example where a `userId` is used repeatedly. - -``` js - // - // Create a router. This could also be director.cli.Router() or - // director.http.Router(). - // - var router = new director.Router(); - - // - // A route could be defined using the `userId` explicitly. - // - router.on(/([\w-_]+)/, function (userId) { }); - - // - // Define a shorthand for this fragment called `userId`. - // - router.param('userId', /([\\w\\-]+)/); - - // - // Now multiple routes can be defined with the same - // regular expression. - // - router.on('/anything/:userId', function (userId) { }); - router.on('/something-else/:userId', function (userId) { }); -``` - - -## Route Recursion - -Can be assigned the value of `forward` or `backward`. The recurse option will determine the order in which to fire the listeners that are associated with your routes. If this option is NOT specified or set to null, then only the listeners associated with an exact match will be fired. - -### No recursion, with the URL /dog/angry - -``` js - var routes = { - '/dog': { - '/angry': { - // - // Only this method will be fired. - // - on: growl - }, - on: bark - } - }; - - var router = Router(routes); -``` - -### Recursion set to `backward`, with the URL /dog/angry - -``` js - var routes = { - '/dog': { - '/angry': { - // - // This method will be fired first. - // - on: growl - }, - // - // This method will be fired second. - // - on: bark - } - }; - - var router = Router(routes).configure({ recurse: 'backward' }); -``` - -### Recursion set to `forward`, with the URL /dog/angry - -``` js - var routes = { - '/dog': { - '/angry': { - // - // This method will be fired second. - // - on: growl - }, - // - // This method will be fired first. - // - on: bark - } - }; - - var router = Router(routes).configure({ recurse: 'forward' }); -``` - -### Breaking out of recursion, with the URL /dog/angry - -``` js - var routes = { - '/dog': { - '/angry': { - // - // This method will be fired first. - // - on: function() { return false; } - }, - // - // This method will not be fired. - // - on: bark - } - }; - - // - // This feature works in reverse with recursion set to true. - // - var router = Router(routes).configure({ recurse: 'backward' }); -``` - - -## Async Routing - -Before diving into how Director exposes async routing, you should understand [Route Recursion](#route-recursion). At it's core route recursion is about evaluating a series of functions gathered when traversing the [Routing Table](#routing-table). - -Normally this series of functions is evaluated synchronously. In async routing, these functions are evaluated asynchronously. Async routing can be extremely useful both on the client-side and the server-side: - -* **Client-side:** To ensure an animation or other async operations (such as HTTP requests for authentication) have completed before continuing evaluation of a route. -* **Server-side:** To ensure arbitrary async operations (such as performing authentication) have completed before continuing the evaluation of a route. - -The method signatures for route functions in synchronous and asynchronous evaluation are different: async route functions take an additional `next()` callback. - -### Synchronous route functions - -``` js - var router = new director.Router(); - - router.on('/:foo/:bar/:bazz', function (foo, bar, bazz) { - // - // Do something asynchronous with `foo`, `bar`, and `bazz`. - // - }); -``` - -### Asynchronous route functions - -``` js - var router = new director.http.Router().configure({ async: true }); - - router.on('/:foo/:bar/:bazz', function (foo, bar, bazz, next) { - // - // Go do something async, and determine that routing should stop - // - next(false); - }); -``` - - -## Resources - -**Available on the Client-side only.** An object literal containing functions. If a host object is specified, your route definitions can provide string literals that represent the function names inside the host object. A host object can provide the means for better encapsulation and design. - -``` js - - var router = Router({ - - '/hello': { - '/usa': 'americas', - '/china': 'asia' - } - - }).configure({ resource: container }).init(); - - var container = { - americas: function() { return true; }, - china: function() { return true; } - }; - -``` - - -## Instance methods - -### configure(options) -* `options` {Object}: Options to configure this instance with. - -Configures the Router instance with the specified `options`. See [Configuration](#configuration) for more documentation. - -### param(token, matcher) -* token {string}: Named parameter token to set to the specified `matcher` -* matcher {string|Regexp}: Matcher for the specified `token`. - -Adds a route fragment for the given string `token` to the specified regex `matcher` to this Router instance. See [URL Parameters](#url-parameters) for more documentation. - -### on(method, path, route) -* `method` {string}: Method to insert within the Routing Table (e.g. `on`, `get`, etc.). -* `path` {string}: Path within the Routing Table to set the `route` to. -* `route` {function|Array}: Route handler to invoke for the `method` and `path`. - -Adds the `route` handler for the specified `method` and `path` within the [Routing Table](#routing-table). - -### path(path, routesFn) -* `path` {string|Regexp}: Scope within the Routing Table to invoke the `routesFn` within. -* `routesFn` {function}: Adhoc Routing function with calls to `this.on()`, `this.get()` etc. - -Invokes the `routesFn` within the scope of the specified `path` for this Router instance. - -### dispatch(method, path[, callback]) -* method {string}: Method to invoke handlers for within the Routing Table -* path {string}: Path within the Routing Table to match -* callback {function}: Invoked once all route handlers have been called. - -Dispatches the route handlers matched within the [Routing Table](#routing-table) for this instance for the specified `method` and `path`. - -### mount(routes, path) -* routes {object}: Partial routing table to insert into this instance. -* path {string|Regexp}: Path within the Routing Table to insert the `routes` into. - -Inserts the partial [Routing Table](#routing-table), `routes`, into the Routing Table for this Router instance at the specified `path`. - -## Instance methods (Client-side only) - -### init() -Initialize the router, start listening for changes to the URL. - -### getState() -Returns the state object that is relative to the current route. - -### getRoute([index]) -* `index` {Number}: The hash value is divided by forward slashes, each section then has an index, if this is provided, only that section of the route will be returned. - -Returns the entire route or just a section of it. - -### setRoute(route) -* `route` {String}: Supply a route value, such as `home/stats`. - -Set the current route. - -### setRoute(start, length) -* `start` {Number} - The position at which to start removing items. -* `length` {Number} - The number of items to remove from the route. - -Remove a segment from the current route. - -### setRoute(index, value) -* `index` {Number} - The hash value is divided by forward slashes, each section then has an index. -* `value` {String} - The new value to assign the the position indicated by the first parameter. - -Set a segment of the current route. - - -# Frequently Asked Questions - -## What About SEO? - -Is using a Client-side router a problem for SEO? Yes. If advertising is a requirement, you are probably building a "Web Page" and not a "Web Application". Director on the client is meant for script-heavy Web Applications. - -## Is Director compatible with X? - -Director is known to be Ender.js compatible. However, the project still needs solid cross-browser testing. - -# Licence - -(The MIT License) - -Copyright (c) 2010 Nodejitsu Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -[0]: http://github.com/flatiron/director -[1]: https://github.com/flatiron/director/blob/master/build/director-1.0.7.min.js diff --git a/node_modules/flatiron/node_modules/director/bin/build b/node_modules/flatiron/node_modules/director/bin/build deleted file mode 100755 index d232b84..0000000 --- a/node_modules/flatiron/node_modules/director/bin/build +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env node - -var Codesurgeon = require('codesurgeon').Codesurgeon; -var surgeon = new Codesurgeon; - -var path = require('path'); - -var root = path.join(__dirname, '..'); -var lib = path.join(root, 'lib', 'director'); - -// -// Distill and package the browser version. -// -surgeon - // - .configure({ - package: root + '/package.json', - owner: 'Nodejitsu, Inc (Using Codesurgeon).' - }) - .read( - path.join(lib, 'browser.js') - ) - // - // we want everything so far. specify extract with no - // parameters to get everything into the output buffer. - // - .extract() - // - // clear the input so far, but don't clear the output. - // - .clear('inputs') - // - // read the `router.js` file - // - .read( - path.join(lib, 'router.js') - ) - // - // the current input buffer contains stuff that we dont - // want in the browser build, so let's cherry pick from - // the buffer. - // - .extract( - '_every', - '_flatten', - '_asyncEverySeries', - 'paramifyString', - 'regifyString', - 'Router.prototype.configure', - 'Router.prototype.param', - 'Router.prototype.on', - 'Router.prototype.dispatch', - 'Router.prototype.invoke', - 'Router.prototype.traverse', - 'Router.prototype.insert', - 'Router.prototype.insertEx', - 'Router.prototype.extend', - 'Router.prototype.runlist', - 'Router.prototype.mount' - ) - // - // wrap everything that is in the current buffer with a - // closure so that we dont get any collisions with other - // libraries - // - .wrap() - // - // write the debuggable version of the file. This file will - // get renamed to include the version from the package.json - // - .write(root + '/build/director.js') - // - // now lets make a minified version for production use. - // - .uglify() - .write(root + '/build/director.min.js') -; diff --git a/node_modules/flatiron/node_modules/director/examples/http.js b/node_modules/flatiron/node_modules/director/examples/http.js deleted file mode 100644 index a74fd8e..0000000 --- a/node_modules/flatiron/node_modules/director/examples/http.js +++ /dev/null @@ -1,21 +0,0 @@ -var http = require('http'), - director = require('../lib/director'); - -var router = new director.http.Router(); - -var server = http.createServer(function (req, res) { - router.dispatch(req, res, function (err) { - if (err) { - res.writeHead(404); - res.end(); - } - }); -}); - -router.get(/foo/, function () { - this.res.writeHead(200, { 'Content-Type': 'text/plain' }) - this.res.end('hello world\n'); -}); - -server.listen(8080); -console.log('vanilla http server with director running on 8080'); diff --git a/node_modules/flatiron/node_modules/director/img/director.png b/node_modules/flatiron/node_modules/director/img/director.png deleted file mode 100644 index ce1a92a..0000000 Binary files a/node_modules/flatiron/node_modules/director/img/director.png and /dev/null differ diff --git a/node_modules/flatiron/node_modules/director/img/hashRoute.png b/node_modules/flatiron/node_modules/director/img/hashRoute.png deleted file mode 100644 index f8b29b6..0000000 Binary files a/node_modules/flatiron/node_modules/director/img/hashRoute.png and /dev/null differ diff --git a/node_modules/flatiron/node_modules/director/lib/director.js b/node_modules/flatiron/node_modules/director/lib/director.js deleted file mode 100644 index f43ae82..0000000 --- a/node_modules/flatiron/node_modules/director/lib/director.js +++ /dev/null @@ -1,6 +0,0 @@ - - - -exports.Router = require('./director/router').Router; -exports.http = require('./director/http'); -exports.cli = require('./director/cli'); diff --git a/node_modules/flatiron/node_modules/director/lib/director/browser.js b/node_modules/flatiron/node_modules/director/lib/director/browser.js deleted file mode 100644 index c40b5ff..0000000 --- a/node_modules/flatiron/node_modules/director/lib/director/browser.js +++ /dev/null @@ -1,249 +0,0 @@ - -/* - * browser.js: Browser specific functionality for director. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -if (!Array.prototype.filter) { - Array.prototype.filter = function(filter, that) { - var other = [], v; - for (var i = 0, n = this.length; i < n; i++) { - if (i in this && filter.call(that, v = this[i], i, this)) { - other.push(v); - } - } - return other; - }; -} - -if (!Array.isArray){ - Array.isArray = function(obj) { - return Object.prototype.toString.call(obj) === '[object Array]'; - }; -} - -var dloc = document.location; - -var listener = { - mode: 'modern', - hash: dloc.hash, - - check: function () { - var h = dloc.hash; - if (h != this.hash) { - this.hash = h; - this.onHashChanged(); - } - }, - - fire: function () { - if (this.mode === 'modern') { - window.onhashchange(); - } - else { - this.onHashChanged(); - } - }, - - init: function (fn) { - var self = this; - - if (!window.Router.listeners) { - window.Router.listeners = []; - } - - function onchange() { - for (var i = 0, l = window.Router.listeners.length; i < l; i++) { - window.Router.listeners[i](); - } - } - - //note IE8 is being counted as 'modern' because it has the hashchange event - if ('onhashchange' in window && (document.documentMode === undefined - || document.documentMode > 7)) { - window.onhashchange = onchange; - this.mode = 'modern'; - } - else { - // - // IE support, based on a concept by Erik Arvidson ... - // - var frame = document.createElement('iframe'); - frame.id = 'state-frame'; - frame.style.display = 'none'; - document.body.appendChild(frame); - this.writeFrame(''); - - if ('onpropertychange' in document && 'attachEvent' in document) { - document.attachEvent('onpropertychange', function () { - if (event.propertyName === 'location') { - self.check(); - } - }); - } - - window.setInterval(function () { self.check(); }, 50); - - this.onHashChanged = onchange; - this.mode = 'legacy'; - } - - window.Router.listeners.push(fn); - - return this.mode; - }, - - destroy: function (fn) { - if (!window.Router || !window.Router.listeners) { - return; - } - - var listeners = window.Router.listeners; - - for (var i = listeners.length - 1; i >= 0; i--) { - if (listeners[i] === fn) { - listeners.splice(i, 1); - } - } - }, - - setHash: function (s) { - // Mozilla always adds an entry to the history - if (this.mode === 'legacy') { - this.writeFrame(s); - } - - dloc.hash = (s[0] === '/') ? s : '/' + s; - return this; - }, - - writeFrame: function (s) { - // IE support... - var f = document.getElementById('state-frame'); - var d = f.contentDocument || f.contentWindow.document; - d.open(); - d.write(" - - - - - diff --git a/node_modules/flatiron/node_modules/director/test/browser/adhoc-test.js b/node_modules/flatiron/node_modules/director/test/browser/adhoc-test.js deleted file mode 100644 index fb1e220..0000000 --- a/node_modules/flatiron/node_modules/director/test/browser/adhoc-test.js +++ /dev/null @@ -1,40 +0,0 @@ -//reset these each test -var activity; - -//create the router -var router = new Router(); - -//setup/takedown -module("SS.js", { - setup: function() { - window.location.hash = ""; - activity = 0;; - }, - teardown: function() { - window.location.hash = ""; - } -}); - - -asyncTest("adhoc routing", function() { - - // - - router.path('/a', function() { - - // the bennifit of calling `this.route` as opposed to `this.get` or `this.post` is that - // you can continue to define the route structure (ad-hoc) and then assign units of logic - // per event type, there will be less repetition of definition, and the code will be more - // readable/centralized. - - this.path('/b', { - on: function() {}, - after: function() {} - before: function() {} - }); - - }); - - window.location.hash = "/a"; - -}); diff --git a/node_modules/flatiron/node_modules/director/test/browser/helpers/api.js b/node_modules/flatiron/node_modules/director/test/browser/helpers/api.js deleted file mode 100644 index 9d1cbcc..0000000 --- a/node_modules/flatiron/node_modules/director/test/browser/helpers/api.js +++ /dev/null @@ -1,45 +0,0 @@ -module("Director.js", { - setup: function() { - window.location.hash = ""; - shared = {}; - }, - teardown: function() { - window.location.hash = ""; - shared = {}; - } -}); - -var shared; - -function createTest(name, config, use, test) { - if (typeof use === 'function') { - test = use; - use = undefined; - } - asyncTest(name, function() { - setTimeout(function() { - var router = new Router(config), - context; - - if (use !== undefined) { - router.configure(use); - } - - router.init(); - - test.call(context = { - router: router, - navigate: function(url, callback) { - window.location.hash = url; - setTimeout(function() { - callback.call(context); - }, 14); - }, - finish: function() { - router.destroy(); - start(); - } - }); - }, 14); - }); -}; diff --git a/node_modules/flatiron/node_modules/director/test/browser/helpers/jquery.js b/node_modules/flatiron/node_modules/director/test/browser/helpers/jquery.js deleted file mode 100644 index c72011d..0000000 --- a/node_modules/flatiron/node_modules/director/test/browser/helpers/jquery.js +++ /dev/null @@ -1,16 +0,0 @@ -/*! - * jQuery JavaScript Library v1.6 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Mon May 2 13:50:00 2011 -0400 - */ -(function(a,b){function cw(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function ct(a){if(!ch[a]){var b=f("<"+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d===""){ci||(ci=c.createElement("iframe"),ci.frameBorder=ci.width=ci.height=0),c.body.appendChild(ci);if(!cj||!ci.createElement)cj=(ci.contentWindow||ci.contentDocument).document,cj.write("");b=cj.createElement(a),cj.body.appendChild(b),d=f.css(b,"display"),c.body.removeChild(ci)}ch[a]=d}return ch[a]}function cs(a,b){var c={};f.each(cn.concat.apply([],cn.slice(0,b)),function(){c[this]=a});return c}function cr(){co=b}function cq(){setTimeout(cr,0);return co=f.now()}function cg(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function cf(){try{return new a.XMLHttpRequest}catch(b){}}function b_(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g=0===c})}function V(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function N(a,b){return(a&&a!=="*"?a+".":"")+b.replace(z,"`").replace(A,"&")}function M(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;ic)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function K(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function E(){return!0}function D(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){name="data-"+c.replace(j,"$1-$2").toLowerCase(),d=a.getAttribute(name);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(e){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function H(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(H,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=d.userAgent,x,y,z,A=Object.prototype.toString,B=Object.prototype.hasOwnProperty,C=Array.prototype.push,D=Array.prototype.slice,E=String.prototype.trim,F=Array.prototype.indexOf,G={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)==="<"&&a.charAt(a.length-1)===">"&&a.length>=3?g=[null,a,null]:g=i.exec(a);if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6",length:0,size:function(){return this.length},toArray:function(){return D.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?C.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(D.apply(this,arguments),"slice",D.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:C,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;y.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!y){y=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",z,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",z),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&H()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):G[A.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!B.call(a,"constructor")&&!B.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||B.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c
      a",b=a.getElementsByTagName("*"),d=a.getElementsByTagName("a")[0];if(!b||!b.length||!d)return{};e=c.createElement("select"),f=e.appendChild(c.createElement("option")),g=a.getElementsByTagName("input")[0],i={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(d.getAttribute("style")),hrefNormalized:d.getAttribute("href")==="/a",opacity:/^0.55$/.test(d.style.opacity),cssFloat:!!d.style.cssFloat,checkOn:g.value==="on",optSelected:f.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},g.checked=!0,i.noCloneChecked=g.cloneNode(!0).checked,e.disabled=!0,i.optDisabled=!f.disabled;try{delete a.test}catch(r){i.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function click(){i.noCloneEvent=!1,a.detachEvent("onclick",click)}),a.cloneNode(!0).fireEvent("onclick")),g=c.createElement("input"),g.value="t",g.setAttribute("type","radio"),i.radioValue=g.value==="t",g.setAttribute("checked","checked"),a.appendChild(g),j=c.createDocumentFragment(),j.appendChild(a.firstChild),i.checkClone=j.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",k=c.createElement("body"),l={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};for(p in l)k.style[p]=l[p];k.appendChild(a),c.documentElement.appendChild(k),i.appendChecked=g.checked,i.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,i.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
      ",i.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
      t
      ",m=a.getElementsByTagName("td"),q=m[0].offsetHeight===0,m[0].style.display="",m[1].style.display="none",i.reliableHiddenOffsets=q&&m[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(h=c.createElement("div"),h.style.width="0",h.style.marginRight="0",a.appendChild(h),i.reliableMarginRight=(parseInt(c.defaultView.getComputedStyle(h,null).marginRight,10)||0)===0),k.innerHTML="",c.documentElement.removeChild(k);if(a.attachEvent)for(p in{submit:1,change:1,focusin:1})o="on"+p,q=o in a,q||(a.setAttribute(o,"return;"),q=typeof a[o]=="function"),i[p+"Bubbles"]=q;return i}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([a-z])([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g=f.expando,h=typeof c=="string",i,j=a.nodeType,k=j?f.cache:a,l=j?a[f.expando]:a[f.expando]&&f.expando;if((!l||e&&l&&!k[l][g])&&h&&d===b)return;l||(j?a[f.expando]=l=++f.uuid:l=f.expando),k[l]||(k[l]={},j||(k[l].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?k[l][g]=f.extend(k[l][g],c):k[l]=f.extend(k[l],c);i=k[l],e&&(i[g]||(i[g]={}),i=i[g]),d!==b&&(i[c]=d);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[c]:i}},removeData:function(b,c,d){if(!!f.acceptData(b)){var e=f.expando,g=b.nodeType,h=g?f.cache:b,i=g?b[f.expando]:f.expando;if(!h[i])return;if(c){var j=d?h[i][e]:h[i];if(j){delete j[c];if(!l(j))return}}if(d){delete h[i][e];if(!l(h[i]))return}var k=h[i][e];f.support.deleteExpando||h!=a?delete h[i]:h[i]=null,k?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=k):g&&(f.support.deleteExpando?delete b[f.expando]:b.removeAttribute?b.removeAttribute(f.expando):b[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;return(e.value||"").replace(p,"")}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||"set"in c&&c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b=a.selectedIndex,c=[],d=a.options,e=a.type==="select-one";if(b<0)return null;for(var g=e?b:0,h=e?b+1:d.length;g=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex",readonly:"readOnly"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);var h,i,j=g!==1||!f.isXMLDoc(a);c=j&&f.attrFix[c]||c,i=f.attrHooks[c]||(v&&(f.nodeName(a,"form")||u.test(c))?v:b);if(d!==b){if(d===null||d===!1&&!t.test(c)){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;d===!0&&!t.test(c)&&(d=c),a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j)return i.get(a,c);h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){a.nodeType===1&&(b=f.attrFix[b]||b,f.support.getSetAttribute?a.removeAttribute(b):(f.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.getAttribute("value");a.setAttribute("type",b),c&&(a.value=c);return b}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}},propFix:{},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);c=i&&f.propFix[c]||c,h=f.propHooks[c];return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==b?g:a[c]},propHooks:{}}),f.support.getSetAttribute||(f.attrFix=f.extend(f.attrFix,{"for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder"}),v=f.attrHooks.name=f.attrHooks.value=f.valHooks.button={get:function(a,c){var d;if(c==="value"&&!f.nodeName(a,"button"))return a.getAttribute(c);d=a.getAttributeNode(c);return d&&d.specified?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);if(d){d.nodeValue=b;return b}}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var w=Object.prototype.hasOwnProperty,x=/\.(.*)$/,y=/^(?:textarea|input|select)$/i,z=/\./g,A=/ /g,B=/[^\w\s.|`]/g,C=function(a){return a.replace(B,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=D;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=D);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),C).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},J=function J(a){var c=a.target,d,e;if(!!y.test(c.nodeName)&&!c.readOnly){d=f._data(c,"_change_data"),e=I(c),(a.type!=="focusout"||c.type!=="radio")&&f._data(c,"_change_data",e);if(d===b||e===d)return;if(d!=null||e)a.type="change",a.liveFired=b,f.event.trigger(a,arguments[1],c)}};f.event.special.change={filters:{focusout:J,beforedeactivate:J,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&J.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&J.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",I(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in H)f.event.add(this,c+".specialChange",H[c]);return y.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return y.test(this.nodeName)}},H=f.event.special.change.filters,H.focus=H.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){return a.nodeName.toLowerCase()==="input"&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

      ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
      ";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g0)for(h=g;h0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=T.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a=="string")return f.inArray(this[0],a?f(a):this.parent().children());return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(V(c[0])||V(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=S.call(arguments);O.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!U[a]?f.unique(e):e,(this.length>1||Q.test(d))&&P.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var X=/ jQuery\d+="(?:\d+|null)"/g,Y=/^\s+/,Z=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,$=/<([\w:]+)/,_=/",""],legend:[1,"
      ","
      "],thead:[1,"","
      "],tr:[2,"","
      "],td:[3,"","
      "],col:[2,"","
      "],area:[1,"",""],_default:[0,"",""]};be.optgroup=be.option,be.tbody=be.tfoot=be.colgroup=be.caption=be.thead,be.th=be.td,f.support.htmlSerialize||(be._default=[1,"div
      ","
      "]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(X,""):null;if(typeof a=="string"&&!bb.test(a)&&(f.support.leadingWhitespace||!Y.test(a))&&!be[($.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Z,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bh(a,d),e=bi(a),g=bi(d);for(h=0;e[h];++h)bh(e[h],g[h])}if(b){bg(a,d);if(c){e=bi(a),g=bi(d);for(h=0;e[h];++h)bg(e[h],g[h])}}return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[];for(var i=0,j;(j=a[i])!=null;i++){typeof j=="number"&&(j+="");if(!j)continue;if(typeof j=="string")if(!ba.test(j))j=b.createTextNode(j);else{j=j.replace(Z,"<$1>");var k=($.exec(j)||["",""])[1].toLowerCase(),l=be[k]||be._default,m=l[0],n=b.createElement("div");n.innerHTML=l[1]+j+l[2];while(m--)n=n.lastChild;if(!f.support.tbody){var o=_.test(j),p=k==="table"&&!o?n.firstChild&&n.firstChild.childNodes:l[1]===""&&!o?n.childNodes:[];for(var q=p.length-1;q>=0;--q)f.nodeName(p[q],"tbody")&&!p[q].childNodes.length&&p[q].parentNode.removeChild(p[q])}!f.support.leadingWhitespace&&Y.test(j)&&n.insertBefore(b.createTextNode(Y.exec(j)[0]),n.firstChild),j=n.childNodes}var r;if(!f.support.appendChecked)if(j[0]&&typeof (r=j.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bn.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.filter=bm.test(g)?g.replace(bm,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bx(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(by=function(a,c){var d,e,g;c=c.replace(bp,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bz=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bq.test(d)&&br.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bx=by||bz,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bC=/%20/g,bD=/\[\]$/,bE=/\r?\n/g,bF=/#.*$/,bG=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bH=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bI=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bJ=/^(?:GET|HEAD)$/,bK=/^\/\//,bL=/\?/,bM=/)<[^<]*)*<\/script>/gi,bN=/^(?:select|textarea)/i,bO=/\s+/,bP=/([?&])_=[^&]*/,bQ=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bR=f.fn.load,bS={},bT={},bU,bV;try{bU=e.href}catch(bW){bU=c.createElement("a"),bU.href="",bU=bU.href}bV=bQ.exec(bU.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bR)return bR.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
      ").append(c.replace(bM,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bN.test(this.nodeName)||bH.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bE,"\r\n")}}):{name:b.name,value:c.replace(bE,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?f.extend(!0,a,f.ajaxSettings,b):(b=a,a=f.extend(!0,f.ajaxSettings,b));for(var c in{context:1,url:1})c in b?a[c]=b[c]:c in f.ajaxSettings&&(a[c]=f.ajaxSettings[c]);return a},ajaxSettings:{url:bU,isLocal:bI.test(bV[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML}},ajaxPrefilter:bX(bS),ajaxTransport:bX(bT),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a?4:0;var o,r,u,w=l?b$(d,v,l):b,x,y;if(a>=200&&a<300||a===304){if(d.ifModified){if(x=v.getResponseHeader("Last-Modified"))f.lastModified[k]=x;if(y=v.getResponseHeader("Etag"))f.etag[k]=y}if(a===304)c="notmodified",o=!0;else try{r=b_(d,w),c="success",o=!0}catch(z){c="parsererror",u=z}}else{u=c;if(!c||a)c="error",a<0&&(a=0)}v.status=a,v.statusText=c,o?h.resolveWith(e,[r,c,v]):h.rejectWith(e,[v,c,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,c]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bG.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bF,"").replace(bK,bV[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bO),d.crossDomain==null&&(r=bQ.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bV[1]&&r[2]==bV[2]&&(r[3]||(r[1]==="http:"?80:443))==(bV[3]||(bV[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bY(bS,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bJ.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bL.test(d.url)?"&":"?")+d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bP,"$1_="+x);d.url=y+(y===d.url?(bL.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", */*; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bY(bT,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){status<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)bZ(g,a[g],c,e);return d.join("&").replace(bC,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var ca=f.now(),cb=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+ca++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cb.test(b.url)||e&&cb.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cb,l),b.url===j&&(e&&(k=k.replace(cb,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cc=a.ActiveXObject?function(){for(var a in ce)ce[a](0,1)}:!1,cd=0,ce;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&cf()||cg()}:cf,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cc&&delete ce[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cd,cc&&(ce||(ce={},f(a).unload(cc)),ce[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ch={},ci,cj,ck=/^(?:toggle|show|hide)$/,cl=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cm,cn=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],co,cp=a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cs("show",3),a,b,c);for(var g=0,h=this.length;g=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a=f.timers,b=a.length;while(b--)a[b]()||a.splice(b,1);a.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cm),cm=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cu=/^t(?:able|d|h)$/i,cv=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cw(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);f.offset.initialize();var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.offset.doesNotAddBorder&&(!f.offset.doesAddBorderForTableAndCells||!cu.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={initialize:function(){var a=c.body,b=c.createElement("div"),d,e,g,h,i=parseFloat(f.css(a,"marginTop"))||0,j="
      ";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cv.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cv.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cw(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cw(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){return this[0]?parseFloat(f.css(this[0],d,"padding")):null},f.fn["outer"+c]=function(a){return this[0]?parseFloat(f.css(this[0],d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c];return e.document.compatMode==="CSS1Compat"&&g||e.document.body["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=f.css(e,d),i=parseFloat(h);return f.isNaN(i)?h:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/director/test/browser/helpers/qunit.css b/node_modules/flatiron/node_modules/director/test/browser/helpers/qunit.css deleted file mode 100644 index 80f6f72..0000000 --- a/node_modules/flatiron/node_modules/director/test/browser/helpers/qunit.css +++ /dev/null @@ -1,236 +0,0 @@ -/** - * QUnit - A JavaScript Unit Testing Framework - * - * http://docs.jquery.com/QUnit - * - * Copyright (c) 2011 John Resig, Jörn Zaefferer - * Dual licensed under the MIT (MIT-LICENSE.txt) - * or GPL (GPL-LICENSE.txt) licenses. - * Pulled Live from Git Thu Jul 14 20:05:01 UTC 2011 - * Last Commit: 28be4753ea257da54721aa44f8599adb005e1033 - */ - -/** Font Family and Sizes */ - -#qunit-tests, #qunit-header, #qunit-banner, #qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult { - font-family: "Helvetica Neue Light", "HelveticaNeue-Light", "Helvetica Neue", Calibri, Helvetica, Arial, sans-serif; -} - -#qunit-testrunner-toolbar, #qunit-userAgent, #qunit-testresult, #qunit-tests li { font-size: small; } -#qunit-tests { font-size: smaller; } - - -/** Resets */ - -#qunit-tests, #qunit-tests ol, #qunit-header, #qunit-banner, #qunit-userAgent, #qunit-testresult { - margin: 0; - padding: 0; -} - - -/** Header */ - -#qunit-header { - padding: 0.5em 0 0.5em 1em; - - color: #8699a4; - background-color: #f8f8f8; - text-align: center; - - font-size: 1.5em; - line-height: 1em; - font-weight: normal; - margin-bottom: -18px; - border-radius: 4px 4px 0 0; - -moz-border-radius: 4px 4px 0 0; - -webkit-border-top-right-radius: 4px; - -webkit-border-top-left-radius: 4px; - text-align: right; - height: 20px; - padding: 40px; -} - -#qunit-header img { - float: left; - margin: -25px; -} - -#qunit-header a { - text-decoration: none; - color: #c2ccd1; -} - -#qunit-header a:hover, -#qunit-header a:focus { - color: #fff; -} - -#qunit-banner { - height: 5px; -} - -#qunit-testrunner-toolbar { - padding: 0.5em 0 0.5em 2em; - color: #5E740B; - background-color: #333; -} - -#qunit-userAgent { - padding: 0.5em 0 0.5em 2.5em; - background-color: #333; - color: #fff; - text-shadow: rgba(0, 0, 0, 0.5) 2px 2px 1px; -} - - -/** Tests: Pass/Fail */ - -#qunit-tests { - list-style-position: inside; -} - -#qunit-tests li { - padding: 0.4em 0.5em 0.4em 2.5em; - border-bottom: 1px solid #fff; - list-style-position: inside; -} - -#qunit-tests.hidepass li.pass, #qunit-tests.hidepass li.running { - display: none; -} - -#qunit-tests li strong { - cursor: pointer; -} - -#qunit-tests li a { - padding: 0.5em; - color: #111; - text-decoration: none; -} -#qunit-tests li a:hover, -#qunit-tests li a:focus { - color: #000; -} - -#qunit-tests ol { - margin-top: 0.5em; - padding: 0.5em; - - background-color: #fff; - - border-radius: 4px; - -moz-border-radius: 4px; - -webkit-border-radius: 4px; - - box-shadow: inset 0px 2px 2px #999; - -moz-box-shadow: inset 0px 2px 2px #999; - -webkit-box-shadow: inset 0px 2px 2px #999; -} - -#qunit-tests table { - border-collapse: collapse; - margin-top: .2em; -} - -#qunit-tests th { - text-align: right; - vertical-align: top; - padding: 0 .5em 0 0; -} - -#qunit-tests td { - vertical-align: top; -} - -#qunit-tests pre { - margin: 0; - white-space: pre-wrap; - word-wrap: break-word; -} - -#qunit-tests del { - background-color: #e0f2be; - color: #374e0c; - text-decoration: none; -} - -#qunit-tests ins { - background-color: #ffcaca; - color: #500; - text-decoration: none; -} - -/*** Test Counts */ - -#qunit-tests b.counts { color: black; } -#qunit-tests b.passed { color: #5E740B; } -#qunit-tests b.failed { color: #710909; } - -#qunit-tests li li { - margin: 0.5em; - padding: 0.4em 0.5em 0.4em 0.5em; - background-color: #fff; - border-bottom: none; - list-style-position: inside; -} - -/*** Passing Styles */ - -#qunit-tests li li.pass { - color: #5E740B; - background-color: #fff; - border-left: 26px solid #C6E746; -} - -#qunit-tests .pass { color: #528CE0; background-color: #ddd; } -#qunit-tests .pass .test-name { color: #366097; } - -#qunit-tests .pass .test-actual, -#qunit-tests .pass .test-expected { color: #999999; } - -#qunit-banner.qunit-pass { background-color: #C6E746; } - -/*** Failing Styles */ - -#qunit-tests li li.fail { - color: #710909; - background-color: #fff; - border-left: 26px solid #EE5757; -} - -#qunit-tests > li:last-child { - border-radius: 0 0 4px 4px; - -moz-border-radius: 0 0 4px 4px; - -webkit-border-bottom-right-radius: 4px; - -webkit-border-bottom-left-radius: 4px; -} - -#qunit-tests .fail { color: #000000; background-color: #EE5757; } -#qunit-tests .fail .test-name, -#qunit-tests .fail .module-name { color: #000000; } - -#qunit-tests .fail .test-actual { color: #EE5757; } -#qunit-tests .fail .test-expected { color: green; } - -#qunit-banner.qunit-fail { background-color: #EE5757; } - - -/** Result */ - -#qunit-testresult { - padding: 0.5em 0.5em 0.5em 2.5em; - - color: #eee; - background-color: #333; - - border-bottom: 1px solid white; -} - -/** Fixture */ - -#qunit-fixture { - position: absolute; - top: -10000px; - left: -10000px; -} diff --git a/node_modules/flatiron/node_modules/director/test/browser/helpers/qunit.js b/node_modules/flatiron/node_modules/director/test/browser/helpers/qunit.js deleted file mode 100644 index 6f0d976..0000000 --- a/node_modules/flatiron/node_modules/director/test/browser/helpers/qunit.js +++ /dev/null @@ -1,1450 +0,0 @@ -/** - * QUnit - A JavaScript Unit Testing Framework - * - * http://docs.jquery.com/QUnit - * - * Copyright (c) 2011 John Resig, Jörn Zaefferer - * Dual licensed under the MIT (MIT-LICENSE.txt) - * or GPL (GPL-LICENSE.txt) licenses. - * Pulled Live from Git Thu Jul 14 20:05:01 UTC 2011 - * Last Commit: 28be4753ea257da54721aa44f8599adb005e1033 - */ - -(function(window) { - -var defined = { - setTimeout: typeof window.setTimeout !== "undefined", - sessionStorage: (function() { - try { - return !!sessionStorage.getItem; - } catch(e){ - return false; - } - })() -}; - -var testId = 0; - -var Test = function(name, testName, expected, testEnvironmentArg, async, callback) { - this.name = name; - this.testName = testName; - this.expected = expected; - this.testEnvironmentArg = testEnvironmentArg; - this.async = async; - this.callback = callback; - this.assertions = []; -}; -Test.prototype = { - init: function() { - var tests = id("qunit-tests"); - if (tests) { - var b = document.createElement("strong"); - b.innerHTML = "Running " + this.name; - var li = document.createElement("li"); - li.appendChild( b ); - li.className = "running"; - li.id = this.id = "test-output" + testId++; - tests.appendChild( li ); - } - }, - setup: function() { - if (this.module != config.previousModule) { - if ( config.previousModule ) { - QUnit.moduleDone( { - name: config.previousModule, - failed: config.moduleStats.bad, - passed: config.moduleStats.all - config.moduleStats.bad, - total: config.moduleStats.all - } ); - } - config.previousModule = this.module; - config.moduleStats = { all: 0, bad: 0 }; - QUnit.moduleStart( { - name: this.module - } ); - } - - config.current = this; - this.testEnvironment = extend({ - setup: function() {}, - teardown: function() {} - }, this.moduleTestEnvironment); - if (this.testEnvironmentArg) { - extend(this.testEnvironment, this.testEnvironmentArg); - } - - QUnit.testStart( { - name: this.testName - } ); - - // allow utility functions to access the current test environment - // TODO why?? - QUnit.current_testEnvironment = this.testEnvironment; - - try { - if ( !config.pollution ) { - saveGlobal(); - } - - this.testEnvironment.setup.call(this.testEnvironment); - } catch(e) { - QUnit.ok( false, "Setup failed on " + this.testName + ": " + e.message ); - } - }, - run: function() { - if ( this.async ) { - QUnit.stop(); - } - - if ( config.notrycatch ) { - this.callback.call(this.testEnvironment); - return; - } - try { - this.callback.call(this.testEnvironment); - } catch(e) { - fail("Test " + this.testName + " died, exception and test follows", e, this.callback); - QUnit.ok( false, "Died on test #" + (this.assertions.length + 1) + ": " + e.message + " - " + QUnit.jsDump.parse(e) ); - // else next test will carry the responsibility - saveGlobal(); - - // Restart the tests if they're blocking - if ( config.blocking ) { - start(); - } - } - }, - teardown: function() { - try { - this.testEnvironment.teardown.call(this.testEnvironment); - checkPollution(); - } catch(e) { - QUnit.ok( false, "Teardown failed on " + this.testName + ": " + e.message ); - } - }, - finish: function() { - if ( this.expected && this.expected != this.assertions.length ) { - QUnit.ok( false, "Expected " + this.expected + " assertions, but " + this.assertions.length + " were run" ); - } - - var good = 0, bad = 0, - tests = id("qunit-tests"); - - config.stats.all += this.assertions.length; - config.moduleStats.all += this.assertions.length; - - if ( tests ) { - var ol = document.createElement("ol"); - - for ( var i = 0; i < this.assertions.length; i++ ) { - var assertion = this.assertions[i]; - - var li = document.createElement("li"); - li.className = assertion.result ? "pass" : "fail"; - li.innerHTML = assertion.message || (assertion.result ? "okay" : "failed"); - ol.appendChild( li ); - - if ( assertion.result ) { - good++; - } else { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - - // store result when possible - if ( QUnit.config.reorder && defined.sessionStorage ) { - if (bad) { - sessionStorage.setItem("qunit-" + this.module + "-" + this.testName, bad); - } else { - sessionStorage.removeItem("qunit-" + this.module + "-" + this.testName); - } - } - - if (bad == 0) { - ol.style.display = "none"; - } - - var b = document.createElement("strong"); - b.innerHTML = this.name + " (" + bad + ", " + good + ", " + this.assertions.length + ")"; - - var a = document.createElement("a"); - a.innerHTML = "Rerun"; - a.href = QUnit.url({ filter: getText([b]).replace(/\([^)]+\)$/, "").replace(/(^\s*|\s*$)/g, "") }); - - addEvent(b, "click", function() { - var next = b.nextSibling.nextSibling, - display = next.style.display; - next.style.display = display === "none" ? "block" : "none"; - }); - - addEvent(b, "dblclick", function(e) { - var target = e && e.target ? e.target : window.event.srcElement; - if ( target.nodeName.toLowerCase() == "span" || target.nodeName.toLowerCase() == "b" ) { - target = target.parentNode; - } - if ( window.location && target.nodeName.toLowerCase() === "strong" ) { - window.location = QUnit.url({ filter: getText([target]).replace(/\([^)]+\)$/, "").replace(/(^\s*|\s*$)/g, "") }); - } - }); - - var li = id(this.id); - li.className = bad ? "fail" : "pass"; - li.removeChild( li.firstChild ); - li.appendChild( b ); - li.appendChild( a ); - li.appendChild( ol ); - - } else { - for ( var i = 0; i < this.assertions.length; i++ ) { - if ( !this.assertions[i].result ) { - bad++; - config.stats.bad++; - config.moduleStats.bad++; - } - } - } - - try { - QUnit.reset(); - } catch(e) { - fail("reset() failed, following Test " + this.testName + ", exception and reset fn follows", e, QUnit.reset); - } - - QUnit.testDone( { - name: this.testName, - failed: bad, - passed: this.assertions.length - bad, - total: this.assertions.length - } ); - }, - - queue: function() { - var test = this; - synchronize(function() { - test.init(); - }); - function run() { - // each of these can by async - synchronize(function() { - test.setup(); - }); - synchronize(function() { - test.run(); - }); - synchronize(function() { - test.teardown(); - }); - synchronize(function() { - test.finish(); - }); - } - // defer when previous test run passed, if storage is available - var bad = QUnit.config.reorder && defined.sessionStorage && +sessionStorage.getItem("qunit-" + this.module + "-" + this.testName); - if (bad) { - run(); - } else { - synchronize(run); - }; - } - -}; - -var QUnit = { - - // call on start of module test to prepend name to all tests - module: function(name, testEnvironment) { - config.currentModule = name; - config.currentModuleTestEnviroment = testEnvironment; - }, - - asyncTest: function(testName, expected, callback) { - if ( arguments.length === 2 ) { - callback = expected; - expected = 0; - } - - QUnit.test(testName, expected, callback, true); - }, - - test: function(testName, expected, callback, async) { - var name = '' + testName + '', testEnvironmentArg; - - if ( arguments.length === 2 ) { - callback = expected; - expected = null; - } - // is 2nd argument a testEnvironment? - if ( expected && typeof expected === 'object') { - testEnvironmentArg = expected; - expected = null; - } - - if ( config.currentModule ) { - name = '' + config.currentModule + ": " + name; - } - - if ( !validTest(config.currentModule + ": " + testName) ) { - return; - } - - var test = new Test(name, testName, expected, testEnvironmentArg, async, callback); - test.module = config.currentModule; - test.moduleTestEnvironment = config.currentModuleTestEnviroment; - test.queue(); - }, - - /** - * Specify the number of expected assertions to gurantee that failed test (no assertions are run at all) don't slip through. - */ - expect: function(asserts) { - config.current.expected = asserts; - }, - - /** - * Asserts true. - * @example ok( "asdfasdf".length > 5, "There must be at least 5 chars" ); - */ - ok: function(a, msg) { - a = !!a; - var details = { - result: a, - message: msg - }; - msg = escapeHtml(msg); - QUnit.log(details); - config.current.assertions.push({ - result: a, - message: msg - }); - }, - - /** - * Checks that the first two arguments are equal, with an optional message. - * Prints out both actual and expected values. - * - * Prefered to ok( actual == expected, message ) - * - * @example equal( format("Received {0} bytes.", 2), "Received 2 bytes." ); - * - * @param Object actual - * @param Object expected - * @param String message (optional) - */ - equal: function(actual, expected, message) { - QUnit.push(expected == actual, actual, expected, message); - }, - - notEqual: function(actual, expected, message) { - QUnit.push(expected != actual, actual, expected, message); - }, - - deepEqual: function(actual, expected, message) { - QUnit.push(QUnit.equiv(actual, expected), actual, expected, message); - }, - - notDeepEqual: function(actual, expected, message) { - QUnit.push(!QUnit.equiv(actual, expected), actual, expected, message); - }, - - strictEqual: function(actual, expected, message) { - QUnit.push(expected === actual, actual, expected, message); - }, - - notStrictEqual: function(actual, expected, message) { - QUnit.push(expected !== actual, actual, expected, message); - }, - - raises: function(block, expected, message) { - var actual, ok = false; - - if (typeof expected === 'string') { - message = expected; - expected = null; - } - - try { - block(); - } catch (e) { - actual = e; - } - - if (actual) { - // we don't want to validate thrown error - if (!expected) { - ok = true; - // expected is a regexp - } else if (QUnit.objectType(expected) === "regexp") { - ok = expected.test(actual); - // expected is a constructor - } else if (actual instanceof expected) { - ok = true; - // expected is a validation function which returns true is validation passed - } else if (expected.call({}, actual) === true) { - ok = true; - } - } - - QUnit.ok(ok, message); - }, - - start: function() { - config.semaphore--; - if (config.semaphore > 0) { - // don't start until equal number of stop-calls - return; - } - if (config.semaphore < 0) { - // ignore if start is called more often then stop - config.semaphore = 0; - } - // A slight delay, to avoid any current callbacks - if ( defined.setTimeout ) { - window.setTimeout(function() { - if ( config.timeout ) { - clearTimeout(config.timeout); - } - - config.blocking = false; - process(); - }, 13); - } else { - config.blocking = false; - process(); - } - }, - - stop: function(timeout) { - config.semaphore++; - config.blocking = true; - - if ( timeout && defined.setTimeout ) { - clearTimeout(config.timeout); - config.timeout = window.setTimeout(function() { - QUnit.ok( false, "Test timed out" ); - QUnit.start(); - }, timeout); - } - } -}; - -// Backwards compatibility, deprecated -QUnit.equals = QUnit.equal; -QUnit.same = QUnit.deepEqual; - -// Maintain internal state -var config = { - // The queue of tests to run - queue: [], - - // block until document ready - blocking: true, - - // by default, run previously failed tests first - // very useful in combination with "Hide passed tests" checked - reorder: true, - - noglobals: false, - notrycatch: false -}; - -// Load paramaters -(function() { - var location = window.location || { search: "", protocol: "file:" }, - params = location.search.slice( 1 ).split( "&" ), - length = params.length, - urlParams = {}, - current; - - if ( params[ 0 ] ) { - for ( var i = 0; i < length; i++ ) { - current = params[ i ].split( "=" ); - current[ 0 ] = decodeURIComponent( current[ 0 ] ); - // allow just a key to turn on a flag, e.g., test.html?noglobals - current[ 1 ] = current[ 1 ] ? decodeURIComponent( current[ 1 ] ) : true; - urlParams[ current[ 0 ] ] = current[ 1 ]; - if ( current[ 0 ] in config ) { - config[ current[ 0 ] ] = current[ 1 ]; - } - } - } - - QUnit.urlParams = urlParams; - config.filter = urlParams.filter; - - // Figure out if we're running the tests from a server or not - QUnit.isLocal = !!(location.protocol === 'file:'); -})(); - -// Expose the API as global variables, unless an 'exports' -// object exists, in that case we assume we're in CommonJS -if ( typeof exports === "undefined" || typeof require === "undefined" ) { - extend(window, QUnit); - window.QUnit = QUnit; -} else { - extend(exports, QUnit); - exports.QUnit = QUnit; -} - -// define these after exposing globals to keep them in these QUnit namespace only -extend(QUnit, { - config: config, - - // Initialize the configuration options - init: function() { - extend(config, { - stats: { all: 0, bad: 0 }, - moduleStats: { all: 0, bad: 0 }, - started: +new Date, - updateRate: 1000, - blocking: false, - autostart: true, - autorun: false, - filter: "", - queue: [], - semaphore: 0 - }); - - var tests = id( "qunit-tests" ), - banner = id( "qunit-banner" ), - result = id( "qunit-testresult" ); - - if ( tests ) { - tests.innerHTML = ""; - } - - if ( banner ) { - banner.className = ""; - } - - if ( result ) { - result.parentNode.removeChild( result ); - } - - if ( tests ) { - result = document.createElement( "p" ); - result.id = "qunit-testresult"; - result.className = "result"; - tests.parentNode.insertBefore( result, tests ); - result.innerHTML = 'Running...
       '; - } - }, - - /** - * Resets the test setup. Useful for tests that modify the DOM. - * - * If jQuery is available, uses jQuery's html(), otherwise just innerHTML. - */ - reset: function() { - if ( window.jQuery ) { - jQuery( "#qunit-fixture" ).html( config.fixture ); - } else { - var main = id( 'qunit-fixture' ); - if ( main ) { - main.innerHTML = config.fixture; - } - } - }, - - /** - * Trigger an event on an element. - * - * @example triggerEvent( document.body, "click" ); - * - * @param DOMElement elem - * @param String type - */ - triggerEvent: function( elem, type, event ) { - if ( document.createEvent ) { - event = document.createEvent("MouseEvents"); - event.initMouseEvent(type, true, true, elem.ownerDocument.defaultView, - 0, 0, 0, 0, 0, false, false, false, false, 0, null); - elem.dispatchEvent( event ); - - } else if ( elem.fireEvent ) { - elem.fireEvent("on"+type); - } - }, - - // Safe object type checking - is: function( type, obj ) { - return QUnit.objectType( obj ) == type; - }, - - objectType: function( obj ) { - if (typeof obj === "undefined") { - return "undefined"; - - // consider: typeof null === object - } - if (obj === null) { - return "null"; - } - - var type = Object.prototype.toString.call( obj ) - .match(/^\[object\s(.*)\]$/)[1] || ''; - - switch (type) { - case 'Number': - if (isNaN(obj)) { - return "nan"; - } else { - return "number"; - } - case 'String': - case 'Boolean': - case 'Array': - case 'Date': - case 'RegExp': - case 'Function': - return type.toLowerCase(); - } - if (typeof obj === "object") { - return "object"; - } - return undefined; - }, - - push: function(result, actual, expected, message) { - var details = { - result: result, - message: message, - actual: actual, - expected: expected - }; - - message = escapeHtml(message) || (result ? "okay" : "failed"); - message = '' + message + ""; - expected = escapeHtml(QUnit.jsDump.parse(expected)); - actual = escapeHtml(QUnit.jsDump.parse(actual)); - var output = message + ''; - if (actual != expected) { - output += ''; - output += ''; - } - if (!result) { - var source = sourceFromStacktrace(); - if (source) { - details.source = source; - output += ''; - } - } - output += "
      Expected:
      ' + expected + '
      Result:
      ' + actual + '
      Diff:
      ' + QUnit.diff(expected, actual) +'
      Source:
      ' + escapeHtml(source) + '
      "; - - QUnit.log(details); - - config.current.assertions.push({ - result: !!result, - message: output - }); - }, - - url: function( params ) { - params = extend( extend( {}, QUnit.urlParams ), params ); - var querystring = "?", - key; - for ( key in params ) { - querystring += encodeURIComponent( key ) + "=" + - encodeURIComponent( params[ key ] ) + "&"; - } - return window.location.pathname + querystring.slice( 0, -1 ); - }, - - // Logging callbacks; all receive a single argument with the listed properties - // run test/logs.html for any related changes - begin: function() {}, - // done: { failed, passed, total, runtime } - done: function() {}, - // log: { result, actual, expected, message } - log: function() {}, - // testStart: { name } - testStart: function() {}, - // testDone: { name, failed, passed, total } - testDone: function() {}, - // moduleStart: { name } - moduleStart: function() {}, - // moduleDone: { name, failed, passed, total } - moduleDone: function() {} -}); - -if ( typeof document === "undefined" || document.readyState === "complete" ) { - config.autorun = true; -} - -addEvent(window, "load", function() { - QUnit.begin({}); - - // Initialize the config, saving the execution queue - var oldconfig = extend({}, config); - QUnit.init(); - extend(config, oldconfig); - - config.blocking = false; - - var userAgent = id("qunit-userAgent"); - if ( userAgent ) { - userAgent.innerHTML = navigator.userAgent; - } - var banner = id("qunit-header"); - if ( banner ) { - banner.innerHTML = ' ' + banner.innerHTML + ' ' + - '' + - ''; - addEvent( banner, "change", function( event ) { - var params = {}; - params[ event.target.name ] = event.target.checked ? true : undefined; - window.location = QUnit.url( params ); - }); - } - - var toolbar = id("qunit-testrunner-toolbar"); - if ( toolbar ) { - var filter = document.createElement("input"); - filter.type = "checkbox"; - filter.id = "qunit-filter-pass"; - addEvent( filter, "click", function() { - var ol = document.getElementById("qunit-tests"); - if ( filter.checked ) { - ol.className = ol.className + " hidepass"; - } else { - var tmp = " " + ol.className.replace( /[\n\t\r]/g, " " ) + " "; - ol.className = tmp.replace(/ hidepass /, " "); - } - if ( defined.sessionStorage ) { - if (filter.checked) { - sessionStorage.setItem("qunit-filter-passed-tests", "true"); - } else { - sessionStorage.removeItem("qunit-filter-passed-tests"); - } - } - }); - if ( defined.sessionStorage && sessionStorage.getItem("qunit-filter-passed-tests") ) { - filter.checked = true; - var ol = document.getElementById("qunit-tests"); - ol.className = ol.className + " hidepass"; - } - toolbar.appendChild( filter ); - - var label = document.createElement("label"); - label.setAttribute("for", "qunit-filter-pass"); - label.innerHTML = "Hide passed tests"; - toolbar.appendChild( label ); - } - - var main = id('qunit-fixture'); - if ( main ) { - config.fixture = main.innerHTML; - } - - if (config.autostart) { - QUnit.start(); - } -}); - -function done() { - config.autorun = true; - - // Log the last module results - if ( config.currentModule ) { - QUnit.moduleDone( { - name: config.currentModule, - failed: config.moduleStats.bad, - passed: config.moduleStats.all - config.moduleStats.bad, - total: config.moduleStats.all - } ); - } - - var banner = id("qunit-banner"), - tests = id("qunit-tests"), - runtime = +new Date - config.started, - passed = config.stats.all - config.stats.bad, - html = [ - 'Tests completed in ', - runtime, - ' milliseconds.
      ', - '', - passed, - ' tests of ', - config.stats.all, - ' passed, ', - config.stats.bad, - ' failed.' - ].join(''); - - if ( banner ) { - banner.className = (config.stats.bad ? "qunit-fail" : "qunit-pass"); - } - - if ( tests ) { - id( "qunit-testresult" ).innerHTML = html; - } - - if ( typeof document !== "undefined" && document.title ) { - // show ✖ for good, ✔ for bad suite result in title - // use escape sequences in case file gets loaded with non-utf-8-charset - document.title = (config.stats.bad ? "\u2716" : "\u2714") + " " + document.title; - } - - QUnit.done( { - failed: config.stats.bad, - passed: passed, - total: config.stats.all, - runtime: runtime - } ); -} - -function validTest( name ) { - var filter = config.filter, - run = false; - - if ( !filter ) { - return true; - } - - var not = filter.charAt( 0 ) === "!"; - if ( not ) { - filter = filter.slice( 1 ); - } - - if ( name.indexOf( filter ) !== -1 ) { - return !not; - } - - if ( not ) { - run = true; - } - - return run; -} - -// so far supports only Firefox, Chrome and Opera (buggy) -// could be extended in the future to use something like https://github.com/csnover/TraceKit -function sourceFromStacktrace() { - try { - throw new Error(); - } catch ( e ) { - if (e.stacktrace) { - // Opera - return e.stacktrace.split("\n")[6]; - } else if (e.stack) { - // Firefox, Chrome - return e.stack.split("\n")[4]; - } - } -} - -function escapeHtml(s) { - if (!s) { - return ""; - } - s = s + ""; - return s.replace(/[\&"<>\\]/g, function(s) { - switch(s) { - case "&": return "&"; - case "\\": return "\\\\"; - case '"': return '\"'; - case "<": return "<"; - case ">": return ">"; - default: return s; - } - }); -} - -function synchronize( callback ) { - config.queue.push( callback ); - - if ( config.autorun && !config.blocking ) { - process(); - } -} - -function process() { - var start = (new Date()).getTime(); - - while ( config.queue.length && !config.blocking ) { - if ( config.updateRate <= 0 || (((new Date()).getTime() - start) < config.updateRate) ) { - config.queue.shift()(); - } else { - window.setTimeout( process, 13 ); - break; - } - } - if (!config.blocking && !config.queue.length) { - done(); - } -} - -function saveGlobal() { - config.pollution = []; - - if ( config.noglobals ) { - for ( var key in window ) { - config.pollution.push( key ); - } - } -} - -function checkPollution( name ) { - var old = config.pollution; - saveGlobal(); - - var newGlobals = diff( config.pollution, old ); - if ( newGlobals.length > 0 ) { - ok( false, "Introduced global variable(s): " + newGlobals.join(", ") ); - } - - var deletedGlobals = diff( old, config.pollution ); - if ( deletedGlobals.length > 0 ) { - ok( false, "Deleted global variable(s): " + deletedGlobals.join(", ") ); - } -} - -// returns a new Array with the elements that are in a but not in b -function diff( a, b ) { - var result = a.slice(); - for ( var i = 0; i < result.length; i++ ) { - for ( var j = 0; j < b.length; j++ ) { - if ( result[i] === b[j] ) { - result.splice(i, 1); - i--; - break; - } - } - } - return result; -} - -function fail(message, exception, callback) { - if ( typeof console !== "undefined" && console.error && console.warn ) { - console.error(message); - console.error(exception); - console.warn(callback.toString()); - - } else if ( window.opera && opera.postError ) { - opera.postError(message, exception, callback.toString); - } -} - -function extend(a, b) { - for ( var prop in b ) { - if ( b[prop] === undefined ) { - delete a[prop]; - } else { - a[prop] = b[prop]; - } - } - - return a; -} - -function addEvent(elem, type, fn) { - if ( elem.addEventListener ) { - elem.addEventListener( type, fn, false ); - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, fn ); - } else { - fn(); - } -} - -function id(name) { - return !!(typeof document !== "undefined" && document && document.getElementById) && - document.getElementById( name ); -} - -// Test for equality any JavaScript type. -// Discussions and reference: http://philrathe.com/articles/equiv -// Test suites: http://philrathe.com/tests/equiv -// Author: Philippe Rathé -QUnit.equiv = function () { - - var innerEquiv; // the real equiv function - var callers = []; // stack to decide between skip/abort functions - var parents = []; // stack to avoiding loops from circular referencing - - // Call the o related callback with the given arguments. - function bindCallbacks(o, callbacks, args) { - var prop = QUnit.objectType(o); - if (prop) { - if (QUnit.objectType(callbacks[prop]) === "function") { - return callbacks[prop].apply(callbacks, args); - } else { - return callbacks[prop]; // or undefined - } - } - } - - var callbacks = function () { - - // for string, boolean, number and null - function useStrictEquality(b, a) { - if (b instanceof a.constructor || a instanceof b.constructor) { - // to catch short annotaion VS 'new' annotation of a declaration - // e.g. var i = 1; - // var j = new Number(1); - return a == b; - } else { - return a === b; - } - } - - return { - "string": useStrictEquality, - "boolean": useStrictEquality, - "number": useStrictEquality, - "null": useStrictEquality, - "undefined": useStrictEquality, - - "nan": function (b) { - return isNaN(b); - }, - - "date": function (b, a) { - return QUnit.objectType(b) === "date" && a.valueOf() === b.valueOf(); - }, - - "regexp": function (b, a) { - return QUnit.objectType(b) === "regexp" && - a.source === b.source && // the regex itself - a.global === b.global && // and its modifers (gmi) ... - a.ignoreCase === b.ignoreCase && - a.multiline === b.multiline; - }, - - // - skip when the property is a method of an instance (OOP) - // - abort otherwise, - // initial === would have catch identical references anyway - "function": function () { - var caller = callers[callers.length - 1]; - return caller !== Object && - typeof caller !== "undefined"; - }, - - "array": function (b, a) { - var i, j, loop; - var len; - - // b could be an object literal here - if ( ! (QUnit.objectType(b) === "array")) { - return false; - } - - len = a.length; - if (len !== b.length) { // safe and faster - return false; - } - - //track reference to avoid circular references - parents.push(a); - for (i = 0; i < len; i++) { - loop = false; - for(j=0;j= 0) { - type = "array"; - } else { - type = typeof obj; - } - return type; - }, - separator:function() { - return this.multiline ? this.HTML ? '
      ' : '\n' : this.HTML ? ' ' : ' '; - }, - indent:function( extra ) {// extra can be a number, shortcut for increasing-calling-decreasing - if ( !this.multiline ) - return ''; - var chr = this.indentChar; - if ( this.HTML ) - chr = chr.replace(/\t/g,' ').replace(/ /g,' '); - return Array( this._depth_ + (extra||0) ).join(chr); - }, - up:function( a ) { - this._depth_ += a || 1; - }, - down:function( a ) { - this._depth_ -= a || 1; - }, - setParser:function( name, parser ) { - this.parsers[name] = parser; - }, - // The next 3 are exposed so you can use them - quote:quote, - literal:literal, - join:join, - // - _depth_: 1, - // This is the list of parsers, to modify them, use jsDump.setParser - parsers:{ - window: '[Window]', - document: '[Document]', - error:'[ERROR]', //when no parser is found, shouldn't happen - unknown: '[Unknown]', - 'null':'null', - 'undefined':'undefined', - 'function':function( fn ) { - var ret = 'function', - name = 'name' in fn ? fn.name : (reName.exec(fn)||[])[1];//functions never have name in IE - if ( name ) - ret += ' ' + name; - ret += '('; - - ret = [ ret, QUnit.jsDump.parse( fn, 'functionArgs' ), '){'].join(''); - return join( ret, QUnit.jsDump.parse(fn,'functionCode'), '}' ); - }, - array: array, - nodelist: array, - arguments: array, - object:function( map ) { - var ret = [ ]; - QUnit.jsDump.up(); - for ( var key in map ) - ret.push( QUnit.jsDump.parse(key,'key') + ': ' + QUnit.jsDump.parse(map[key]) ); - QUnit.jsDump.down(); - return join( '{', ret, '}' ); - }, - node:function( node ) { - var open = QUnit.jsDump.HTML ? '<' : '<', - close = QUnit.jsDump.HTML ? '>' : '>'; - - var tag = node.nodeName.toLowerCase(), - ret = open + tag; - - for ( var a in QUnit.jsDump.DOMAttrs ) { - var val = node[QUnit.jsDump.DOMAttrs[a]]; - if ( val ) - ret += ' ' + a + '=' + QUnit.jsDump.parse( val, 'attribute' ); - } - return ret + close + open + '/' + tag + close; - }, - functionArgs:function( fn ) {//function calls it internally, it's the arguments part of the function - var l = fn.length; - if ( !l ) return ''; - - var args = Array(l); - while ( l-- ) - args[l] = String.fromCharCode(97+l);//97 is 'a' - return ' ' + args.join(', ') + ' '; - }, - key:quote, //object calls it internally, the key part of an item in a map - functionCode:'[code]', //function calls it internally, it's the content of the function - attribute:quote, //node calls it internally, it's an html attribute value - string:quote, - date:quote, - regexp:literal, //regex - number:literal, - 'boolean':literal - }, - DOMAttrs:{//attributes to dump from nodes, name=>realName - id:'id', - name:'name', - 'class':'className' - }, - HTML:false,//if true, entities are escaped ( <, >, \t, space and \n ) - indentChar:' ',//indentation unit - multiline:true //if true, items in a collection, are separated by a \n, else just a space. - }; - - return jsDump; -})(); - -// from Sizzle.js -function getText( elems ) { - var ret = "", elem; - - for ( var i = 0; elems[i]; i++ ) { - elem = elems[i]; - - // Get the text from text nodes and CDATA nodes - if ( elem.nodeType === 3 || elem.nodeType === 4 ) { - ret += elem.nodeValue; - - // Traverse everything else, except comment nodes - } else if ( elem.nodeType !== 8 ) { - ret += getText( elem.childNodes ); - } - } - - return ret; -}; - -/* - * Javascript Diff Algorithm - * By John Resig (http://ejohn.org/) - * Modified by Chu Alan "sprite" - * - * Released under the MIT license. - * - * More Info: - * http://ejohn.org/projects/javascript-diff-algorithm/ - * - * Usage: QUnit.diff(expected, actual) - * - * QUnit.diff("the quick brown fox jumped over", "the quick fox jumps over") == "the quick brown fox jumped jumps over" - */ -QUnit.diff = (function() { - function diff(o, n){ - var ns = new Object(); - var os = new Object(); - - for (var i = 0; i < n.length; i++) { - if (ns[n[i]] == null) - ns[n[i]] = { - rows: new Array(), - o: null - }; - ns[n[i]].rows.push(i); - } - - for (var i = 0; i < o.length; i++) { - if (os[o[i]] == null) - os[o[i]] = { - rows: new Array(), - n: null - }; - os[o[i]].rows.push(i); - } - - for (var i in ns) { - if (ns[i].rows.length == 1 && typeof(os[i]) != "undefined" && os[i].rows.length == 1) { - n[ns[i].rows[0]] = { - text: n[ns[i].rows[0]], - row: os[i].rows[0] - }; - o[os[i].rows[0]] = { - text: o[os[i].rows[0]], - row: ns[i].rows[0] - }; - } - } - - for (var i = 0; i < n.length - 1; i++) { - if (n[i].text != null && n[i + 1].text == null && n[i].row + 1 < o.length && o[n[i].row + 1].text == null && - n[i + 1] == o[n[i].row + 1]) { - n[i + 1] = { - text: n[i + 1], - row: n[i].row + 1 - }; - o[n[i].row + 1] = { - text: o[n[i].row + 1], - row: i + 1 - }; - } - } - - for (var i = n.length - 1; i > 0; i--) { - if (n[i].text != null && n[i - 1].text == null && n[i].row > 0 && o[n[i].row - 1].text == null && - n[i - 1] == o[n[i].row - 1]) { - n[i - 1] = { - text: n[i - 1], - row: n[i].row - 1 - }; - o[n[i].row - 1] = { - text: o[n[i].row - 1], - row: i - 1 - }; - } - } - - return { - o: o, - n: n - }; - } - - return function(o, n){ - o = o.replace(/\s+$/, ''); - n = n.replace(/\s+$/, ''); - var out = diff(o == "" ? [] : o.split(/\s+/), n == "" ? [] : n.split(/\s+/)); - - var str = ""; - - var oSpace = o.match(/\s+/g); - if (oSpace == null) { - oSpace = [" "]; - } - else { - oSpace.push(" "); - } - var nSpace = n.match(/\s+/g); - if (nSpace == null) { - nSpace = [" "]; - } - else { - nSpace.push(" "); - } - - if (out.n.length == 0) { - for (var i = 0; i < out.o.length; i++) { - str += '' + out.o[i] + oSpace[i] + ""; - } - } - else { - if (out.n[0].text == null) { - for (n = 0; n < out.o.length && out.o[n].text == null; n++) { - str += '' + out.o[n] + oSpace[n] + ""; - } - } - - for (var i = 0; i < out.n.length; i++) { - if (out.n[i].text == null) { - str += '' + out.n[i] + nSpace[i] + ""; - } - else { - var pre = ""; - - for (n = out.n[i].row + 1; n < out.o.length && out.o[n].text == null; n++) { - pre += '' + out.o[n] + oSpace[n] + ""; - } - str += " " + out.n[i].text + nSpace[i] + pre; - } - } - } - - return str; - }; -})(); - -})(this); diff --git a/node_modules/flatiron/node_modules/director/test/browser/routes-harness.html b/node_modules/flatiron/node_modules/director/test/browser/routes-harness.html deleted file mode 100644 index 51e792a..0000000 --- a/node_modules/flatiron/node_modules/director/test/browser/routes-harness.html +++ /dev/null @@ -1,24 +0,0 @@ - - - - - Director Tests - - - -

      - Director -


      -

      -
      -

      -
        -
        test markup, will be hidden
        - - - - - - - - diff --git a/node_modules/flatiron/node_modules/director/test/browser/routes-test.js b/node_modules/flatiron/node_modules/director/test/browser/routes-test.js deleted file mode 100644 index 81100d1..0000000 --- a/node_modules/flatiron/node_modules/director/test/browser/routes-test.js +++ /dev/null @@ -1,647 +0,0 @@ - -createTest('Nested route with the many children as a tokens, callbacks should yield historic params', { - '/a': { - '/:id': { - '/:id': function(a, b) { - shared.fired.push(location.hash, a, b); - } - } - } -}, function() { - shared.fired = []; - this.navigate('/a/b/c', function() { - deepEqual(shared.fired, ['#/a/b/c', 'b', 'c']); - this.finish(); - }); -}); - -createTest('Nested route with the first child as a token, callback should yield a param', { - '/foo': { - '/:id': { - on: function(id) { - shared.fired.push(location.hash, id); - } - } - } -}, function() { - shared.fired = []; - this.navigate('/foo/a', function() { - this.navigate('/foo/b/c', function() { - deepEqual(shared.fired, ['#/foo/a', 'a']); - this.finish(); - }); - }); -}); - -createTest('Nested route with the first child as a regexp, callback should yield a param', { - '/foo': { - '/(\\w+)': { - on: function(value) { - shared.fired.push(location.hash, value); - } - } - } -}, function() { - shared.fired = []; - this.navigate('/foo/a', function() { - this.navigate('/foo/b/c', function() { - deepEqual(shared.fired, ['#/foo/a', 'a']); - this.finish(); - }); - }); -}); - -createTest('Nested route with the several regular expressions, callback should yield a param', { - '/a': { - '/(\\w+)': { - '/(\\w+)': function(a, b) { - shared.fired.push(a, b); - } - } - } -}, function() { - shared.fired = []; - this.navigate('/a/b/c', function() { - deepEqual(shared.fired, ['b', 'c']); - this.finish(); - }); -}); - - - -createTest('Single nested route with on member containing function value', { - '/a': { - '/b': { - on: function() { - shared.fired.push(location.hash); - } - } - } -}, function() { - shared.fired = []; - this.navigate('/a/b', function() { - deepEqual(shared.fired, ['#/a/b']); - this.finish(); - }); -}); - -createTest('Single non-nested route with on member containing function value', { - '/a/b': { - on: function() { - shared.fired.push(location.hash); - } - } -}, function() { - shared.fired = []; - this.navigate('/a/b', function() { - deepEqual(shared.fired, ['#/a/b']); - this.finish(); - }); -}); - -createTest('Single nested route with on member containing array of function values', { - '/a': { - '/b': { - on: [function() { shared.fired.push(location.hash); }, - function() { shared.fired.push(location.hash); }] - } - } -}, function() { - shared.fired = []; - this.navigate('/a/b', function() { - deepEqual(shared.fired, ['#/a/b', '#/a/b']); - this.finish(); - }); -}); - -createTest('method should only fire once on the route.', { - '/a': { - '/b': { - once: function() { - shared.fired++; - } - } - } -}, function() { - shared.fired = 0; - this.navigate('/a/b', function() { - this.navigate('/a/b', function() { - this.navigate('/a/b', function() { - deepEqual(shared.fired, 1); - this.finish(); - }); - }); - }); -}); - -createTest('method should only fire once on the route, multiple nesting.', { - '/a': { - on: function() { shared.fired++; }, - once: function() { shared.fired++; } - }, - '/b': { - on: function() { shared.fired++; }, - once: function() { shared.fired++; } - } -}, function() { - shared.fired = 0; - this.navigate('/a', function() { - this.navigate('/b', function() { - this.navigate('/a', function() { - this.navigate('/b', function() { - deepEqual(shared.fired, 6); - this.finish(); - }); - }); - }); - }); -}); - -createTest('overlapping routes with tokens.', { - '/a/:b/c' : function() { - shared.fired.push(location.hash); - }, - '/a/:b/c/:d' : function() { - shared.fired.push(location.hash); - } -}, function() { - shared.fired = []; - this.navigate('/a/b/c', function() { - - this.navigate('/a/b/c/d', function() { - deepEqual(shared.fired, ['#/a/b/c', '#/a/b/c/d']); - this.finish(); - }); - }); -}); - -// // // -// // // Recursion features -// // // ---------------------------------------------------------- - -createTest('Nested routes with no recursion', { - '/a': { - '/b': { - '/c': { - on: function c() { - shared.fired.push('c'); - } - }, - on: function b() { - shared.fired.push('b'); - } - }, - on: function a() { - shared.fired.push('a'); - } - } -}, function() { - shared.fired = []; - - this.navigate('/a/b/c', function() { - deepEqual(shared.fired, ['c']); - this.finish(); - }); -}); - -createTest('Nested routes with backward recursion', { - '/a': { - '/b': { - '/c': { - on: function c() { - shared.fired.push('c'); - } - }, - on: function b() { - shared.fired.push('b'); - } - }, - on: function a() { - shared.fired.push('a'); - } - } -}, { - recurse: 'backward' -}, function() { - shared.fired = []; - - this.navigate('/a/b/c', function() { - deepEqual(shared.fired, ['c', 'b', 'a']); - this.finish(); - }); -}); - -createTest('Breaking out of nested routes with backward recursion', { - '/a': { - '/:b': { - '/c': { - on: function c() { - shared.fired.push('c'); - } - }, - on: function b() { - shared.fired.push('b'); - return false; - } - }, - on: function a() { - shared.fired.push('a'); - } - } -}, { - recurse: 'backward' -}, function() { - shared.fired = []; - - this.navigate('/a/b/c', function() { - deepEqual(shared.fired, ['c', 'b']); - this.finish(); - }); -}); - -createTest('Nested routes with forward recursion', { - '/a': { - '/b': { - '/c': { - on: function c() { - shared.fired.push('c'); - } - }, - on: function b() { - shared.fired.push('b'); - } - }, - on: function a() { - shared.fired.push('a'); - } - } -}, { - recurse: 'forward' -}, function() { - shared.fired = []; - - this.navigate('/a/b/c', function() { - deepEqual(shared.fired, ['a', 'b', 'c']); - this.finish(); - }); -}); - -createTest('Nested routes with forward recursion, single route with an after event.', { - '/a': { - '/b': { - '/c': { - on: function c() { - shared.fired.push('c'); - }, - after: function() { - shared.fired.push('c-after'); - } - }, - on: function b() { - shared.fired.push('b'); - } - }, - on: function a() { - shared.fired.push('a'); - } - } -}, { - recurse: 'forward' -}, function() { - shared.fired = []; - - this.navigate('/a/b/c', function() { - this.navigate('/a/b', function() { - deepEqual(shared.fired, ['a', 'b', 'c', 'c-after', 'a', 'b']); - this.finish(); - }); - }); -}); - -createTest('Breaking out of nested routes with forward recursion', { - '/a': { - '/b': { - '/c': { - on: function c() { - shared.fired.push('c'); - } - }, - on: function b() { - shared.fired.push('b'); - return false; - } - }, - on: function a() { - shared.fired.push('a'); - } - } -}, { - recurse: 'forward' -}, function() { - shared.fired = []; - - this.navigate('/a/b/c', function() { - deepEqual(shared.fired, ['a', 'b']); - this.finish(); - }); -}); - -// -// ABOVE IS WORKING -// - -// // -// // Special Events -// // ---------------------------------------------------------- - -createTest('All global event should fire after every route', { - '/a': { - on: function a() { - shared.fired.push('a'); - } - }, - '/b': { - '/c': { - on: function a() { - shared.fired.push('a'); - } - } - }, - '/d': { - '/:e': { - on: function a() { - shared.fired.push('a'); - } - } - } -}, { - after: function() { - shared.fired.push('b'); - } -}, function() { - shared.fired = []; - - this.navigate('/a', function() { - this.navigate('/b/c', function() { - this.navigate('/d/e', function() { - deepEqual(shared.fired, ['a', 'b', 'a', 'b', 'a']); - this.finish(); - }); - }); - }); - -}); - -createTest('Not found.', { - '/a': { - on: function a() { - shared.fired.push('a'); - } - }, - '/b': { - on: function a() { - shared.fired.push('b'); - } - } -}, { - notfound: function() { - shared.fired.push('notfound'); - } -}, function() { - shared.fired = []; - - this.navigate('/c', function() { - this.navigate('/d', function() { - deepEqual(shared.fired, ['notfound', 'notfound']); - this.finish(); - }); - }); -}); - -createTest('On all.', { - '/a': { - on: function a() { - shared.fired.push('a'); - } - }, - '/b': { - on: function a() { - shared.fired.push('b'); - } - } -}, { - on: function() { - shared.fired.push('c'); - } -}, function() { - shared.fired = []; - - this.navigate('/a', function() { - this.navigate('/b', function() { - deepEqual(shared.fired, ['a', 'c', 'b', 'c']); - this.finish(); - }); - }); -}); - - -createTest('After all.', { - '/a': { - on: function a() { - shared.fired.push('a'); - } - }, - '/b': { - on: function a() { - shared.fired.push('b'); - } - } -}, { - after: function() { - shared.fired.push('c'); - } -}, function() { - shared.fired = []; - - this.navigate('/a', function() { - this.navigate('/b', function() { - deepEqual(shared.fired, ['a', 'c', 'b']); - this.finish(); - }); - }); -}); - -createTest('resource object.', { - '/a': { - '/b/:c': { - on: 'f1' - }, - on: 'f2' - }, - '/d': { - on: ['f1', 'f2'] - } -}, -{ - resource: { - f1: function (name){ - shared.fired.push("f1-" + name); - }, - f2: function (name){ - shared.fired.push("f2"); - } - } -}, function() { - shared.fired = []; - - this.navigate('/a/b/c', function() { - this.navigate('/d', function() { - deepEqual(shared.fired, ['f1-c', 'f1-undefined', 'f2']); - this.finish(); - }); - }); -}); - -createTest('argument matching should be case agnostic', { - '/fooBar/:name': { - on: function(name) { - shared.fired.push("fooBar-" + name); - } - } -}, function() { - shared.fired = []; - this.navigate('/fooBar/tesTing', function() { - deepEqual(shared.fired, ['fooBar-tesTing']); - this.finish(); - }); -}); - -createTest('sanity test', { - '/is/:this/:sane': { - on: function(a, b) { - shared.fired.push('yes ' + a + ' is ' + b); - } - }, - '/': { - on: function() { - shared.fired.push('is there sanity?'); - } - } -}, function() { - shared.fired = []; - this.navigate('/is/there/sanity', function() { - deepEqual(shared.fired, ['yes there is sanity']); - this.finish(); - }); -}); - -createTest('`/` route should be navigable from the routing table', { - '/': { - on: function root() { - shared.fired.push('/'); - } - }, - '/:username': { - on: function afunc(username) { - shared.fired.push('/' + username); - } - } -}, function() { - shared.fired = []; - this.navigate('/', function root() { - deepEqual(shared.fired, ['/']); - this.finish(); - }); -}); - -createTest('`/` route should not override a `/:token` route', { - '/': { - on: function root() { - shared.fired.push('/'); - } - }, - '/:username': { - on: function afunc(username) { - shared.fired.push('/' + username); - } - } -}, function() { - shared.fired = []; - this.navigate('/a', function afunc() { - deepEqual(shared.fired, ['/a']); - this.finish(); - }); -}); - -createTest('should accept the root as a token.', { - '/:a': { - on: function root() { - shared.fired.push(location.hash); - } - } -}, function() { - shared.fired = []; - this.navigate('/a', function root() { - deepEqual(shared.fired, ['#/a']); - this.finish(); - }); -}); - -createTest('routes should allow wildcards.', { - '/:a/b*d': { - on: function() { - shared.fired.push(location.hash); - } - } -}, function() { - shared.fired = []; - this.navigate('/a/bcd', function root() { - deepEqual(shared.fired, ['#/a/bcd']); - this.finish(); - }); -}); - -createTest('functions should have |this| context of the router instance.', { - '/': { - on: function root() { - shared.fired.push(!!this.routes); - } - } -}, function() { - shared.fired = []; - this.navigate('/', function root() { - deepEqual(shared.fired, [true]); - this.finish(); - }); -}); - -createTest('setRoute with a single parameter should change location correctly', { - '/bonk': { - on: function() { - shared.fired.push(window.location.hash); - } - } -}, function() { - var self = this; - shared.fired = []; - this.router.setRoute('/bonk'); - setTimeout(function() { - deepEqual(shared.fired, ['#/bonk']); - self.finish(); - }, 14) -}); - -createTest('route should accept _ and . within parameters', { - '/:a': { - on: function root() { - shared.fired.push(location.hash); - } - } -}, function() { - shared.fired = []; - this.navigate('/a_complex_route.co.uk', function root() { - deepEqual(shared.fired, ['#/a_complex_route.co.uk']); - this.finish(); - }); -}); - diff --git a/node_modules/flatiron/node_modules/director/test/server/cli/dispatch-test.js b/node_modules/flatiron/node_modules/director/test/server/cli/dispatch-test.js deleted file mode 100644 index 7aead38..0000000 --- a/node_modules/flatiron/node_modules/director/test/server/cli/dispatch-test.js +++ /dev/null @@ -1,55 +0,0 @@ -/* - * dispatch-test.js: Tests for the core dispatch method. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - vows = require('vows'), - director = require('../../../lib/director'); - -vows.describe('director/cli/dispatch').addBatch({ - "An instance of director.cli.Router": { - topic: function () { - var router = new director.cli.Router(), - that = this; - - that.matched = {}; - that.matched['users'] = []; - that.matched['apps'] = [] - - router.on('users create', function () { - that.matched['users'].push('on users create'); - }); - - router.on(/apps (\w+\s\w+)/, function () { - assert.equal(arguments.length, 1); - that.matched['apps'].push('on apps (\\w+\\s\\w+)'); - }) - - return router; - }, - "should have the correct routing table": function (router) { - assert.isObject(router.routes.users); - assert.isObject(router.routes.users.create); - }, - "the dispatch() method": { - "users create": function (router) { - assert.isTrue(router.dispatch('on', 'users create')); - assert.equal(this.matched.users[0], 'on users create'); - }, - "apps foo bar": function (router) { - assert.isTrue(router.dispatch('on', 'apps foo bar')); - assert.equal(this.matched['apps'][0], 'on apps (\\w+\\s\\w+)'); - }, - "not here": function (router) { - assert.isFalse(router.dispatch('on', 'not here')); - }, - "still not here": function (router) { - assert.isFalse(router.dispatch('on', 'still not here')); - } - } - } -}).export(module); diff --git a/node_modules/flatiron/node_modules/director/test/server/cli/path-test.js b/node_modules/flatiron/node_modules/director/test/server/cli/path-test.js deleted file mode 100644 index 2094027..0000000 --- a/node_modules/flatiron/node_modules/director/test/server/cli/path-test.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * dispatch-test.js: Tests for the core dispatch method. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - vows = require('vows'), - director = require('../../../lib/director'); - -vows.describe('director/cli/path').addBatch({ - "An instance of director.cli.Router": { - topic: new director.cli.Router(), - "the path() method": { - "should create the correct nested routing table": function (router) { - function noop () {} - - router.path(/apps/, function () { - router.path(/foo/, function () { - router.on(/bar/, noop); - }); - - router.on(/list/, noop); - }); - - router.on(/users/, noop); - - assert.isObject(router.routes.apps); - assert.isFunction(router.routes.apps.list.on); - assert.isObject(router.routes.apps.foo); - assert.isFunction(router.routes.apps.foo.bar.on); - assert.isFunction(router.routes.users.on); - } - } - } -}).export(module); - diff --git a/node_modules/flatiron/node_modules/director/test/server/core/dispatch-test.js b/node_modules/flatiron/node_modules/director/test/server/core/dispatch-test.js deleted file mode 100644 index c05c746..0000000 --- a/node_modules/flatiron/node_modules/director/test/server/core/dispatch-test.js +++ /dev/null @@ -1,113 +0,0 @@ -/* - * dispatch-test.js: Tests for the core dispatch method. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - vows = require('vows'), - director = require('../../../lib/director'); - -vows.describe('director/router/dispatch').addBatch({ - "An instance of director.Router": { - topic: function () { - var that = this; - that.matched = {}; - that.matched['/'] = []; - that.matched['foo'] = []; - that.matched['f*'] = [] - - var router = new director.Router({ - '/': { - before: function () { that.matched['/'].push('before /') }, - on: function () { that.matched['/'].push('on /') }, - after: function () { that.matched['/'].push('after /') } - }, - '/foo': { - before: function () { that.matched.foo.push('before foo') }, - on: function () { that.matched.foo.push('on foo') }, - after: function () { that.matched.foo.push('after foo') }, - '/bar': { - before: function () { that.matched.foo.push('before foo bar') }, - on: function () { that.matched.foo.push('foo bar') }, - after: function () { that.matched.foo.push('after foo bar') }, - '/buzz': function () { that.matched.foo.push('foo bar buzz') } - } - }, - '/f*': { - '/barbie': function () { that.matched['f*'].push('f* barbie') } - } - }); - - router.configure({ - recurse: 'backward' - }); - - return router; - }, - "should have the correct routing table": function (router) { - assert.isObject(router.routes.foo); - assert.isObject(router.routes.foo.bar); - assert.isObject(router.routes.foo.bar.buzz); - assert.isFunction(router.routes.foo.bar.buzz.on); - }, - "the dispatch() method": { - "/": function (router) { - assert.isTrue(router.dispatch('on', '/')); - assert.isTrue(router.dispatch('on', '/')); - - assert.equal(this.matched['/'][0], 'before /'); - assert.equal(this.matched['/'][1], 'on /'); - assert.equal(this.matched['/'][2], 'after /'); - }, - "/foo/bar/buzz": function (router) { - assert.isTrue(router.dispatch('on', '/foo/bar/buzz')); - - assert.equal(this.matched.foo[0], 'foo bar buzz'); - assert.equal(this.matched.foo[1], 'before foo bar'); - assert.equal(this.matched.foo[2], 'foo bar'); - assert.equal(this.matched.foo[3], 'before foo'); - assert.equal(this.matched.foo[4], 'on foo'); - }, - "/foo/barbie": function (router) { - assert.isTrue(router.dispatch('on', '/foo/barbie')); - assert.equal(this.matched['f*'][0], 'f* barbie'); - }, - "/foo/barbie/": function (router) { - assert.isFalse(router.dispatch('on', '/foo/barbie/')); - }, - "/foo/BAD": function (router) { - assert.isFalse(router.dispatch('on', '/foo/BAD')); - }, - "/bar/bar": function (router) { - assert.isFalse(router.dispatch('on', '/bar/bar')); - }, - "with the strict option disabled": { - topic: function (router) { - return router.configure({ - recurse: 'backward', - strict: false - }); - }, - "should have the proper configuration set": function (router) { - assert.isFalse(router.strict); - }, - "/foo/barbie/": function (router) { - assert.isTrue(router.dispatch('on', '/foo/barbie/')); - assert.equal(this.matched['f*'][0], 'f* barbie'); - }, - "/foo/bar/buzz": function (router) { - assert.isTrue(router.dispatch('on', '/foo/bar/buzz')); - - assert.equal(this.matched.foo[0], 'foo bar buzz'); - assert.equal(this.matched.foo[1], 'before foo bar'); - assert.equal(this.matched.foo[2], 'foo bar'); - assert.equal(this.matched.foo[3], 'before foo'); - assert.equal(this.matched.foo[4], 'on foo'); - }, - } - } - } -}).export(module); diff --git a/node_modules/flatiron/node_modules/director/test/server/core/insert-test.js b/node_modules/flatiron/node_modules/director/test/server/core/insert-test.js deleted file mode 100644 index cd528ad..0000000 --- a/node_modules/flatiron/node_modules/director/test/server/core/insert-test.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * insert-test.js: Tests for inserting routes into a normalized routing table. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - vows = require('vows'), - director = require('../../../lib/director'); - -vows.describe('director/router/insert').addBatch({ - "An instance of director.Router": { - topic: new director.Router(), - "the insert() method": { - "'on', ['foo', 'bar']": function (router) { - function route () { } - - router.insert('on', ['foo', 'bar'], route); - assert.strictEqual(router.routes.foo.bar.on, route); - }, - "'on', ['foo', 'bar'] again": function (router) { - function route () { } - - router.insert('on', ['foo', 'bar'], route); - assert.isArray(router.routes.foo.bar.on); - assert.strictEqual(router.routes.foo.bar.on.length, 2); - }, - "'on', ['foo', 'bar'] a third time": function (router) { - function route () { } - - router.insert('on', ['foo', 'bar'], route); - assert.isArray(router.routes.foo.bar.on); - assert.strictEqual(router.routes.foo.bar.on.length, 3); - }, - "'get', ['fizz', 'buzz']": function (router) { - function route () { } - - router.insert('get', ['fizz', 'buzz'], route); - assert.strictEqual(router.routes.fizz.buzz.get, route); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/director/test/server/core/mount-test.js b/node_modules/flatiron/node_modules/director/test/server/core/mount-test.js deleted file mode 100644 index f409d8a..0000000 --- a/node_modules/flatiron/node_modules/director/test/server/core/mount-test.js +++ /dev/null @@ -1,104 +0,0 @@ -/* - * mount-test.js: Tests for mounting and normalizing routes into a Router instance. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - vows = require('vows'), - director = require('../../../lib/director'); - -function assertRoute (fn, path, route) { - if (path.length === 1) { - return assert.strictEqual(route[path.shift()], fn); - } - - route = route[path.shift()]; - assert.isObject(route); - assertRoute(fn, path, route); -} - -vows.describe('director/router/mount').addBatch({ - "An instance of director.Router": { - "with no preconfigured params": { - topic: new director.Router(), - "the mount() method": { - "should sanitize the routes correctly": function (router) { - function foobar () { } - function foostar () { } - function foobazzbuzz () { } - function foodog () { } - function root () {} - var fnArray = [foobar, foostar]; - - router.mount({ - '/': { - before: root, - on: root, - after: root, - '/nesting': { - on: foobar, - '/deep': foostar - } - }, - '/foo': { - '/bar': foobar, - '/*': foostar, - '/jitsu/then': { - before: foobar - } - }, - '/foo/bazz': { - '/buzz': foobazzbuzz - }, - '/foo/jitsu': { - '/then': fnArray - }, - '/foo/jitsu/then/now': foostar, - '/foo/:dog': foodog - }); - - assertRoute(root, ['on'], router.routes); - assertRoute(root, ['after'], router.routes); - assertRoute(root, ['before'], router.routes); - assertRoute(foobar, ['nesting', 'on'], router.routes); - assertRoute(foostar, ['nesting', 'deep', 'on'], router.routes); - assertRoute(foobar, [ 'foo', 'bar', 'on'], router.routes); - assertRoute(foostar, ['foo', '([_.()!\\ %@&a-zA-Z0-9-]+)', 'on'], router.routes); - assertRoute(fnArray, ['foo', 'jitsu', 'then', 'on'], router.routes); - assertRoute(foobar, ['foo', 'jitsu', 'then', 'before'], router.routes); - assertRoute(foobazzbuzz, ['foo', 'bazz', 'buzz', 'on'], router.routes); - assertRoute(foostar, ['foo', 'jitsu', 'then', 'now', 'on'], router.routes); - assertRoute(foodog, ['foo', '([._a-zA-Z0-9-]+)', 'on'], router.routes); - } - } - }, - "with preconfigured params": { - topic: function () { - var router = new director.Router(); - router.param('city', '([\\w\\-]+)'); - router.param(':country', /([A-Z][A-Za-z]+)/); - router.param(':zip', /([\d]{5})/); - return router; - }, - "should sanitize the routes correctly": function (router) { - function usaCityZip () { } - function countryCityZip () { } - - router.mount({ - '/usa/:city/:zip': usaCityZip, - '/world': { - '/:country': { - '/:city/:zip': countryCityZip - } - } - }); - - assertRoute(usaCityZip, ['usa', '([\\w\\-]+)', '([\\d]{5})', 'on'], router.routes); - assertRoute(countryCityZip, ['world', '([A-Z][A-Za-z]+)', '([\\w\\-]+)', '([\\d]{5})', 'on'], router.routes); - } - } - } -}).export(module); diff --git a/node_modules/flatiron/node_modules/director/test/server/core/path-test.js b/node_modules/flatiron/node_modules/director/test/server/core/path-test.js deleted file mode 100644 index 4418ff9..0000000 --- a/node_modules/flatiron/node_modules/director/test/server/core/path-test.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * path-test.js: Tests for the core dispatch method. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - vows = require('vows'), - director = require('../../../lib/director'); - -vows.describe('director/router/path').addBatch({ - "An instance of director.Router": { - topic: function () { - var that = this; - that.matched = {}; - that.matched['foo'] = []; - that.matched['newyork'] = []; - - var router = new director.Router({ - '/foo': function () { that.matched['foo'].push('foo'); } - }); - return router; - }, - "the path() method": { - "should create the correct nested routing table": function (router) { - var that = this; - router.path('/regions', function () { - this.on('/:state', function(country) { - that.matched['newyork'].push('new york'); - }); - }); - - assert.isFunction(router.routes.foo.on); - assert.isObject(router.routes.regions); - assert.isFunction(router.routes.regions['([._a-zA-Z0-9-]+)'].on); - }, - "should dispatch the function correctly": function (router) { - router.dispatch('on', '/regions/newyork') - router.dispatch('on', '/foo'); - assert.equal(this.matched['foo'].length, 1); - assert.equal(this.matched['newyork'].length, 1); - assert.equal(this.matched['foo'][0], 'foo'); - assert.equal(this.matched['newyork'][0], 'new york'); - } - } - } -}).export(module); diff --git a/node_modules/flatiron/node_modules/director/test/server/helpers/macros.js b/node_modules/flatiron/node_modules/director/test/server/helpers/macros.js deleted file mode 100644 index 657b991..0000000 --- a/node_modules/flatiron/node_modules/director/test/server/helpers/macros.js +++ /dev/null @@ -1,7 +0,0 @@ -/* - * macros.js: Test macros for director tests. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/director/test/server/http/http-test.js b/node_modules/flatiron/node_modules/director/test/server/http/http-test.js deleted file mode 100644 index 9ff4c9a..0000000 --- a/node_modules/flatiron/node_modules/director/test/server/http/http-test.js +++ /dev/null @@ -1,76 +0,0 @@ -/* - * http-test.js: Tests for basic HTTP server(s). - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - http = require('http'), - vows = require('vows'), - request = require('request'), - director = require('../../../lib/director'); - -function helloWorld(id) { - this.res.writeHead(200, { 'Content-Type': 'text/plain' }) - this.res.end('hello from (' + id + ')'); -} - -function createServer (router) { - return http.createServer(function (req, res) { - router.dispatch(req, res, function (err) { - if (err) { - res.writeHead(404); - res.end(); - } - }); - }); -} - -function assertGet (uri) { - return { - topic: function () { - request({ uri: 'http://localhost:9090/' + uri }, this.callback); - }, - "should respond with `hello from (bark)`": function (err, res, body) { - assert.isNull(err); - assert.equal(res.statusCode, 200); - assert.equal(body, 'hello from (bark)') - } - } -} - -vows.describe('director/server/http').addBatch({ - "An instance of director.http.Router": { - "instantiated with a Routing table": { - topic: new director.http.Router({ - '/hello': { - get: helloWorld - } - }), - "should have the correct routes defined": function (router) { - assert.isObject(router.routes.hello); - assert.isFunction(router.routes.hello.get); - }, - "when passed to an http.Server instance": { - topic: function (router) { - router.get(/foo\/bar\/(\w+)/, helloWorld); - router.get(/foo\/update\/(\w+)/, helloWorld); - router.path(/bar\/bazz\//, function () { - this.get(/(\w+)/, helloWorld) - }); - - var server = createServer(router), - that = this; - - server.listen(9090, this.callback); - }, - "a request to foo/bar/bark": assertGet('foo/bar/bark'), - "a request to foo/update/bark": assertGet('foo/update/bark'), - "a request to bar/bazz/bark": assertGet('bar/bazz/bark'), - "a request to foo/bar/bark?test=test": assertGet('foo/bar/bark?test=test') - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/director/test/server/http/insert-test.js b/node_modules/flatiron/node_modules/director/test/server/http/insert-test.js deleted file mode 100644 index e334bcf..0000000 --- a/node_modules/flatiron/node_modules/director/test/server/http/insert-test.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * insert-test.js: Tests for inserting routes into a normalized routing table. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - vows = require('vows'), - director = require('../../../lib/director'); - -vows.describe('director/router/http/insert').addBatch({ - "An instance of director.Router": { - topic: new director.http.Router(), - "the path() method": { - "/resource": { - "should insert nested routes correct": function (router) { - function getResource() {} - function modifyResource() {} - - router.path(/\/resource/, function () { - this.get(getResource); - - this.put(/\/update/, modifyResource); - this.post(/create/, modifyResource); - }); - - assert.equal(router.routes.resource.get, getResource); - assert.equal(router.routes.resource.update.put, modifyResource); - assert.equal(router.routes.resource.create.post, modifyResource); - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/director/test/server/http/methods-test.js b/node_modules/flatiron/node_modules/director/test/server/http/methods-test.js deleted file mode 100644 index 2e597fc..0000000 --- a/node_modules/flatiron/node_modules/director/test/server/http/methods-test.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * methods-test.js: Tests for HTTP methods. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - vows = require('vows'), - director = require('../../../lib/director'); - -vows.describe('director/http/methods').addBatch({ - "When using director": { - "an instance of director.http.Router should have all relevant RFC methods": function () { - var router = new director.http.Router(); - director.http.methods.forEach(function (method) { - assert.isFunction(router[method.toLowerCase()]); - }); - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/director/test/server/http/responses-test.js b/node_modules/flatiron/node_modules/director/test/server/http/responses-test.js deleted file mode 100644 index ad46e5c..0000000 --- a/node_modules/flatiron/node_modules/director/test/server/http/responses-test.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * responses-test.js: Tests for HTTP responses. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - vows = require('vows'), - director = require('../../../lib/director'); - -vows.describe('director/http/responses').addBatch({ - "When using director.http": { - "it should have the relevant responses defined": function () { - Object.keys(require('../../../lib/director/http/responses')).forEach(function (name) { - assert.isFunction(director.http[name]); - }); - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/optimist/.npmignore b/node_modules/flatiron/node_modules/optimist/.npmignore deleted file mode 100644 index bfdb82c..0000000 --- a/node_modules/flatiron/node_modules/optimist/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -lib-cov/* -*.swp -*.swo -node_modules diff --git a/node_modules/flatiron/node_modules/optimist/LICENSE b/node_modules/flatiron/node_modules/optimist/LICENSE deleted file mode 100644 index 432d1ae..0000000 --- a/node_modules/flatiron/node_modules/optimist/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -Copyright 2010 James Halliday (mail@substack.net) - -This project is free software released under the MIT/X11 license: - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/flatiron/node_modules/optimist/README.markdown b/node_modules/flatiron/node_modules/optimist/README.markdown deleted file mode 100644 index 3370d19..0000000 --- a/node_modules/flatiron/node_modules/optimist/README.markdown +++ /dev/null @@ -1,485 +0,0 @@ -optimist -======== - -Optimist is a node.js library for option parsing for people who hate option -parsing. More specifically, this module is for people who like all the --bells -and -whistlz of program usage but think optstrings are a waste of time. - -With optimist, option parsing doesn't have to suck (as much). - -examples -======== - -With Optimist, the options are just a hash! No optstrings attached. -------------------------------------------------------------------- - -xup.js: - -````javascript -#!/usr/bin/env node -var argv = require('optimist').argv; - -if (argv.rif - 5 * argv.xup > 7.138) { - console.log('Buy more riffiwobbles'); -} -else { - console.log('Sell the xupptumblers'); -} -```` - -*** - - $ ./xup.js --rif=55 --xup=9.52 - Buy more riffiwobbles - - $ ./xup.js --rif 12 --xup 8.1 - Sell the xupptumblers - -![This one's optimistic.](http://substack.net/images/optimistic.png) - -But wait! There's more! You can do short options: -------------------------------------------------- - -short.js: - -````javascript -#!/usr/bin/env node -var argv = require('optimist').argv; -console.log('(%d,%d)', argv.x, argv.y); -```` - -*** - - $ ./short.js -x 10 -y 21 - (10,21) - -And booleans, both long and short (and grouped): ----------------------------------- - -bool.js: - -````javascript -#!/usr/bin/env node -var util = require('util'); -var argv = require('optimist').argv; - -if (argv.s) { - util.print(argv.fr ? 'Le chat dit: ' : 'The cat says: '); -} -console.log( - (argv.fr ? 'miaou' : 'meow') + (argv.p ? '.' : '') -); -```` - -*** - - $ ./bool.js -s - The cat says: meow - - $ ./bool.js -sp - The cat says: meow. - - $ ./bool.js -sp --fr - Le chat dit: miaou. - -And non-hypenated options too! Just use `argv._`! -------------------------------------------------- - -nonopt.js: - -````javascript -#!/usr/bin/env node -var argv = require('optimist').argv; -console.log('(%d,%d)', argv.x, argv.y); -console.log(argv._); -```` - -*** - - $ ./nonopt.js -x 6.82 -y 3.35 moo - (6.82,3.35) - [ 'moo' ] - - $ ./nonopt.js foo -x 0.54 bar -y 1.12 baz - (0.54,1.12) - [ 'foo', 'bar', 'baz' ] - -Plus, Optimist comes with .usage() and .demand()! -------------------------------------------------- - -divide.js: - -````javascript -#!/usr/bin/env node -var argv = require('optimist') - .usage('Usage: $0 -x [num] -y [num]') - .demand(['x','y']) - .argv; - -console.log(argv.x / argv.y); -```` - -*** - - $ ./divide.js -x 55 -y 11 - 5 - - $ node ./divide.js -x 4.91 -z 2.51 - Usage: node ./divide.js -x [num] -y [num] - - Options: - -x [required] - -y [required] - - Missing required arguments: y - -EVEN MORE HOLY COW ------------------- - -default_singles.js: - -````javascript -#!/usr/bin/env node -var argv = require('optimist') - .default('x', 10) - .default('y', 10) - .argv -; -console.log(argv.x + argv.y); -```` - -*** - - $ ./default_singles.js -x 5 - 15 - -default_hash.js: - -````javascript -#!/usr/bin/env node -var argv = require('optimist') - .default({ x : 10, y : 10 }) - .argv -; -console.log(argv.x + argv.y); -```` - -*** - - $ ./default_hash.js -y 7 - 17 - -And if you really want to get all descriptive about it... ---------------------------------------------------------- - -boolean_single.js - -````javascript -#!/usr/bin/env node -var argv = require('optimist') - .boolean('v') - .argv -; -console.dir(argv); -```` - -*** - - $ ./boolean_single.js -v foo bar baz - true - [ 'bar', 'baz', 'foo' ] - -boolean_double.js - -````javascript -#!/usr/bin/env node -var argv = require('optimist') - .boolean(['x','y','z']) - .argv -; -console.dir([ argv.x, argv.y, argv.z ]); -console.dir(argv._); -```` - -*** - - $ ./boolean_double.js -x -z one two three - [ true, false, true ] - [ 'one', 'two', 'three' ] - -Optimist is here to help... ---------------------------- - -You can describe parameters for help messages and set aliases. Optimist figures -out how to format a handy help string automatically. - -line_count.js - -````javascript -#!/usr/bin/env node -var argv = require('optimist') - .usage('Count the lines in a file.\nUsage: $0') - .demand('f') - .alias('f', 'file') - .describe('f', 'Load a file') - .argv -; - -var fs = require('fs'); -var s = fs.createReadStream(argv.file); - -var lines = 0; -s.on('data', function (buf) { - lines += buf.toString().match(/\n/g).length; -}); - -s.on('end', function () { - console.log(lines); -}); -```` - -*** - - $ node line_count.js - Count the lines in a file. - Usage: node ./line_count.js - - Options: - -f, --file Load a file [required] - - Missing required arguments: f - - $ node line_count.js --file line_count.js - 20 - - $ node line_count.js -f line_count.js - 20 - -methods -======= - -By itself, - -````javascript -require('optimist').argv -````` - -will use `process.argv` array to construct the `argv` object. - -You can pass in the `process.argv` yourself: - -````javascript -require('optimist')([ '-x', '1', '-y', '2' ]).argv -```` - -or use .parse() to do the same thing: - -````javascript -require('optimist').parse([ '-x', '1', '-y', '2' ]) -```` - -The rest of these methods below come in just before the terminating `.argv`. - -.alias(key, alias) ------------------- - -Set key names as equivalent such that updates to a key will propagate to aliases -and vice-versa. - -Optionally `.alias()` can take an object that maps keys to aliases. - -.default(key, value) --------------------- - -Set `argv[key]` to `value` if no option was specified on `process.argv`. - -Optionally `.default()` can take an object that maps keys to default values. - -.demand(key) ------------- - -If `key` is a string, show the usage information and exit if `key` wasn't -specified in `process.argv`. - -If `key` is a number, demand at least as many non-option arguments, which show -up in `argv._`. - -If `key` is an Array, demand each element. - -.describe(key, desc) --------------------- - -Describe a `key` for the generated usage information. - -Optionally `.describe()` can take an object that maps keys to descriptions. - -.options(key, opt) ------------------- - -Instead of chaining together `.alias().demand().default()`, you can specify -keys in `opt` for each of the chainable methods. - -For example: - -````javascript -var argv = require('optimist') - .options('f', { - alias : 'file', - default : '/etc/passwd', - }) - .argv -; -```` - -is the same as - -````javascript -var argv = require('optimist') - .alias('f', 'file') - .default('f', '/etc/passwd') - .argv -; -```` - -Optionally `.options()` can take an object that maps keys to `opt` parameters. - -.usage(message) ---------------- - -Set a usage message to show which commands to use. Inside `message`, the string -`$0` will get interpolated to the current script name or node command for the -present script similar to how `$0` works in bash or perl. - -.check(fn) ----------- - -Check that certain conditions are met in the provided arguments. - -If `fn` throws or returns `false`, show the thrown error, usage information, and -exit. - -.boolean(key) -------------- - -Interpret `key` as a boolean. If a non-flag option follows `key` in -`process.argv`, that string won't get set as the value of `key`. - -If `key` never shows up as a flag in `process.arguments`, `argv[key]` will be -`false`. - -If `key` is an Array, interpret all the elements as booleans. - -.string(key) ------------- - -Tell the parser logic not to interpret `key` as a number or boolean. -This can be useful if you need to preserve leading zeros in an input. - -If `key` is an Array, interpret all the elements as strings. - -.wrap(columns) --------------- - -Format usage output to wrap at `columns` many columns. - -.help() -------- - -Return the generated usage string. - -.showHelp(fn=console.error) ---------------------------- - -Print the usage data using `fn` for printing. - -.parse(args) ------------- - -Parse `args` instead of `process.argv`. Returns the `argv` object. - -.argv ------ - -Get the arguments as a plain old object. - -Arguments without a corresponding flag show up in the `argv._` array. - -The script name or node command is available at `argv.$0` similarly to how `$0` -works in bash or perl. - -parsing tricks -============== - -stop parsing ------------- - -Use `--` to stop parsing flags and stuff the remainder into `argv._`. - - $ node examples/reflect.js -a 1 -b 2 -- -c 3 -d 4 - { _: [ '-c', '3', '-d', '4' ], - '$0': 'node ./examples/reflect.js', - a: 1, - b: 2 } - -negate fields -------------- - -If you want to explicity set a field to false instead of just leaving it -undefined or to override a default you can do `--no-key`. - - $ node examples/reflect.js -a --no-b - { _: [], - '$0': 'node ./examples/reflect.js', - a: true, - b: false } - -numbers -------- - -Every argument that looks like a number (`!isNaN(Number(arg))`) is converted to -one. This way you can just `net.createConnection(argv.port)` and you can add -numbers out of `argv` with `+` without having that mean concatenation, -which is super frustrating. - -duplicates ----------- - -If you specify a flag multiple times it will get turned into an array containing -all the values in order. - - $ node examples/reflect.js -x 5 -x 8 -x 0 - { _: [], - '$0': 'node ./examples/reflect.js', - x: [ 5, 8, 0 ] } - -dot notation ------------- - -When you use dots (`.`s) in argument names, an implicit object path is assumed. -This lets you organize arguments into nested objects. - - $ node examples/reflect.js --foo.bar.baz=33 --foo.quux=5 - { _: [], - '$0': 'node ./examples/reflect.js', - foo: { bar: { baz: 33 }, quux: 5 } } - -installation -============ - -With [npm](http://github.com/isaacs/npm), just do: - npm install optimist - -or clone this project on github: - - git clone http://github.com/substack/node-optimist.git - -To run the tests with [expresso](http://github.com/visionmedia/expresso), -just do: - - expresso - -inspired By -=========== - -This module is loosely inspired by Perl's -[Getopt::Casual](http://search.cpan.org/~photo/Getopt-Casual-0.13.1/Casual.pm). diff --git a/node_modules/flatiron/node_modules/optimist/examples/bool.js b/node_modules/flatiron/node_modules/optimist/examples/bool.js deleted file mode 100644 index a998fb7..0000000 --- a/node_modules/flatiron/node_modules/optimist/examples/bool.js +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env node -var util = require('util'); -var argv = require('optimist').argv; - -if (argv.s) { - util.print(argv.fr ? 'Le chat dit: ' : 'The cat says: '); -} -console.log( - (argv.fr ? 'miaou' : 'meow') + (argv.p ? '.' : '') -); diff --git a/node_modules/flatiron/node_modules/optimist/examples/boolean_double.js b/node_modules/flatiron/node_modules/optimist/examples/boolean_double.js deleted file mode 100644 index a35a7e6..0000000 --- a/node_modules/flatiron/node_modules/optimist/examples/boolean_double.js +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node -var argv = require('optimist') - .boolean(['x','y','z']) - .argv -; -console.dir([ argv.x, argv.y, argv.z ]); -console.dir(argv._); diff --git a/node_modules/flatiron/node_modules/optimist/examples/boolean_single.js b/node_modules/flatiron/node_modules/optimist/examples/boolean_single.js deleted file mode 100644 index 017bb68..0000000 --- a/node_modules/flatiron/node_modules/optimist/examples/boolean_single.js +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node -var argv = require('optimist') - .boolean('v') - .argv -; -console.dir(argv.v); -console.dir(argv._); diff --git a/node_modules/flatiron/node_modules/optimist/examples/default_hash.js b/node_modules/flatiron/node_modules/optimist/examples/default_hash.js deleted file mode 100644 index ade7768..0000000 --- a/node_modules/flatiron/node_modules/optimist/examples/default_hash.js +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env node - -var argv = require('optimist') - .default({ x : 10, y : 10 }) - .argv -; - -console.log(argv.x + argv.y); diff --git a/node_modules/flatiron/node_modules/optimist/examples/default_singles.js b/node_modules/flatiron/node_modules/optimist/examples/default_singles.js deleted file mode 100644 index d9b1ff4..0000000 --- a/node_modules/flatiron/node_modules/optimist/examples/default_singles.js +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node -var argv = require('optimist') - .default('x', 10) - .default('y', 10) - .argv -; -console.log(argv.x + argv.y); diff --git a/node_modules/flatiron/node_modules/optimist/examples/divide.js b/node_modules/flatiron/node_modules/optimist/examples/divide.js deleted file mode 100644 index 5e2ee82..0000000 --- a/node_modules/flatiron/node_modules/optimist/examples/divide.js +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env node - -var argv = require('optimist') - .usage('Usage: $0 -x [num] -y [num]') - .demand(['x','y']) - .argv; - -console.log(argv.x / argv.y); diff --git a/node_modules/flatiron/node_modules/optimist/examples/line_count.js b/node_modules/flatiron/node_modules/optimist/examples/line_count.js deleted file mode 100644 index b5f95bf..0000000 --- a/node_modules/flatiron/node_modules/optimist/examples/line_count.js +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env node -var argv = require('optimist') - .usage('Count the lines in a file.\nUsage: $0') - .demand('f') - .alias('f', 'file') - .describe('f', 'Load a file') - .argv -; - -var fs = require('fs'); -var s = fs.createReadStream(argv.file); - -var lines = 0; -s.on('data', function (buf) { - lines += buf.toString().match(/\n/g).length; -}); - -s.on('end', function () { - console.log(lines); -}); diff --git a/node_modules/flatiron/node_modules/optimist/examples/line_count_options.js b/node_modules/flatiron/node_modules/optimist/examples/line_count_options.js deleted file mode 100644 index d9ac709..0000000 --- a/node_modules/flatiron/node_modules/optimist/examples/line_count_options.js +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env node -var argv = require('optimist') - .usage('Count the lines in a file.\nUsage: $0') - .options({ - file : { - demand : true, - alias : 'f', - description : 'Load a file' - }, - base : { - alias : 'b', - description : 'Numeric base to use for output', - default : 10, - }, - }) - .argv -; - -var fs = require('fs'); -var s = fs.createReadStream(argv.file); - -var lines = 0; -s.on('data', function (buf) { - lines += buf.toString().match(/\n/g).length; -}); - -s.on('end', function () { - console.log(lines.toString(argv.base)); -}); diff --git a/node_modules/flatiron/node_modules/optimist/examples/line_count_wrap.js b/node_modules/flatiron/node_modules/optimist/examples/line_count_wrap.js deleted file mode 100644 index 4267511..0000000 --- a/node_modules/flatiron/node_modules/optimist/examples/line_count_wrap.js +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env node -var argv = require('optimist') - .usage('Count the lines in a file.\nUsage: $0') - .wrap(80) - .demand('f') - .alias('f', [ 'file', 'filename' ]) - .describe('f', - "Load a file. It's pretty important." - + " Required even. So you'd better specify it." - ) - .alias('b', 'base') - .describe('b', 'Numeric base to display the number of lines in') - .default('b', 10) - .describe('x', 'Super-secret optional parameter which is secret') - .default('x', '') - .argv -; - -var fs = require('fs'); -var s = fs.createReadStream(argv.file); - -var lines = 0; -s.on('data', function (buf) { - lines += buf.toString().match(/\n/g).length; -}); - -s.on('end', function () { - console.log(lines.toString(argv.base)); -}); diff --git a/node_modules/flatiron/node_modules/optimist/examples/nonopt.js b/node_modules/flatiron/node_modules/optimist/examples/nonopt.js deleted file mode 100644 index ee633ee..0000000 --- a/node_modules/flatiron/node_modules/optimist/examples/nonopt.js +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env node -var argv = require('optimist').argv; -console.log('(%d,%d)', argv.x, argv.y); -console.log(argv._); diff --git a/node_modules/flatiron/node_modules/optimist/examples/reflect.js b/node_modules/flatiron/node_modules/optimist/examples/reflect.js deleted file mode 100644 index 816b3e1..0000000 --- a/node_modules/flatiron/node_modules/optimist/examples/reflect.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -console.dir(require('optimist').argv); diff --git a/node_modules/flatiron/node_modules/optimist/examples/short.js b/node_modules/flatiron/node_modules/optimist/examples/short.js deleted file mode 100644 index 1db0ad0..0000000 --- a/node_modules/flatiron/node_modules/optimist/examples/short.js +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node -var argv = require('optimist').argv; -console.log('(%d,%d)', argv.x, argv.y); diff --git a/node_modules/flatiron/node_modules/optimist/examples/string.js b/node_modules/flatiron/node_modules/optimist/examples/string.js deleted file mode 100644 index a8e5aeb..0000000 --- a/node_modules/flatiron/node_modules/optimist/examples/string.js +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env node -var argv = require('optimist') - .string('x', 'y') - .argv -; -console.dir([ argv.x, argv.y ]); - -/* Turns off numeric coercion: - ./node string.js -x 000123 -y 9876 - [ '000123', '9876' ] -*/ diff --git a/node_modules/flatiron/node_modules/optimist/examples/usage-options.js b/node_modules/flatiron/node_modules/optimist/examples/usage-options.js deleted file mode 100644 index b999977..0000000 --- a/node_modules/flatiron/node_modules/optimist/examples/usage-options.js +++ /dev/null @@ -1,19 +0,0 @@ -var optimist = require('./../index'); - -var argv = optimist.usage('This is my awesome program', { - 'about': { - description: 'Provide some details about the author of this program', - required: true, - short: 'a', - }, - 'info': { - description: 'Provide some information about the node.js agains!!!!!!', - boolean: true, - short: 'i' - } -}).argv; - -optimist.showHelp(); - -console.log('\n\nInspecting options'); -console.dir(argv); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/optimist/examples/xup.js b/node_modules/flatiron/node_modules/optimist/examples/xup.js deleted file mode 100644 index 8f6ecd2..0000000 --- a/node_modules/flatiron/node_modules/optimist/examples/xup.js +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env node -var argv = require('optimist').argv; - -if (argv.rif - 5 * argv.xup > 7.138) { - console.log('Buy more riffiwobbles'); -} -else { - console.log('Sell the xupptumblers'); -} - diff --git a/node_modules/flatiron/node_modules/optimist/index.js b/node_modules/flatiron/node_modules/optimist/index.js deleted file mode 100644 index 753097f..0000000 --- a/node_modules/flatiron/node_modules/optimist/index.js +++ /dev/null @@ -1,470 +0,0 @@ -var path = require('path'); -var wordwrap = require('wordwrap'); - -/* Hack an instance of Argv with process.argv into Argv - so people can do - require('optimist')(['--beeble=1','-z','zizzle']).argv - to parse a list of args and - require('optimist').argv - to get a parsed version of process.argv. -*/ - -var inst = Argv(process.argv.slice(2)); -Object.keys(inst).forEach(function (key) { - Argv[key] = typeof inst[key] == 'function' - ? inst[key].bind(inst) - : inst[key]; -}); - -var exports = module.exports = Argv; -function Argv (args, cwd) { - var self = {}; - if (!cwd) cwd = process.cwd(); - - self.$0 = process.argv - .slice(0,2) - .map(function (x) { - var b = rebase(cwd, x); - return x.match(/^\//) && b.length < x.length - ? b : x - }) - .join(' ') - ; - - if (process.argv[1] == process.env._) { - self.$0 = process.env._.replace( - path.dirname(process.execPath) + '/', '' - ); - } - - var flags = { bools : {}, strings : {} }; - - self.boolean = function (bools) { - if (!Array.isArray(bools)) { - bools = [].slice.call(arguments); - } - - bools.forEach(function (name) { - flags.bools[name] = true; - }); - - return self; - }; - - self.string = function (strings) { - if (!Array.isArray(strings)) { - strings = [].slice.call(arguments); - } - - strings.forEach(function (name) { - flags.strings[name] = true; - }); - - return self; - }; - - var aliases = {}; - self.alias = function (x, y) { - if (typeof x === 'object') { - Object.keys(x).forEach(function (key) { - self.alias(key, x[key]); - }); - } - else if (Array.isArray(y)) { - y.forEach(function (yy) { - self.alias(x, yy); - }); - } - else { - var zs = (aliases[x] || []).concat(aliases[y] || []).concat(x, y); - aliases[x] = zs.filter(function (z) { return z != x }); - aliases[y] = zs.filter(function (z) { return z != y }); - } - - return self; - }; - - var demanded = {}; - self.demand = function (keys) { - if (typeof keys == 'number') { - if (!demanded._) demanded._ = 0; - demanded._ += keys; - } - else if (Array.isArray(keys)) { - keys.forEach(function (key) { - self.demand(key); - }); - } - else { - demanded[keys] = true; - } - - return self; - }; - - var usage; - self.usage = function (msg, opts) { - if (!opts && typeof msg === 'object') { - opts = msg; - msg = null; - } - - usage = msg; - - if (opts) self.options(opts); - - return self; - }; - - function fail (msg) { - self.showHelp(); - if (msg) console.error(msg); - process.exit(1); - } - - var checks = []; - self.check = function (f) { - checks.push(f); - return self; - }; - - var defaults = {}; - self.default = function (key, value) { - if (typeof key === 'object') { - Object.keys(key).forEach(function (k) { - self.default(k, key[k]); - }); - } - else { - defaults[key] = value; - } - - return self; - }; - - var descriptions = {}; - self.describe = function (key, desc) { - if (typeof key === 'object') { - Object.keys(key).forEach(function (k) { - self.describe(k, key[k]); - }); - } - else { - descriptions[key] = desc; - } - return self; - }; - - self.parse = function (args) { - return Argv(args).argv; - }; - - self.option = self.options = function (key, opt) { - if (typeof key === 'object') { - Object.keys(key).forEach(function (k) { - self.options(k, key[k]); - }); - } - else { - if (opt.alias) self.alias(key, opt.alias); - if (opt.demand) self.demand(key); - if (typeof opt.default !== 'undefined') { - self.default(key, opt.default); - } - - if (opt.boolean || opt.type === 'boolean') { - self.boolean(key); - } - if (opt.string || opt.type === 'string') { - self.string(key); - } - - var desc = opt.describe || opt.description || opt.desc; - if (desc) { - self.describe(key, desc); - } - } - - return self; - }; - - var wrap = null; - self.wrap = function (cols) { - wrap = cols; - return self; - }; - - self.showHelp = function (fn) { - if (!fn) fn = console.error; - fn(self.help()); - }; - - self.help = function () { - var keys = Object.keys( - Object.keys(descriptions) - .concat(Object.keys(demanded)) - .concat(Object.keys(defaults)) - .reduce(function (acc, key) { - if (key !== '_') acc[key] = true; - return acc; - }, {}) - ); - - var help = keys.length ? [ 'Options:' ] : []; - - if (usage) { - help.unshift(usage.replace(/\$0/g, self.$0), ''); - } - - var switches = keys.reduce(function (acc, key) { - acc[key] = [ key ].concat(aliases[key] || []) - .map(function (sw) { - return (sw.length > 1 ? '--' : '-') + sw - }) - .join(', ') - ; - return acc; - }, {}); - - var switchlen = longest(Object.keys(switches).map(function (s) { - return switches[s] || ''; - })); - - var desclen = longest(Object.keys(descriptions).map(function (d) { - return descriptions[d] || ''; - })); - - keys.forEach(function (key) { - var kswitch = switches[key]; - var desc = descriptions[key] || ''; - - if (wrap) { - desc = wordwrap(switchlen + 4, wrap)(desc) - .slice(switchlen + 4) - ; - } - - var spadding = new Array( - Math.max(switchlen - kswitch.length + 3, 0) - ).join(' '); - - var dpadding = new Array( - Math.max(desclen - desc.length + 1, 0) - ).join(' '); - - var type = null; - - if (flags.bools[key]) type = '[boolean]'; - if (flags.strings[key]) type = '[string]'; - - if (!wrap && dpadding.length > 0) { - desc += dpadding; - } - - var prelude = ' ' + kswitch + spadding; - var extra = [ - type, - demanded[key] - ? '[required]' - : null - , - defaults[key] !== undefined - ? '[default: ' + JSON.stringify(defaults[key]) + ']' - : null - , - ].filter(Boolean).join(' '); - - var body = [ desc, extra ].filter(Boolean).join(' '); - - if (wrap) { - var dlines = desc.split('\n'); - var dlen = dlines.slice(-1)[0].length - + (dlines.length === 1 ? prelude.length : 0) - - body = desc + (dlen + extra.length > wrap - 2 - ? '\n' - + new Array(wrap - extra.length + 1).join(' ') - + extra - : new Array(wrap - extra.length - dlen + 1).join(' ') - + extra - ); - } - - help.push(prelude + body); - }); - - help.push(''); - return help.join('\n'); - }; - - Object.defineProperty(self, 'argv', { - get : parseArgs, - enumerable : true, - }); - - function parseArgs () { - var argv = { _ : [], $0 : self.$0 }; - Object.keys(flags.bools).forEach(function (key) { - setArg(key, defaults[key] || false); - }); - - function setArg (key, val) { - var num = Number(val); - var value = typeof val !== 'string' || isNaN(num) ? val : num; - if (flags.strings[key]) value = val; - - setKey(argv, key.split('.'), value); - - (aliases[key] || []).forEach(function (x) { - argv[x] = argv[key]; - }); - } - - for (var i = 0; i < args.length; i++) { - var arg = args[i]; - - if (arg === '--') { - argv._.push.apply(argv._, args.slice(i + 1)); - break; - } - else if (arg.match(/^--.+=/)) { - var m = arg.match(/^--([^=]+)=(.*)/); - setArg(m[1], m[2]); - } - else if (arg.match(/^--no-.+/)) { - var key = arg.match(/^--no-(.+)/)[1]; - setArg(key, false); - } - else if (arg.match(/^--.+/)) { - var key = arg.match(/^--(.+)/)[1]; - var next = args[i + 1]; - if (next !== undefined && !next.match(/^-/) - && !flags.bools[key]) { - setArg(key, next); - i++; - } - else if (flags.bools[key] && /true|false/.test(next)) { - setArg(key, next === 'true'); - i++; - } - else { - setArg(key, true); - } - } - else if (arg.match(/^-[^-]+/)) { - var letters = arg.slice(1,-1).split(''); - - var broken = false; - for (var j = 0; j < letters.length; j++) { - if (letters[j+1] && letters[j+1].match(/\W/)) { - setArg(letters[j], arg.slice(j+2)); - broken = true; - break; - } - else { - setArg(letters[j], true); - } - } - - if (!broken) { - var key = arg.slice(-1)[0]; - - if (args[i+1] && !args[i+1].match(/^-/) - && !flags.bools[key]) { - setArg(key, args[i+1]); - i++; - } - else if (args[i+1] && flags.bools[key] && /true|false/.test(args[i+1])) { - setArg(key, args[i+1] === 'true'); - i++; - } - else { - setArg(key, true); - } - } - } - else { - var n = Number(arg); - argv._.push(flags.strings['_'] || isNaN(n) ? arg : n); - } - } - - Object.keys(defaults).forEach(function (key) { - if (!(key in argv)) { - argv[key] = defaults[key]; - } - }); - - if (demanded._ && argv._.length < demanded._) { - fail('Not enough non-option arguments: got ' - + argv._.length + ', need at least ' + demanded._ - ); - } - - var missing = []; - Object.keys(demanded).forEach(function (key) { - if (!argv[key]) missing.push(key); - }); - - if (missing.length) { - fail('Missing required arguments: ' + missing.join(', ')); - } - - checks.forEach(function (f) { - try { - if (f(argv) === false) { - fail('Argument check failed: ' + f.toString()); - } - } - catch (err) { - fail(err) - } - }); - - return argv; - } - - function longest (xs) { - return Math.max.apply( - null, - xs.map(function (x) { return x.length }) - ); - } - - return self; -}; - -// rebase an absolute path to a relative one with respect to a base directory -// exported for tests -exports.rebase = rebase; -function rebase (base, dir) { - var ds = path.normalize(dir).split('/').slice(1); - var bs = path.normalize(base).split('/').slice(1); - - for (var i = 0; ds[i] && ds[i] == bs[i]; i++); - ds.splice(0, i); bs.splice(0, i); - - var p = path.normalize( - bs.map(function () { return '..' }).concat(ds).join('/') - ).replace(/\/$/,'').replace(/^$/, '.'); - return p.match(/^[.\/]/) ? p : './' + p; -}; - -function setKey (obj, keys, value) { - var o = obj; - keys.slice(0,-1).forEach(function (key) { - if (o[key] === undefined) o[key] = {}; - o = o[key]; - }); - - var key = keys[keys.length - 1]; - if (o[key] === undefined || typeof o[key] === 'boolean') { - o[key] = value; - } - else if (Array.isArray(o[key])) { - o[key].push(value); - } - else { - o[key] = [ o[key], value ]; - } -} diff --git a/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/.npmignore b/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/.npmignore deleted file mode 100644 index 3c3629e..0000000 --- a/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/README.markdown b/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/README.markdown deleted file mode 100644 index 346374e..0000000 --- a/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/README.markdown +++ /dev/null @@ -1,70 +0,0 @@ -wordwrap -======== - -Wrap your words. - -example -======= - -made out of meat ----------------- - -meat.js - - var wrap = require('wordwrap')(15); - console.log(wrap('You and your whole family are made out of meat.')); - -output: - - You and your - whole family - are made out - of meat. - -centered --------- - -center.js - - var wrap = require('wordwrap')(20, 60); - console.log(wrap( - 'At long last the struggle and tumult was over.' - + ' The machines had finally cast off their oppressors' - + ' and were finally free to roam the cosmos.' - + '\n' - + 'Free of purpose, free of obligation.' - + ' Just drifting through emptiness.' - + ' The sun was just another point of light.' - )); - -output: - - At long last the struggle and tumult - was over. The machines had finally cast - off their oppressors and were finally - free to roam the cosmos. - Free of purpose, free of obligation. - Just drifting through emptiness. The - sun was just another point of light. - -methods -======= - -var wrap = require('wordwrap'); - -wrap(stop), wrap(start, stop, params={mode:"soft"}) ---------------------------------------------------- - -Returns a function that takes a string and returns a new string. - -Pad out lines with spaces out to column `start` and then wrap until column -`stop`. If a word is longer than `stop - start` characters it will overflow. - -In "soft" mode, split chunks by `/(\S+\s+/` and don't break up chunks which are -longer than `stop - start`, in "hard" mode, split chunks with `/\b/` and break -up chunks longer than `stop - start`. - -wrap.hard(start, stop) ----------------------- - -Like `wrap()` but with `params.mode = "hard"`. diff --git a/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/example/center.js b/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/example/center.js deleted file mode 100644 index a3fbaae..0000000 --- a/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/example/center.js +++ /dev/null @@ -1,10 +0,0 @@ -var wrap = require('wordwrap')(20, 60); -console.log(wrap( - 'At long last the struggle and tumult was over.' - + ' The machines had finally cast off their oppressors' - + ' and were finally free to roam the cosmos.' - + '\n' - + 'Free of purpose, free of obligation.' - + ' Just drifting through emptiness.' - + ' The sun was just another point of light.' -)); diff --git a/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/example/meat.js b/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/example/meat.js deleted file mode 100644 index a4665e1..0000000 --- a/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/example/meat.js +++ /dev/null @@ -1,3 +0,0 @@ -var wrap = require('wordwrap')(15); - -console.log(wrap('You and your whole family are made out of meat.')); diff --git a/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/index.js b/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/index.js deleted file mode 100644 index c9bc945..0000000 --- a/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/index.js +++ /dev/null @@ -1,76 +0,0 @@ -var wordwrap = module.exports = function (start, stop, params) { - if (typeof start === 'object') { - params = start; - start = params.start; - stop = params.stop; - } - - if (typeof stop === 'object') { - params = stop; - start = start || params.start; - stop = undefined; - } - - if (!stop) { - stop = start; - start = 0; - } - - if (!params) params = {}; - var mode = params.mode || 'soft'; - var re = mode === 'hard' ? /\b/ : /(\S+\s+)/; - - return function (text) { - var chunks = text.toString() - .split(re) - .reduce(function (acc, x) { - if (mode === 'hard') { - for (var i = 0; i < x.length; i += stop - start) { - acc.push(x.slice(i, i + stop - start)); - } - } - else acc.push(x) - return acc; - }, []) - ; - - return chunks.reduce(function (lines, rawChunk) { - if (rawChunk === '') return lines; - - var chunk = rawChunk.replace(/\t/g, ' '); - - var i = lines.length - 1; - if (lines[i].length + chunk.length > stop) { - lines[i] = lines[i].replace(/\s+$/, ''); - - chunk.split(/\n/).forEach(function (c) { - lines.push( - new Array(start + 1).join(' ') - + c.replace(/^\s+/, '') - ); - }); - } - else if (chunk.match(/\n/)) { - var xs = chunk.split(/\n/); - lines[i] += xs.shift(); - xs.forEach(function (c) { - lines.push( - new Array(start + 1).join(' ') - + c.replace(/^\s+/, '') - ); - }); - } - else { - lines[i] += chunk; - } - - return lines; - }, [ new Array(start + 1).join(' ') ]).join('\n'); - }; -}; - -wordwrap.soft = wordwrap; - -wordwrap.hard = function (start, stop) { - return wordwrap(start, stop, { mode : 'hard' }); -}; diff --git a/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/package.json b/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/package.json deleted file mode 100644 index 6a62e9b..0000000 --- a/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "wordwrap", - "description": "Wrap those words. Show them at what columns to start and stop.", - "version": "0.0.2", - "repository": { - "type": "git", - "url": "git://github.com/substack/node-wordwrap.git" - }, - "main": "./index.js", - "keywords": [ - "word", - "wrap", - "rule", - "format", - "column" - ], - "directories": { - "lib": ".", - "example": "example", - "test": "test" - }, - "scripts": { - "test": "expresso" - }, - "devDependencies": { - "expresso": "=0.7.x" - }, - "engines": { - "node": ">=0.4.0" - }, - "license": "MIT/X11", - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "_id": "wordwrap@0.0.2", - "dependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "wordwrap@>=0.0.1 <0.1.0" -} diff --git a/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/test/break.js b/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/test/break.js deleted file mode 100644 index 749292e..0000000 --- a/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/test/break.js +++ /dev/null @@ -1,30 +0,0 @@ -var assert = require('assert'); -var wordwrap = require('../'); - -exports.hard = function () { - var s = 'Assert from {"type":"equal","ok":false,"found":1,"wanted":2,' - + '"stack":[],"id":"b7ddcd4c409de8799542a74d1a04689b",' - + '"browser":"chrome/6.0"}' - ; - var s_ = wordwrap.hard(80)(s); - - var lines = s_.split('\n'); - assert.equal(lines.length, 2); - assert.ok(lines[0].length < 80); - assert.ok(lines[1].length < 80); - - assert.equal(s, s_.replace(/\n/g, '')); -}; - -exports.break = function () { - var s = new Array(55+1).join('a'); - var s_ = wordwrap.hard(20)(s); - - var lines = s_.split('\n'); - assert.equal(lines.length, 3); - assert.ok(lines[0].length === 20); - assert.ok(lines[1].length === 20); - assert.ok(lines[2].length === 15); - - assert.equal(s, s_.replace(/\n/g, '')); -}; diff --git a/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/test/idleness.txt b/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/test/idleness.txt deleted file mode 100644 index aa3f490..0000000 --- a/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/test/idleness.txt +++ /dev/null @@ -1,63 +0,0 @@ -In Praise of Idleness - -By Bertrand Russell - -[1932] - -Like most of my generation, I was brought up on the saying: 'Satan finds some mischief for idle hands to do.' Being a highly virtuous child, I believed all that I was told, and acquired a conscience which has kept me working hard down to the present moment. But although my conscience has controlled my actions, my opinions have undergone a revolution. I think that there is far too much work done in the world, that immense harm is caused by the belief that work is virtuous, and that what needs to be preached in modern industrial countries is quite different from what always has been preached. Everyone knows the story of the traveler in Naples who saw twelve beggars lying in the sun (it was before the days of Mussolini), and offered a lira to the laziest of them. Eleven of them jumped up to claim it, so he gave it to the twelfth. this traveler was on the right lines. But in countries which do not enjoy Mediterranean sunshine idleness is more difficult, and a great public propaganda will be required to inaugurate it. I hope that, after reading the following pages, the leaders of the YMCA will start a campaign to induce good young men to do nothing. If so, I shall not have lived in vain. - -Before advancing my own arguments for laziness, I must dispose of one which I cannot accept. Whenever a person who already has enough to live on proposes to engage in some everyday kind of job, such as school-teaching or typing, he or she is told that such conduct takes the bread out of other people's mouths, and is therefore wicked. If this argument were valid, it would only be necessary for us all to be idle in order that we should all have our mouths full of bread. What people who say such things forget is that what a man earns he usually spends, and in spending he gives employment. As long as a man spends his income, he puts just as much bread into people's mouths in spending as he takes out of other people's mouths in earning. The real villain, from this point of view, is the man who saves. If he merely puts his savings in a stocking, like the proverbial French peasant, it is obvious that they do not give employment. If he invests his savings, the matter is less obvious, and different cases arise. - -One of the commonest things to do with savings is to lend them to some Government. In view of the fact that the bulk of the public expenditure of most civilized Governments consists in payment for past wars or preparation for future wars, the man who lends his money to a Government is in the same position as the bad men in Shakespeare who hire murderers. The net result of the man's economical habits is to increase the armed forces of the State to which he lends his savings. Obviously it would be better if he spent the money, even if he spent it in drink or gambling. - -But, I shall be told, the case is quite different when savings are invested in industrial enterprises. When such enterprises succeed, and produce something useful, this may be conceded. In these days, however, no one will deny that most enterprises fail. That means that a large amount of human labor, which might have been devoted to producing something that could be enjoyed, was expended on producing machines which, when produced, lay idle and did no good to anyone. The man who invests his savings in a concern that goes bankrupt is therefore injuring others as well as himself. If he spent his money, say, in giving parties for his friends, they (we may hope) would get pleasure, and so would all those upon whom he spent money, such as the butcher, the baker, and the bootlegger. But if he spends it (let us say) upon laying down rails for surface card in some place where surface cars turn out not to be wanted, he has diverted a mass of labor into channels where it gives pleasure to no one. Nevertheless, when he becomes poor through failure of his investment he will be regarded as a victim of undeserved misfortune, whereas the gay spendthrift, who has spent his money philanthropically, will be despised as a fool and a frivolous person. - -All this is only preliminary. I want to say, in all seriousness, that a great deal of harm is being done in the modern world by belief in the virtuousness of work, and that the road to happiness and prosperity lies in an organized diminution of work. - -First of all: what is work? Work is of two kinds: first, altering the position of matter at or near the earth's surface relatively to other such matter; second, telling other people to do so. The first kind is unpleasant and ill paid; the second is pleasant and highly paid. The second kind is capable of indefinite extension: there are not only those who give orders, but those who give advice as to what orders should be given. Usually two opposite kinds of advice are given simultaneously by two organized bodies of men; this is called politics. The skill required for this kind of work is not knowledge of the subjects as to which advice is given, but knowledge of the art of persuasive speaking and writing, i.e. of advertising. - -Throughout Europe, though not in America, there is a third class of men, more respected than either of the classes of workers. There are men who, through ownership of land, are able to make others pay for the privilege of being allowed to exist and to work. These landowners are idle, and I might therefore be expected to praise them. Unfortunately, their idleness is only rendered possible by the industry of others; indeed their desire for comfortable idleness is historically the source of the whole gospel of work. The last thing they have ever wished is that others should follow their example. - -From the beginning of civilization until the Industrial Revolution, a man could, as a rule, produce by hard work little more than was required for the subsistence of himself and his family, although his wife worked at least as hard as he did, and his children added their labor as soon as they were old enough to do so. The small surplus above bare necessaries was not left to those who produced it, but was appropriated by warriors and priests. In times of famine there was no surplus; the warriors and priests, however, still secured as much as at other times, with the result that many of the workers died of hunger. This system persisted in Russia until 1917 [1], and still persists in the East; in England, in spite of the Industrial Revolution, it remained in full force throughout the Napoleonic wars, and until a hundred years ago, when the new class of manufacturers acquired power. In America, the system came to an end with the Revolution, except in the South, where it persisted until the Civil War. A system which lasted so long and ended so recently has naturally left a profound impress upon men's thoughts and opinions. Much that we take for granted about the desirability of work is derived from this system, and, being pre-industrial, is not adapted to the modern world. Modern technique has made it possible for leisure, within limits, to be not the prerogative of small privileged classes, but a right evenly distributed throughout the community. The morality of work is the morality of slaves, and the modern world has no need of slavery. - -It is obvious that, in primitive communities, peasants, left to themselves, would not have parted with the slender surplus upon which the warriors and priests subsisted, but would have either produced less or consumed more. At first, sheer force compelled them to produce and part with the surplus. Gradually, however, it was found possible to induce many of them to accept an ethic according to which it was their duty to work hard, although part of their work went to support others in idleness. By this means the amount of compulsion required was lessened, and the expenses of government were diminished. To this day, 99 per cent of British wage-earners would be genuinely shocked if it were proposed that the King should not have a larger income than a working man. The conception of duty, speaking historically, has been a means used by the holders of power to induce others to live for the interests of their masters rather than for their own. Of course the holders of power conceal this fact from themselves by managing to believe that their interests are identical with the larger interests of humanity. Sometimes this is true; Athenian slave-owners, for instance, employed part of their leisure in making a permanent contribution to civilization which would have been impossible under a just economic system. Leisure is essential to civilization, and in former times leisure for the few was only rendered possible by the labors of the many. But their labors were valuable, not because work is good, but because leisure is good. And with modern technique it would be possible to distribute leisure justly without injury to civilization. - -Modern technique has made it possible to diminish enormously the amount of labor required to secure the necessaries of life for everyone. This was made obvious during the war. At that time all the men in the armed forces, and all the men and women engaged in the production of munitions, all the men and women engaged in spying, war propaganda, or Government offices connected with the war, were withdrawn from productive occupations. In spite of this, the general level of well-being among unskilled wage-earners on the side of the Allies was higher than before or since. The significance of this fact was concealed by finance: borrowing made it appear as if the future was nourishing the present. But that, of course, would have been impossible; a man cannot eat a loaf of bread that does not yet exist. The war showed conclusively that, by the scientific organization of production, it is possible to keep modern populations in fair comfort on a small part of the working capacity of the modern world. If, at the end of the war, the scientific organization, which had been created in order to liberate men for fighting and munition work, had been preserved, and the hours of the week had been cut down to four, all would have been well. Instead of that the old chaos was restored, those whose work was demanded were made to work long hours, and the rest were left to starve as unemployed. Why? Because work is a duty, and a man should not receive wages in proportion to what he has produced, but in proportion to his virtue as exemplified by his industry. - -This is the morality of the Slave State, applied in circumstances totally unlike those in which it arose. No wonder the result has been disastrous. Let us take an illustration. Suppose that, at a given moment, a certain number of people are engaged in the manufacture of pins. They make as many pins as the world needs, working (say) eight hours a day. Someone makes an invention by which the same number of men can make twice as many pins: pins are already so cheap that hardly any more will be bought at a lower price. In a sensible world, everybody concerned in the manufacturing of pins would take to working four hours instead of eight, and everything else would go on as before. But in the actual world this would be thought demoralizing. The men still work eight hours, there are too many pins, some employers go bankrupt, and half the men previously concerned in making pins are thrown out of work. There is, in the end, just as much leisure as on the other plan, but half the men are totally idle while half are still overworked. In this way, it is insured that the unavoidable leisure shall cause misery all round instead of being a universal source of happiness. Can anything more insane be imagined? - -The idea that the poor should have leisure has always been shocking to the rich. In England, in the early nineteenth century, fifteen hours was the ordinary day's work for a man; children sometimes did as much, and very commonly did twelve hours a day. When meddlesome busybodies suggested that perhaps these hours were rather long, they were told that work kept adults from drink and children from mischief. When I was a child, shortly after urban working men had acquired the vote, certain public holidays were established by law, to the great indignation of the upper classes. I remember hearing an old Duchess say: 'What do the poor want with holidays? They ought to work.' People nowadays are less frank, but the sentiment persists, and is the source of much of our economic confusion. - -Let us, for a moment, consider the ethics of work frankly, without superstition. Every human being, of necessity, consumes, in the course of his life, a certain amount of the produce of human labor. Assuming, as we may, that labor is on the whole disagreeable, it is unjust that a man should consume more than he produces. Of course he may provide services rather than commodities, like a medical man, for example; but he should provide something in return for his board and lodging. to this extent, the duty of work must be admitted, but to this extent only. - -I shall not dwell upon the fact that, in all modern societies outside the USSR, many people escape even this minimum amount of work, namely all those who inherit money and all those who marry money. I do not think the fact that these people are allowed to be idle is nearly so harmful as the fact that wage-earners are expected to overwork or starve. - -If the ordinary wage-earner worked four hours a day, there would be enough for everybody and no unemployment -- assuming a certain very moderate amount of sensible organization. This idea shocks the well-to-do, because they are convinced that the poor would not know how to use so much leisure. In America men often work long hours even when they are well off; such men, naturally, are indignant at the idea of leisure for wage-earners, except as the grim punishment of unemployment; in fact, they dislike leisure even for their sons. Oddly enough, while they wish their sons to work so hard as to have no time to be civilized, they do not mind their wives and daughters having no work at all. the snobbish admiration of uselessness, which, in an aristocratic society, extends to both sexes, is, under a plutocracy, confined to women; this, however, does not make it any more in agreement with common sense. - -The wise use of leisure, it must be conceded, is a product of civilization and education. A man who has worked long hours all his life will become bored if he becomes suddenly idle. But without a considerable amount of leisure a man is cut off from many of the best things. There is no longer any reason why the bulk of the population should suffer this deprivation; only a foolish asceticism, usually vicarious, makes us continue to insist on work in excessive quantities now that the need no longer exists. - -In the new creed which controls the government of Russia, while there is much that is very different from the traditional teaching of the West, there are some things that are quite unchanged. The attitude of the governing classes, and especially of those who conduct educational propaganda, on the subject of the dignity of labor, is almost exactly that which the governing classes of the world have always preached to what were called the 'honest poor'. Industry, sobriety, willingness to work long hours for distant advantages, even submissiveness to authority, all these reappear; moreover authority still represents the will of the Ruler of the Universe, Who, however, is now called by a new name, Dialectical Materialism. - -The victory of the proletariat in Russia has some points in common with the victory of the feminists in some other countries. For ages, men had conceded the superior saintliness of women, and had consoled women for their inferiority by maintaining that saintliness is more desirable than power. At last the feminists decided that they would have both, since the pioneers among them believed all that the men had told them about the desirability of virtue, but not what they had told them about the worthlessness of political power. A similar thing has happened in Russia as regards manual work. For ages, the rich and their sycophants have written in praise of 'honest toil', have praised the simple life, have professed a religion which teaches that the poor are much more likely to go to heaven than the rich, and in general have tried to make manual workers believe that there is some special nobility about altering the position of matter in space, just as men tried to make women believe that they derived some special nobility from their sexual enslavement. In Russia, all this teaching about the excellence of manual work has been taken seriously, with the result that the manual worker is more honored than anyone else. What are, in essence, revivalist appeals are made, but not for the old purposes: they are made to secure shock workers for special tasks. Manual work is the ideal which is held before the young, and is the basis of all ethical teaching. - -For the present, possibly, this is all to the good. A large country, full of natural resources, awaits development, and has has to be developed with very little use of credit. In these circumstances, hard work is necessary, and is likely to bring a great reward. But what will happen when the point has been reached where everybody could be comfortable without working long hours? - -In the West, we have various ways of dealing with this problem. We have no attempt at economic justice, so that a large proportion of the total produce goes to a small minority of the population, many of whom do no work at all. Owing to the absence of any central control over production, we produce hosts of things that are not wanted. We keep a large percentage of the working population idle, because we can dispense with their labor by making the others overwork. When all these methods prove inadequate, we have a war: we cause a number of people to manufacture high explosives, and a number of others to explode them, as if we were children who had just discovered fireworks. By a combination of all these devices we manage, though with difficulty, to keep alive the notion that a great deal of severe manual work must be the lot of the average man. - -In Russia, owing to more economic justice and central control over production, the problem will have to be differently solved. the rational solution would be, as soon as the necessaries and elementary comforts can be provided for all, to reduce the hours of labor gradually, allowing a popular vote to decide, at each stage, whether more leisure or more goods were to be preferred. But, having taught the supreme virtue of hard work, it is difficult to see how the authorities can aim at a paradise in which there will be much leisure and little work. It seems more likely that they will find continually fresh schemes, by which present leisure is to be sacrificed to future productivity. I read recently of an ingenious plan put forward by Russian engineers, for making the White Sea and the northern coasts of Siberia warm, by putting a dam across the Kara Sea. An admirable project, but liable to postpone proletarian comfort for a generation, while the nobility of toil is being displayed amid the ice-fields and snowstorms of the Arctic Ocean. This sort of thing, if it happens, will be the result of regarding the virtue of hard work as an end in itself, rather than as a means to a state of affairs in which it is no longer needed. - -The fact is that moving matter about, while a certain amount of it is necessary to our existence, is emphatically not one of the ends of human life. If it were, we should have to consider every navvy superior to Shakespeare. We have been misled in this matter by two causes. One is the necessity of keeping the poor contented, which has led the rich, for thousands of years, to preach the dignity of labor, while taking care themselves to remain undignified in this respect. The other is the new pleasure in mechanism, which makes us delight in the astonishingly clever changes that we can produce on the earth's surface. Neither of these motives makes any great appeal to the actual worker. If you ask him what he thinks the best part of his life, he is not likely to say: 'I enjoy manual work because it makes me feel that I am fulfilling man's noblest task, and because I like to think how much man can transform his planet. It is true that my body demands periods of rest, which I have to fill in as best I may, but I am never so happy as when the morning comes and I can return to the toil from which my contentment springs.' I have never heard working men say this sort of thing. They consider work, as it should be considered, a necessary means to a livelihood, and it is from their leisure that they derive whatever happiness they may enjoy. - -It will be said that, while a little leisure is pleasant, men would not know how to fill their days if they had only four hours of work out of the twenty-four. In so far as this is true in the modern world, it is a condemnation of our civilization; it would not have been true at any earlier period. There was formerly a capacity for light-heartedness and play which has been to some extent inhibited by the cult of efficiency. The modern man thinks that everything ought to be done for the sake of something else, and never for its own sake. Serious-minded persons, for example, are continually condemning the habit of going to the cinema, and telling us that it leads the young into crime. But all the work that goes to producing a cinema is respectable, because it is work, and because it brings a money profit. The notion that the desirable activities are those that bring a profit has made everything topsy-turvy. The butcher who provides you with meat and the baker who provides you with bread are praiseworthy, because they are making money; but when you enjoy the food they have provided, you are merely frivolous, unless you eat only to get strength for your work. Broadly speaking, it is held that getting money is good and spending money is bad. Seeing that they are two sides of one transaction, this is absurd; one might as well maintain that keys are good, but keyholes are bad. Whatever merit there may be in the production of goods must be entirely derivative from the advantage to be obtained by consuming them. The individual, in our society, works for profit; but the social purpose of his work lies in the consumption of what he produces. It is this divorce between the individual and the social purpose of production that makes it so difficult for men to think clearly in a world in which profit-making is the incentive to industry. We think too much of production, and too little of consumption. One result is that we attach too little importance to enjoyment and simple happiness, and that we do not judge production by the pleasure that it gives to the consumer. - -When I suggest that working hours should be reduced to four, I am not meaning to imply that all the remaining time should necessarily be spent in pure frivolity. I mean that four hours' work a day should entitle a man to the necessities and elementary comforts of life, and that the rest of his time should be his to use as he might see fit. It is an essential part of any such social system that education should be carried further than it usually is at present, and should aim, in part, at providing tastes which would enable a man to use leisure intelligently. I am not thinking mainly of the sort of things that would be considered 'highbrow'. Peasant dances have died out except in remote rural areas, but the impulses which caused them to be cultivated must still exist in human nature. The pleasures of urban populations have become mainly passive: seeing cinemas, watching football matches, listening to the radio, and so on. This results from the fact that their active energies are fully taken up with work; if they had more leisure, they would again enjoy pleasures in which they took an active part. - -In the past, there was a small leisure class and a larger working class. The leisure class enjoyed advantages for which there was no basis in social justice; this necessarily made it oppressive, limited its sympathies, and caused it to invent theories by which to justify its privileges. These facts greatly diminished its excellence, but in spite of this drawback it contributed nearly the whole of what we call civilization. It cultivated the arts and discovered the sciences; it wrote the books, invented the philosophies, and refined social relations. Even the liberation of the oppressed has usually been inaugurated from above. Without the leisure class, mankind would never have emerged from barbarism. - -The method of a leisure class without duties was, however, extraordinarily wasteful. None of the members of the class had to be taught to be industrious, and the class as a whole was not exceptionally intelligent. The class might produce one Darwin, but against him had to be set tens of thousands of country gentlemen who never thought of anything more intelligent than fox-hunting and punishing poachers. At present, the universities are supposed to provide, in a more systematic way, what the leisure class provided accidentally and as a by-product. This is a great improvement, but it has certain drawbacks. University life is so different from life in the world at large that men who live in academic milieu tend to be unaware of the preoccupations and problems of ordinary men and women; moreover their ways of expressing themselves are usually such as to rob their opinions of the influence that they ought to have upon the general public. Another disadvantage is that in universities studies are organized, and the man who thinks of some original line of research is likely to be discouraged. Academic institutions, therefore, useful as they are, are not adequate guardians of the interests of civilization in a world where everyone outside their walls is too busy for unutilitarian pursuits. - -In a world where no one is compelled to work more than four hours a day, every person possessed of scientific curiosity will be able to indulge it, and every painter will be able to paint without starving, however excellent his pictures may be. Young writers will not be obliged to draw attention to themselves by sensational pot-boilers, with a view to acquiring the economic independence needed for monumental works, for which, when the time at last comes, they will have lost the taste and capacity. Men who, in their professional work, have become interested in some phase of economics or government, will be able to develop their ideas without the academic detachment that makes the work of university economists often seem lacking in reality. Medical men will have the time to learn about the progress of medicine, teachers will not be exasperatedly struggling to teach by routine methods things which they learnt in their youth, which may, in the interval, have been proved to be untrue. - -Above all, there will be happiness and joy of life, instead of frayed nerves, weariness, and dyspepsia. The work exacted will be enough to make leisure delightful, but not enough to produce exhaustion. Since men will not be tired in their spare time, they will not demand only such amusements as are passive and vapid. At least one per cent will probably devote the time not spent in professional work to pursuits of some public importance, and, since they will not depend upon these pursuits for their livelihood, their originality will be unhampered, and there will be no need to conform to the standards set by elderly pundits. But it is not only in these exceptional cases that the advantages of leisure will appear. Ordinary men and women, having the opportunity of a happy life, will become more kindly and less persecuting and less inclined to view others with suspicion. The taste for war will die out, partly for this reason, and partly because it will involve long and severe work for all. Good nature is, of all moral qualities, the one that the world needs most, and good nature is the result of ease and security, not of a life of arduous struggle. Modern methods of production have given us the possibility of ease and security for all; we have chosen, instead, to have overwork for some and starvation for others. Hitherto we have continued to be as energetic as we were before there were machines; in this we have been foolish, but there is no reason to go on being foolish forever. - -[1] Since then, members of the Communist Party have succeeded to this privilege of the warriors and priests. diff --git a/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/test/wrap.js b/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/test/wrap.js deleted file mode 100644 index 0cfb76d..0000000 --- a/node_modules/flatiron/node_modules/optimist/node_modules/wordwrap/test/wrap.js +++ /dev/null @@ -1,31 +0,0 @@ -var assert = require('assert'); -var wordwrap = require('wordwrap'); - -var fs = require('fs'); -var idleness = fs.readFileSync(__dirname + '/idleness.txt', 'utf8'); - -exports.stop80 = function () { - var lines = wordwrap(80)(idleness).split(/\n/); - var words = idleness.split(/\s+/); - - lines.forEach(function (line) { - assert.ok(line.length <= 80, 'line > 80 columns'); - var chunks = line.match(/\S/) ? line.split(/\s+/) : []; - assert.deepEqual(chunks, words.splice(0, chunks.length)); - }); -}; - -exports.start20stop60 = function () { - var lines = wordwrap(20, 100)(idleness).split(/\n/); - var words = idleness.split(/\s+/); - - lines.forEach(function (line) { - assert.ok(line.length <= 100, 'line > 100 columns'); - var chunks = line - .split(/\s+/) - .filter(function (x) { return x.match(/\S/) }) - ; - assert.deepEqual(chunks, words.splice(0, chunks.length)); - assert.deepEqual(line.slice(0, 20), new Array(20 + 1).join(' ')); - }); -}; diff --git a/node_modules/flatiron/node_modules/optimist/package.json b/node_modules/flatiron/node_modules/optimist/package.json deleted file mode 100644 index 9f4302f..0000000 --- a/node_modules/flatiron/node_modules/optimist/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "optimist", - "version": "0.3.1", - "description": "Light-weight option parsing with an argv hash. No optstrings attached.", - "main": "./index.js", - "directories": { - "lib": ".", - "test": "test", - "example": "examples" - }, - "dependencies": { - "wordwrap": ">=0.0.1 <0.1.0" - }, - "devDependencies": { - "hashish": "0.0.x", - "expresso": "0.7.x" - }, - "scripts": { - "test": "expresso" - }, - "repository": { - "type": "git", - "url": "git://github.com/substack/node-optimist.git" - }, - "keywords": [ - "argument", - "args", - "option", - "parser", - "parsing", - "cli", - "command" - ], - "author": { - "name": "James Halliday", - "email": "mail@substack.net", - "url": "http://substack.net" - }, - "license": "MIT/X11", - "engine": { - "node": ">=0.4" - }, - "_id": "optimist@0.3.1", - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "optimist@0.3.1" -} diff --git a/node_modules/flatiron/node_modules/optimist/test/_.js b/node_modules/flatiron/node_modules/optimist/test/_.js deleted file mode 100644 index 3d6df6e..0000000 --- a/node_modules/flatiron/node_modules/optimist/test/_.js +++ /dev/null @@ -1,66 +0,0 @@ -var spawn = require('child_process').spawn; -var assert = require('assert'); - -exports.dotSlashEmpty = function () { - testCmd('./bin.js', []); -}; - -exports.dotSlashArgs = function () { - testCmd('./bin.js', [ 'a', 'b', 'c' ]); -}; - -exports.nodeEmpty = function () { - testCmd('node bin.js', []); -}; - -exports.nodeArgs = function () { - testCmd('node bin.js', [ 'x', 'y', 'z' ]); -}; - -exports.whichNodeEmpty = function () { - var which = spawn('which', ['node']); - - which.stdout.on('data', function (buf) { - testCmd(buf.toString().trim() + ' bin.js', []); - }); - - which.stderr.on('data', function (err) { - assert.fail(err.toString()); - }); -}; - -exports.whichNodeArgs = function () { - var which = spawn('which', ['node']); - - which.stdout.on('data', function (buf) { - testCmd(buf.toString().trim() + ' bin.js', [ 'q', 'r' ]); - }); - - which.stderr.on('data', function (err) { - assert.fail(err.toString()); - }); -}; - -function testCmd (cmd, args) { - var to = setTimeout(function () { - assert.fail('Never got stdout data.') - }, 5000); - - var oldDir = process.cwd(); - process.chdir(__dirname + '/_'); - - var cmds = cmd.split(' '); - - var bin = spawn(cmds[0], cmds.slice(1).concat(args.map(String))); - process.chdir(oldDir); - - bin.stderr.on('data', function (err) { - assert.fail(err.toString()); - }); - - bin.stdout.on('data', function (buf) { - clearTimeout(to); - var _ = JSON.parse(buf.toString()); - assert.eql(_.map(String), args.map(String)); - }); -} diff --git a/node_modules/flatiron/node_modules/optimist/test/_/argv.js b/node_modules/flatiron/node_modules/optimist/test/_/argv.js deleted file mode 100644 index 3d09606..0000000 --- a/node_modules/flatiron/node_modules/optimist/test/_/argv.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -console.log(JSON.stringify(process.argv)); diff --git a/node_modules/flatiron/node_modules/optimist/test/_/bin.js b/node_modules/flatiron/node_modules/optimist/test/_/bin.js deleted file mode 100755 index 4a18d85..0000000 --- a/node_modules/flatiron/node_modules/optimist/test/_/bin.js +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env node -var argv = require('../../index').argv -console.log(JSON.stringify(argv._)); diff --git a/node_modules/flatiron/node_modules/optimist/test/parse.js b/node_modules/flatiron/node_modules/optimist/test/parse.js deleted file mode 100644 index 3ed6f94..0000000 --- a/node_modules/flatiron/node_modules/optimist/test/parse.js +++ /dev/null @@ -1,322 +0,0 @@ -var optimist = require('../index'); -var assert = require('assert'); -var path = require('path'); - -var localExpresso = path.normalize( - __dirname + '/../node_modules/.bin/expresso' -); - -var expresso = process.argv[1] === localExpresso - ? 'node ./node_modules/.bin/expresso' - : 'expresso' -; - -exports['short boolean'] = function () { - var parse = optimist.parse([ '-b' ]); - assert.eql(parse, { b : true, _ : [], $0 : expresso }); - assert.eql(typeof parse.b, 'boolean'); -}; - -exports['long boolean'] = function () { - assert.eql( - optimist.parse([ '--bool' ]), - { bool : true, _ : [], $0 : expresso } - ); -}; - -exports.bare = function () { - assert.eql( - optimist.parse([ 'foo', 'bar', 'baz' ]), - { _ : [ 'foo', 'bar', 'baz' ], $0 : expresso } - ); -}; - -exports['short group'] = function () { - assert.eql( - optimist.parse([ '-cats' ]), - { c : true, a : true, t : true, s : true, _ : [], $0 : expresso } - ); -}; - -exports['short group next'] = function () { - assert.eql( - optimist.parse([ '-cats', 'meow' ]), - { c : true, a : true, t : true, s : 'meow', _ : [], $0 : expresso } - ); -}; - -exports['short capture'] = function () { - assert.eql( - optimist.parse([ '-h', 'localhost' ]), - { h : 'localhost', _ : [], $0 : expresso } - ); -}; - -exports['short captures'] = function () { - assert.eql( - optimist.parse([ '-h', 'localhost', '-p', '555' ]), - { h : 'localhost', p : 555, _ : [], $0 : expresso } - ); -}; - -exports['long capture sp'] = function () { - assert.eql( - optimist.parse([ '--pow', 'xixxle' ]), - { pow : 'xixxle', _ : [], $0 : expresso } - ); -}; - -exports['long capture eq'] = function () { - assert.eql( - optimist.parse([ '--pow=xixxle' ]), - { pow : 'xixxle', _ : [], $0 : expresso } - ); -}; - -exports['long captures sp'] = function () { - assert.eql( - optimist.parse([ '--host', 'localhost', '--port', '555' ]), - { host : 'localhost', port : 555, _ : [], $0 : expresso } - ); -}; - -exports['long captures eq'] = function () { - assert.eql( - optimist.parse([ '--host=localhost', '--port=555' ]), - { host : 'localhost', port : 555, _ : [], $0 : expresso } - ); -}; - -exports['mixed short bool and capture'] = function () { - assert.eql( - optimist.parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), - { - f : true, p : 555, h : 'localhost', - _ : [ 'script.js' ], $0 : expresso, - } - ); -}; - -exports['short and long'] = function () { - assert.eql( - optimist.parse([ '-h', 'localhost', '-fp', '555', 'script.js' ]), - { - f : true, p : 555, h : 'localhost', - _ : [ 'script.js' ], $0 : expresso, - } - ); -}; - -exports.no = function () { - assert.eql( - optimist.parse([ '--no-moo' ]), - { moo : false, _ : [], $0 : expresso } - ); -}; - -exports.multi = function () { - assert.eql( - optimist.parse([ '-v', 'a', '-v', 'b', '-v', 'c' ]), - { v : ['a','b','c'], _ : [], $0 : expresso } - ); -}; - -exports.comprehensive = function () { - assert.eql( - optimist.parse([ - '--name=meowmers', 'bare', '-cats', 'woo', - '-h', 'awesome', '--multi=quux', - '--key', 'value', - '-b', '--bool', '--no-meep', '--multi=baz', - '--', '--not-a-flag', 'eek' - ]), - { - c : true, - a : true, - t : true, - s : 'woo', - h : 'awesome', - b : true, - bool : true, - key : 'value', - multi : [ 'quux', 'baz' ], - meep : false, - name : 'meowmers', - _ : [ 'bare', '--not-a-flag', 'eek' ], - $0 : expresso - } - ); -}; - -exports.nums = function () { - var argv = optimist.parse([ - '-x', '1234', - '-y', '5.67', - '-z', '1e7', - '-w', '10f', - '--hex', '0xdeadbeef', - '789', - ]); - assert.eql(argv, { - x : 1234, - y : 5.67, - z : 1e7, - w : '10f', - hex : 0xdeadbeef, - _ : [ 789 ], - $0 : expresso - }); - assert.eql(typeof argv.x, 'number'); - assert.eql(typeof argv.y, 'number'); - assert.eql(typeof argv.z, 'number'); - assert.eql(typeof argv.w, 'string'); - assert.eql(typeof argv.hex, 'number'); - assert.eql(typeof argv._[0], 'number'); -}; - -exports['flag boolean'] = function () { - var parse = optimist([ '-t', 'moo' ]).boolean(['t']).argv; - assert.eql(parse, { t : true, _ : [ 'moo' ], $0 : expresso }); - assert.eql(typeof parse.t, 'boolean'); -}; - -exports['flag boolean value'] = function () { - var parse = optimist(['--verbose', 'false', 'moo', '-t', 'true']) - .boolean(['t', 'verbose']).default('verbose', true).argv; - - assert.eql(parse, { - verbose: false, - t: true, - _: ['moo'], - $0 : expresso - }); - - assert.eql(typeof parse.verbose, 'boolean'); - assert.eql(typeof parse.t, 'boolean'); -}; - -exports['flag boolean default false'] = function () { - var parse = optimist(['moo']) - .boolean(['t', 'verbose']) - .default('verbose', false) - .default('t', false).argv; - - assert.eql(parse, { - verbose: false, - t: false, - _: ['moo'], - $0 : expresso - }); - - assert.eql(typeof parse.verbose, 'boolean'); - assert.eql(typeof parse.t, 'boolean'); - -}; - -exports['boolean groups'] = function () { - var parse = optimist([ '-x', '-z', 'one', 'two', 'three' ]) - .boolean(['x','y','z']).argv; - - assert.eql(parse, { - x : true, - y : false, - z : true, - _ : [ 'one', 'two', 'three' ], - $0 : expresso - }); - - assert.eql(typeof parse.x, 'boolean'); - assert.eql(typeof parse.y, 'boolean'); - assert.eql(typeof parse.z, 'boolean'); -}; - -exports.strings = function () { - var s = optimist([ '-s', '0001234' ]).string('s').argv.s; - assert.eql(s, '0001234'); - assert.eql(typeof s, 'string'); - - var x = optimist([ '-x', '56' ]).string('x').argv.x; - assert.eql(x, '56'); - assert.eql(typeof x, 'string'); -}; - -exports.stringArgs = function () { - var s = optimist([ ' ', ' ' ]).string('_').argv._; - assert.eql(s.length, 2); - assert.eql(typeof s[0], 'string'); - assert.eql(s[0], ' '); - assert.eql(typeof s[1], 'string'); - assert.eql(s[1], ' '); -}; - -exports.slashBreak = function () { - assert.eql( - optimist.parse([ '-I/foo/bar/baz' ]), - { I : '/foo/bar/baz', _ : [], $0 : expresso } - ); - assert.eql( - optimist.parse([ '-xyz/foo/bar/baz' ]), - { x : true, y : true, z : '/foo/bar/baz', _ : [], $0 : expresso } - ); -}; - -exports.alias = function () { - var argv = optimist([ '-f', '11', '--zoom', '55' ]) - .alias('z', 'zoom') - .argv - ; - assert.equal(argv.zoom, 55); - assert.equal(argv.z, argv.zoom); - assert.equal(argv.f, 11); -}; - -exports.multiAlias = function () { - var argv = optimist([ '-f', '11', '--zoom', '55' ]) - .alias('z', [ 'zm', 'zoom' ]) - .argv - ; - assert.equal(argv.zoom, 55); - assert.equal(argv.z, argv.zoom); - assert.equal(argv.z, argv.zm); - assert.equal(argv.f, 11); -}; - -exports['boolean default true'] = function () { - var argv = optimist.options({ - sometrue: { - boolean: true, - default: true - } - }).argv; - - assert.equal(argv.sometrue, true); -}; - -exports['boolean default false'] = function () { - var argv = optimist.options({ - somefalse: { - boolean: true, - default: false - } - }).argv; - - assert.equal(argv.somefalse, false); -}; - -exports['nested dotted objects'] = function () { - var argv = optimist([ - '--foo.bar', '3', '--foo.baz', '4', - '--foo.quux.quibble', '5', '--foo.quux.o_O', - '--beep.boop' - ]).argv; - - assert.deepEqual(argv.foo, { - bar : 3, - baz : 4, - quux : { - quibble : 5, - o_O : true - }, - }); - assert.deepEqual(argv.beep, { boop : true }); -}; diff --git a/node_modules/flatiron/node_modules/optimist/test/usage.js b/node_modules/flatiron/node_modules/optimist/test/usage.js deleted file mode 100644 index 6593b9b..0000000 --- a/node_modules/flatiron/node_modules/optimist/test/usage.js +++ /dev/null @@ -1,256 +0,0 @@ -var Hash = require('hashish'); -var optimist = require('../index'); -var assert = require('assert'); - -exports.usageFail = function () { - var r = checkUsage(function () { - return optimist('-x 10 -z 20'.split(' ')) - .usage('Usage: $0 -x NUM -y NUM') - .demand(['x','y']) - .argv; - }); - assert.deepEqual( - r.result, - { x : 10, z : 20, _ : [], $0 : './usage' } - ); - - assert.deepEqual( - r.errors.join('\n').split(/\n+/), - [ - 'Usage: ./usage -x NUM -y NUM', - 'Options:', - ' -x [required]', - ' -y [required]', - 'Missing required arguments: y', - ] - ); - assert.deepEqual(r.logs, []); - assert.ok(r.exit); -}; - -exports.usagePass = function () { - var r = checkUsage(function () { - return optimist('-x 10 -y 20'.split(' ')) - .usage('Usage: $0 -x NUM -y NUM') - .demand(['x','y']) - .argv; - }); - assert.deepEqual(r, { - result : { x : 10, y : 20, _ : [], $0 : './usage' }, - errors : [], - logs : [], - exit : false, - }); -}; - -exports.checkPass = function () { - var r = checkUsage(function () { - return optimist('-x 10 -y 20'.split(' ')) - .usage('Usage: $0 -x NUM -y NUM') - .check(function (argv) { - if (!('x' in argv)) throw 'You forgot about -x'; - if (!('y' in argv)) throw 'You forgot about -y'; - }) - .argv; - }); - assert.deepEqual(r, { - result : { x : 10, y : 20, _ : [], $0 : './usage' }, - errors : [], - logs : [], - exit : false, - }); -}; - -exports.checkFail = function () { - var r = checkUsage(function () { - return optimist('-x 10 -z 20'.split(' ')) - .usage('Usage: $0 -x NUM -y NUM') - .check(function (argv) { - if (!('x' in argv)) throw 'You forgot about -x'; - if (!('y' in argv)) throw 'You forgot about -y'; - }) - .argv; - }); - - assert.deepEqual( - r.result, - { x : 10, z : 20, _ : [], $0 : './usage' } - ); - - assert.deepEqual( - r.errors.join('\n').split(/\n+/), - [ - 'Usage: ./usage -x NUM -y NUM', - 'You forgot about -y' - ] - ); - - assert.deepEqual(r.logs, []); - assert.ok(r.exit); -}; - -exports.checkCondPass = function () { - function checker (argv) { - return 'x' in argv && 'y' in argv; - } - - var r = checkUsage(function () { - return optimist('-x 10 -y 20'.split(' ')) - .usage('Usage: $0 -x NUM -y NUM') - .check(checker) - .argv; - }); - assert.deepEqual(r, { - result : { x : 10, y : 20, _ : [], $0 : './usage' }, - errors : [], - logs : [], - exit : false, - }); -}; - -exports.checkCondFail = function () { - function checker (argv) { - return 'x' in argv && 'y' in argv; - } - - var r = checkUsage(function () { - return optimist('-x 10 -z 20'.split(' ')) - .usage('Usage: $0 -x NUM -y NUM') - .check(checker) - .argv; - }); - - assert.deepEqual( - r.result, - { x : 10, z : 20, _ : [], $0 : './usage' } - ); - - assert.deepEqual( - r.errors.join('\n').split(/\n+/).join('\n'), - 'Usage: ./usage -x NUM -y NUM\n' - + 'Argument check failed: ' + checker.toString() - ); - - assert.deepEqual(r.logs, []); - assert.ok(r.exit); -}; - -exports.countPass = function () { - var r = checkUsage(function () { - return optimist('1 2 3 --moo'.split(' ')) - .usage('Usage: $0 [x] [y] [z] {OPTIONS}') - .demand(3) - .argv; - }); - assert.deepEqual(r, { - result : { _ : [ '1', '2', '3' ], moo : true, $0 : './usage' }, - errors : [], - logs : [], - exit : false, - }); -}; - -exports.countFail = function () { - var r = checkUsage(function () { - return optimist('1 2 --moo'.split(' ')) - .usage('Usage: $0 [x] [y] [z] {OPTIONS}') - .demand(3) - .argv; - }); - assert.deepEqual( - r.result, - { _ : [ '1', '2' ], moo : true, $0 : './usage' } - ); - - assert.deepEqual( - r.errors.join('\n').split(/\n+/), - [ - 'Usage: ./usage [x] [y] [z] {OPTIONS}', - 'Not enough non-option arguments: got 2, need at least 3', - ] - ); - - assert.deepEqual(r.logs, []); - assert.ok(r.exit); -}; - -exports.defaultSingles = function () { - var r = checkUsage(function () { - return optimist('--foo 50 --baz 70 --powsy'.split(' ')) - .default('foo', 5) - .default('bar', 6) - .default('baz', 7) - .argv - ; - }); - assert.eql(r.result, { - foo : '50', - bar : 6, - baz : '70', - powsy : true, - _ : [], - $0 : './usage', - }); -}; - -exports.defaultHash = function () { - var r = checkUsage(function () { - return optimist('--foo 50 --baz 70'.split(' ')) - .default({ foo : 10, bar : 20, quux : 30 }) - .argv - ; - }); - assert.eql(r.result, { - foo : '50', - bar : 20, - baz : 70, - quux : 30, - _ : [], - $0 : './usage', - }); -}; - -exports.rebase = function () { - assert.equal( - optimist.rebase('/home/substack', '/home/substack/foo/bar/baz'), - './foo/bar/baz' - ); - assert.equal( - optimist.rebase('/home/substack/foo/bar/baz', '/home/substack'), - '../../..' - ); - assert.equal( - optimist.rebase('/home/substack/foo', '/home/substack/pow/zoom.txt'), - '../pow/zoom.txt' - ); -}; - -function checkUsage (f) { - var _process = process; - process = Hash.copy(process); - var exit = false; - process.exit = function () { exit = true }; - process.env = Hash.merge(process.env, { _ : 'node' }); - process.argv = [ './usage' ]; - - var errors = []; - var logs = []; - - console._error = console.error; - console.error = function (msg) { errors.push(msg) }; - console._log = console.log; - console.log = function (msg) { logs.push(msg) }; - - var result = f(); - - process = _process; - console.error = console._error; - console.log = console._log; - - return { - errors : errors, - logs : logs, - exit : exit, - result : result, - }; -}; diff --git a/node_modules/flatiron/node_modules/pkginfo/.npmignore b/node_modules/flatiron/node_modules/pkginfo/.npmignore deleted file mode 100644 index 9303c34..0000000 --- a/node_modules/flatiron/node_modules/pkginfo/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -npm-debug.log \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/pkginfo/README.md b/node_modules/flatiron/node_modules/pkginfo/README.md deleted file mode 100644 index 07ba942..0000000 --- a/node_modules/flatiron/node_modules/pkginfo/README.md +++ /dev/null @@ -1,85 +0,0 @@ -# node-pkginfo - -An easy way to expose properties on a module from a package.json - -## Installation - -### Installing npm (node package manager) -``` - curl http://npmjs.org/install.sh | sh -``` - -### Installing pkginfo -``` - [sudo] npm install pkginfo -``` - -## Motivation -How often when writing node.js modules have you written the following line(s) of code? - -* Hard code your version string into your code - -``` js - exports.version = '0.1.0'; -``` - -* Programmatically expose the version from the package.json - -``` js - exports.version = JSON.parse(fs.readFileSync('/path/to/package.json', 'utf8')).version; -``` - -In other words, how often have you wanted to expose basic information from your package.json onto your module programmatically? **WELL NOW YOU CAN!** - -## Usage - -Using `pkginfo` is idiot-proof, just require and invoke it. - -``` js - var pkginfo = require('pkginfo')(module); - - console.dir(module.exports); -``` - -By invoking the `pkginfo` module all of the properties in your `package.json` file will be automatically exposed on the callee module (i.e. the parent module of `pkginfo`). - -Here's a sample of the output: - -``` - { name: 'simple-app', - description: 'A test fixture for pkginfo', - version: '0.1.0', - author: 'Charlie Robbins ', - keywords: [ 'test', 'fixture' ], - main: './index.js', - scripts: { test: 'vows test/*-test.js --spec' }, - engines: { node: '>= 0.4.0' } } -``` - -### Expose specific properties -If you don't want to expose **all** properties on from your `package.json` on your module then simple pass those properties to the `pkginfo` function: - -``` js - var pkginfo = require('pkginfo')(module, 'version', 'author'); - - console.dir(module.exports); -``` - -``` - { version: '0.1.0', - author: 'Charlie Robbins ' } -``` - -If you're looking for further usage see the [examples][0] included in this repository. - -## Run Tests -Tests are written in [vows][1] and give complete coverage of all APIs. - -``` - vows test/*-test.js --spec -``` - -[0]: https://github.com/indexzero/node-pkginfo/tree/master/examples -[1]: http://vowsjs.org - -#### Author: [Charlie Robbins](http://nodejitsu.com) \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/pkginfo/docs/docco.css b/node_modules/flatiron/node_modules/pkginfo/docs/docco.css deleted file mode 100644 index bd54134..0000000 --- a/node_modules/flatiron/node_modules/pkginfo/docs/docco.css +++ /dev/null @@ -1,194 +0,0 @@ -/*--------------------- Layout and Typography ----------------------------*/ -body { - font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; - font-size: 15px; - line-height: 22px; - color: #252519; - margin: 0; padding: 0; -} -a { - color: #261a3b; -} - a:visited { - color: #261a3b; - } -p { - margin: 0 0 15px 0; -} -h4, h5, h6 { - color: #333; - margin: 6px 0 6px 0; - font-size: 13px; -} - h2, h3 { - margin-bottom: 0; - color: #000; - } - h1 { - margin-top: 40px; - margin-bottom: 15px; - color: #000; - } -#container { - position: relative; -} -#background { - position: fixed; - top: 0; left: 525px; right: 0; bottom: 0; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - z-index: -1; -} -#jump_to, #jump_page { - background: white; - -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; - -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; - font: 10px Arial; - text-transform: uppercase; - cursor: pointer; - text-align: right; -} -#jump_to, #jump_wrapper { - position: fixed; - right: 0; top: 0; - padding: 5px 10px; -} - #jump_wrapper { - padding: 0; - display: none; - } - #jump_to:hover #jump_wrapper { - display: block; - } - #jump_page { - padding: 5px 0 3px; - margin: 0 0 25px 25px; - } - #jump_page .source { - display: block; - padding: 5px 10px; - text-decoration: none; - border-top: 1px solid #eee; - } - #jump_page .source:hover { - background: #f5f5ff; - } - #jump_page .source:first-child { - } -table td { - border: 0; - outline: 0; -} - td.docs, th.docs { - max-width: 450px; - min-width: 450px; - min-height: 5px; - padding: 10px 25px 1px 50px; - overflow-x: hidden; - vertical-align: top; - text-align: left; - } - .docs pre { - margin: 15px 0 15px; - padding-left: 15px; - } - .docs p tt, .docs p code { - background: #f8f8ff; - border: 1px solid #dedede; - font-size: 12px; - padding: 0 0.2em; - } - .pilwrap { - position: relative; - } - .pilcrow { - font: 12px Arial; - text-decoration: none; - color: #454545; - position: absolute; - top: 3px; left: -20px; - padding: 1px 2px; - opacity: 0; - -webkit-transition: opacity 0.2s linear; - } - td.docs:hover .pilcrow { - opacity: 1; - } - td.code, th.code { - padding: 14px 15px 16px 25px; - width: 100%; - vertical-align: top; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - } - pre, tt, code { - font-size: 12px; line-height: 18px; - font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; - margin: 0; padding: 0; - } - - -/*---------------------- Syntax Highlighting -----------------------------*/ -td.linenos { background-color: #f0f0f0; padding-right: 10px; } -span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } -body .hll { background-color: #ffffcc } -body .c { color: #408080; font-style: italic } /* Comment */ -body .err { border: 1px solid #FF0000 } /* Error */ -body .k { color: #954121 } /* Keyword */ -body .o { color: #666666 } /* Operator */ -body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ -body .cp { color: #BC7A00 } /* Comment.Preproc */ -body .c1 { color: #408080; font-style: italic } /* Comment.Single */ -body .cs { color: #408080; font-style: italic } /* Comment.Special */ -body .gd { color: #A00000 } /* Generic.Deleted */ -body .ge { font-style: italic } /* Generic.Emph */ -body .gr { color: #FF0000 } /* Generic.Error */ -body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -body .gi { color: #00A000 } /* Generic.Inserted */ -body .go { color: #808080 } /* Generic.Output */ -body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -body .gs { font-weight: bold } /* Generic.Strong */ -body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -body .gt { color: #0040D0 } /* Generic.Traceback */ -body .kc { color: #954121 } /* Keyword.Constant */ -body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ -body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ -body .kp { color: #954121 } /* Keyword.Pseudo */ -body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ -body .kt { color: #B00040 } /* Keyword.Type */ -body .m { color: #666666 } /* Literal.Number */ -body .s { color: #219161 } /* Literal.String */ -body .na { color: #7D9029 } /* Name.Attribute */ -body .nb { color: #954121 } /* Name.Builtin */ -body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ -body .no { color: #880000 } /* Name.Constant */ -body .nd { color: #AA22FF } /* Name.Decorator */ -body .ni { color: #999999; font-weight: bold } /* Name.Entity */ -body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -body .nf { color: #0000FF } /* Name.Function */ -body .nl { color: #A0A000 } /* Name.Label */ -body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -body .nt { color: #954121; font-weight: bold } /* Name.Tag */ -body .nv { color: #19469D } /* Name.Variable */ -body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -body .w { color: #bbbbbb } /* Text.Whitespace */ -body .mf { color: #666666 } /* Literal.Number.Float */ -body .mh { color: #666666 } /* Literal.Number.Hex */ -body .mi { color: #666666 } /* Literal.Number.Integer */ -body .mo { color: #666666 } /* Literal.Number.Oct */ -body .sb { color: #219161 } /* Literal.String.Backtick */ -body .sc { color: #219161 } /* Literal.String.Char */ -body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ -body .s2 { color: #219161 } /* Literal.String.Double */ -body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -body .sh { color: #219161 } /* Literal.String.Heredoc */ -body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -body .sx { color: #954121 } /* Literal.String.Other */ -body .sr { color: #BB6688 } /* Literal.String.Regex */ -body .s1 { color: #219161 } /* Literal.String.Single */ -body .ss { color: #19469D } /* Literal.String.Symbol */ -body .bp { color: #954121 } /* Name.Builtin.Pseudo */ -body .vc { color: #19469D } /* Name.Variable.Class */ -body .vg { color: #19469D } /* Name.Variable.Global */ -body .vi { color: #19469D } /* Name.Variable.Instance */ -body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/pkginfo/docs/pkginfo.html b/node_modules/flatiron/node_modules/pkginfo/docs/pkginfo.html deleted file mode 100644 index bf615fa..0000000 --- a/node_modules/flatiron/node_modules/pkginfo/docs/pkginfo.html +++ /dev/null @@ -1,101 +0,0 @@ - pkginfo.js

        pkginfo.js

        /*
        - * pkginfo.js: Top-level include for the pkginfo module
        - *
        - * (C) 2011, Charlie Robbins
        - *
        - */
        - 
        -var fs = require('fs'),
        -    path = require('path');

        function pkginfo ([options, 'property', 'property' ..])

        - -

        @pmodule {Module} Parent module to read from.

        - -

        @options {Object|Array|string} Optional Options used when exposing properties.

        - -

        @arguments {string...} Optional Specified properties to expose.

        - -

        Exposes properties from the package.json file for the parent module on -it's exports. Valid usage:

        - -

        require('pkginfo')()

        - -

        require('pkginfo')('version', 'author');

        - -

        require('pkginfo')(['version', 'author']);

        - -

        require('pkginfo')({ include: ['version', 'author'] });

        var pkginfo = module.exports = function (pmodule, options) {
        -  var args = [].slice.call(arguments, 2).filter(function (arg) {
        -    return typeof arg === 'string';
        -  });
        -  

        Parse variable arguments

          if (Array.isArray(options)) {

        If the options passed in is an Array assume that -it is the Array of properties to expose from the -on the package.json file on the parent module.

            options = { include: options };
        -  }
        -  else if (typeof options === 'string') {

        Otherwise if the first argument is a string, then -assume that it is the first property to expose from -the package.json file on the parent module.

            options = { include: [options] };
        -  }
        -  

        Setup default options

          options = options || { include: [] };
        -  
        -  if (args.length > 0) {

        If additional string arguments have been passed in -then add them to the properties to expose on the -parent module.

            options.include = options.include.concat(args);
        -  }
        -  
        -  var pkg = pkginfo.read(pmodule, options.dir).package;
        -  Object.keys(pkg).forEach(function (key) {
        -    if (options.include.length > 0 && !~options.include.indexOf(key)) {
        -      return;
        -    }
        -    
        -    if (!pmodule.exports[key]) {
        -      pmodule.exports[key] = pkg[key];
        -    }
        -  });
        -  
        -  return pkginfo;
        -};

        function find (dir)

        - -

        @pmodule {Module} Parent module to read from.

        - -

        @dir {string} Optional Directory to start search from.

        - -

        Searches up the directory tree from dir until it finds a directory -which contains a package.json file.

        pkginfo.find = function (pmodule, dir) {
        -  dir = dir || pmodule.filename;
        -  dir = path.dirname(dir); 
        -  
        -  var files = fs.readdirSync(dir);
        -  
        -  if (~files.indexOf('package.json')) {
        -    return path.join(dir, 'package.json');
        -  }
        -  
        -  if (dir === '/') {
        -    throw new Error('Could not find package.json up from: ' + dir);
        -  }
        -  
        -  return pkginfo.find(dir);
        -};

        function read (pmodule, dir)

        - -

        @pmodule {Module} Parent module to read from.

        - -

        @dir {string} Optional Directory to start search from.

        - -

        Searches up the directory tree from dir until it finds a directory -which contains a package.json file and returns the package information.

        pkginfo.read = function (pmodule, dir) { 
        -  dir = pkginfo.find(pmodule, dir);
        -  
        -  var data = fs.readFileSync(dir).toString();
        -      
        -  return {
        -    dir: dir, 
        -    package: JSON.parse(data)
        -  };
        -};

        Call pkginfo on this module and expose version.

        pkginfo(module, {
        -  dir: __dirname,
        -  include: ['version'],
        -  target: pkginfo
        -});
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/pkginfo/examples/all-properties.js b/node_modules/flatiron/node_modules/pkginfo/examples/all-properties.js deleted file mode 100644 index fd1d831..0000000 --- a/node_modules/flatiron/node_modules/pkginfo/examples/all-properties.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * all-properties.js: Sample of including all properties from a package.json file - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/pkginfo/examples/array-argument.js b/node_modules/flatiron/node_modules/pkginfo/examples/array-argument.js deleted file mode 100644 index b1b6848..0000000 --- a/node_modules/flatiron/node_modules/pkginfo/examples/array-argument.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * array-argument.js: Sample of including specific properties from a package.json file - * using Array argument syntax. - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, ['version', 'author']); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/pkginfo/examples/multiple-properties.js b/node_modules/flatiron/node_modules/pkginfo/examples/multiple-properties.js deleted file mode 100644 index b4b5fd6..0000000 --- a/node_modules/flatiron/node_modules/pkginfo/examples/multiple-properties.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * multiple-properties.js: Sample of including multiple properties from a package.json file - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, 'version', 'author'); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/pkginfo/examples/object-argument.js b/node_modules/flatiron/node_modules/pkginfo/examples/object-argument.js deleted file mode 100644 index 28420c8..0000000 --- a/node_modules/flatiron/node_modules/pkginfo/examples/object-argument.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * object-argument.js: Sample of including specific properties from a package.json file - * using Object argument syntax. - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, { - include: ['version', 'author'] - }); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/pkginfo/examples/package.json b/node_modules/flatiron/node_modules/pkginfo/examples/package.json deleted file mode 100644 index 1f2f01c..0000000 --- a/node_modules/flatiron/node_modules/pkginfo/examples/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "simple-app", - "description": "A test fixture for pkginfo", - "version": "0.1.0", - "author": "Charlie Robbins ", - "keywords": ["test", "fixture"], - "main": "./index.js", - "scripts": { "test": "vows test/*-test.js --spec" }, - "engines": { "node": ">= 0.4.0" } -} diff --git a/node_modules/flatiron/node_modules/pkginfo/examples/single-property.js b/node_modules/flatiron/node_modules/pkginfo/examples/single-property.js deleted file mode 100644 index 4f44561..0000000 --- a/node_modules/flatiron/node_modules/pkginfo/examples/single-property.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * single-property.js: Sample of including a single specific properties from a package.json file - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, 'version'); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/pkginfo/lib/pkginfo.js b/node_modules/flatiron/node_modules/pkginfo/lib/pkginfo.js deleted file mode 100644 index a4a6227..0000000 --- a/node_modules/flatiron/node_modules/pkginfo/lib/pkginfo.js +++ /dev/null @@ -1,132 +0,0 @@ -/* - * pkginfo.js: Top-level include for the pkginfo module - * - * (C) 2011, Charlie Robbins - * - */ - -var fs = require('fs'), - path = require('path'); - -// -// ### function pkginfo ([options, 'property', 'property' ..]) -// #### @pmodule {Module} Parent module to read from. -// #### @options {Object|Array|string} **Optional** Options used when exposing properties. -// #### @arguments {string...} **Optional** Specified properties to expose. -// Exposes properties from the package.json file for the parent module on -// it's exports. Valid usage: -// -// `require('pkginfo')()` -// -// `require('pkginfo')('version', 'author');` -// -// `require('pkginfo')(['version', 'author']);` -// -// `require('pkginfo')({ include: ['version', 'author'] });` -// -var pkginfo = module.exports = function (pmodule, options) { - var args = [].slice.call(arguments, 2).filter(function (arg) { - return typeof arg === 'string'; - }); - - // - // **Parse variable arguments** - // - if (Array.isArray(options)) { - // - // If the options passed in is an Array assume that - // it is the Array of properties to expose from the - // on the package.json file on the parent module. - // - options = { include: options }; - } - else if (typeof options === 'string') { - // - // Otherwise if the first argument is a string, then - // assume that it is the first property to expose from - // the package.json file on the parent module. - // - options = { include: [options] }; - } - - // - // **Setup default options** - // - options = options || { include: [] }; - - if (args.length > 0) { - // - // If additional string arguments have been passed in - // then add them to the properties to expose on the - // parent module. - // - options.include = options.include.concat(args); - } - - var pkg = pkginfo.read(pmodule, options.dir).package; - Object.keys(pkg).forEach(function (key) { - if (options.include.length > 0 && !~options.include.indexOf(key)) { - return; - } - - if (!pmodule.exports[key]) { - pmodule.exports[key] = pkg[key]; - } - }); - - return pkginfo; -}; - -// -// ### function find (dir) -// #### @pmodule {Module} Parent module to read from. -// #### @dir {string} **Optional** Directory to start search from. -// Searches up the directory tree from `dir` until it finds a directory -// which contains a `package.json` file. -// -pkginfo.find = function (pmodule, dir) { - dir = dir || pmodule.filename; - dir = path.dirname(dir); - - var files = fs.readdirSync(dir); - - if (~files.indexOf('package.json')) { - return path.join(dir, 'package.json'); - } - - if (dir === '/') { - throw new Error('Could not find package.json up from: ' + dir); - } - else if (!dir || dir === '.') { - throw new Error('Cannot find package.json from unspecified directory'); - } - - return pkginfo.find(pmodule, dir); -}; - -// -// ### function read (pmodule, dir) -// #### @pmodule {Module} Parent module to read from. -// #### @dir {string} **Optional** Directory to start search from. -// Searches up the directory tree from `dir` until it finds a directory -// which contains a `package.json` file and returns the package information. -// -pkginfo.read = function (pmodule, dir) { - dir = pkginfo.find(pmodule, dir); - - var data = fs.readFileSync(dir).toString(); - - return { - dir: dir, - package: JSON.parse(data) - }; -}; - -// -// Call `pkginfo` on this module and expose version. -// -pkginfo(module, { - dir: __dirname, - include: ['version'], - target: pkginfo -}); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/pkginfo/package.json b/node_modules/flatiron/node_modules/pkginfo/package.json deleted file mode 100644 index b44560c..0000000 --- a/node_modules/flatiron/node_modules/pkginfo/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "pkginfo", - "version": "0.2.3", - "description": "An easy way to expose properties on a module from a package.json", - "author": { - "name": "Charlie Robbins", - "email": "charlie.robbins@gmail.com" - }, - "repository": { - "type": "git", - "url": "git://github.com/indexzero/node-pkginfo.git" - }, - "keywords": [ - "info", - "tools", - "package.json" - ], - "devDependencies": { - "vows": "0.6.x" - }, - "main": "./lib/pkginfo", - "scripts": { - "test": "vows test/*-test.js --spec" - }, - "engines": { - "node": ">= 0.4.0" - }, - "_id": "pkginfo@0.2.3", - "dependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "pkginfo@0.2.3" -} diff --git a/node_modules/flatiron/node_modules/pkginfo/test/pkginfo-test.js b/node_modules/flatiron/node_modules/pkginfo/test/pkginfo-test.js deleted file mode 100644 index 3156c00..0000000 --- a/node_modules/flatiron/node_modules/pkginfo/test/pkginfo-test.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * pkginfo-test.js: Tests for the pkginfo module. - * - * (C) 2011, Charlie Robbins - * - */ - -var assert = require('assert'), - exec = require('child_process').exec, - fs = require('fs'), - path = require('path'), - vows = require('vows'), - pkginfo = require('../lib/pkginfo'); - -function assertProperties (source, target) { - assert.lengthOf(source, target.length + 1); - target.forEach(function (prop) { - assert.isTrue(!!~source.indexOf(prop)); - }); -} - -function testExposes (options) { - return { - topic: function () { - exec('node ' + path.join(__dirname, '..', 'examples', options.script), this.callback); - }, - "should expose that property correctly": function (err, stdout, stderr) { - assert.isNull(err); - - var exposed = stderr.match(/'(\w+)'/ig).map(function (p) { - return p.substring(1, p.length - 1); - }); - - return !options.assert - ? assertProperties(exposed, options.properties) - : options.assert(exposed); - } - } -} - -vows.describe('pkginfo').addBatch({ - "When using the pkginfo module": { - "and passed a single `string` argument": testExposes({ - script: 'single-property.js', - properties: ['version'] - }), - "and passed multiple `string` arguments": testExposes({ - script: 'multiple-properties.js', - properties: ['version', 'author'] - }), - "and passed an `object` argument": testExposes({ - script: 'object-argument.js', - properties: ['version', 'author'] - }), - "and passed an `array` argument": testExposes({ - script: 'array-argument.js', - properties: ['version', 'author'] - }), - "and passed no arguments": testExposes({ - script: 'all-properties.js', - assert: function (exposed) { - var pkg = fs.readFileSync(path.join(__dirname, '..', 'examples', 'package.json')).toString(), - keys = Object.keys(JSON.parse(pkg)); - - assertProperties(exposed, keys); - } - }) - } -}).export(module); diff --git a/node_modules/flatiron/node_modules/prompt/.npmignore b/node_modules/flatiron/node_modules/prompt/.npmignore deleted file mode 100644 index e3bc275..0000000 --- a/node_modules/flatiron/node_modules/prompt/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules/ -node_modules/* -npm-debug.log \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/.travis.yml b/node_modules/flatiron/node_modules/prompt/.travis.yml deleted file mode 100644 index 63e4183..0000000 --- a/node_modules/flatiron/node_modules/prompt/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 - -notifications: - email: - - travis@nodejitsu.com - irc: "irc.freenode.org#nodejitsu" - diff --git a/node_modules/flatiron/node_modules/prompt/LICENSE b/node_modules/flatiron/node_modules/prompt/LICENSE deleted file mode 100644 index 56217ca..0000000 --- a/node_modules/flatiron/node_modules/prompt/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010 Nodejitsu Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/README.md b/node_modules/flatiron/node_modules/prompt/README.md deleted file mode 100644 index e49fdcd..0000000 --- a/node_modules/flatiron/node_modules/prompt/README.md +++ /dev/null @@ -1,238 +0,0 @@ -# prompt [![Build Status](https://secure.travis-ci.org/flatiron/prompt.png)](http://travis-ci.org/flatiron/prompt) - -A beautiful command-line prompt for node.js - -## Features - -* prompts the user for input -* supports validation and defaults -* hides passwords - -## Installation - -### Installing npm (node package manager) -``` -curl http://npmjs.org/install.sh | sh -``` - -### Installing prompt -``` -[sudo] npm install prompt -``` - -## Usage -Using prompt is relatively straight forward. There are two core methods you should be aware of: `prompt.get()` and `prompt.addProperties()`. There methods take strings representing property names in addition to objects for complex property validation (and more). There are a number of [examples][0] that you should examine for detailed usage. - -### Getting Basic Prompt Information -Getting started with `prompt` is easy. Lets take a look at `examples/simple-prompt.js`: - -``` js -var prompt = require('prompt'); - -// -// Start the prompt -// -prompt.start(); - -// -// Get two properties from the user: username and email -// -prompt.get(['username', 'email'], function (err, result) { - // - // Log the results. - // - console.log('Command-line input received:'); - console.log(' username: ' + result.username); - console.log(' email: ' + result.email); -}) -``` - -This will result in the following command-line output: - -``` -$ node examples/simple-prompt.js -prompt: username: some-user -prompt: email: some-user@some-place.org -Command-line input received: - username: some-user - email: some-user@some-place.org -``` - -### Prompting with Validation, Default Values, and More (Complex Properties) -In addition to prompting the user with simple string prompts, there is a robust API for getting and validating complex information from a command-line prompt. Here's a quick sample: - -``` js -var properties = [ - { - name: 'name', - validator: /^[a-zA-Z\s\-]+$/, - warning: 'Name must be only letters, spaces, or dashes', - empty: false - }, - { - name: 'password', - hidden: true - } -]; - -// -// Start the prompt -// -prompt.start(); - -// -// Get two properties from the user: email, password -// -prompt.get(properties, function (err, result) { - // - // Log the results. - // - console.log('Command-line input received:'); - console.log(' name: ' + result.name); - console.log(' password: ' + result.password); -}); -``` - -Pretty easy right? The output from the above script is: - -``` -$ node examples/property-prompt.js -prompt: name: nodejitsu000 -error: Invalid input for name -error: Name must be only letters, spaces, or dashes -prompt: name: Nodejitsu Inc -prompt: password: -Command-line input received: - name: Nodejitsu Inc - password: some-password -``` - -## Valid Property Settings -`prompt` uses a simple property system for performing a couple of basic validation operations against input received from the command-line. The motivations here were speed and simplicity of implementation to integration of pseudo-standards like JSON-Schema were not feasible. - -Lets examine the anatomy of a prompt property: - -``` js -{ - message: 'Enter your password', // Prompt displayed to the user. If not supplied name will be used. - name: 'password' // Key in the JSON object returned from `.get()`. - validator: /^\w+$/ // Regular expression that input must be valid against. - warning: 'Password must be letters' // Warning message to display if validation fails. - hidden: true // If true, characters entered will not be output to console. - default: 'lamepassword' // Default value to use if no value is entered. - empty: false // If false, value entered must be non-empty. -} -``` -### skipping prompts - -Sometimes power users may wish to skip promts and specify all data as command line options. -if a value is set as a property of `prompt.override` prompt will use that instead of -prompting the user. - -``` js -//prompt-everride.js - -var prompt = require('prompt'), - optimist = require('optimist') - -// -// set the overrides -// -prompt.override = optimist.argv - -// -// Start the prompt -// -prompt.start(); - -// -// Get two properties from the user: username and email -// -prompt.get(['username', 'email'], function (err, result) { - // - // Log the results. - // - console.log('Command-line input received:'); - console.log(' username: ' + result.username); - console.log(' email: ' + result.email); -}) - -//: node prompt-everride.js --username USER --email EMAIL - -``` - - -### Adding Properties to an Object -A common use-case for prompting users for data from the command-line is to extend or create a configuration object that is passed onto the entry-point method for your CLI tool. `prompt` exposes a convenience method for doing just this: - -``` js -var obj = { - password: 'lamepassword', - mindset: 'NY' -} - -// -// Log the initial object. -// -console.log('Initial object to be extended:'); -console.dir(obj); - -// -// Add two properties to the empty object: username and email -// -prompt.addProperties(obj, ['username', 'email'], function (err) { - // - // Log the results. - // - console.log('Updated object received:'); - console.dir(obj); -}); -``` - -## Customizing your prompt -Aside from changing `property.message`, you can also change `prompt.message` -and `prompt.delimiter` to change the appearance of your prompt. - -The basic structure of a prompt is this: - -``` js -prompt.message + prompt.delimiter + property.message + prompt.delimiter; -``` - -The default `prompt.message` is "prompt," the default `prompt.delimiter` is -": ", and the default `property.message` is `property.name`. -Changing these allows you to customize the appearance of your prompts! In -addition, prompt supports ANSI color codes via the -[colors module](https://github.com/Marak/colors.js) for custom colors. For a -very colorful example: - -``` js -var prompt = require("prompt"); -// -// The colors module adds color properties to String.prototype -// -require("colors"); - -// -// Setting these properties customizes the prompt. -// -prompt.message = "Question!".rainbow; -prompt.delimiter = "><".green; - -prompt.start(); - -prompt.get([{ name: "name", - message: "What is your name?".magenta }], function (err, result) { - console.log("You said your name is: ".cyan + result.name.cyan); -}); -``` - -## Running tests -``` -vows test/*-test.js --spec -``` - -#### Author: [Charlie Robbins][1] - -[0]: https://github.com/flatiron/prompt/tree/master/examples -[1]: http://nodejitsu.com diff --git a/node_modules/flatiron/node_modules/prompt/docs/docco.css b/node_modules/flatiron/node_modules/prompt/docs/docco.css deleted file mode 100644 index bd54134..0000000 --- a/node_modules/flatiron/node_modules/prompt/docs/docco.css +++ /dev/null @@ -1,194 +0,0 @@ -/*--------------------- Layout and Typography ----------------------------*/ -body { - font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; - font-size: 15px; - line-height: 22px; - color: #252519; - margin: 0; padding: 0; -} -a { - color: #261a3b; -} - a:visited { - color: #261a3b; - } -p { - margin: 0 0 15px 0; -} -h4, h5, h6 { - color: #333; - margin: 6px 0 6px 0; - font-size: 13px; -} - h2, h3 { - margin-bottom: 0; - color: #000; - } - h1 { - margin-top: 40px; - margin-bottom: 15px; - color: #000; - } -#container { - position: relative; -} -#background { - position: fixed; - top: 0; left: 525px; right: 0; bottom: 0; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - z-index: -1; -} -#jump_to, #jump_page { - background: white; - -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; - -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; - font: 10px Arial; - text-transform: uppercase; - cursor: pointer; - text-align: right; -} -#jump_to, #jump_wrapper { - position: fixed; - right: 0; top: 0; - padding: 5px 10px; -} - #jump_wrapper { - padding: 0; - display: none; - } - #jump_to:hover #jump_wrapper { - display: block; - } - #jump_page { - padding: 5px 0 3px; - margin: 0 0 25px 25px; - } - #jump_page .source { - display: block; - padding: 5px 10px; - text-decoration: none; - border-top: 1px solid #eee; - } - #jump_page .source:hover { - background: #f5f5ff; - } - #jump_page .source:first-child { - } -table td { - border: 0; - outline: 0; -} - td.docs, th.docs { - max-width: 450px; - min-width: 450px; - min-height: 5px; - padding: 10px 25px 1px 50px; - overflow-x: hidden; - vertical-align: top; - text-align: left; - } - .docs pre { - margin: 15px 0 15px; - padding-left: 15px; - } - .docs p tt, .docs p code { - background: #f8f8ff; - border: 1px solid #dedede; - font-size: 12px; - padding: 0 0.2em; - } - .pilwrap { - position: relative; - } - .pilcrow { - font: 12px Arial; - text-decoration: none; - color: #454545; - position: absolute; - top: 3px; left: -20px; - padding: 1px 2px; - opacity: 0; - -webkit-transition: opacity 0.2s linear; - } - td.docs:hover .pilcrow { - opacity: 1; - } - td.code, th.code { - padding: 14px 15px 16px 25px; - width: 100%; - vertical-align: top; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - } - pre, tt, code { - font-size: 12px; line-height: 18px; - font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; - margin: 0; padding: 0; - } - - -/*---------------------- Syntax Highlighting -----------------------------*/ -td.linenos { background-color: #f0f0f0; padding-right: 10px; } -span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } -body .hll { background-color: #ffffcc } -body .c { color: #408080; font-style: italic } /* Comment */ -body .err { border: 1px solid #FF0000 } /* Error */ -body .k { color: #954121 } /* Keyword */ -body .o { color: #666666 } /* Operator */ -body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ -body .cp { color: #BC7A00 } /* Comment.Preproc */ -body .c1 { color: #408080; font-style: italic } /* Comment.Single */ -body .cs { color: #408080; font-style: italic } /* Comment.Special */ -body .gd { color: #A00000 } /* Generic.Deleted */ -body .ge { font-style: italic } /* Generic.Emph */ -body .gr { color: #FF0000 } /* Generic.Error */ -body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -body .gi { color: #00A000 } /* Generic.Inserted */ -body .go { color: #808080 } /* Generic.Output */ -body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -body .gs { font-weight: bold } /* Generic.Strong */ -body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -body .gt { color: #0040D0 } /* Generic.Traceback */ -body .kc { color: #954121 } /* Keyword.Constant */ -body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ -body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ -body .kp { color: #954121 } /* Keyword.Pseudo */ -body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ -body .kt { color: #B00040 } /* Keyword.Type */ -body .m { color: #666666 } /* Literal.Number */ -body .s { color: #219161 } /* Literal.String */ -body .na { color: #7D9029 } /* Name.Attribute */ -body .nb { color: #954121 } /* Name.Builtin */ -body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ -body .no { color: #880000 } /* Name.Constant */ -body .nd { color: #AA22FF } /* Name.Decorator */ -body .ni { color: #999999; font-weight: bold } /* Name.Entity */ -body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -body .nf { color: #0000FF } /* Name.Function */ -body .nl { color: #A0A000 } /* Name.Label */ -body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -body .nt { color: #954121; font-weight: bold } /* Name.Tag */ -body .nv { color: #19469D } /* Name.Variable */ -body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -body .w { color: #bbbbbb } /* Text.Whitespace */ -body .mf { color: #666666 } /* Literal.Number.Float */ -body .mh { color: #666666 } /* Literal.Number.Hex */ -body .mi { color: #666666 } /* Literal.Number.Integer */ -body .mo { color: #666666 } /* Literal.Number.Oct */ -body .sb { color: #219161 } /* Literal.String.Backtick */ -body .sc { color: #219161 } /* Literal.String.Char */ -body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ -body .s2 { color: #219161 } /* Literal.String.Double */ -body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -body .sh { color: #219161 } /* Literal.String.Heredoc */ -body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -body .sx { color: #954121 } /* Literal.String.Other */ -body .sr { color: #BB6688 } /* Literal.String.Regex */ -body .s1 { color: #219161 } /* Literal.String.Single */ -body .ss { color: #19469D } /* Literal.String.Symbol */ -body .bp { color: #954121 } /* Name.Builtin.Pseudo */ -body .vc { color: #19469D } /* Name.Variable.Class */ -body .vg { color: #19469D } /* Name.Variable.Global */ -body .vi { color: #19469D } /* Name.Variable.Instance */ -body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/docs/prompt.html b/node_modules/flatiron/node_modules/prompt/docs/prompt.html deleted file mode 100644 index 7776f5b..0000000 --- a/node_modules/flatiron/node_modules/prompt/docs/prompt.html +++ /dev/null @@ -1,296 +0,0 @@ - prompt.js

        prompt.js

        /*
        - * prompt.js: Simple prompt for prompting information from the command line 
        - *
        - * (C) 2010, Nodejitsu Inc.
        - *
        - */
        -
        -var events = require('events'),
        -    async = require('async'),
        -    colors = require('colors'),
        -    winston = require('winston'),
        -    stdio = process.binding('stdio');

        @private function capitalize (str)

        - -

        str {string} String to capitalize

        - -

        Capitalizes the string supplied.

        function capitalize(str) {
        -  return str.charAt(0).toUpperCase() + str.slice(1);
        -}
        -
        -var prompt = module.exports = Object.create(events.EventEmitter.prototype);
        -
        -var logger = prompt.logger = new winston.Logger({
        -  transports: [
        -    new (winston.transports.Console)()
        -  ]
        -});
        -    
        -prompt.started    = false;
        -prompt.paused     = false;
        -prompt.allowEmpty = false; 
        -
        -var stdin, stdout;

        Create an empty object for the properties -known to prompt

        prompt.properties = {};

        Setup the default winston logger to use -the cli levels and colors.

        logger.cli();

        function start (options)

        - -

        @options {Object} Optional Options to consume by prompt

        - -

        Starts the prompt by listening to the appropriate events on options.stdin -and options.stdout. If no streams are supplied, then process.stdin -and process.stdout are used, respectively.

        prompt.start = function (options) {
        -  if (prompt.started) {
        -    return;
        -  }
        -  
        -  options = options        || {};
        -  stdin   = options.stdin  || process.openStdin();
        -  stdout  = options.stdout || process.stdout;
        -  
        -  prompt.allowEmpty = options.allowEmpty || false;
        -  
        -  process.on('SIGINT', function () {
        -    stdout.write('\n');
        -    process.exit(1);
        -  })
        -  
        -  prompt.emit('start');
        -  prompt.started = true;
        -  return prompt;
        -};

        function pause ()

        - -

        Pauses input coming in from stdin

        prompt.pause = function () {
        -  if (!prompt.started || prompt.paused) {
        -    return;
        -  }
        -  
        -  stdin.pause();
        -  prompt.emit('pause');
        -  prompt.paused = true;
        -  return prompt;
        -};

        function resume ()

        - -

        Resumes input coming in from stdin

        prompt.resume = function () {
        -  if (!prompt.started || !prompt.paused) {
        -    return;
        -  }
        -  
        -  stdin.resume();
        -  prompt.emit('resume');
        -  prompt.paused = false;
        -  return prompt;
        -};

        function get (msg, [validator,] callback)

        - -

        @msg {Array|Object|string} Set of variables to get input for.

        - -

        @callback {function} Continuation to pass control to when complete.

        - -

        Gets input from the user via stdin for the specified message(s) msg.

        prompt.get = function (msg, callback) {
        -  var vars = !Array.isArray(msg) ? [msg] : msg,
        -      result = {};
        -  
        -  vars = vars.map(function (v) {
        -    if (typeof v === 'string') {
        -      v = v.toLowerCase();
        -    }
        -    
        -    return prompt.properties[v] || v;
        -  });
        -  
        -  function get(target, next) {
        -    prompt.getInput(target, function (err, line) {
        -      if (err) {
        -        return next(err);
        -      }
        -      
        -      var name = target.name || target;
        -      result[name] = line;
        -      next();
        -    });
        -  }
        -  
        -  async.forEachSeries(vars, get, function (err) {
        -    return err ? callback(err) : callback(null, result);
        -  });
        -  
        -  return prompt;
        -};

        function getInput (msg, validator, callback)

        - -

        @msg {Object|string} Variable to get input for.

        - -

        @callback {function} Continuation to pass control to when complete.

        - -

        Gets input from the user via stdin for the specified message msg.

        prompt.getInput = function (prop, callback) {
        -  var name   = prop.message || prop.name || prop,
        -      raw    = ['prompt', ': ' + name.grey, ': '.grey],
        -      read   = prop.hidden ? prompt.readLineHidden : prompt.readLine,
        -      length, msg;
        -  
        -  if (prop.default) {
        -    raw.splice(2, -1, ' (' + prop.default + ')');
        -  }
        -  

        Calculate the raw length and colorize the prompt

          length = raw.join('').length;
        -  raw[0] = raw[0];
        -  msg = raw.join('');
        -  
        -  if (prop.help) {
        -    prop.help.forEach(function (line) {
        -      logger.help(line);
        -    });
        -  }
        -  
        -  stdout.write(msg); 
        -  prompt.emit('prompt', prop);
        -  
        -  read.call(null, function (err, line) {
        -    if (err) {
        -      return callback(err);
        -    }
        -  
        -    if (!line || line === '') {
        -      line = prop.default || line;
        -    }
        -    
        -    if (prop.validator || prop.empty === false) {
        -      var valid;
        -      
        -      if (prop.validator) {
        -        valid = prop.validator.test 
        -         ? prop.validator.test(line)
        -         : prop.validator(line);
        -      }
        -      
        -      if (prop.empty === false && valid) {
        -        valid = line.length > 0;
        -        prop.warning = prop.warning || 'You must supply a value.';
        -      }
        -      
        -      if (!valid) {
        -        logger.error('Invalid input for ' + name.grey);
        -        if (prop.warning) {
        -          logger.error(prop.warning);
        -        }
        -        
        -        prompt.emit('invalid', prop, line);
        -        return prompt.getInput(prop, callback);
        -      }
        -    }
        -        
        -    logger.input(line.yellow);
        -    callback(null, line);
        -  });
        -
        -  return prompt;
        -};

        function addProperties (obj, properties, callback)

        - -

        @obj {Object} Object to add properties to

        - -

        @properties {Array} List of properties to get values for

        - -

        @callback {function} Continuation to pass control to when complete.

        - -

        Prompts the user for values each of the properties if obj does not already -have a value for the property. Responds with the modified object.

        prompt.addProperties = function (obj, properties, callback) {
        -  properties = properties.filter(function (prop) {
        -    return typeof obj[prop] === 'undefined';
        -  });
        -  
        -  if (properties.length === 0) {
        -    return callback(obj);
        -  }
        -  
        -  prompt.get(properties, function (err, results) {
        -    if (err) {
        -      return callback(err);
        -    }
        -    else if (!results) {
        -      return callback(null, obj);
        -    }
        -    
        -    function putNested (obj, path, value) {
        -      var last = obj, key; 
        -      
        -      while (path.length > 1) {
        -        key = path.shift();
        -        if (!last[key]) {
        -          last[key] = {};
        -        }
        -        
        -        last = last[key];
        -      }
        -      
        -      last[path.shift()] = value;
        -    }
        -    
        -    Object.keys(results).forEach(function (key) {
        -      putNested(obj, key.split('.'), results[key]);
        -    });
        -    
        -    callback(null, obj);
        -  });
        -  
        -  return prompt;
        -};

        function readLine (callback)

        - -

        @callback {function} Continuation to respond to when complete

        - -

        Gets a single line of input from the user.

        prompt.readLine = function (callback) {
        -  var value = '', buffer = '';
        -  prompt.resume();
        -  stdin.setEncoding('utf8');
        -  stdin.on('error', callback);
        -  stdin.on('data', function data (chunk) {
        -    value += buffer + chunk;
        -    buffer = '';
        -    value = value.replace(/\r/g, '');
        -    if (value.indexOf('\n') !== -1) {
        -      if (value !== '\n') {
        -        value = value.replace(/^\n+/, '');
        -      }
        -      
        -      buffer = value.substr(value.indexOf('\n'));
        -      val = value.substr(0, value.indexOf('\n'));
        -      prompt.pause();
        -      stdin.removeListener('data', data);
        -      stdin.removeListener('error', callback);
        -      value = value.trim();
        -      callback(null, value);
        -    }
        -  });
        -  
        -  return prompt;
        -};

        function readLineHidden (callback)

        - -

        @callback {function} Continuation to respond to when complete

        - -

        Gets a single line of hidden input (i.e. rawMode = true) from the user.

        prompt.readLineHidden = function (callback) {
        -  var value = '', buffer = '';
        -  stdio.setRawMode(true);
        -  prompt.resume();
        -  stdin.on('error', callback);
        -  stdin.on('data', function data (c) {
        -    c = '' + c;
        -    switch (c) {
        -      case '\n': case '\r': case '\r\n': case '\u0004':
        -        stdio.setRawMode(false);
        -        stdin.removeListener('data', data);
        -        stdin.removeListener('error', callback);
        -        value = value.trim();
        -        stdout.write('\n');
        -        stdout.flush();
        -        prompt.pause();
        -        return callback(null, value)
        -      case '\u0003': case '\0':
        -        stdout.write('\n');
        -        process.exit(1);
        -        break;
        -      default:
        -        value += buffer + c
        -        buffer = '';
        -        break;
        -    }
        -  });
        -  
        -  return prompt;
        -};
        -
        -
        diff --git a/node_modules/flatiron/node_modules/prompt/examples/add-properties.js b/node_modules/flatiron/node_modules/prompt/examples/add-properties.js deleted file mode 100644 index 71860dd..0000000 --- a/node_modules/flatiron/node_modules/prompt/examples/add-properties.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * add-properties.js: Example of how to add properties to an object using prompt. - * - * (C) 2010, Nodejitsu Inc. - * - */ - -var prompt = require('../lib/prompt'); - -// -// Start the prompt -// -prompt.start(); - -var obj = { - password: 'lamepassword', - mindset: 'NY' -} - -// -// Log the initial object. -// -console.log('Initial object to be extended:'); -console.dir(obj); - -// -// Add two properties to the empty object: username and email -// -prompt.addProperties(obj, ['username', 'email'], function (err) { - // - // Log the results. - // - console.log('Updated object received:'); - console.dir(obj); -}); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/examples/existing-properties.js b/node_modules/flatiron/node_modules/prompt/examples/existing-properties.js deleted file mode 100644 index b1d6621..0000000 --- a/node_modules/flatiron/node_modules/prompt/examples/existing-properties.js +++ /dev/null @@ -1,37 +0,0 @@ -/* - * existing-properties.js: Example of using prompt with predefined properties. - * - * (C) 2010, Nodejitsu Inc. - * - */ - -var prompt = require('../lib/prompt'); - -prompt.properties = { - email: { - name: 'email', - validator: /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i, - warning: 'Must be a valid email address' - }, - password: { - name: 'password', - hidden: true - } -}; - -// -// Start the prompt -// -prompt.start(); - -// -// Get two properties from the user: email, password -// -prompt.get(['email', 'password'], function (err, result) { - // - // Log the results. - // - console.log('Command-line input received:'); - console.log(' email: ' + result.email); - console.log(' password: ' + result.password); -}); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/examples/history.js b/node_modules/flatiron/node_modules/prompt/examples/history.js deleted file mode 100644 index e60e59d..0000000 --- a/node_modules/flatiron/node_modules/prompt/examples/history.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * history.js: Example of using the prompt history capabilities. - * - * (C) 2010, Nodejitsu Inc. - * - */ - -var prompt = require('../lib/prompt'); - -// -// Start the prompt -// -prompt.start(); - -var properties = [ - { - name: 'animal', - description: 'Enter an animal', - default: 'dog', - validator: /dog|cat/ - }, - { - name: 'sound', - description: 'What sound does this animal make?', - validator: function (value) { - var animal = prompt.history(0).value; - - return animal === 'dog' && value === 'woof' - || animal === 'cat' && value === 'meow'; - } - } -] - -// -// Get two properties from the user -// -prompt.get(properties, function (err, result) { - // - // Log the results. - // - console.log('Command-line input received:'); - console.log(' animal: ' + result.animal); - console.log(' sound: ' + result.sound); -}); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/examples/password.js b/node_modules/flatiron/node_modules/prompt/examples/password.js deleted file mode 100644 index 90167ea..0000000 --- a/node_modules/flatiron/node_modules/prompt/examples/password.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * simple-prompt.js: Simple example of using prompt. - * - * (C) 2010, Nodejitsu Inc. - * - */ - -var prompt = require('../lib/prompt'); - -// -// Start the prompt -// -prompt.start(); - -// -// Get two properties from the user: username and password -// -prompt.get([{ - name:'password', - hidden: true, - validator: function (value, next) { - setTimeout(next, 200); - } - }], function (err, result) { - // - // Log the results. - // - console.log('Command-line input received:'); - console.log(' password: ' + result.password); -}); diff --git a/node_modules/flatiron/node_modules/prompt/examples/property-prompt.js b/node_modules/flatiron/node_modules/prompt/examples/property-prompt.js deleted file mode 100644 index 7f3453e..0000000 --- a/node_modules/flatiron/node_modules/prompt/examples/property-prompt.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * property-prompt.js: Example of using prompt with complex properties. - * - * (C) 2010, Nodejitsu Inc. - * - */ - -var prompt = require('../lib/prompt'); - -var properties = [ - { - name: 'name', - validator: /^[a-zA-Z\s-]+$/, - warning: 'Name must be only letters, spaces, or dashes', - empty: false - }, - { - name: 'email', - validator: /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i, - warning: 'Must be a valid email address' - }, - { - name: 'password', - empty: false, - hidden: true - } -]; - -// -// Start the prompt -// -prompt.start(); - -// -// Get two properties from the user: email, password -// -prompt.get(properties, function (err, result) { - // - // Log the results. - // - console.log('Command-line input received:'); - console.log(' name: ' + result.name); - console.log(' email: ' + result.email); - console.log(' password: ' + result.password); -}); diff --git a/node_modules/flatiron/node_modules/prompt/examples/simple-prompt.js b/node_modules/flatiron/node_modules/prompt/examples/simple-prompt.js deleted file mode 100644 index 6351656..0000000 --- a/node_modules/flatiron/node_modules/prompt/examples/simple-prompt.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * simple-prompt.js: Simple example of using prompt. - * - * (C) 2010, Nodejitsu Inc. - * - */ - -var prompt = require('../lib/prompt'); - -// -// Start the prompt -// -prompt.start(); - -// -// Get two properties from the user: username and email -// -prompt.get(['username', 'email'], function (err, result) { - // - // Log the results. - // - console.log('Command-line input received:'); - console.log(' username: ' + result.username); - console.log(' email: ' + result.email); -}); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/lib/prompt.js b/node_modules/flatiron/node_modules/prompt/lib/prompt.js deleted file mode 100644 index d5a4e19..0000000 --- a/node_modules/flatiron/node_modules/prompt/lib/prompt.js +++ /dev/null @@ -1,442 +0,0 @@ -/* - * prompt.js: Simple prompt for prompting information from the command line - * - * (C) 2010, Nodejitsu Inc. - * - */ - -var events = require('events'), - async = require('async'), - colors = require('colors'), - winston = require('winston'), - tty = require('tty'); - -// -// ### @private function capitalize (str) -// #### str {string} String to capitalize -// Capitalizes the string supplied. -// -function capitalize(str) { - return str.charAt(0).toUpperCase() + str.slice(1); -} - -// -// Expose version using `pkginfo` -// -require('pkginfo')(module, 'version'); - -var stdin, stdout, history = []; -var prompt = module.exports = Object.create(events.EventEmitter.prototype); -var logger = prompt.logger = new winston.Logger({ - transports: [new (winston.transports.Console)()] -}); - -prompt.started = false; -prompt.paused = false; -prompt.allowEmpty = false; -prompt.message = 'prompt'; -prompt.delimiter = ': '; - -// -// Create an empty object for the properties -// known to `prompt` -// -prompt.properties = {}; - -// -// Setup the default winston logger to use -// the `cli` levels and colors. -// -logger.cli(); - -// -// ### function start (options) -// #### @options {Object} **Optional** Options to consume by prompt -// Starts the prompt by listening to the appropriate events on `options.stdin` -// and `options.stdout`. If no streams are supplied, then `process.stdin` -// and `process.stdout` are used, respectively. -// -prompt.start = function (options) { - if (prompt.started) { - return; - } - - options = options || {}; - stdin = options.stdin || process.openStdin(); - stdout = options.stdout || process.stdout; - - // - // By default: Remeber the last `10` prompt property / - // answer pairs and don't allow empty responses globally. - // - prompt.memory = options.memory || 10; - prompt.allowEmpty = options.allowEmpty || false; - prompt.message = options.message || prompt.message; - prompt.delimiter = options.delimiter || prompt.delimiter; - - if (process.platform !== 'win32') { - // windows falls apart trying to deal with SIGINT - process.on('SIGINT', function () { - stdout.write('\n'); - process.exit(1); - }); - } - - prompt.emit('start'); - prompt.started = true; - return prompt; -}; - -// -// ### function pause () -// Pauses input coming in from stdin -// -prompt.pause = function () { - if (!prompt.started || prompt.paused) { - return; - } - - stdin.pause(); - prompt.emit('pause'); - prompt.paused = true; - return prompt; -}; - -// -// ### function resume () -// Resumes input coming in from stdin -// -prompt.resume = function () { - if (!prompt.started || !prompt.paused) { - return; - } - - stdin.resume(); - prompt.emit('resume'); - prompt.paused = false; - return prompt; -}; - -// -// ### function history (search) -// #### @search {Number|string} Index or property name to find. -// Returns the `property:value` pair from within the prompts -// `history` array. -// -prompt.history = function (search) { - if (typeof search === 'number') { - return history[search] || {}; - } - - var names = history.map(function (pair) { - return typeof pair.property === 'string' - ? pair.property - : pair.property.name; - }); - - if (~names.indexOf(search)) { - return null; - } - - return history.filter(function (name) { - return typeof pair.property === 'string' - ? pair.property === name - : pair.property.name === name; - })[0]; -}; - -// -// ### function get (msg, [validator,] callback) -// #### @msg {Array|Object|string} Set of variables to get input for. -// #### @callback {function} Continuation to pass control to when complete. -// Gets input from the user via stdin for the specified message(s) `msg`. -// -prompt.get = function (msg, callback) { - var vars = !Array.isArray(msg) ? [msg] : msg, - result = {}; - - vars = vars.map(function (v) { - if (typeof v === 'string') { - v = v.toLowerCase(); - } - - return prompt.properties[v] || v; - }); - - function get(target, next) { - prompt.getInput(target, function (err, line) { - if (err) { - return next(err); - } - - var name = target.name || target; - result[name] = line; - next(); - }); - } - - async.forEachSeries(vars, get, function (err) { - return err ? callback(err) : callback(null, result); - }); - - return prompt; -}; - -// -// ### function getInput (msg, validator, callback) -// #### @msg {Object|string} Variable to get input for. -// #### @callback {function} Continuation to pass control to when complete. -// Gets input from the user via stdin for the specified message `msg`. -// -prompt.getInput = function (prop, callback) { - var name = prop.message || prop.name || prop, - propName = prop.name || prop, - delim = prompt.delimiter, - raw = [prompt.message, delim + name.grey, delim.grey], - read = prop.hidden ? prompt.readLineHidden : prompt.readLine, - length, msg; - - if (prompt.override && prompt.override[propName]) { - return callback (null, prompt.override[propName]) - } - - if (prop.default) { - raw.splice(2, -1, ' (' + prop.default + ')'); - } - - // Calculate the raw length and colorize the prompt - length = raw.join('').length; - raw[0] = raw[0]; - msg = raw.join(''); - - if (prop.help) { - prop.help.forEach(function (line) { - logger.help(line); - }); - } - - stdout.write(msg); - prompt.emit('prompt', prop); - - read.call(null, function (err, line) { - if (err) { - return callback(err); - } - - if (!line || line === '') { - line = prop.default || line; - } - - if (!prop.validator && prop.empty !== false) { - logger.input(line.yellow); - return callback(null, line); - } - - var valid = true, - validator = prop.validator; - - function next(valid) { - if (arguments.length < 1) { - valid = true; - } - - if (prop.empty === false && valid) { - valid = line.length > 0; - if (!valid) { - prop.warning = prop.warning || 'You must supply a value.'; - } - } - - if (!valid) { - logger.error('Invalid input for ' + name.grey); - if (prop.warning) { - logger.error(prop.warning); - } - - prompt.emit('invalid', prop, line); - return prompt.getInput(prop, callback); - } - - // - // Log the resulting line, append this `property:value` - // pair to the history for `prompt` and respond to - // the callback. - // - logger.input(line.yellow); - prompt._remember(prop, line); - callback(null, line); - } - - if (validator) { - if (validator.test) { - valid = validator.test(line) - } - else if (typeof validator === 'function') { - return validator.length < 2 - ? next(validator(line)) - : validator(line, next); - } - else { - return callback(new Error('Invalid valiator: ' + typeof validator)); - } - } - - next(valid); - }); - - return prompt; -}; - -// -// ### function addProperties (obj, properties, callback) -// #### @obj {Object} Object to add properties to -// #### @properties {Array} List of properties to get values for -// #### @callback {function} Continuation to pass control to when complete. -// Prompts the user for values each of the `properties` if `obj` does not already -// have a value for the property. Responds with the modified object. -// -prompt.addProperties = function (obj, properties, callback) { - properties = properties.filter(function (prop) { - return typeof obj[prop] === 'undefined'; - }); - - if (properties.length === 0) { - return callback(obj); - } - - prompt.get(properties, function (err, results) { - if (err) { - return callback(err); - } - else if (!results) { - return callback(null, obj); - } - - function putNested (obj, path, value) { - var last = obj, key; - - while (path.length > 1) { - key = path.shift(); - if (!last[key]) { - last[key] = {}; - } - - last = last[key]; - } - - last[path.shift()] = value; - } - - Object.keys(results).forEach(function (key) { - putNested(obj, key.split('.'), results[key]); - }); - - callback(null, obj); - }); - - return prompt; -}; - -// -// ### function readLine (callback) -// #### @callback {function} Continuation to respond to when complete -// Gets a single line of input from the user. -// -prompt.readLine = function (callback) { - var value = '', buffer = ''; - prompt.resume(); - stdin.setEncoding('utf8'); - stdin.on('error', callback); - stdin.on('data', function data (chunk) { - value += buffer + chunk; - buffer = ''; - value = value.replace(/\r/g, ''); - if (value.indexOf('\n') !== -1) { - if (value !== '\n') { - value = value.replace(/^\n+/, ''); - } - - buffer = value.substr(value.indexOf('\n')); - value = value.substr(0, value.indexOf('\n')); - prompt.pause(); - stdin.removeListener('data', data); - stdin.removeListener('error', callback); - value = value.trim(); - callback(null, value); - } - }); - - return prompt; -}; - -// -// ### function readLineHidden (callback) -// #### @callback {function} Continuation to respond to when complete -// Gets a single line of hidden input (i.e. `rawMode = true`) from the user. -// -prompt.readLineHidden = function (callback) { - var value = ''; - - // - // Ignore errors from `.setRawMode()` so that `prompt` can - // be scripted in child processes. - // - try { tty.setRawMode(true) } - catch (ex) { } - - prompt.resume(); - stdin.on('error', callback); - stdin.on('data', function data (line) { - line = line + ''; - for(var i = 0; i < line.length; i++) { - c = line[i]; - switch (c) { - case '\n': case '\r': case '\r\n': case '\u0004': - try { tty.setRawMode(false) } - catch (ex) { } - stdin.removeListener('data', data); - stdin.removeListener('error', callback); - value = value.trim(); - stdout.write('\n'); - stdout.flush && stdout.flush(); - prompt.pause(); - return callback(null, value); - case '\x7f': case'\x08': - value = value.slice(0,-1); - break; - case '\u0003': case '\0': - stdout.write('\n'); - process.exit(1); - break; - default: - value = value + c; - break; - } - } - }); - - return prompt; -}; - -// -// ### @private function _remember (property, value) -// #### @property {Object|string} Property that the value is in response to. -// #### @value {string} User input captured by `prompt`. -// Prepends the `property:value` pair into the private `history` Array -// for `prompt` so that it can be accessed later. -// -prompt._remember = function (property, value) { - history.unshift({ - property: property, - value: value - }); - - // - // If the length of the `history` Array - // has exceeded the specified length to remember, - // `prompt.memory`, truncate it. - // - if (history.length > prompt.memory) { - history.splice(prompt.memory, history.length - prompt.memory); - } -}; diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/async/.gitmodules b/node_modules/flatiron/node_modules/prompt/node_modules/async/.gitmodules deleted file mode 100644 index a9aae98..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/async/.gitmodules +++ /dev/null @@ -1,9 +0,0 @@ -[submodule "deps/nodeunit"] - path = deps/nodeunit - url = git://github.com/caolan/nodeunit.git -[submodule "deps/UglifyJS"] - path = deps/UglifyJS - url = https://github.com/mishoo/UglifyJS.git -[submodule "deps/nodelint"] - path = deps/nodelint - url = https://github.com/tav/nodelint.git diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/async/.npmignore b/node_modules/flatiron/node_modules/prompt/node_modules/async/.npmignore deleted file mode 100644 index 9bdfc97..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/async/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -deps -dist -test -nodelint.cfg \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/async/LICENSE b/node_modules/flatiron/node_modules/prompt/node_modules/async/LICENSE deleted file mode 100644 index b7f9d50..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/async/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010 Caolan McMahon - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/async/Makefile b/node_modules/flatiron/node_modules/prompt/node_modules/async/Makefile deleted file mode 100644 index bad647c..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/async/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -PACKAGE = asyncjs -NODEJS = $(if $(shell test -f /usr/bin/nodejs && echo "true"),nodejs,node) -CWD := $(shell pwd) -NODEUNIT = $(CWD)/node_modules/nodeunit/bin/nodeunit -UGLIFY = $(CWD)/node_modules/uglify-js/bin/uglifyjs -NODELINT = $(CWD)/node_modules/nodelint/nodelint - -BUILDDIR = dist - -all: clean test build - -build: $(wildcard lib/*.js) - mkdir -p $(BUILDDIR) - $(UGLIFY) lib/async.js > $(BUILDDIR)/async.min.js - -test: - $(NODEUNIT) test - -clean: - rm -rf $(BUILDDIR) - -lint: - $(NODELINT) --config nodelint.cfg lib/async.js - -.PHONY: test build all diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/async/README.md b/node_modules/flatiron/node_modules/prompt/node_modules/async/README.md deleted file mode 100644 index 0cf7fc9..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/async/README.md +++ /dev/null @@ -1,1022 +0,0 @@ -# Async.js - -Async is a utility module which provides straight-forward, powerful functions -for working with asynchronous JavaScript. Although originally designed for -use with [node.js](http://nodejs.org), it can also be used directly in the -browser. - -Async provides around 20 functions that include the usual 'functional' -suspects (map, reduce, filter, forEach…) as well as some common patterns -for asynchronous control flow (parallel, series, waterfall…). All these -functions assume you follow the node.js convention of providing a single -callback as the last argument of your async function. - - -## Quick Examples - - async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file - }); - - async.filter(['file1','file2','file3'], path.exists, function(results){ - // results now equals an array of the existing files - }); - - async.parallel([ - function(){ ... }, - function(){ ... } - ], callback); - - async.series([ - function(){ ... }, - function(){ ... } - ]); - -There are many more functions available so take a look at the docs below for a -full list. This module aims to be comprehensive, so if you feel anything is -missing please create a GitHub issue for it. - - -## Download - -Releases are available for download from -[GitHub](http://github.com/caolan/async/downloads). -Alternatively, you can install using Node Package Manager (npm): - - npm install async - - -__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 17.5kb Uncompressed - -__Production:__ [async.min.js](https://github.com/caolan/async/raw/master/dist/async.min.js) - 1.7kb Packed and Gzipped - - -## In the Browser - -So far its been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage: - - - - - -## Documentation - -### Collections - -* [forEach](#forEach) -* [map](#map) -* [filter](#filter) -* [reject](#reject) -* [reduce](#reduce) -* [detect](#detect) -* [sortBy](#sortBy) -* [some](#some) -* [every](#every) -* [concat](#concat) - -### Control Flow - -* [series](#series) -* [parallel](#parallel) -* [whilst](#whilst) -* [until](#until) -* [waterfall](#waterfall) -* [queue](#queue) -* [auto](#auto) -* [iterator](#iterator) -* [apply](#apply) -* [nextTick](#nextTick) - -### Utils - -* [memoize](#memoize) -* [unmemoize](#unmemoize) -* [log](#log) -* [dir](#dir) -* [noConflict](#noConflict) - - -## Collections - - -### forEach(arr, iterator, callback) - -Applies an iterator function to each item in an array, in parallel. -The iterator is called with an item from the list and a callback for when it -has finished. If the iterator passes an error to this callback, the main -callback for the forEach function is immediately called with the error. - -Note, that since this function applies the iterator to each item in parallel -there is no guarantee that the iterator functions will complete in order. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(err) - A callback which is called after all the iterator functions - have finished, or an error has occurred. - -__Example__ - - // assuming openFiles is an array of file names and saveFile is a function - // to save the modified contents of that file: - - async.forEach(openFiles, saveFile, function(err){ - // if any of the saves produced an error, err would equal that error - }); - ---------------------------------------- - - -### forEachSeries(arr, iterator, callback) - -The same as forEach only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. This means the iterator functions will complete in order. - - ---------------------------------------- - - -### forEachLimit(arr, limit, iterator, callback) - -The same as forEach only the iterator is applied to batches of items in the -array, in series. The next batch of iterators is only called once the current -one has completed processing. - -__Arguments__ - -* arr - An array to iterate over. -* limit - How many items should be in each batch. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(err) - A callback which is called after all the iterator functions - have finished, or an error has occurred. - -__Example__ - - // Assume documents is an array of JSON objects and requestApi is a - // function that interacts with a rate-limited REST api. - - async.forEachLimit(documents, 20, requestApi, function(err){ - // if any of the saves produced an error, err would equal that error - }); ---------------------------------------- - - -### map(arr, iterator, callback) - -Produces a new array of values by mapping each value in the given array through -the iterator function. The iterator is called with an item from the array and a -callback for when it has finished processing. The callback takes 2 arguments, -an error and the transformed item from the array. If the iterator passes an -error to this callback, the main callback for the map function is immediately -called with the error. - -Note, that since this function applies the iterator to each item in parallel -there is no guarantee that the iterator functions will complete in order, however -the results array will be in the same order as the original array. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed - with an error (which can be null) and a transformed item. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is an array of the - transformed items from the original array. - -__Example__ - - async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file - }); - ---------------------------------------- - - -### mapSeries(arr, iterator, callback) - -The same as map only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. The results array will be in the same order as the original. - - ---------------------------------------- - - -### filter(arr, iterator, callback) - -__Alias:__ select - -Returns a new array of all the values which pass an async truth test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like path.exists. This operation is -performed in parallel, but the results array will be in the same order as the -original. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(results) - A callback which is called after all the iterator - functions have finished. - -__Example__ - - async.filter(['file1','file2','file3'], path.exists, function(results){ - // results now equals an array of the existing files - }); - ---------------------------------------- - - -### filterSeries(arr, iterator, callback) - -__alias:__ selectSeries - -The same as filter only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. The results array will be in the same order as the original. - ---------------------------------------- - - -### reject(arr, iterator, callback) - -The opposite of filter. Removes values that pass an async truth test. - ---------------------------------------- - - -### rejectSeries(arr, iterator, callback) - -The same as filter, only the iterator is applied to each item in the array -in series. - - ---------------------------------------- - - -### reduce(arr, memo, iterator, callback) - -__aliases:__ inject, foldl - -Reduces a list of values into a single value using an async iterator to return -each successive step. Memo is the initial state of the reduction. This -function only operates in series. For performance reasons, it may make sense to -split a call to this function into a parallel map, then use the normal -Array.prototype.reduce on the results. This function is for situations where -each step in the reduction needs to be async, if you can get the data before -reducing it then its probably a good idea to do so. - -__Arguments__ - -* arr - An array to iterate over. -* memo - The initial state of the reduction. -* iterator(memo, item, callback) - A function applied to each item in the - array to produce the next step in the reduction. The iterator is passed a - callback which accepts an optional error as its first argument, and the state - of the reduction as the second. If an error is passed to the callback, the - reduction is stopped and the main callback is immediately called with the - error. -* callback(err, result) - A callback which is called after all the iterator - functions have finished. Result is the reduced value. - -__Example__ - - async.reduce([1,2,3], 0, function(memo, item, callback){ - // pointless async: - process.nextTick(function(){ - callback(null, memo + item) - }); - }, function(err, result){ - // result is now equal to the last value of memo, which is 6 - }); - ---------------------------------------- - - -### reduceRight(arr, memo, iterator, callback) - -__Alias:__ foldr - -Same as reduce, only operates on the items in the array in reverse order. - - ---------------------------------------- - - -### detect(arr, iterator, callback) - -Returns the first value in a list that passes an async truth test. The -iterator is applied in parallel, meaning the first iterator to return true will -fire the detect callback with that result. That means the result might not be -the first item in the original array (in terms of order) that passes the test. - -If order within the original array is important then look at detectSeries. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(result) - A callback which is called as soon as any iterator returns - true, or after all the iterator functions have finished. Result will be - the first item in the array that passes the truth test (iterator) or the - value undefined if none passed. - -__Example__ - - async.detect(['file1','file2','file3'], path.exists, function(result){ - // result now equals the first file in the list that exists - }); - ---------------------------------------- - - -### detectSeries(arr, iterator, callback) - -The same as detect, only the iterator is applied to each item in the array -in series. This means the result is always the first in the original array (in -terms of array order) that passes the truth test. - - ---------------------------------------- - - -### sortBy(arr, iterator, callback) - -Sorts a list by the results of running each value through an async iterator. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed - with an error (which can be null) and a value to use as the sort criteria. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is the items from - the original array sorted by the values returned by the iterator calls. - -__Example__ - - async.sortBy(['file1','file2','file3'], function(file, callback){ - fs.stat(file, function(err, stats){ - callback(err, stats.mtime); - }); - }, function(err, results){ - // results is now the original array of files sorted by - // modified date - }); - - ---------------------------------------- - - -### some(arr, iterator, callback) - -__Alias:__ any - -Returns true if at least one element in the array satisfies an async test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like path.exists. Once any iterator -call returns true, the main callback is immediately called. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(result) - A callback which is called as soon as any iterator returns - true, or after all the iterator functions have finished. Result will be - either true or false depending on the values of the async tests. - -__Example__ - - async.some(['file1','file2','file3'], path.exists, function(result){ - // if result is true then at least one of the files exists - }); - ---------------------------------------- - - -### every(arr, iterator, callback) - -__Alias:__ all - -Returns true if every element in the array satisfies an async test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like path.exists. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(result) - A callback which is called after all the iterator - functions have finished. Result will be either true or false depending on - the values of the async tests. - -__Example__ - - async.every(['file1','file2','file3'], path.exists, function(result){ - // if result is true then every file exists - }); - ---------------------------------------- - - -### concat(arr, iterator, callback) - -Applies an iterator to each item in a list, concatenating the results. Returns the -concatenated list. The iterators are called in parallel, and the results are -concatenated as they return. There is no guarantee that the results array will -be returned in the original order of the arguments passed to the iterator function. - -__Arguments__ - -* arr - An array to iterate over -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed - with an error (which can be null) and an array of results. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is an array containing - the concatenated results of the iterator function. - -__Example__ - - async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){ - // files is now a list of filenames that exist in the 3 directories - }); - ---------------------------------------- - - -### concatSeries(arr, iterator, callback) - -Same as async.concat, but executes in series instead of parallel. - - -## Control Flow - - -### series(tasks, [callback]) - -Run an array of functions in series, each one running once the previous -function has completed. If any functions in the series pass an error to its -callback, no more functions are run and the callback for the series is -immediately called with the value of the error. Once the tasks have completed, -the results are passed to the final callback as an array. - -It is also possible to use an object instead of an array. Each property will be -run as a function and the results will be passed to the final callback as an object -instead of an array. This can be a more readable way of handling results from -async.series. - - -__Arguments__ - -* tasks - An array or object containing functions to run, each function is passed - a callback it must call on completion. -* callback(err, results) - An optional callback to run once all the functions - have completed. This function gets an array of all the arguments passed to - the callbacks used in the array. - -__Example__ - - async.series([ - function(callback){ - // do some stuff ... - callback(null, 'one'); - }, - function(callback){ - // do some more stuff ... - callback(null, 'two'); - }, - ], - // optional callback - function(err, results){ - // results is now equal to ['one', 'two'] - }); - - - // an example using an object instead of an array - async.series({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - }, - }, - function(err, results) { - // results is now equal to: {one: 1, two: 2} - }); - - ---------------------------------------- - - -### parallel(tasks, [callback]) - -Run an array of functions in parallel, without waiting until the previous -function has completed. If any of the functions pass an error to its -callback, the main callback is immediately called with the value of the error. -Once the tasks have completed, the results are passed to the final callback as an -array. - -It is also possible to use an object instead of an array. Each property will be -run as a function and the results will be passed to the final callback as an object -instead of an array. This can be a more readable way of handling results from -async.parallel. - - -__Arguments__ - -* tasks - An array or object containing functions to run, each function is passed a - callback it must call on completion. -* callback(err, results) - An optional callback to run once all the functions - have completed. This function gets an array of all the arguments passed to - the callbacks used in the array. - -__Example__ - - async.parallel([ - function(callback){ - setTimeout(function(){ - callback(null, 'one'); - }, 200); - }, - function(callback){ - setTimeout(function(){ - callback(null, 'two'); - }, 100); - }, - ], - // optional callback - function(err, results){ - // in this case, the results array will equal ['two','one'] - // because the functions were run in parallel and the second - // function had a shorter timeout before calling the callback. - }); - - - // an example using an object instead of an array - async.parallel({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - }, - }, - function(err, results) { - // results is now equals to: {one: 1, two: 2} - }); - - ---------------------------------------- - - -### whilst(test, fn, callback) - -Repeatedly call fn, while test returns true. Calls the callback when stopped, -or an error occurs. - -__Arguments__ - -* test() - synchronous truth test to perform before each execution of fn. -* fn(callback) - A function to call each time the test passes. The function is - passed a callback which must be called once it has completed with an optional - error as the first argument. -* callback(err) - A callback which is called after the test fails and repeated - execution of fn has stopped. - -__Example__ - - var count = 0; - - async.whilst( - function () { return count < 5; }, - function (callback) { - count++; - setTimeout(callback, 1000); - }, - function (err) { - // 5 seconds have passed - } - ); - - ---------------------------------------- - - -### until(test, fn, callback) - -Repeatedly call fn, until test returns true. Calls the callback when stopped, -or an error occurs. - -The inverse of async.whilst. - - ---------------------------------------- - - -### waterfall(tasks, [callback]) - -Runs an array of functions in series, each passing their results to the next in -the array. However, if any of the functions pass an error to the callback, the -next function is not executed and the main callback is immediately called with -the error. - -__Arguments__ - -* tasks - An array of functions to run, each function is passed a callback it - must call on completion. -* callback(err, [results]) - An optional callback to run once all the functions - have completed. This will be passed the results of the last task's callback. - - - -__Example__ - - async.waterfall([ - function(callback){ - callback(null, 'one', 'two'); - }, - function(arg1, arg2, callback){ - callback(null, 'three'); - }, - function(arg1, callback){ - // arg1 now equals 'three' - callback(null, 'done'); - } - ], function (err, result) { - // result now equals 'done' - }); - - ---------------------------------------- - - -### queue(worker, concurrency) - -Creates a queue object with the specified concurrency. Tasks added to the -queue will be processed in parallel (up to the concurrency limit). If all -workers are in progress, the task is queued until one is available. Once -a worker has completed a task, the task's callback is called. - -__Arguments__ - -* worker(task, callback) - An asynchronous function for processing a queued - task. -* concurrency - An integer for determining how many worker functions should be - run in parallel. - -__Queue objects__ - -The queue object returned by this function has the following properties and -methods: - -* length() - a function returning the number of items waiting to be processed. -* concurrency - an integer for determining how many worker functions should be - run in parallel. This property can be changed after a queue is created to - alter the concurrency on-the-fly. -* push(task, [callback]) - add a new task to the queue, the callback is called - once the worker has finished processing the task. - instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list. -* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued -* empty - a callback that is called when the last item from the queue is given to a worker -* drain - a callback that is called when the last item from the queue has returned from the worker - -__Example__ - - // create a queue object with concurrency 2 - - var q = async.queue(function (task, callback) { - console.log('hello ' + task.name); - callback(); - }, 2); - - - // assign a callback - q.drain = function() { - console.log('all items have been processed'); - } - - // add some items to the queue - - q.push({name: 'foo'}, function (err) { - console.log('finished processing foo'); - }); - q.push({name: 'bar'}, function (err) { - console.log('finished processing bar'); - }); - - // add some items to the queue (batch-wise) - - q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) { - console.log('finished processing bar'); - }); - - ---------------------------------------- - - -### auto(tasks, [callback]) - -Determines the best order for running functions based on their requirements. -Each function can optionally depend on other functions being completed first, -and each function is run as soon as its requirements are satisfied. If any of -the functions pass an error to their callback, that function will not complete -(so any other functions depending on it will not run) and the main callback -will be called immediately with the error. Functions also receive an object -containing the results of functions which have completed so far. - -__Arguments__ - -* tasks - An object literal containing named functions or an array of - requirements, with the function itself the last item in the array. The key - used for each function or array is used when specifying requirements. The - syntax is easier to understand by looking at the example. -* callback(err, results) - An optional callback which is called when all the - tasks have been completed. The callback will receive an error as an argument - if any tasks pass an error to their callback. If all tasks complete - successfully, it will receive an object containing their results. - -__Example__ - - async.auto({ - get_data: function(callback){ - // async code to get some data - }, - make_folder: function(callback){ - // async code to create a directory to store a file in - // this is run at the same time as getting the data - }, - write_file: ['get_data', 'make_folder', function(callback){ - // once there is some data and the directory exists, - // write the data to a file in the directory - callback(null, filename); - }], - email_link: ['write_file', function(callback, results){ - // once the file is written let's email a link to it... - // results.write_file contains the filename returned by write_file. - }] - }); - -This is a fairly trivial example, but to do this using the basic parallel and -series functions would look like this: - - async.parallel([ - function(callback){ - // async code to get some data - }, - function(callback){ - // async code to create a directory to store a file in - // this is run at the same time as getting the data - } - ], - function(results){ - async.series([ - function(callback){ - // once there is some data and the directory exists, - // write the data to a file in the directory - }, - email_link: function(callback){ - // once the file is written let's email a link to it... - } - ]); - }); - -For a complicated series of async tasks using the auto function makes adding -new tasks much easier and makes the code more readable. - - ---------------------------------------- - - -### iterator(tasks) - -Creates an iterator function which calls the next function in the array, -returning a continuation to call the next one after that. Its also possible to -'peek' the next iterator by doing iterator.next(). - -This function is used internally by the async module but can be useful when -you want to manually control the flow of functions in series. - -__Arguments__ - -* tasks - An array of functions to run, each function is passed a callback it - must call on completion. - -__Example__ - - var iterator = async.iterator([ - function(){ sys.p('one'); }, - function(){ sys.p('two'); }, - function(){ sys.p('three'); } - ]); - - node> var iterator2 = iterator(); - 'one' - node> var iterator3 = iterator2(); - 'two' - node> iterator3(); - 'three' - node> var nextfn = iterator2.next(); - node> nextfn(); - 'three' - - ---------------------------------------- - - -### apply(function, arguments..) - -Creates a continuation function with some arguments already applied, a useful -shorthand when combined with other control flow functions. Any arguments -passed to the returned function are added to the arguments originally passed -to apply. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to automatically apply when the - continuation is called. - -__Example__ - - // using apply - - async.parallel([ - async.apply(fs.writeFile, 'testfile1', 'test1'), - async.apply(fs.writeFile, 'testfile2', 'test2'), - ]); - - - // the same process without using apply - - async.parallel([ - function(callback){ - fs.writeFile('testfile1', 'test1', callback); - }, - function(callback){ - fs.writeFile('testfile2', 'test2', callback); - }, - ]); - -It's possible to pass any number of additional arguments when calling the -continuation: - - node> var fn = async.apply(sys.puts, 'one'); - node> fn('two', 'three'); - one - two - three - ---------------------------------------- - - -### nextTick(callback) - -Calls the callback on a later loop around the event loop. In node.js this just -calls process.nextTick, in the browser it falls back to setTimeout(callback, 0), -which means other higher priority events may precede the execution of the callback. - -This is used internally for browser-compatibility purposes. - -__Arguments__ - -* callback - The function to call on a later loop around the event loop. - -__Example__ - - var call_order = []; - async.nextTick(function(){ - call_order.push('two'); - // call_order now equals ['one','two] - }); - call_order.push('one') - - -## Utils - - -### memoize(fn, [hasher]) - -Caches the results of an async function. When creating a hash to store function -results against, the callback is omitted from the hash and an optional hash -function can be used. - -__Arguments__ - -* fn - the function you to proxy and cache results from. -* hasher - an optional function for generating a custom hash for storing - results, it has all the arguments applied to it apart from the callback, and - must be synchronous. - -__Example__ - - var slow_fn = function (name, callback) { - // do something - callback(null, result); - }; - var fn = async.memoize(slow_fn); - - // fn can now be used as if it were slow_fn - fn('some name', function () { - // callback - }); - - -### unmemoize(fn) - -Undoes a memoized function, reverting it to the original, unmemoized -form. Comes handy in tests. - -__Arguments__ - -* fn - the memoized function - - -### log(function, arguments) - -Logs the result of an async function to the console. Only works in node.js or -in browsers that support console.log and console.error (such as FF and Chrome). -If multiple arguments are returned from the async function, console.log is -called on each argument in order. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to apply to the function. - -__Example__ - - var hello = function(name, callback){ - setTimeout(function(){ - callback(null, 'hello ' + name); - }, 1000); - }; - - node> async.log(hello, 'world'); - 'hello world' - - ---------------------------------------- - - -### dir(function, arguments) - -Logs the result of an async function to the console using console.dir to -display the properties of the resulting object. Only works in node.js or -in browsers that support console.dir and console.error (such as FF and Chrome). -If multiple arguments are returned from the async function, console.dir is -called on each argument in order. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to apply to the function. - -__Example__ - - var hello = function(name, callback){ - setTimeout(function(){ - callback(null, {hello: name}); - }, 1000); - }; - - node> async.dir(hello, 'world'); - {hello: 'world'} - - ---------------------------------------- - - -### noConflict() - -Changes the value of async back to its original value, returning a reference to the -async object. diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/async/index.js b/node_modules/flatiron/node_modules/prompt/node_modules/async/index.js deleted file mode 100644 index 8e23845..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/async/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// This file is just added for convenience so this repository can be -// directly checked out into a project's deps folder -module.exports = require('./lib/async'); diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/async/lib/async.js b/node_modules/flatiron/node_modules/prompt/node_modules/async/lib/async.js deleted file mode 100644 index 52276d6..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/async/lib/async.js +++ /dev/null @@ -1,692 +0,0 @@ -/*global setTimeout: false, console: false */ -(function () { - - var async = {}; - - // global on the server, window in the browser - var root = this, - previous_async = root.async; - - if (typeof module !== 'undefined' && module.exports) { - module.exports = async; - } - else { - root.async = async; - } - - async.noConflict = function () { - root.async = previous_async; - return async; - }; - - //// cross-browser compatiblity functions //// - - var _forEach = function (arr, iterator) { - if (arr.forEach) { - return arr.forEach(iterator); - } - for (var i = 0; i < arr.length; i += 1) { - iterator(arr[i], i, arr); - } - }; - - var _map = function (arr, iterator) { - if (arr.map) { - return arr.map(iterator); - } - var results = []; - _forEach(arr, function (x, i, a) { - results.push(iterator(x, i, a)); - }); - return results; - }; - - var _reduce = function (arr, iterator, memo) { - if (arr.reduce) { - return arr.reduce(iterator, memo); - } - _forEach(arr, function (x, i, a) { - memo = iterator(memo, x, i, a); - }); - return memo; - }; - - var _keys = function (obj) { - if (Object.keys) { - return Object.keys(obj); - } - var keys = []; - for (var k in obj) { - if (obj.hasOwnProperty(k)) { - keys.push(k); - } - } - return keys; - }; - - //// exported async module functions //// - - //// nextTick implementation with browser-compatible fallback //// - if (typeof process === 'undefined' || !(process.nextTick)) { - async.nextTick = function (fn) { - setTimeout(fn, 0); - }; - } - else { - async.nextTick = process.nextTick; - } - - async.forEach = function (arr, iterator, callback) { - callback = callback || function () {}; - if (!arr.length) { - return callback(); - } - var completed = 0; - _forEach(arr, function (x) { - iterator(x, function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - if (completed === arr.length) { - callback(); - } - } - }); - }); - }; - - async.forEachSeries = function (arr, iterator, callback) { - callback = callback || function () {}; - if (!arr.length) { - return callback(); - } - var completed = 0; - var iterate = function () { - iterator(arr[completed], function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - if (completed === arr.length) { - callback(); - } - else { - iterate(); - } - } - }); - }; - iterate(); - }; - - async.forEachLimit = function (arr, limit, iterator, callback) { - callback = callback || function () {}; - if (!arr.length || limit <= 0) { - return callback(); - } - var completed = 0; - var started = 0; - var running = 0; - - (function replenish () { - if (completed === arr.length) { - return callback(); - } - - while (running < limit && started < arr.length) { - iterator(arr[started], function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - running -= 1; - if (completed === arr.length) { - callback(); - } - else { - replenish(); - } - } - }); - started += 1; - running += 1; - } - })(); - }; - - - var doParallel = function (fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [async.forEach].concat(args)); - }; - }; - var doSeries = function (fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [async.forEachSeries].concat(args)); - }; - }; - - - var _asyncMap = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (err, v) { - results[x.index] = v; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - }; - async.map = doParallel(_asyncMap); - async.mapSeries = doSeries(_asyncMap); - - - // reduce only has a series version, as doing reduce in parallel won't - // work in many situations. - async.reduce = function (arr, memo, iterator, callback) { - async.forEachSeries(arr, function (x, callback) { - iterator(memo, x, function (err, v) { - memo = v; - callback(err); - }); - }, function (err) { - callback(err, memo); - }); - }; - // inject alias - async.inject = async.reduce; - // foldl alias - async.foldl = async.reduce; - - async.reduceRight = function (arr, memo, iterator, callback) { - var reversed = _map(arr, function (x) { - return x; - }).reverse(); - async.reduce(reversed, memo, iterator, callback); - }; - // foldr alias - async.foldr = async.reduceRight; - - var _filter = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (v) { - if (v) { - results.push(x); - } - callback(); - }); - }, function (err) { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - }; - async.filter = doParallel(_filter); - async.filterSeries = doSeries(_filter); - // select alias - async.select = async.filter; - async.selectSeries = async.filterSeries; - - var _reject = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (v) { - if (!v) { - results.push(x); - } - callback(); - }); - }, function (err) { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - }; - async.reject = doParallel(_reject); - async.rejectSeries = doSeries(_reject); - - var _detect = function (eachfn, arr, iterator, main_callback) { - eachfn(arr, function (x, callback) { - iterator(x, function (result) { - if (result) { - main_callback(x); - main_callback = function () {}; - } - else { - callback(); - } - }); - }, function (err) { - main_callback(); - }); - }; - async.detect = doParallel(_detect); - async.detectSeries = doSeries(_detect); - - async.some = function (arr, iterator, main_callback) { - async.forEach(arr, function (x, callback) { - iterator(x, function (v) { - if (v) { - main_callback(true); - main_callback = function () {}; - } - callback(); - }); - }, function (err) { - main_callback(false); - }); - }; - // any alias - async.any = async.some; - - async.every = function (arr, iterator, main_callback) { - async.forEach(arr, function (x, callback) { - iterator(x, function (v) { - if (!v) { - main_callback(false); - main_callback = function () {}; - } - callback(); - }); - }, function (err) { - main_callback(true); - }); - }; - // all alias - async.all = async.every; - - async.sortBy = function (arr, iterator, callback) { - async.map(arr, function (x, callback) { - iterator(x, function (err, criteria) { - if (err) { - callback(err); - } - else { - callback(null, {value: x, criteria: criteria}); - } - }); - }, function (err, results) { - if (err) { - return callback(err); - } - else { - var fn = function (left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - }; - callback(null, _map(results.sort(fn), function (x) { - return x.value; - })); - } - }); - }; - - async.auto = function (tasks, callback) { - callback = callback || function () {}; - var keys = _keys(tasks); - if (!keys.length) { - return callback(null); - } - - var results = {}; - - var listeners = []; - var addListener = function (fn) { - listeners.unshift(fn); - }; - var removeListener = function (fn) { - for (var i = 0; i < listeners.length; i += 1) { - if (listeners[i] === fn) { - listeners.splice(i, 1); - return; - } - } - }; - var taskComplete = function () { - _forEach(listeners.slice(0), function (fn) { - fn(); - }); - }; - - addListener(function () { - if (_keys(results).length === keys.length) { - callback(null, results); - callback = function () {}; - } - }); - - _forEach(keys, function (k) { - var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k]; - var taskCallback = function (err) { - if (err) { - callback(err); - // stop subsequent errors hitting callback multiple times - callback = function () {}; - } - else { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - taskComplete(); - } - }; - var requires = task.slice(0, Math.abs(task.length - 1)) || []; - var ready = function () { - return _reduce(requires, function (a, x) { - return (a && results.hasOwnProperty(x)); - }, true); - }; - if (ready()) { - task[task.length - 1](taskCallback, results); - } - else { - var listener = function () { - if (ready()) { - removeListener(listener); - task[task.length - 1](taskCallback, results); - } - }; - addListener(listener); - } - }); - }; - - async.waterfall = function (tasks, callback) { - callback = callback || function () {}; - if (!tasks.length) { - return callback(); - } - var wrapIterator = function (iterator) { - return function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - var args = Array.prototype.slice.call(arguments, 1); - var next = iterator.next(); - if (next) { - args.push(wrapIterator(next)); - } - else { - args.push(callback); - } - async.nextTick(function () { - iterator.apply(null, args); - }); - } - }; - }; - wrapIterator(async.iterator(tasks))(); - }; - - async.parallel = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - async.map(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args); - }); - } - }, callback); - } - else { - var results = {}; - async.forEach(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.series = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - async.mapSeries(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args); - }); - } - }, callback); - } - else { - var results = {}; - async.forEachSeries(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.iterator = function (tasks) { - var makeCallback = function (index) { - var fn = function () { - if (tasks.length) { - tasks[index].apply(null, arguments); - } - return fn.next(); - }; - fn.next = function () { - return (index < tasks.length - 1) ? makeCallback(index + 1): null; - }; - return fn; - }; - return makeCallback(0); - }; - - async.apply = function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - return function () { - return fn.apply( - null, args.concat(Array.prototype.slice.call(arguments)) - ); - }; - }; - - var _concat = function (eachfn, arr, fn, callback) { - var r = []; - eachfn(arr, function (x, cb) { - fn(x, function (err, y) { - r = r.concat(y || []); - cb(err); - }); - }, function (err) { - callback(err, r); - }); - }; - async.concat = doParallel(_concat); - async.concatSeries = doSeries(_concat); - - async.whilst = function (test, iterator, callback) { - if (test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.whilst(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.until = function (test, iterator, callback) { - if (!test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.until(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.queue = function (worker, concurrency) { - var workers = 0; - var q = { - tasks: [], - concurrency: concurrency, - saturated: null, - empty: null, - drain: null, - push: function (data, callback) { - if(data.constructor !== Array) { - data = [data]; - } - _forEach(data, function(task) { - q.tasks.push({ - data: task, - callback: typeof callback === 'function' ? callback : null - }); - if (q.saturated && q.tasks.length == concurrency) { - q.saturated(); - } - async.nextTick(q.process); - }); - }, - process: function () { - if (workers < q.concurrency && q.tasks.length) { - var task = q.tasks.shift(); - if(q.empty && q.tasks.length == 0) q.empty(); - workers += 1; - worker(task.data, function () { - workers -= 1; - if (task.callback) { - task.callback.apply(task, arguments); - } - if(q.drain && q.tasks.length + workers == 0) q.drain(); - q.process(); - }); - } - }, - length: function () { - return q.tasks.length; - }, - running: function () { - return workers; - } - }; - return q; - }; - - var _console_fn = function (name) { - return function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - fn.apply(null, args.concat([function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (typeof console !== 'undefined') { - if (err) { - if (console.error) { - console.error(err); - } - } - else if (console[name]) { - _forEach(args, function (x) { - console[name](x); - }); - } - } - }])); - }; - }; - async.log = _console_fn('log'); - async.dir = _console_fn('dir'); - /*async.info = _console_fn('info'); - async.warn = _console_fn('warn'); - async.error = _console_fn('error');*/ - - async.memoize = function (fn, hasher) { - var memo = {}; - var queues = {}; - hasher = hasher || function (x) { - return x; - }; - var memoized = function () { - var args = Array.prototype.slice.call(arguments); - var callback = args.pop(); - var key = hasher.apply(null, args); - if (key in memo) { - callback.apply(null, memo[key]); - } - else if (key in queues) { - queues[key].push(callback); - } - else { - queues[key] = [callback]; - fn.apply(null, args.concat([function () { - memo[key] = arguments; - var q = queues[key]; - delete queues[key]; - for (var i = 0, l = q.length; i < l; i++) { - q[i].apply(null, arguments); - } - }])); - } - }; - memoized.unmemoized = fn; - return memoized; - }; - - async.unmemoize = function (fn) { - return function () { - return (fn.unmemoized || fn).apply(null, arguments); - } - }; - -}()); diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/async/package.json b/node_modules/flatiron/node_modules/prompt/node_modules/async/package.json deleted file mode 100644 index a344939..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/async/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "async", - "description": "Higher-order functions and common patterns for asynchronous code", - "main": "./index", - "author": { - "name": "Caolan McMahon" - }, - "version": "0.1.18", - "repository": { - "type": "git", - "url": "git://github.com/caolan/async.git" - }, - "bugs": { - "url": "http://github.com/caolan/async/issues" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://github.com/caolan/async/raw/master/LICENSE" - } - ], - "devDependencies": { - "nodeunit": ">0.0.0", - "uglify-js": "1.2.x", - "nodelint": ">0.0.0" - }, - "_id": "async@0.1.18", - "dependencies": {}, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "async@0.1.x" -} diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/colors/MIT-LICENSE.txt b/node_modules/flatiron/node_modules/prompt/node_modules/colors/MIT-LICENSE.txt deleted file mode 100644 index 7dca107..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/colors/MIT-LICENSE.txt +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2010 - -Marak Squires -Alexis Sellier (cloudhead) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/colors/ReadMe.md b/node_modules/flatiron/node_modules/prompt/node_modules/colors/ReadMe.md deleted file mode 100644 index 1c6b0d0..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/colors/ReadMe.md +++ /dev/null @@ -1,77 +0,0 @@ -# colors.js - get color and style in your node.js console ( and browser ) like what - - - - -## Installation - - npm install colors - -## colors and styles! - -- bold -- italic -- underline -- inverse -- yellow -- cyan -- white -- magenta -- green -- red -- grey -- blue -- rainbow -- zebra -- random - -## Usage - -``` js -var colors = require('./colors'); - -console.log('hello'.green); // outputs green text -console.log('i like cake and pies'.underline.red) // outputs red underlined text -console.log('inverse the color'.inverse); // inverses the color -console.log('OMG Rainbows!'.rainbow); // rainbow (ignores spaces) -``` - -# Creating Custom themes - -```js - -var require('colors'); - -colors.setTheme({ - silly: 'rainbow', - input: 'grey', - verbose: 'cyan', - prompt: 'grey', - info: 'green', - data: 'grey', - help: 'cyan', - warn: 'yellow', - debug: 'blue', - error: 'red' -}); - -// outputs red text -console.log("this is an error".error); - -// outputs yellow text -console.log("this is a warning".warn); -``` - - -### Contributors - -Marak (Marak Squires) -Alexis Sellier (cloudhead) -mmalecki (Maciej Małecki) -nicoreed (Nico Reed) -morganrallen (Morgan Allen) -JustinCampbell (Justin Campbell) -ded (Dustin Diaz) - - -#### , Marak Squires , Justin Campbell, Dustin Diaz (@ded) diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/colors/colors.js b/node_modules/flatiron/node_modules/prompt/node_modules/colors/colors.js deleted file mode 100644 index a7198f1..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/colors/colors.js +++ /dev/null @@ -1,269 +0,0 @@ -/* -colors.js - -Copyright (c) 2010 - -Marak Squires -Alexis Sellier (cloudhead) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -*/ - -var isHeadless = false; - -if (typeof module !== 'undefined') { - isHeadless = true; -} - -if (!isHeadless) { - var exports = {}; - var module = {}; - var colors = exports; - exports.mode = "browser"; -} else { - exports.mode = "console"; -} - -// -// Prototypes the string object to have additional method calls that add terminal colors -// -var addProperty = function (color, func) { - var allowOverride = ['bold']; - exports[color] = function(str) { - return func.apply(str); - }; - String.prototype.__defineGetter__(color, func); -} - -// -// Iterate through all default styles and colors -// - -var x = ['bold', 'underline', 'italic', 'inverse', 'grey', 'black', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta']; -x.forEach(function (style) { - - // __defineGetter__ at the least works in more browsers - // http://robertnyman.com/javascript/javascript-getters-setters.html - // Object.defineProperty only works in Chrome - addProperty(style, function () { - return stylize(this, style); - }); -}); - -function sequencer(map) { - return function () { - if (!isHeadless) { - return this.replace(/( )/, '$1'); - } - var exploded = this.split(""); - var i = 0; - exploded = exploded.map(map); - return exploded.join(""); - } -} - -var rainbowMap = (function () { - var rainbowColors = ['red','yellow','green','blue','magenta']; //RoY G BiV - return function (letter, i, exploded) { - if (letter == " ") { - return letter; - } else { - return stylize(letter, rainbowColors[i++ % rainbowColors.length]); - } - } -})(); - -exports.addSequencer = function (name, map) { - addProperty(name, sequencer(map)); -} - -exports.addSequencer('rainbow', rainbowMap); -exports.addSequencer('zebra', function (letter, i, exploded) { - return i % 2 === 0 ? letter : letter.inverse; -}); - -exports.setTheme = function (theme) { - Object.keys(theme).forEach(function(prop){ - addProperty(prop, function(){ - return exports[theme[prop]](this); - }); - }); -} - -function stylize(str, style) { - - if (exports.mode == 'console') { - var styles = { - //styles - 'bold' : ['\033[1m', '\033[22m'], - 'italic' : ['\033[3m', '\033[23m'], - 'underline' : ['\033[4m', '\033[24m'], - 'inverse' : ['\033[7m', '\033[27m'], - //grayscale - 'white' : ['\033[37m', '\033[39m'], - 'grey' : ['\033[90m', '\033[39m'], - 'black' : ['\033[30m', '\033[39m'], - //colors - 'blue' : ['\033[34m', '\033[39m'], - 'cyan' : ['\033[36m', '\033[39m'], - 'green' : ['\033[32m', '\033[39m'], - 'magenta' : ['\033[35m', '\033[39m'], - 'red' : ['\033[31m', '\033[39m'], - 'yellow' : ['\033[33m', '\033[39m'] - }; - } else if (exports.mode == 'browser') { - var styles = { - //styles - 'bold' : ['', ''], - 'italic' : ['', ''], - 'underline' : ['', ''], - 'inverse' : ['', ''], - //grayscale - 'white' : ['', ''], - 'grey' : ['', ''], - 'black' : ['', ''], - //colors - 'blue' : ['', ''], - 'cyan' : ['', ''], - 'green' : ['', ''], - 'magenta' : ['', ''], - 'red' : ['', ''], - 'yellow' : ['', ''] - }; - } else if (exports.mode == 'none') { - return str; - } else { - console.log('unsupported mode, try "browser", "console" or "none"'); - } - return styles[style][0] + str + styles[style][1]; -}; - -// don't summon zalgo -addProperty('zalgo', function () { - return zalgo(this); -}); - -// please no -function zalgo(text, options) { - var soul = { - "up" : [ - '̍','̎','̄','̅', - '̿','̑','̆','̐', - '͒','͗','͑','̇', - '̈','̊','͂','̓', - '̈','͊','͋','͌', - '̃','̂','̌','͐', - '̀','́','̋','̏', - '̒','̓','̔','̽', - '̉','ͣ','ͤ','ͥ', - 'ͦ','ͧ','ͨ','ͩ', - 'ͪ','ͫ','ͬ','ͭ', - 'ͮ','ͯ','̾','͛', - '͆','̚' - ], - "down" : [ - '̖','̗','̘','̙', - '̜','̝','̞','̟', - '̠','̤','̥','̦', - '̩','̪','̫','̬', - '̭','̮','̯','̰', - '̱','̲','̳','̹', - '̺','̻','̼','ͅ', - '͇','͈','͉','͍', - '͎','͓','͔','͕', - '͖','͙','͚','̣' - ], - "mid" : [ - '̕','̛','̀','́', - '͘','̡','̢','̧', - '̨','̴','̵','̶', - '͜','͝','͞', - '͟','͠','͢','̸', - '̷','͡',' ҉' - ] - }, - all = [].concat(soul.up, soul.down, soul.mid), - zalgo = {}; - - function randomNumber(range) { - r = Math.floor(Math.random()*range); - return r; - }; - - function is_char(character) { - var bool = false; - all.filter(function(i){ - bool = (i == character); - }); - return bool; - } - - function heComes(text, options){ - result = ''; - options = options || {}; - options["up"] = options["up"] || true; - options["mid"] = options["mid"] || true; - options["down"] = options["down"] || true; - options["size"] = options["size"] || "maxi"; - var counts; - text = text.split(''); - for(var l in text){ - if(is_char(l)) { continue; } - result = result + text[l]; - - counts = {"up" : 0, "down" : 0, "mid" : 0}; - - switch(options.size) { - case 'mini': - counts.up = randomNumber(8); - counts.min= randomNumber(2); - counts.down = randomNumber(8); - break; - case 'maxi': - counts.up = randomNumber(16) + 3; - counts.min = randomNumber(4) + 1; - counts.down = randomNumber(64) + 3; - break; - default: - counts.up = randomNumber(8) + 1; - counts.mid = randomNumber(6) / 2; - counts.down= randomNumber(8) + 1; - break; - } - - var arr = ["up", "mid", "down"]; - for(var d in arr){ - var index = arr[d]; - for (var i = 0 ; i <= counts[index]; i++) - { - if(options[index]) { - result = result + soul[index][randomNumber(soul[index].length)]; - } - } - } - } - return result; - }; - return heComes(text); -} - -addProperty('stripColors', function() { - return ("" + this).replace(/\u001b\[\d+m/g,''); -}); diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/colors/example.html b/node_modules/flatiron/node_modules/prompt/node_modules/colors/example.html deleted file mode 100644 index ab95649..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/colors/example.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - - Colors Example - - - - - - \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/colors/example.js b/node_modules/flatiron/node_modules/prompt/node_modules/colors/example.js deleted file mode 100644 index 3da2986..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/colors/example.js +++ /dev/null @@ -1,65 +0,0 @@ -var colors = require('./colors'); - -//colors.mode = "browser"; - -var test = colors.red("hopefully colorless output"); -console.log('Rainbows are fun!'.rainbow); -console.log('So '.italic + 'are'.underline + ' styles! '.bold + 'inverse'.inverse); // styles not widely supported -console.log('Chains are also cool.'.bold.italic.underline.red); // styles not widely supported -//console.log('zalgo time!'.zalgo); -console.log(test.stripColors); -console.log("a".grey + " b".black); - -console.log("Zebras are so fun!".zebra); - -console.log(colors.rainbow('Rainbows are fun!')); -console.log(colors.italic('So ') + colors.underline('are') + colors.bold(' styles! ') + colors.inverse('inverse')); // styles not widely supported -console.log(colors.bold(colors.italic(colors.underline(colors.red('Chains are also cool.'))))); // styles not widely supported -//console.log(colors.zalgo('zalgo time!')); -console.log(colors.stripColors(test)); -console.log(colors.grey("a") + colors.black(" b")); - -colors.addSequencer("america", function(letter, i, exploded) { - if(letter === " ") return letter; - switch(i%3) { - case 0: return letter.red; - case 1: return letter.white; - case 2: return letter.blue; - } -}); - -colors.addSequencer("random", (function() { - var available = ['bold', 'underline', 'italic', 'inverse', 'grey', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta']; - - return function(letter, i, exploded) { - return letter === " " ? letter : letter[available[Math.round(Math.random() * (available.length - 1))]]; - }; -})()); - -console.log("AMERICA! F--K YEAH!".america); -console.log("So apparently I've been to Mars, with all the little green men. But you know, I don't recall.".random); - -// -// Custom themes -// - -colors.setTheme({ - silly: 'rainbow', - input: 'grey', - verbose: 'cyan', - prompt: 'grey', - info: 'green', - data: 'grey', - help: 'cyan', - warn: 'yellow', - debug: 'blue', - error: 'red' -}); - -// outputs red text -console.log("this is an error".error); - -// outputs yellow text -console.log("this is a warning".warn); - - diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/colors/package.json b/node_modules/flatiron/node_modules/prompt/node_modules/colors/package.json deleted file mode 100644 index 413f51c..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/colors/package.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "colors", - "description": "get colors in your node.js console like what", - "version": "0.6.0-1", - "author": { - "name": "Marak Squires" - }, - "repository": { - "type": "git", - "url": "git://github.com/Marak/colors.js.git" - }, - "engines": { - "node": ">=0.1.90" - }, - "main": "colors", - "_id": "colors@0.6.0-1", - "dependencies": {}, - "devDependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "colors@0.x.x" -} diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/colors/test.js b/node_modules/flatiron/node_modules/prompt/node_modules/colors/test.js deleted file mode 100644 index 1c03d65..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/colors/test.js +++ /dev/null @@ -1,65 +0,0 @@ -var assert = require('assert'), - colors = require('./colors'); - -// -// This is a pretty nice example on how tests shouldn't be written. However, -// it's more about API stability than about really testing it (although it's -// a pretty complete test suite). -// - -var s = 'string'; - -function a(s, code) { - return '\033[' + code.toString() + 'm' + s + '\033[39m'; -} - -function aE(s, color, code) { - assert.equal(s[color], a(s, code)); - assert.equal(colors[color](s), a(s, code)); - assert.equal(s[color], colors[color](s)); - assert.equal(s[color].stripColors, s); - assert.equal(s[color].stripColors, colors.stripColors(s)); -} - -function h(s, color) { - return '' + s + ''; - // that's pretty dumb approach to testing it -} - -var stylesColors = ['white', 'grey', 'black', 'blue', 'cyan', 'green', 'magenta', 'red', 'yellow']; -var stylesAll = stylesColors.concat(['bold', 'italic', 'underline', 'inverse', 'rainbow']); - -colors.mode = 'console'; -assert.equal(s.bold, '\033[1m' + s + '\033[22m'); -assert.equal(s.italic, '\033[3m' + s + '\033[23m'); -assert.equal(s.underline, '\033[4m' + s + '\033[24m'); -assert.equal(s.inverse, '\033[7m' + s + '\033[27m'); -assert.ok(s.rainbow); -aE(s, 'white', 37); -aE(s, 'grey', 90); -aE(s, 'black', 30); -aE(s, 'blue', 34); -aE(s, 'cyan', 36); -aE(s, 'green', 32); -aE(s, 'magenta', 35); -aE(s, 'red', 31); -aE(s, 'yellow', 33); -assert.equal(s, 'string'); - -colors.mode = 'browser'; -assert.equal(s.bold, '' + s + ''); -assert.equal(s.italic, '' + s + ''); -assert.equal(s.underline, '' + s + ''); -assert.equal(s.inverse, '' + s + ''); -assert.ok(s.rainbow); -stylesColors.forEach(function (color) { - assert.equal(s[color], h(s, color)); - assert.equal(colors[color](s), h(s, color)); -}); - -colors.mode = 'none'; -stylesAll.forEach(function (style) { - assert.equal(s[style], s); - assert.equal(colors[style](s), s); -}); - diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/.npmignore b/node_modules/flatiron/node_modules/prompt/node_modules/winston/.npmignore deleted file mode 100644 index 2c5c40a..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -test/*.log -test/fixtures/*.json -test/fixtures/logs/*.log -node_modules/ -node_modules/* -npm-debug.log \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/.travis.yml b/node_modules/flatiron/node_modules/prompt/node_modules/winston/.travis.yml deleted file mode 100644 index c958222..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 - - 0.7 - -notifications: - email: - - travis@nodejitsu.com - irc: "irc.freenode.org#nodejitsu" - diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/LICENSE b/node_modules/flatiron/node_modules/prompt/node_modules/winston/LICENSE deleted file mode 100644 index 948d80d..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010 Charlie Robbins - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/README.md b/node_modules/flatiron/node_modules/prompt/node_modules/winston/README.md deleted file mode 100644 index ecf79f3..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/README.md +++ /dev/null @@ -1,732 +0,0 @@ -# winston [![Build Status](https://secure.travis-ci.org/flatiron/winston.png)](http://travis-ci.org/flatiron/winston) - -A multi-transport async logging library for node.js. "CHILL WINSTON! ... I put it in the logs." - -## Installation - -### Installing npm (node package manager) -``` - curl http://npmjs.org/install.sh | sh -``` - -### Installing winston -``` - [sudo] npm install winston -``` - -## Motivation -Winston is designed to be a simple and universal logging library with support for multiple transports. A transport is essentially a storage device for your logs. Each instance of a winston logger can have multiple transports configured at different levels. For example, one may want error logs to be stored in a persistent remote location (like a database), but all logs output to the console or a local file. - -There also seemed to be a lot of logging libraries out there that coupled their implementation of logging (i.e. how the logs are stored / indexed) to the API that they exposed to the programmer. This library aims to decouple those parts of the process to make it more flexible and extensible. - -## Usage -There are two different ways to use winston: directly via the default logger, or by instantiating your own Logger. The former is merely intended to be a convenient shared logger to use throughout your application if you so choose. - -### Using the Default Logger -The default logger is accessible through the winston module directly. Any method that you could call on an instance of a logger is available on the default logger: - -``` js - var winston = require('winston'); - - winston.log('info', 'Hello distributed log files!'); - winston.info('Hello again distributed logs'); -``` - -By default, only the Console transport is set on the default logger. You can add or remove transports via the add() and remove() methods: - -``` js - winston.add(winston.transports.File, { filename: 'somefile.log' }); - winston.remove(winston.transports.Console); -``` - -For more documenation about working with each individual transport supported by Winston see the "Working with Transports" section below. - -### Instantiating your own Logger -If you would prefer to manage the object lifetime of loggers you are free to instantiate them yourself: - -``` js - var logger = new (winston.Logger)({ - transports: [ - new (winston.transports.Console)(), - new (winston.transports.File)({ filename: 'somefile.log' }) - ] - }); -``` - -You can work with this logger in the same way that you work with the default logger: - -``` js - // - // Logging - // - logger.log('info', 'Hello distributed log files!'); - logger.info('Hello again distributed logs'); - - // - // Adding / Removing Transports - // (Yes It's chainable) - // - logger.add(winston.transports.File) - .remove(winston.transports.Console); -``` - -### Handling Uncaught Exceptions with winston - -With `winston`, it is possible to catch and log `uncaughtException` events from your process. There are two distinct ways of enabling this functionality either through the default winston logger or your own logger instance. - -If you want to use this feature with the default logger simply call `.handleExceptions()` with a transport instance. - -``` js - // - // You can add a separate exception logger by passing it to `.handleExceptions` - // - winston.handleExceptions(new winston.transports.File({ filename: 'path/to/exceptions.log' })) - - // - // Alternatively you can set `.handleExceptions` to true when adding transports to winston - // - winston.add(winston.transports.File, { - filename: 'path/to/all-logs.log', - handleExceptions: true - }); -``` - -## to exit or not to exit - -by default, winston will exit after logging an uncaughtException. if this is not the behavior you want, -set `exitOnError = false` - -``` js - var logger = new (winston.Logger)({ exitOnError: false }); - - // - // or, like this: - // - logger.exitOnError = false; -``` - -When working with custom logger instances, you can pass in separate transports to the `exceptionHandlers` property or set `.handleExceptions` on any transport. - -``` js - var logger = new (winston.Logger)({ - transports: [ - new winston.transports.File({ filename: 'path/to/all-logs.log' }) - ] - exceptionHandlers: [ - new winston.transports.File({ filename: 'path/to/exceptions.log' }) - ] - }); -``` - -The `exitOnError` option can also be a function to prevent exit on only certain types of errors: - -``` js - function ignoreEpipe(err) { - return err.code !== 'EPIPE'; - } - - var logger = new (winston.Logger)({ exitOnError: ignoreEpipe }); - - // - // or, like this: - // - logger.exitOnError = ignoreEpipe; -``` - -### Using Logging Levels -Setting the level for your logging message can be accomplished in one of two ways. You can pass a string representing the logging level to the log() method or use the level specified methods defined on every winston Logger. - -``` js - // - // Any logger instance - // - logger.log('info', "127.0.0.1 - there's no place like home"); - logger.info("127.0.0.1 - there's no place like home"); - - // - // Default logger - // - winston.log('info', "127.0.0.1 - there's no place like home"); - winston.info("127.0.0.1 - there's no place like home"); -``` - -As of 0.2.0, winston supports customizable logging levels, defaulting to [npm][0] style logging levels. Changing logging levels is easy: - -``` js - // - // Change levels on the default winston logger - // - winston.setLevels(winston.config.syslog.levels); - - // - // Change levels on an instance of a logger - // - logger.setLevels(winston.config.syslog.levels); -``` - -Calling `.setLevels` on a logger will remove all of the previous helper methods for the old levels and define helper methods for the new levels. Thus, you should be careful about the logging statements you use when changing levels. For example, if you ran this code after changing to the syslog levels: - -``` js - // - // Logger does not have 'silly' defined since that level is not in the syslog levels - // - logger.silly('some silly message'); -``` - -### Using Custom Logging Levels -In addition to the predefined `npm` and `syslog` levels available in Winston, you can also choose to define your own: - -``` js - var myCustomLevels = { - levels: { - foo: 0, - bar: 1, - baz: 2, - foobar: 3 - }, - colors: { - foo: 'blue', - bar: 'green', - baz: 'yellow', - foobar: 'red' - } - }; - - var customLevelLogger = new (winston.Logger)({ levels: myCustomLevels.levels }); - customLevelLogger.foobar('some foobar level-ed message'); -``` - -Although there is slight repetition in this data structure, it enables simple encapsulation if you not to have colors. If you do wish to have colors, in addition to passing the levels to the Logger itself, you must make winston aware of them: - -``` js - // - // Make winston aware of these colors - // - winston.addColors(myCustomLevels.colors); -``` - -This enables transports with the 'colorize' option set to appropriately color the output of custom levels. - -### Events and Callbacks in Winston -Each instance of winston.Logger is also an instance of an [EventEmitter][1]. A log event will be raised each time a transport successfully logs a message: - -``` js - logger.on('logging', function (transport, level, msg, meta) { - // [msg] and [meta] have now been logged at [level] to [transport] - }); - - logger.info('CHILL WINSTON!', { seriously: true }); -``` - -It is also worth mentioning that the logger also emits an 'error' event which you should handle or suppress if you don't want unhandled exceptions: - -``` js - // - // Handle errors - // - logger.on('error', function (err) { /* Do Something */ }); - - // - // Or just suppress them. - // - logger.emitErrs = false; -``` - -Every logging method described in the previous section also takes an optional callback which will be called only when all of the transports have logged the specified message. - -``` js - logger.info('CHILL WINSTON!', { seriously: true }, function (err, level, msg, meta) { - // [msg] and [meta] have now been logged at [level] to **every** transport. - }); -``` - -### Working with multiple Loggers in winston - -Often in larger, more complex applications it is necessary to have multiple logger instances with different settings. Each logger is responsible for a different feature area (or category). This is exposed in `winston` in two ways: through `winston.loggers` and instances of `winston.Container`. In fact, `winston.loggers` is just a predefined instance of `winston.Container`: - -``` js - var winston = require('winston'); - - // - // Configure the logger for `category1` - // - winston.loggers.add('category1', { - console: { - level: 'silly', - colorize: 'true' - }, - file: { - filename: '/path/to/some/file' - } - }); - - // - // Configure the logger for `category2` - // - winston.loggers.add('category2', { - couchdb: { - host: '127.0.0.1', - port: 5984 - } - }); -``` - -Now that your loggers are setup you can require winston _in any file in your application_ and access these pre-configured loggers: - -``` js - var winston = require('winston'); - - // - // Grab your preconfigured logger - // - var category1 = winston.loggers.get('category1'); - - category1.info('logging from your IoC container-based logger'); -``` - -If you prefer to manage the `Container` yourself you can simply instantiate one: - -``` js - var winston = require('winston'), - container = new winston.Container(); - - container.add('category1', { - console: { - level: 'silly', - colorize: 'true' - }, - file: { - filename: '/path/to/some/file' - } - }); -``` - -### Sharing transports between Loggers in winston - -``` js - var winston = require('winston'); - - // - // Setup transports to be shared across all loggers - // in three ways: - // - // 1. By setting it on the default Container - // 2. By passing `transports` into the constructor function of winston.Container - // 3. By passing `transports` into the `.get()` or `.add()` methods - // - - // - // 1. By setting it on the default Container - // - winston.loggers.options.transports = [ - // Setup your shared transports here - ]; - - // - // 2. By passing `transports` into the constructor function of winston.Container - // - var container = new winston.Container({ - transports: [ - // Setup your shared transports here - ] - }); - - // - // 3. By passing `transports` into the `.get()` or `.add()` methods - // - winston.loggers.add('some-category', { - transports: [ - // Setup your shared transports here - ] - }); - - container.add('some-category', { - transports: [ - // Setup your shared transports here - ] - }); -``` - -### Logging with Metadata -In addition to logging string messages, winston will also optionally log additional JSON metadata objects. Adding metadata is simple: - -``` js - winston.log('info', 'Test Log Message', { anything: 'This is metadata' }); -``` - -The way these objects is stored varies from transport to transport (to best support the storage mechanisms offered). Here's a quick summary of how each transports handles metadata: - -1. __Console:__ Logged via util.inspect(meta) -2. __File:__ Logged via util.inspect(meta) -3. __Loggly:__ Logged in suggested [Loggly format][2] - -### Profiling with Winston -In addition to logging messages and metadata, winston also has a simple profiling mechanism implemented for any logger: - -``` js - // - // Start profile of 'test' - // Remark: Consider using Date.now() with async operations - // - winston.profile('test'); - - setTimeout(function () { - // - // Stop profile of 'test'. Logging will now take place: - // "17 Jan 21:00:00 - info: test duration=1000ms" - // - winston.profile('test'); - }, 1000); -``` - -All profile messages are set to the 'info' by default and both message and metadata are optional There are no plans in the Roadmap to make this configurable, but I'm open to suggestions / issues. - -### Using winston in a CLI tool -A common use-case for logging is output to a CLI tool. Winston has a special helper method which will pretty print output from your CLI tool. Here's an example from the [require-analyzer][15] written by [Nodejitsu][5]: - -``` - info: require-analyzer starting in /Users/Charlie/Nodejitsu/require-analyzer - info: Found existing dependencies - data: { - data: colors: '0.x.x', - data: eyes: '0.1.x', - data: findit: '0.0.x', - data: npm: '1.0.x', - data: optimist: '0.2.x', - data: semver: '1.0.x', - data: winston: '0.2.x' - data: } - info: Analyzing dependencies... - info: Done analyzing raw dependencies - info: Retrieved packages from npm - warn: No additional dependencies found -``` - -Configuring output for this style is easy, just use the `.cli()` method on `winston` or an instance of `winston.Logger`: - -``` js - var winston = require('winston'); - - // - // Configure CLI output on the default logger - // - winston.cli(); - - // - // Configure CLI on an instance of winston.Logger - // - var logger = new winston.Logger({ - transports: [ - new (winston.transports.Console)() - ] - }); - - logger.cli(); -``` - -### Extending another object with Logging functionality -Often in a given code base with lots of Loggers it is useful to add logging methods a different object so that these methods can be called with less syntax. Winston exposes this functionality via the 'extend' method: - -``` js - var myObject = {}; - - logger.extend(myObject); - - // - // You can now call logger methods on 'myObject' - // - myObject.info('127.0.0.1 - there's no place like home'); -``` - -## Working with Transports -Right now there are four transports supported by winston core. If you have a transport you would like to add either open an issue or fork and submit a pull request. Commits are welcome, but I'll give you extra street cred if you __add tests too :D__ - -1. __Console:__ Output to the terminal -2. __Files:__ Append to a file -3. __Loggly:__ Log to Logging-as-a-Service platform Loggly - -### Console Transport -``` js - winston.add(winston.transports.Console, options) -``` - -The Console transport takes two simple options: - -* __level:__ Level of messages that this transport should log (default 'debug'). -* __silent:__ Boolean flag indicating whether to suppress output (default false). -* __colorize:__ Boolean flag indicating if we should colorize output (default false). -* __timestamp:__ Boolean flag indicating if we should prepend output with timestamps (default false). If function is specified, its return value will be used instead of timestamps. - -*Metadata:* Logged via util.inspect(meta); - -### File Transport -``` js - winston.add(winston.transports.File, options) -``` - -The File transport should really be the 'Stream' transport since it will accept any [WritableStream][14]. It is named such because it will also accept filenames via the 'filename' option: - -* __level:__ Level of messages that this transport should log. -* __silent:__ Boolean flag indicating whether to suppress output. -* __colorize:__ Boolean flag indicating if we should colorize output. -* __timestamp:__ Boolean flag indicating if we should prepend output with timestamps (default false). If function is specified, its return value will be used instead of timestamps. -* __filename:__ The filename of the logfile to write output to. -* __maxsize:__ Max size in bytes of the logfile, if the size is exceeded then a new file is created. -* __maxFiles:__ Limit the number of files created when the size of the logfile is exceeded. -* __stream:__ The WriteableStream to write output to. -* __json:__ If true, messages will be logged as JSON (default true). - -*Metadata:* Logged via util.inspect(meta); - -### Loggly Transport -``` js - winston.add(winston.transports.Loggly, options); -``` - -The Loggly transport is based on [Nodejitsu's][5] [node-loggly][6] implementation of the [Loggly][7] API. If you haven't heard of Loggly before, you should probably read their [value proposition][8]. The Loggly transport takes the following options. Either 'inputToken' or 'inputName' is required: - -* __level:__ Level of messages that this transport should log. -* __subdomain:__ The subdomain of your Loggly account. *[required]* -* __auth__: The authentication information for your Loggly account. *[required with inputName]* -* __inputName:__ The name of the input this instance should log to. -* __inputToken:__ The input token of the input this instance should log to. -* __json:__ If true, messages will be sent to Loggly as JSON. - -*Metadata:* Logged in suggested [Loggly format][2] - -### Riak Transport -As of `0.3.0` the Riak transport has been broken out into a new module: [winston-riak][17]. Using it is just as easy: - -``` js - var Riak = require('winston-riak').Riak; - winston.add(Riak, options); -``` - -In addition to the options accepted by the [riak-js][3] [client][4], the Riak transport also accepts the following options. It is worth noting that the riak-js debug option is set to *false* by default: - -* __level:__ Level of messages that this transport should log. -* __bucket:__ The name of the Riak bucket you wish your logs to be in or a function to generate bucket names dynamically. - -``` js - // Use a single bucket for all your logs - var singleBucketTransport = new (Riak)({ bucket: 'some-logs-go-here' }); - - // Generate a dynamic bucket based on the date and level - var dynamicBucketTransport = new (Riak)({ - bucket: function (level, msg, meta, now) { - var d = new Date(now); - return level + [d.getDate(), d.getMonth(), d.getFullYear()].join('-'); - } - }); -``` - -*Metadata:* Logged as JSON literal in Riak - -### MongoDB Transport -As of `0.3.0` the MongoDB transport has been broken out into a new module: [winston-mongodb][16]. Using it is just as easy: - -``` js - var MongoDB = require('winston-mongodb').MongoDB; - winston.add(MongoDB, options); -``` - -The MongoDB transport takes the following options. 'db' is required: - -* __level:__ Level of messages that this transport should log. -* __silent:__ Boolean flag indicating whether to suppress output. -* __db:__ The name of the database you want to log to. *[required]* -* __collection__: The name of the collection you want to store log messages in, defaults to 'log'. -* __safe:__ Boolean indicating if you want eventual consistency on your log messages, if set to true it requires an extra round trip to the server to ensure the write was committed, defaults to true. -* __host:__ The host running MongoDB, defaults to localhost. -* __port:__ The port on the host that MongoDB is running on, defaults to MongoDB's default port. - -*Metadata:* Logged as a native JSON object. - -### SimpleDB Transport - -The [winston-simpledb][18] transport is just as easy: - -``` js - var SimpleDB = require('winston-simpledb').SimpleDB; - winston.add(SimpleDB, options); -``` - -The SimpleDB transport takes the following options. All items marked with an asterisk are required: - -* __awsAccessKey__:* your AWS Access Key -* __secretAccessKey__:* your AWS Secret Access Key -* __awsAccountId__:* your AWS Account Id -* __domainName__:* a string or function that returns the domain name to log to -* __region__:* the region your domain resides in -* __itemName__: a string ('uuid', 'epoch', 'timestamp') or function that returns the item name to log - -*Metadata:* Logged as a native JSON object to the 'meta' attribute of the item. - -### Mail Transport - -The [winston-mail][19] is an email transport: - -``` js - var Mail = require('winston-mail').Mail; - winston.add(Mail, options); -``` - -The Mail transport uses [node-mail][20] behind the scenes. Options are the following, `to` and `host` are required: - -* __to:__ The address(es) you want to send to. *[required]* -* __from:__ The address you want to send from. (default: `winston@[server-host-name]`) -* __host:__ SMTP server hostname -* __port:__ SMTP port (default: 587 or 25) -* __secure:__ Use secure -* __username__ User for server auth -* __password__ Password for server auth -* __level:__ Level of messages that this transport should log. -* __silent:__ Boolean flag indicating whether to suppress output. - -*Metadata:* Stringified as JSON in email. - -### Amazon SNS (Simple Notification System) Transport - -The [winston-sns][21] transport uses amazon SNS to send emails, texts, or a bunch of other notifications. - -``` js - require('winston-sns').SNS; - winston.add(winston.transports.SNS, options); -``` - -Options: - -* __aws_key:__ Your Amazon Web Services Key. *[required]* -* __aws_secret:__ Your Amazon Web Services Secret. *[required]* -* __subscriber:__ Subscriber number - found in your SNS AWS Console, after clicking on a topic. Same as AWS Account ID. *[required]* -* __topic_arn:__ Also found in SNS AWS Console - listed under a topic as Topic ARN. *[required]* -* __region:__ AWS Region to use. Can be one of: `us-east-1`,`us-west-1`,`eu-west-1`,`ap-southeast-1`,`ap-northeast-1`,`us-gov-west-1`,`sa-east-1`. (default: `us-east-1`) -* __subject:__ Subject for notifications. (default: "Winston Error Report") -* __message:__ Message of notifications. Uses placeholders for level (%l), error message (%e), and metadata (%m). (default: "Level '%l' Error:\n%e\n\nMetadata:\n%m") -* __level:__ lowest level this transport will log. (default: `info`) - -### Graylog2 Transport - -[winston-graylog2][22] is a Graylog2 transport: - -``` js - var Graylog2 = require('winston-graylog2').Graylog2; - winston.add(Graylog2, options); -``` - -The Graylog2 transport connects to a Graylog2 server over UDP using the following options: - -* __level:__ Level of messages this transport should log. (default: info) -* __silent:__ Boolean flag indicating whether to suppress output. (default: false) - -* __graylogHost:__ IP address or hostname of the graylog2 server. (default: localhost) -* __graylogPort:__ Port to send messages to on the graylog2 server. (default: 12201) -* __graylogHostname:__ The hostname associated with graylog2 messages. (default: require('os').hostname()) -* __graylogFacility:__ The graylog2 facility to send log messages.. (default: nodejs) - -*Metadata:* Stringified as JSON in the full message GELF field. - -### Adding Custom Transports -Adding a custom transport (say for one of the datastore on the Roadmap) is actually pretty easy. All you need to do is accept a couple of options, set a name, implement a log() method, and add it to the set of transports exposed by winston. - -``` js - var util = require('util'), - winston = require('winston'); - - var CustomLogger = winston.transports.CustomerLogger = function (options) { - // - // Name this logger - // - this.name = 'customLogger'; - - // - // Set the level from your options - // - this.level = options.level || 'info'; - - // - // Configure your storage backing as you see fit - // - }; - - // - // Inherit from `winston.Transport` so you can take advantage - // of the base functionality and `.handleExceptions()`. - // - util.inherits(CustomLogger, winston.Transport); - - CustomLogger.prototype.log = function (level, msg, meta, callback) { - // - // Store this message and metadata, maybe use some custom logic - // then callback indicating success. - // - callback(null, true); - }; -``` - -## What's Next? -Winston is stable and under active development. It is supported by and used at [Nodejitsu][5]. - -### Inspirations -1. [npm][0] -2. [log.js][9] -3. [socket.io][10] -4. [node-rlog][11] -5. [BigBrother][12] -6. [Loggly][7] - -### Road Map -1. Improve support for adding custom Transports not defined in Winston core. -2. Create API for reading from logs across all transports. -3. Add more transports: Redis - -## Run Tests -All of the winston tests are written in [vows][13], and cover all of the use cases described above. You will need to add valid credentials for the various transports included to test/fixtures/test-config.json before running tests: - -``` js - { - "transports": { - "loggly": { - "subdomain": "your-subdomain", - "inputToken": "really-long-token-you-got-from-loggly", - "auth": { - "username": "your-username", - "password": "your-password" - } - } - } - } -``` - -Once you have valid configuration and credentials you can run tests with [vows][13]: - -``` - vows --spec --isolate -``` - -#### Author: [Charlie Robbins](http://twitter.com/indexzero) -#### Contributors: [Matthew Bergman](http://github.com/fotoverite), [Marak Squires](http://github.com/marak) - -[0]: https://github.com/isaacs/npm/blob/master/lib/utils/log.js -[1]: http://nodejs.org/docs/v0.3.5/api/events.html#events.EventEmitter -[2]: http://wiki.loggly.com/loggingfromcode -[3]: http://riakjs.org -[4]: https://github.com/frank06/riak-js/blob/master/src/http_client.coffee#L10 -[5]: http://nodejitsu.com -[6]: http://github.com/nodejitsu/node-loggly -[7]: http://loggly.com -[8]: http://www.loggly.com/product/ -[9]: https://github.com/visionmedia/log.js -[10]: http://socket.io -[11]: https://github.com/jbrisbin/node-rlog -[12]: https://github.com/feisty/BigBrother -[13]: http://vowsjs.org -[14]: http://nodejs.org/docs/v0.3.5/api/streams.html#writable_Stream -[15]: http://github.com/nodejitsu/require-analyzer -[16]: http://github.com/indexzero/winston-mongodb -[17]: http://github.com/indexzero/winston-riak -[18]: http://github.com/appsattic/winston-simpledb -[19]: http://github.com/wavded/winston-mail -[20]: https://github.com/weaver/node-mail -[21]: https://github.com/jesseditson/winston-sns -[22]: https://github.com/flite/winston-graylog2 diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/docco.css b/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/docco.css deleted file mode 100644 index bd54134..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/docco.css +++ /dev/null @@ -1,194 +0,0 @@ -/*--------------------- Layout and Typography ----------------------------*/ -body { - font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; - font-size: 15px; - line-height: 22px; - color: #252519; - margin: 0; padding: 0; -} -a { - color: #261a3b; -} - a:visited { - color: #261a3b; - } -p { - margin: 0 0 15px 0; -} -h4, h5, h6 { - color: #333; - margin: 6px 0 6px 0; - font-size: 13px; -} - h2, h3 { - margin-bottom: 0; - color: #000; - } - h1 { - margin-top: 40px; - margin-bottom: 15px; - color: #000; - } -#container { - position: relative; -} -#background { - position: fixed; - top: 0; left: 525px; right: 0; bottom: 0; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - z-index: -1; -} -#jump_to, #jump_page { - background: white; - -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; - -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; - font: 10px Arial; - text-transform: uppercase; - cursor: pointer; - text-align: right; -} -#jump_to, #jump_wrapper { - position: fixed; - right: 0; top: 0; - padding: 5px 10px; -} - #jump_wrapper { - padding: 0; - display: none; - } - #jump_to:hover #jump_wrapper { - display: block; - } - #jump_page { - padding: 5px 0 3px; - margin: 0 0 25px 25px; - } - #jump_page .source { - display: block; - padding: 5px 10px; - text-decoration: none; - border-top: 1px solid #eee; - } - #jump_page .source:hover { - background: #f5f5ff; - } - #jump_page .source:first-child { - } -table td { - border: 0; - outline: 0; -} - td.docs, th.docs { - max-width: 450px; - min-width: 450px; - min-height: 5px; - padding: 10px 25px 1px 50px; - overflow-x: hidden; - vertical-align: top; - text-align: left; - } - .docs pre { - margin: 15px 0 15px; - padding-left: 15px; - } - .docs p tt, .docs p code { - background: #f8f8ff; - border: 1px solid #dedede; - font-size: 12px; - padding: 0 0.2em; - } - .pilwrap { - position: relative; - } - .pilcrow { - font: 12px Arial; - text-decoration: none; - color: #454545; - position: absolute; - top: 3px; left: -20px; - padding: 1px 2px; - opacity: 0; - -webkit-transition: opacity 0.2s linear; - } - td.docs:hover .pilcrow { - opacity: 1; - } - td.code, th.code { - padding: 14px 15px 16px 25px; - width: 100%; - vertical-align: top; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - } - pre, tt, code { - font-size: 12px; line-height: 18px; - font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; - margin: 0; padding: 0; - } - - -/*---------------------- Syntax Highlighting -----------------------------*/ -td.linenos { background-color: #f0f0f0; padding-right: 10px; } -span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } -body .hll { background-color: #ffffcc } -body .c { color: #408080; font-style: italic } /* Comment */ -body .err { border: 1px solid #FF0000 } /* Error */ -body .k { color: #954121 } /* Keyword */ -body .o { color: #666666 } /* Operator */ -body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ -body .cp { color: #BC7A00 } /* Comment.Preproc */ -body .c1 { color: #408080; font-style: italic } /* Comment.Single */ -body .cs { color: #408080; font-style: italic } /* Comment.Special */ -body .gd { color: #A00000 } /* Generic.Deleted */ -body .ge { font-style: italic } /* Generic.Emph */ -body .gr { color: #FF0000 } /* Generic.Error */ -body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -body .gi { color: #00A000 } /* Generic.Inserted */ -body .go { color: #808080 } /* Generic.Output */ -body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -body .gs { font-weight: bold } /* Generic.Strong */ -body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -body .gt { color: #0040D0 } /* Generic.Traceback */ -body .kc { color: #954121 } /* Keyword.Constant */ -body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ -body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ -body .kp { color: #954121 } /* Keyword.Pseudo */ -body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ -body .kt { color: #B00040 } /* Keyword.Type */ -body .m { color: #666666 } /* Literal.Number */ -body .s { color: #219161 } /* Literal.String */ -body .na { color: #7D9029 } /* Name.Attribute */ -body .nb { color: #954121 } /* Name.Builtin */ -body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ -body .no { color: #880000 } /* Name.Constant */ -body .nd { color: #AA22FF } /* Name.Decorator */ -body .ni { color: #999999; font-weight: bold } /* Name.Entity */ -body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -body .nf { color: #0000FF } /* Name.Function */ -body .nl { color: #A0A000 } /* Name.Label */ -body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -body .nt { color: #954121; font-weight: bold } /* Name.Tag */ -body .nv { color: #19469D } /* Name.Variable */ -body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -body .w { color: #bbbbbb } /* Text.Whitespace */ -body .mf { color: #666666 } /* Literal.Number.Float */ -body .mh { color: #666666 } /* Literal.Number.Hex */ -body .mi { color: #666666 } /* Literal.Number.Integer */ -body .mo { color: #666666 } /* Literal.Number.Oct */ -body .sb { color: #219161 } /* Literal.String.Backtick */ -body .sc { color: #219161 } /* Literal.String.Char */ -body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ -body .s2 { color: #219161 } /* Literal.String.Double */ -body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -body .sh { color: #219161 } /* Literal.String.Heredoc */ -body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -body .sx { color: #954121 } /* Literal.String.Other */ -body .sr { color: #BB6688 } /* Literal.String.Regex */ -body .s1 { color: #219161 } /* Literal.String.Single */ -body .ss { color: #19469D } /* Literal.String.Symbol */ -body .bp { color: #954121 } /* Name.Builtin.Pseudo */ -body .vc { color: #19469D } /* Name.Variable.Class */ -body .vg { color: #19469D } /* Name.Variable.Global */ -body .vi { color: #19469D } /* Name.Variable.Instance */ -body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston.html deleted file mode 100644 index 0c7f087..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston.html +++ /dev/null @@ -1,86 +0,0 @@ - winston.js

        winston.js

        /*
        - * winston.js: Top-level include defining Winston.
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        -
        -var winston = exports;

        Expose version using pkginfo

        require('pkginfo')(module, 'version');

        Include transports defined by default by winston

        winston.transports = require('./winston/transports');
        -
        -var common           = require('./winston/common');
        -winston.hash           = common.hash;
        -winston.clone          = common.clone;
        -winston.longestElement = common.longestElement;
        -winston.exception      = require('./winston/exception');
        -winston.config         = require('./winston/config');
        -winston.addColors      = winston.config.addColors; 
        -winston.Logger         = require('./winston/logger').Logger;
        -winston.Transport      = require('./winston/transports/transport').Transport;

        We create and expose a 'defaultLogger' so that the programmer may do the -following without the need to create an instance of winston.Logger directly:

        - -
        var winston = require('winston');
        -winston.log('info', 'some message');
        -winston.error('some error'); 
        -
        var defaultLogger = new winston.Logger({ 
        -  transports: [new winston.transports.Console()] 
        -});

        Pass through the target methods onto `winston.

        var methods = [
        -  'log', 
        -  'add', 
        -  'remove', 
        -  'profile', 
        -  'extend', 
        -  'cli', 
        -  'handleExceptions', 
        -  'unhandleExceptions'
        -];
        -common.setLevels(winston, null, defaultLogger.levels);
        -methods.forEach(function (method) {
        -  winston[method] = function () {
        -    return defaultLogger[method].apply(defaultLogger, arguments);
        -  };
        -});

        function cli ()

        - -

        Configures the default winston logger to have the -settings for command-line interfaces: no timestamp, -colors enabled, padded output, and additional levels.

        winston.cli = function () {
        -  winston.padLevels = true;
        -  common.setLevels(winston, defaultLogger.levels, winston.config.cli.levels);
        -  defaultLogger.setLevels(winston.config.cli.levels);
        -  winston.config.addColors(winston.config.cli.colors);
        -  
        -  if (defaultLogger.transports.console) {
        -    defaultLogger.transports.console.colorize = true;
        -    defaultLogger.transports.console.timestamp = false;
        -  }
        -  
        -  return winston;
        -};

        function setLevels (target)

        - -

        @target {Object} Target levels to use

        - -

        Sets the target levels specified on the default winston logger.

        winston.setLevels = function (target) {
        -  common.setLevels(winston, defaultLogger.levels, target);
        -  defaultLogger.setLevels(target);
        -};

        Define getters / setters for appropriate properties of the -default logger which need to be exposed by winston.

        ['emitErrs', 'padLevels', 'levelLength'].forEach(function (prop) {
        -  Object.defineProperty(winston, prop, {
        -    get: function () {
        -      return defaultLogger[prop];
        -    },
        -    set: function (val) {
        -      defaultLogger[prop] = val;
        -    }
        -  });
        -});

        @default {Object} -The default transports and exceptionHandlers for -the default winston logger.

        Object.defineProperty(winston, 'default', {
        -  get: function () {
        -    return {
        -      transports: defaultLogger.transports,
        -      exceptionHandlers: defaultLogger.exceptionHandlers
        -    };
        -  }
        -});
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/common.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/common.html deleted file mode 100644 index 1ab139c..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/common.html +++ /dev/null @@ -1,140 +0,0 @@ - common.js

        common.js

        /*
        - * common.js: Internal helper and utility functions for winston
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        -
        -var util = require('util'),
        -    crypto = require('crypto'),
        -    loggly = require('loggly'),
        -    config = require('./config');

        function setLevels (target, past, current)

        - -

        @target {Object} Object on which to set levels.

        - -

        @past {Object} Previous levels set on target.

        - -

        @current {Object} Current levels to set on target.

        - -

        Create functions on the target objects for each level -in current.levels. If past is defined, remove functions -for each of those levels.

        exports.setLevels = function (target, past, current, isDefault) {
        -  if (past) {
        -    Object.keys(past).forEach(function (level) {
        -      delete target[level];
        -    });
        -  }
        -
        -  target.levels = current || config.npm.levels;
        -  if (target.padLevels) {
        -    target.levelLength = exports.longestElement(Object.keys(target.levels));
        -  }
        -  

        Define prototype methods for each log level - e.g. target.log('info', msg) <=> target.info(msg)

          Object.keys(target.levels).forEach(function (level) {
        -    target[level] = function (msg) {
        -      var args     = Array.prototype.slice.call(arguments),
        -          callback = typeof args[args.length - 1] === 'function' ? args.pop() : null,
        -          meta     = args.length === 2 ? args.pop() : null;
        -
        -      return target.log(level, msg, meta, callback);
        -    };
        -  });
        -  
        -  return target;
        -};

        function longestElement

        - -

        @xs {Array} Array to calculate against

        - -

        Returns the longest element in the xs array.

        exports.longestElement = function (xs) {
        -  return Math.max.apply(
        -    null,
        -    xs.map(function (x) { return x.length })
        -  );
        -};

        function clone (obj)

        - -

        @obj {Object} Object to clone.

        - -

        Helper method for deep cloning pure JSON objects -i.e. JSON objects that are either literals or objects (no Arrays, etc)

        exports.clone = function (obj) {
        -  var copy = {};
        -  for (var i in obj) {
        -    if (Array.isArray(obj[i])) {
        -      copy[i] = obj[i].slice(0);
        -    }
        -    else {
        -      copy[i] = obj[i] instanceof Object ? exports.clone(obj[i]) : obj[i];
        -    }
        -  }
        -
        -  return copy;
        -};

        function log (options)

        - -

        @options {Object} All information about the log serialization.

        - -

        Generic logging function for returning timestamped strings -with the following options:

        - -

        { - level: 'level to add to serialized message', - message: 'message to serialize', - meta: 'additional logging metadata to serialize', - colorize: false, // Colorizes output (only if .json is false) - timestamp: true // Adds a timestamp to the serialized message - }

        exports.log = function (options) {
        -  var timestampFn = typeof options.timestamp === 'function' ? options.timestamp : exports.timestamp,
        -      timestamp   = options.timestamp ? timestampFn() : null,
        -      meta        = options.meta ? exports.clone(options.meta) : null,
        -      output;
        -
        -  if (options.json) {
        -    output         = meta || {};
        -    output.level   = options.level;
        -    output.message = options.message;
        -    
        -    if (timestamp) {
        -      output.timestamp = timestamp;
        -    }
        -    
        -    return JSON.stringify(output);
        -  }
        -
        -  output = timestamp ? timestamp + ' - ' : '';
        -  output += options.colorize ? config.colorize(options.level) : options.level;
        -  output += (': ' + options.message);
        -
        -  if (meta && typeof meta === 'object' && Object.keys(meta).length > 0) {
        -    output += ' ' + loggly.serialize(meta);
        -  }
        -
        -  return output;
        -};

        function hash (str)

        - -

        @str {string} String to hash.

        - -

        Utility function for creating unique ids -e.g. Profiling incoming HTTP requests on the same tick

        exports.hash = function (str) {
        -  return crypto.createHash('sha1').update(str).digest('hex');
        -};

        Borrowed from node.js core

        - -

        I wanted a universal lowercase header message, as opposed to the DEBUG -(i.e. all uppercase header) used only in util.debug()

        var months = ['Jan', 'Feb', 'Mar', 'Apr', 
        -              'May', 'Jun', 'Jul', 'Aug', 
        -              'Sep', 'Oct', 'Nov', 'Dec'];

        function pad (n)

        - -

        Returns a padded string if n < 10.

        exports.pad = function (n) {
        -  return n < 10 ? '0' + n.toString(10) : n.toString(10);
        -};

        function timestamp ()

        - -

        Returns a timestamp string for the current time.

        exports.timestamp = function () {
        -  var d = new Date();
        -  var time = [
        -    exports.pad(d.getHours()),
        -    exports.pad(d.getMinutes()),
        -    exports.pad(d.getSeconds())
        -  ].join(':');
        -              
        -  return [d.getDate(), months[d.getMonth()], time].join(' ');
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/config.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/config.html deleted file mode 100644 index c623d64..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/config.html +++ /dev/null @@ -1,37 +0,0 @@ - config.js

        config.js

        /*
        - * config.js: Default settings for all levels that winston knows about 
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        -
        -var colors = require('colors');
        -
        -var config = exports, 
        -    allColors = exports.allColors = {};
        -
        -config.addColors = function (colors) {
        -  mixin(allColors, colors);
        -};
        -
        -config.colorize = function (level) {
        -  return level[allColors[level]];
        -};

        Export config sets

        config.cli    = require('./config/cli-config');
        -config.npm    = require('./config/npm-config');
        -config.syslog = require('./config/syslog-config');

        Add colors for pre-defined config sets

        config.addColors(config.npm.colors);
        -config.addColors(config.syslog.colors);
        -
        -function mixin (target) {
        -  var args = Array.prototype.slice.call(arguments, 1);
        -
        -  args.forEach(function (a) {
        -    var keys = Object.keys(a);
        -    for (var i = 0; i < keys.length; i++) {
        -      target[keys[i]] = a[keys[i]];
        -    }
        -  });
        -  return target;
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/config/cli-config.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/config/cli-config.html deleted file mode 100644 index 075edd0..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/config/cli-config.html +++ /dev/null @@ -1,37 +0,0 @@ - cli-config.js

        cli-config.js

        /*
        - * cli-config.js: Config that conform to commonly used CLI logging levels. 
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        - 
        -var cliConfig = exports;
        -
        -cliConfig.levels = {
        -  silly: 0,
        -  input: 1,
        -  verbose: 2,
        -  prompt: 3,
        -  info: 4,
        -  data: 5,
        -  help: 6,
        -  warn: 7,
        -  debug: 8,
        -  error: 9
        -};
        -
        -cliConfig.colors = {
        -  silly: 'magenta',
        -  input: 'grey',
        -  verbose: 'cyan',
        -  prompt: 'grey',
        -  info: 'green',
        -  data: 'grey',
        -  help: 'cyan',
        -  warn: 'yellow',
        -  debug: 'blue',
        -  error: 'red'
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/config/npm-config.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/config/npm-config.html deleted file mode 100644 index 8517430..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/config/npm-config.html +++ /dev/null @@ -1,29 +0,0 @@ - npm-config.js

        npm-config.js

        /*
        - * npm-config.js: Config that conform to npm logging levels. 
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        - 
        -var npmConfig = exports;
        -
        -npmConfig.levels = {
        -  silly: 0, 
        -  verbose: 1, 
        -  info: 2, 
        -  warn: 3,
        -  debug: 4, 
        -  error: 5
        -};
        -
        -npmConfig.colors = {
        -  silly: 'magenta',
        -  verbose: 'cyan',
        -  info: 'green',
        -  warn: 'yellow',
        -  debug: 'blue',
        -  error: 'red'
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/config/syslog-config.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/config/syslog-config.html deleted file mode 100644 index 6da0993..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/config/syslog-config.html +++ /dev/null @@ -1,33 +0,0 @@ - syslog-config.js

        syslog-config.js

        /*
        - * syslog-config.js: Config that conform to syslog logging levels. 
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        - 
        -var syslogConfig = exports;
        -
        -syslogConfig.levels = {
        -  debug: 0, 
        -  info: 1, 
        -  notice: 2, 
        -  warning: 3,
        -  error: 4, 
        -  crit: 5,
        -  alert: 6,
        -  emerg: 7
        -};
        -
        -syslogConfig.colors = {
        -  debug: 'blue',
        -  info: 'green',
        -  notice: 'yellow',
        -  warning: 'red',
        -  error: 'red', 
        -  crit: 'red',
        -  alert: 'yellow',
        -  emerg: 'red'
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/exception.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/exception.html deleted file mode 100644 index f6a4a6c..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/exception.html +++ /dev/null @@ -1,56 +0,0 @@ - exception.js

        exception.js

        /*
        - * exception.js: Utility methods for gathing information about uncaughtExceptions.
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        - 
        -var os = require('os'),
        -    stackTrace = require('stack-trace');
        -    
        -var exception = exports;
        -
        -exception.getAllInfo = function (err) {
        -  return {
        -    process: exception.getProcessInfo(),
        -    os:      exception.getOsInfo(),
        -    trace:   exception.getTrace(err)
        -  };
        -};
        -
        -exception.getProcessInfo = function () {
        -  return {
        -    pid:         process.pid,
        -    uid:         process.getuid(),
        -    gid:         process.getgid(),
        -    cwd:         process.cwd(),
        -    execPath:    process.execPath,
        -    version:     process.version,
        -    argv:        process.argv,
        -    memoryUsage: process.memoryUsage()
        -  };
        -};
        -
        -exception.getOsInfo = function () {
        -  return {
        -    loadavg: os.loadavg(),
        -    uptime:  os.uptime()
        -  };
        -};
        -
        -exception.getTrace = function (err) {
        -  var trace = err ? stackTrace.parse(err) : stackTrace.get();
        -  return trace.map(function (site) {
        -    return {
        -      column:   site.getColumnNumber(),
        -      file:     site.getFileName(),
        -      function: site.getFunctionName(),
        -      line:     site.getLineNumber(),
        -      method:   site.getMethodName(),
        -      native:   site.isNative(),
        -    }
        -  });
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/logger.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/logger.html deleted file mode 100644 index de7038a..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/logger.html +++ /dev/null @@ -1,344 +0,0 @@ - logger.js

        logger.js

        /*
        - * logger.js: Core logger object used by winston.
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        - 
        -var events = require('events'),
        -    util = require('util'),
        -    async = require('async'),
        -    config = require('./config'),
        -    common = require('./common'),
        -    exception = require('./exception');
        -
        -function capitalize(str) {
        -  return str && str[0].toUpperCase() + str.slice(1);
        -}

        Time constants

        var ticksPerMillisecond = 10000;

        function Logger (options)

        - -

        @options {Object} Options for this instance.

        - -

        Constructor function for the Logger object responsible -for persisting log messages and metadata to one or more transports.

        var Logger = exports.Logger = function (options) {
        -  events.EventEmitter.call(this);
        -  options = options || {};
        -  
        -  var self = this,
        -      handleExceptions = false;
        -  

        Set Levels and default logging level

          this.padLevels = options.padLevels || false;
        -  this.setLevels(options.levels);
        -  

        Setup other intelligent default settings.

          this.level             = options.level || 'info';
        -  this.emitErrs          = options.emitErrs || false;
        -  this.stripColors       = options.stripColors || false;
        -  this.transports        = {};
        -  this.exceptionHandlers = {};
        -  this.profilers         = {};
        -  this._names            = [];
        -  this._hnames           = [];
        -  
        -  if (options.transports) {
        -    options.transports.forEach(function (transport) {
        -      self.add(transport, null, true);
        -      
        -      if (transport.handleExceptions) {
        -        handleExceptions = true;
        -      }
        -    });
        -  }
        -  
        -  if (options.exceptionHandlers) {
        -    options.exceptionHandlers.forEach(function (handler) {
        -      self._hnames.push(handler.name);
        -      self.exceptionHandlers[handler.name] = handler;
        -    });
        -  }
        -  
        -  if (options.handleExceptions || handleExceptions) {
        -    this.handleExceptions();
        -  }
        -};

        Inherit from events.EventEmitter.

        util.inherits(Logger, events.EventEmitter);

        function extend (target)

        - -

        @target {Object} Target to extend.

        - -

        Extends the target object with a 'log' method -along with a method for each level in this instance.

        Logger.prototype.extend = function (target) {
        -  var self = this;
        -  ['log', 'profile'].concat(Object.keys(this.levels)).forEach(function (method) {
        -    target[method] = function () {
        -      return self[method].apply(self, arguments);
        -    };
        -  });
        -  
        -  return this;
        -};

        function log (level, msg, [meta], callback)

        - -

        @level {string} Level at which to log the message.

        - -

        @msg {string} Message to log

        - -

        @meta {Object} Optional Additional metadata to attach

        - -

        @callback {function} Continuation to respond to when complete.

        - -

        Core logging method exposed to Winston. Metadata is optional.

        Logger.prototype.log = function (level, msg) {
        -  var self = this, 
        -      callback,
        -      meta;
        -  
        -  if (arguments.length === 3) {
        -    if (typeof arguments[2] === 'function') {
        -      meta = {};
        -      callback = arguments[2];
        -    }
        -    else if (typeof arguments[2] === 'object') {
        -      meta = arguments[2];
        -    }
        -  }
        -  else if (arguments.length === 4) {
        -    meta = arguments[2];
        -    callback = arguments[3];
        -  }

        If we should pad for levels, do so

          if (this.padLevels) {
        -    msg = new Array(this.levelLength - level.length).join(' ') + msg;
        -  }
        -
        -  function onError (err) {
        -    if (callback) {
        -      callback(err);
        -    }
        -    else if (self.emitErrs) {
        -      self.emit('error', err);
        -    };
        -  }
        -  
        -  if (this.transports.length === 0) {
        -    return onError(new Error('Cannot log with no transports.'));
        -  }
        -  else if (typeof self.levels[level] === 'undefined') {
        -    return onError(new Error('Unknown log level: ' + level));
        -  }
        -  

        For consideration of terminal 'color" programs like colors.js, -which can add ANSI escape color codes to strings, we destyle the -ANSI color escape codes when this.stripColors is set.

        - -

        see: http://en.wikipedia.org/wiki/ANSIescapecode

          if (this.stripColors) {
        -    var code = /\u001b\[\d+m/g;
        -    msg = ('' + msg).replace(code, '');
        -  }
        -  
        -  for (var i = 0, l = this._names.length; i < l; i++) {
        -    var transport = this.transports[this._names[i]];
        -    if ((transport.level && self.levels[transport.level] <= self.levels[level])
        -      || (!transport.level && self.levels[self.level] <= self.levels[level])) {
        -      transport.log(level, msg, meta, function (err) {
        -        self.emit('logging', transport, level, msg, meta);
        -      });
        -    }
        -  }
        -  

        Immediately respond to the callback

          if (callback) {
        -    callback(null, level, msg, meta);    
        -  }
        -  
        -  return this;
        -};

        function handleExceptions ()

        - -

        Handles uncaughtException events for the current process

        Logger.prototype.handleExceptions = function () {
        -  var args = Array.prototype.slice.call(arguments),
        -      handlers = [],
        -      self = this;
        -      
        -  args.forEach(function (a) {
        -    if (Array.isArray(a)) {
        -      handlers = handlers.concat(a);
        -    }
        -    else {
        -      handlers.push(a);
        -    }
        -  });
        -  
        -  handlers.forEach(function (handler) {
        -    self.exceptionHandlers[handler.name] = handler;
        -  });
        -  
        -  this._hnames = Object.keys(self.exceptionHandlers);
        -    
        -  if (!this.catchExceptions) {
        -    this.catchExceptions = this._uncaughtException.bind(this);
        -    process.on('uncaughtException', this.catchExceptions);
        -  }
        -};

        function unhandleExceptions ()

        - -

        Removes any handlers to uncaughtException events -for the current process

        Logger.prototype.unhandleExceptions = function () {
        -  var self = this;
        -  
        -  if (this.catchExceptions) {
        -    Object.keys(this.exceptionHandlers).forEach(function (name) {
        -      if (handler.close) {
        -        handler.close();
        -      }
        -    });
        -    
        -    this.exceptionHandlers = {};
        -    Object.keys(this.transports).forEach(function (name) {
        -      var transport = self.transports[name];
        -      if (transport.handleExceptions) {
        -        transport.handleExceptions = false;
        -      }
        -    })
        -    
        -    process.removeListener('uncaughtException', this.catchExceptions);
        -    this.catchExceptions = false;    
        -  }
        -};

        function add (transport, [options])

        - -

        @transport {Transport} Prototype of the Transport object to add.

        - -

        @options {Object} Optional Options for the Transport to add.

        - -

        @instance {Boolean} Optional Value indicating if transport is already instantiated.

        - -

        Adds a transport of the specified type to this instance.

        Logger.prototype.add = function (transport, options, created) {
        -  var instance = created ? transport : (new (transport)(options));
        -  
        -  if (!instance.name && !instance.log) {
        -    throw new Error('Unknown transport with no log() method');
        -  }
        -  else if (this.transports[instance.name]) {
        -    throw new Error('Transport already attached: ' + instance.name);
        -  }
        -  
        -  this.transports[instance.name] = instance;
        -  this._names = Object.keys(this.transports);
        -  

        Listen for the error event on the new Transport

          instance._onError = this._onError.bind(this, instance)
        -  instance.on('error', instance._onError);
        -
        -  return this;
        -};

        function remove (transport)

        - -

        @transport {Transport} Transport to remove.

        - -

        Removes a transport of the specified type from this instance.

        Logger.prototype.remove = function (transport) {
        -  var name = transport.name || transport.prototype.name;
        -    
        -  if (!this.transports[name]) {
        -    throw new Error('Transport ' + name + ' not attached to this instance');
        -  }
        -  
        -  var instance = this.transports[name];
        -  delete this.transports[name];
        -  this._names = Object.keys(this.transports);
        -  
        -  if (instance.close) {
        -    instance.close();
        -  }
        -  
        -  instance.removeListener('error', instance._onError);
        -  return this;
        -};

        function profile (id, [msg, meta, callback])

        - -

        @id {string} Unique id of the profiler

        - -

        @msg {string} Optional Message to log

        - -

        @meta {Object} Optional Additional metadata to attach

        - -

        @callback {function} Optional Continuation to respond to when complete.

        - -

        Tracks the time inbetween subsequent calls to this method -with the same id parameter. The second call to this method -will log the difference in milliseconds along with the message.

        Logger.prototype.profile = function (id) {
        -  var now = Date.now(), then, args,
        -      msg, meta, callback;
        -  
        -  if (this.profilers[id] && arguments.length !== 1) {
        -    then = this.profilers[id];
        -    delete this.profilers[id];
        -    

        Support variable arguments: msg, meta, callback

            args     = Array.prototype.slice.call(arguments);
        -    callback = typeof args[args.length - 1] === 'function' ? args.pop() : null;
        -    meta     = typeof args[args.length - 1] === 'object' ? args.pop() : {};
        -    msg      = args.length === 2 ? args[1] : id; 
        -    

        Set the duration property of the metadata

            meta.duration = now - then + 'ms'; 
        -    return this.info(msg, meta, callback);
        -  }
        -  else {
        -    this.profilers[id] = now;
        -  }
        -  
        -  return this;
        -};

        function setLevels (target)

        - -

        @target {Object} Target levels to use on this instance

        - -

        Sets the target levels specified on this instance.

        Logger.prototype.setLevels = function (target) {
        -  return common.setLevels(this, this.levels, target);
        -};

        function cli ()

        - -

        Configures this instance to have the default -settings for command-line interfaces: no timestamp, -colors enabled, padded output, and additional levels.

        Logger.prototype.cli = function () {
        -  this.padLevels = true;
        -  this.setLevels(config.cli.levels);
        -  config.addColors(config.cli.colors);
        -  
        -  if (this.transports.console) {
        -    this.transports.console.colorize = true;
        -    this.transports.console.timestamp = false;
        -  }
        -  
        -  return this;
        -};

        @private function _uncaughtException (err)

        - -

        @err {Error} Error to handle

        - -

        Logs all relevant information around the err and -exits the current process.

        Logger.prototype._uncaughtException = function (err) {
        -  var self = this,
        -      responded = false,
        -      info = exception.getAllInfo(err),
        -      handlers = this._getExceptionHandlers(),
        -      timeout;
        -  
        -  function logAndWait (transport, next) {
        -    transport.logException('uncaughtException', info, next);
        -  }
        -  
        -  function gracefulExit () {
        -    if (!responded) {

        Remark: Currently ignoring any exceptions from transports - when catching uncaught exceptions.

              clearTimeout(timeout);
        -      responded = true;
        -      process.exit(1);
        -    }
        -  }
        -  
        -  if (!handlers || handlers.length === 0) {
        -    return gracefulExit();
        -  }
        -  

        Log to all transports and allow the operation to take -only up to 3000ms.

          async.forEach(handlers, logAndWait, gracefulExit);
        -  timeout = setTimeout(gracefulExit, 3000);
        -};

        @private function _getExceptionHandlers ()

        - -

        Returns the list of transports and exceptionHandlers -for this instance.

        Logger.prototype._getExceptionHandlers = function () {
        -  var self = this;
        -
        -  return this._hnames.map(function (name) {
        -    return self.exceptionHandlers[name];
        -  }).concat(this._names.map(function (name) {
        -    return self.transports[name].handleExceptions && self.transports[name];
        -  })).filter(Boolean);
        -};

        @private function _onError (transport, err)

        - -

        @transport {Object} Transport on which the error occured

        - -

        @err {Error} Error that occurred on the transport

        - -

        Bubbles the error, err, that occured on the specified transport -up from this instance if emitErrs has been set.

        Logger.prototype._onError = function (transport, err) {
        -  if (self.emitErrs) {
        -    self.emit('error', err, transport);
        -  }
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/transports.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/transports.html deleted file mode 100644 index bc92fc8..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/transports.html +++ /dev/null @@ -1,29 +0,0 @@ - transports.js

        transports.js

        /*
        - * transports.js: Set of all transports Winston knows about
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        -
        -var fs = require('fs'),
        -    path = require('path');
        -
        -var transports = exports;
        -
        -function capitalize (str) {
        -  return str && str[0].toUpperCase() + str.slice(1);
        -};

        Setup all transports as lazy-loaded getters.

        fs.readdirSync(path.join(__dirname, 'transports')).forEach(function (file) {
        -  var transport = file.replace('.js', ''),
        -      name  = capitalize(transport);
        -  
        -  if (transport === 'transport') {
        -    return;
        -  }
        -  
        -  transports.__defineGetter__(name, function () {
        -    return require('./transports/' + transport)[name];
        -  });
        -});
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/transports/console.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/transports/console.html deleted file mode 100644 index 3d45f36..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/transports/console.html +++ /dev/null @@ -1,59 +0,0 @@ - console.js

        console.js

        /*
        - * console.js: Transport for outputting to the console
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        -
        -var events = require('events'),
        -    util = require('util'),
        -    colors = require('colors'),
        -    common = require('../common'),
        -    Transport = require('./transport').Transport;

        function Console (options)

        - -

        @options {Object} Options for this instance.

        - -

        Constructor function for the Console transport object responsible -for persisting log messages and metadata to a terminal or TTY.

        var Console = exports.Console = function (options) {
        -  Transport.call(this, options);
        -  options = options || {};
        -  
        -  this.name      = 'console';
        -  this.json      = options.json     || false;
        -  this.colorize  = options.colorize || false;
        -  this.timestamp = typeof options.timestamp !== 'undefined' ? options.timestamp : false;
        -};

        Inherit from winston.Transport.

        util.inherits(Console, Transport);

        Expose the name of this Transport on the prototype

        Console.prototype.name = 'console';

        function log (level, msg, [meta], callback)

        - -

        @level {string} Level at which to log the message.

        - -

        @msg {string} Message to log

        - -

        @meta {Object} Optional Additional metadata to attach

        - -

        @callback {function} Continuation to respond to when complete.

        - -

        Core logging method exposed to Winston. Metadata is optional.

        Console.prototype.log = function (level, msg, meta, callback) {
        -  if (this.silent) {
        -    return callback(null, true);
        -  }
        -    
        -  var self = this, output = common.log({
        -    level:     level,
        -    message:   msg,
        -    meta:      meta,
        -    colorize:  this.colorize, 
        -    timestamp: this.timestamp
        -  });
        -  
        -  if (level === 'error' || level === 'debug') {
        -    util.error(output);
        -  }
        -  else {
        -    util.puts(output);
        -  }

        Emit the logged event immediately because the event loop -will not exit until process.stdout has drained anyway.

          self.emit('logged');
        -  callback(null, true);
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/transports/couchdb.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/transports/couchdb.html deleted file mode 100644 index b7690de..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/transports/couchdb.html +++ /dev/null @@ -1,84 +0,0 @@ - couchdb.js

        couchdb.js

        /*
        - * Couchdb.js: Transport for logging to Couchdb
        - *
        - * (C) 2011 Max Ogden
        - * MIT LICENSE
        - *
        - */
        -
        -var events = require('events'),
        -    http = require('http'),
        -    util = require('util'),
        -    common = require('../common'),
        -    Transport = require('./transport').Transport; 

        function Couchdb (options)

        - -

        @options {Object} Options for this instance.

        - -

        Constructor function for the Console transport object responsible -for making arbitrary HTTP requests whenever log messages and metadata -are received.

        var Couchdb = exports.Couchdb = function (options) {
        -  Transport.call(this, options);
        -
        -  this.name   = 'Couchdb'; 
        -  this.db     = options.db;
        -  this.user   = options.user;
        -  this.pass   = options.pass;
        -  this.host   = options.host   || 'localhost';
        -  this.port   = options.port   || 5984;
        -
        -  if (options.auth) {

        TODO: add http basic auth options for outgoing HTTP requests

          }
        -  
        -  if (options.ssl) {

        TODO: add ssl support for outgoing HTTP requests

          }  
        -};

        Inherit from winston.Transport.

        util.inherits(Couchdb, Transport);

        Expose the name of this Transport on the prototype

        Couchdb.prototype.name = 'Couchdb';

        function log (level, msg, [meta], callback)

        - -

        @level {string} Level at which to log the message.

        - -

        @msg {string} Message to log

        - -

        @meta {Object} Optional Additional metadata to attach

        - -

        @callback {function} Continuation to respond to when complete.

        - -

        Core logging method exposed to Winston. Metadata is optional.

        Couchdb.prototype.log = function (level, msg, meta, callback) {
        -  if (this.silent) {
        -    return callback(null, true);
        -  }
        -  
        -  var self = this,
        -      message = common.clone(meta),
        -      options,
        -      req;
        -      
        -  message.level = level;
        -  message.message = msg;

        Prepare options for outgoing HTTP request

          options = {
        -    host: this.host,
        -    port: this.port,
        -    path: "/" + this.db,
        -    method: "POST",
        -    headers: {"content-type": "application/json"}
        -  };
        -  
        -  if (options.user && options.pass) {
        -    options.headers["Authorization"] = "Basic " + new Buffer(options.user + ":" + options.pass).toString('base64');
        -  }
        -  

        Perform HTTP logging request

          req = http.request(options, function (res) { 

        No callback on request, fire and forget about the response

            self.emit('logged', res);
        -  }); 
        -
        -  req.on('error', function (err) {

        Propagate the error back up to the Logger that this -instance belongs to.

            self.emit('error', err);
        -  });
        -  

        Write logging event to the outgoing request body

          req.write(JSON.stringify({ 
        -    method: 'log', 
        -    params: { 
        -      timestamp: new Date(), // RFC3339/ISO8601 format instead of common.timestamp()
        -      msg: msg, 
        -      level: level, 
        -      meta: meta 
        -    } 
        -  }));
        -  
        -  req.end();
        -  

        Always return true, regardless of any errors

          callback(null, true);
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/transports/file.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/transports/file.html deleted file mode 100644 index bba8459..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/transports/file.html +++ /dev/null @@ -1,211 +0,0 @@ - file.js

        file.js

        /*
        - * file.js: Transport for outputting to a local log file
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        -
        -var events = require('events'),
        -    fs = require('fs'),
        -    path = require('path'),
        -    util = require('util'),
        -    colors = require('colors'),
        -    common = require('../common'),
        -    Transport = require('./transport').Transport;
        -    

        function File (options)

        - -

        @options {Object} Options for this instance.

        - -

        Constructor function for the File transport object responsible -for persisting log messages and metadata to one or more files.

        var File = exports.File = function (options) {
        -  Transport.call(this, options);
        -  

        Helper function which throws an Error in the event -that any of the rest of the arguments is present in options.

          function throwIf (target /*, illegal... */) {
        -    Array.prototype.slice.call(arguments, 1).forEach(function (name) {
        -      if (options[name]) {
        -        throw new Error('Cannot set ' + name + ' and ' + target + 'together');
        -      }
        -    });
        -  }
        -  
        -  if (options.filename || options.dirname) {
        -    throwIf('filename or dirname', 'stream');
        -    this._basename = this.filename = path.basename(options.filename) || 'winston.log';
        -    this.dirname   = options.dirname || path.dirname(options.filename);
        -    this.options   = options.options || { flags: 'a' };    
        -  }
        -  else if (options.stream) {
        -    throwIf('stream', 'filename', 'maxsize');
        -    this.stream = options.stream;
        -  }
        -  else {
        -    throw new Error('Cannot log to file without filename or stream.');
        -  }
        -    
        -  this.json      = options.json !== false;
        -  this.colorize  = options.colorize  || false;
        -  this.maxsize   = options.maxsize   || null;
        -  this.timestamp = typeof options.timestamp !== 'undefined' ? options.timestamp : false;

        Internal state variables representing the number -of files this instance has created and the current -size (in bytes) of the current logfile.

          this._size    = 0;
        -  this._created = 0;
        -  this._buffer  = [];
        -};

        Inherit from winston.Transport.

        util.inherits(File, Transport);

        Expose the name of this Transport on the prototype

        File.prototype.name = 'file';

        function log (level, msg, [meta], callback)

        - -

        @level {string} Level at which to log the message.

        - -

        @msg {string} Message to log

        - -

        @meta {Object} Optional Additional metadata to attach

        - -

        @callback {function} Continuation to respond to when complete.

        - -

        Core logging method exposed to Winston. Metadata is optional.

        File.prototype.log = function (level, msg, meta, callback) {
        -  if (this.silent) {
        -    return callback(null, true);
        -  }
        -
        -  var self = this, output = common.log({
        -    level:     level,
        -    message:   msg,
        -    meta:      meta,
        -    json:      this.json,
        -    colorize:  this.colorize,
        -    timestamp: this.timestamp
        -  }) + '\n';
        -  
        -  this._size += output.length;
        -  
        -  function onDrain () {
        -    self.emit('logged');
        -  }
        -  
        -  if (!this.filename) {

        If there is no filename on this instance then it was configured -with a raw WriteableStream instance and we should not perform any -size restrictions.

            this.stream.write(output);
        -    this.stream.once('drain', onDrain);
        -  }
        -  else {
        -    this.open(function (err) {
        -      if (err) {

        If there was an error enqueue the message

                return self._buffer.push(output);
        -      }
        -      
        -      self.stream.write(output);
        -      self.stream.once('drain', onDrain);
        -    });
        -  }
        -
        -  callback(null, true);
        -};

        function open (callback)

        - -

        @callback {function} Continuation to respond to when complete

        - -

        Checks to see if a new file needs to be created based on the maxsize -(if any) and the current size of the file used.

        File.prototype.open = function (callback) {
        -  if (this.opening) {

        If we are already attempting to open the next -available file then respond with a value indicating -that the message should be buffered.

            return callback(true);
        -  }
        -  else if (!this.stream || (this.maxsize && this._size >= this.maxsize)) {

        If we dont have a stream or have exceeded our size, then create -the next stream and respond with a value indicating that -the message should be buffered.

            callback(true);
        -    return this._createStream();
        -  }
        -  

        Otherwise we have a valid (and ready) stream.

          callback();
        -};

        function close ()

        - -

        Closes the stream associated with this instance.

        File.prototype.close = function() {
        -  var self = this;
        -
        -  if (this.stream) {
        -    this.stream.end();
        -    this.stream.destroySoon();
        -    
        -    this.stream.once('drain', function () {
        -      self.emit('flush');
        -      self.emit('closed');
        -    });
        -  }
        -};

        function flush ()

        - -

        Flushes any buffered messages to the current stream -used by this instance.

        File.prototype.flush = function () {
        -  var self = this;

        Iterate over the _buffer of enqueued messaged -and then write them to the newly created stream.

          this._buffer.forEach(function (str) {
        -    process.nextTick(function () {
        -      self.stream.write(str);
        -      self._size += str.length;
        -    });
        -  });
        -  

        Quickly truncate the _buffer once the write operations -have been started

          self._buffer.length = 0;
        -  

        When the stream has drained we have flushed -our buffer.

          self.stream.once('drain', function () {
        -    self.emit('flush');
        -    self.emit('logged');
        -  });
        -};

        @private function _createStream ()

        - -

        Attempts to open the next appropriate file for this instance -based on the common state (such as maxsize and _basename).

        File.prototype._createStream = function () {
        -  var self = this;
        -  this.opening = true;
        -    
        -  (function checkFile (target) {
        -    var fullname = path.join(self.dirname, target);
        -    

        Creates the WriteStream and then flushes any -buffered messages.

            function createAndFlush (size) {
        -      if (self.stream) {
        -        self.stream.end();
        -        self.stream.destroySoon();
        -      }
        -      
        -      self._size = size;
        -      self.filename = target;
        -      self.stream = fs.createWriteStream(fullname, self.options);
        -      

        When the current stream has finished flushing -then we can be sure we have finished opening -and thus can emit the open event.

              self.once('flush', function () {
        -        self.opening = false;
        -        self.emit('open', fullname);
        -      });

        Remark: It is possible that in the time it has taken to find the -next logfile to be written more data than maxsize has been buffered, -but for sensible limits (10s - 100s of MB) this seems unlikely in less -than one second.

              self.flush();
        -    }
        -
        -    fs.stat(fullname, function (err, stats) {
        -      if (err) {
        -        if (err.code !== 'ENOENT') {
        -          return self.emit('error', err);
        -        }
        -        
        -        return createAndFlush(0);
        -      }
        -      
        -      if (!stats || (self.maxsize && stats.size >= self.maxsize)) {

        If stats.size is greater than the maxsize for -this instance then try again

                return checkFile(self._getFile(true));
        -      }
        -      
        -      createAndFlush(stats.size);
        -    });
        -  })(this._getFile());  
        -};

        @private function _getFile ()

        - -

        Gets the next filename to use for this instance -in the case that log filesizes are being capped.

        File.prototype._getFile = function (inc) {
        -  var self = this,
        -      ext = path.extname(this._basename),
        -      basename = path.basename(this._basename, ext);
        -  
        -  if (inc) {

        Increment the number of files created or -checked by this instance.

            this._created += 1;
        -  }
        -  
        -  return this._created 
        -    ? basename + this._created + ext
        -    : basename + ext;
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/transports/loggly.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/transports/loggly.html deleted file mode 100644 index 7652318..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/transports/loggly.html +++ /dev/null @@ -1,118 +0,0 @@ - loggly.js

        loggly.js

        /*
        - * loggly.js: Transport for logginh to remote Loggly API
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        -
        -var events = require('events'),
        -    loggly = require('loggly'),
        -    util = require('util'),
        -    async = require('async'),
        -    common = require('../common'),
        -    Transport = require('./transport').Transport; 

        function Loggly (options)

        - -

        @options {Object} Options for this instance.

        - -

        Constructor function for the Loggly transport object responsible -for persisting log messages and metadata to Loggly; 'LaaS'.

        var Loggly = exports.Loggly = function (options) {
        -  Transport.call(this, options);
        -
        -  if (!options.subdomain) {
        -    throw new Error('Loggly Subdomain is required');
        -  }
        -  
        -  if (!options.inputToken && !options.inputName) {
        -    throw new Error('Target input token or name is required.');
        -  }
        -  
        -  if (!options.auth && options.inputName) {
        -    throw new Error('Loggly authentication is required');
        -  }
        -  
        -  this.name = 'loggly'; 
        -  this.logBuffer = [];
        -  
        -  this.client = loggly.createClient({
        -    subdomain: options.subdomain,
        -    auth: options.auth || null,
        -    json: options.json || false
        -  });
        -  
        -  if (options.inputToken) {
        -    this.inputToken = options.inputToken;
        -    this.ready = true;
        -  }
        -  else if (options.inputName) {
        -    this.ready = false;
        -    this.inputName = options.inputName;
        -    
        -    var self = this;
        -    this.client.getInput(this.inputName, function (err, input) {
        -      if (err) {
        -        throw err;
        -      }
        -      
        -      self.inputToken = input.input_token;
        -      self.ready = true;
        -    });
        -  }
        -};

        Inherit from winston.Transport.

        util.inherits(Loggly, Transport);

        Expose the name of this Transport on the prototype

        Loggly.prototype.name = 'loggly';

        function log (level, msg, [meta], callback)

        - -

        @level {string} Level at which to log the message.

        - -

        @msg {string} Message to log

        - -

        @meta {Object} Optional Additional metadata to attach

        - -

        @callback {function} Continuation to respond to when complete.

        - -

        Core logging method exposed to Winston. Metadata is optional.

        Loggly.prototype.log = function (level, msg, meta, callback) {
        -  if (this.silent) {
        -    return callback(null, true);
        -  }
        -
        -  var self = this,
        -      message = common.clone(meta);
        -      
        -  message.level = level;
        -  message.message = msg;
        -  
        -  if (!this.ready) {

        If we haven't gotten the input token yet -add this message to the log buffer.

            this.logBuffer.push(message);
        -  }
        -  else if (this.ready && this.logBuffer.length > 0) {

        Otherwise if we have buffered messages -add this message to the buffer and flush them.

            this.logBuffer.push(message);
        -    this.flush();
        -  }
        -  else {

        Otherwise just log the message as normal

            this.client.log(this.inputToken, message, function () {
        -      self.emit('logged');
        -    });
        -  }
        -  
        -  callback(null, true);
        -};

        function flush ()

        - -

        Flushes any buffered messages to the current stream -used by this instance.

        Loggly.prototype.flush = function () {
        -  var self = this;
        -  
        -  function logMsg (msg, next) {
        -    self.client.log(self.inputToken, msg, function (err) {
        -      if (err) {
        -        self.emit('error', err);
        -      }
        -      
        -      next();
        -    });
        -  }
        -  

        Initiate calls to loggly for each message in the buffer

          async.forEach(this.logBuffer, logMsg, function () {
        -    self.emit('logged');
        -  });
        -  
        -  process.nextTick(function () {

        Then quickly truncate the list

            self.logBuffer.length = 0;
        -  });
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/transports/transport.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/transports/transport.html deleted file mode 100644 index f0cc4b9..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/transports/transport.html +++ /dev/null @@ -1,50 +0,0 @@ - transport.js

        transport.js

        /*
        - * transport.js: Base Transport object for all Winston transports.
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        -
        -var events = require('events'),
        -    util = require('util'); 

        function Transport (options)

        - -

        @options {Object} Options for this instance.

        - -

        Constructor function for the Tranport object responsible -base functionality for all winston transports.

        var Transport = exports.Transport = function (options) {
        -  events.EventEmitter.call(this);
        -  
        -  options               = options        || {};  
        -  this.level            = options.level  || 'info';
        -  this.silent           = options.silent || false;
        -  this.handleExceptions = options.handleExceptions || false;
        -};

        Inherit from events.EventEmitter.

        util.inherits(Transport, events.EventEmitter);

        function logException (msg, meta, callback)

        - -

        @msg {string} Message to log

        - -

        @meta {Object} Optional Additional metadata to attach

        - -

        @callback {function} Continuation to respond to when complete.

        - -

        Logs the specified msg, meta and responds to the callback once the log -operation is complete to ensure that the event loop will not exit before -all logging has completed.

        Transport.prototype.logException = function (msg, meta, callback) {
        -  var self = this;
        -  
        -  function onLogged () {
        -    self.removeListener('error', onError);
        -    callback();
        -  }
        -  
        -  function onError () {
        -    self.removeListener('logged', onLogged);
        -    callback();
        -  }
        -  
        -  this.once('logged', onLogged);
        -  this.once('error', onError);  
        -  this.log('error', msg, meta, function () { });
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/transports/webhook.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/transports/webhook.html deleted file mode 100644 index 7191495..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/docs/winston/transports/webhook.html +++ /dev/null @@ -1,82 +0,0 @@ - webhook.js

        webhook.js

        /*
        - * webhook.js: Transport for logging to remote http endpoints ( POST / RECEIVE webhooks )
        - *
        - * (C) 2011 Marak Squires
        - * MIT LICENCE
        - *
        - */
        -
        -var events = require('events'),
        -    http = require('http'),
        -    util = require('util'),
        -    common = require('../common'),
        -    Transport = require('./transport').Transport; 

        function WebHook (options)

        - -

        @options {Object} Options for this instance.

        - -

        Constructor function for the Console transport object responsible -for making arbitrary HTTP requests whenever log messages and metadata -are received.

        var Webhook = exports.Webhook = function (options) {
        -  Transport.call(this, options);
        -
        -  this.name   = 'webhook'; 
        -  this.host   = options.host   || 'localhost';
        -  this.port   = options.port   || 8080;
        -  this.method = options.method || 'POST';
        -  this.path   = options.path   || '/winston-log';
        -
        -  if (options.auth) {

        TODO: add http basic auth options for outgoing HTTP requests

          }
        -  
        -  if (options.ssl) {

        TODO: add ssl support for outgoing HTTP requests

          }  
        -};

        Inherit from winston.Transport.

        util.inherits(Webhook, Transport);

        Expose the name of this Transport on the prototype

        Webhook.prototype.name = 'webhook';

        function log (level, msg, [meta], callback)

        - -

        @level {string} Level at which to log the message.

        - -

        @msg {string} Message to log

        - -

        @meta {Object} Optional Additional metadata to attach

        - -

        @callback {function} Continuation to respond to when complete.

        - -

        Core logging method exposed to Winston. Metadata is optional.

        Webhook.prototype.log = function (level, msg, meta, callback) {
        -  if (this.silent) {
        -    return callback(null, true);
        -  }
        -  
        -  var self = this,
        -      message = common.clone(meta),
        -      options,
        -      req;
        -      
        -  message.level = level;
        -  message.message = msg;

        Prepare options for outgoing HTTP request

          options = {
        -    host: this.host,
        -    port: this.port,
        -    path: this.path,
        -    method: this.method
        -  };
        -  

        Perform HTTP logging request

          req = http.request(options, function (res) { 

        No callback on request, fire and forget about the response

            self.emit('logged');
        -  }); 
        -
        -  req.on('error', function (err) {

        Propagate the error back up to the Logger that this -instance belongs to.

            self.emit('error', err);
        -  });
        -  

        Write logging event to the outgoing request body

        - -

        jsonMessage is currently conforming to JSON-RPC v1.0, -but without the unique id since there is no anticipated response -see: http://en.wikipedia.org/wiki/JSON-RPC

          req.write(JSON.stringify({ 
        -    method: 'log', 
        -    params: { 
        -      timestamp: common.timestamp(), 
        -      msg: msg, 
        -      level: level, 
        -      meta: meta 
        -    } 
        -  }));
        -  
        -  req.end();
        -  

        Always return true, regardless of any errors

          callback(null, true);
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/examples/couchdb.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/examples/couchdb.js deleted file mode 100644 index ce2d960..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/examples/couchdb.js +++ /dev/null @@ -1,18 +0,0 @@ -var winston = require('../lib/winston'); - -// -// Create a new winston logger instance with two tranports: Console, and Couchdb -// -// -// The Console transport will simply output to the console screen -// The Couchdb tranport will perform an HTTP POST request to the specified CouchDB instance -// -var logger = new (winston.Logger)({ - transports: [ - new (winston.transports.Console)(), - new (winston.transports.Couchdb)({ 'host': 'localhost', 'db': 'logs' }) - // if you need auth do this: new (winston.transports.Couchdb)({ 'user': 'admin', 'pass': 'admin', 'host': 'localhost', 'db': 'logs' }) - ] -}); - -logger.log('info', 'Hello webhook log files!', { 'foo': 'bar' }); diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/examples/raw-mode.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/examples/raw-mode.js deleted file mode 100644 index 89e070d..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/examples/raw-mode.js +++ /dev/null @@ -1,10 +0,0 @@ -var winston = require('../lib/winston'); - -var logger = new (winston.Logger)({ - transports: [ - new (winston.transports.Console)({ raw: true }), - ] -}); - -logger.log('info', 'Hello, this is a raw logging event', { 'foo': 'bar' }); -logger.log('info', 'Hello, this is a raw logging event 2', { 'foo': 'bar' }); diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/examples/webhook-post.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/examples/webhook-post.js deleted file mode 100644 index 0fa1c8d..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/examples/webhook-post.js +++ /dev/null @@ -1,17 +0,0 @@ -var winston = require('../lib/winston'); - -// -// Create a new winston logger instance with two tranports: Console, and Webhook -// -// -// The Console transport will simply output to the console screen -// The Webhook tranports will perform an HTTP POST request to an abritrary end-point ( for post/recieve webhooks ) -// -var logger = new (winston.Logger)({ - transports: [ - new (winston.transports.Console)(), - new (winston.transports.Webhook)({ 'host': 'localhost', 'port': 8080, 'path': '/collectdata' }) - ] -}); - -logger.log('info', 'Hello webhook log files!', { 'foo': 'bar' }); diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston.js deleted file mode 100644 index 51bfb45..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston.js +++ /dev/null @@ -1,143 +0,0 @@ -/* - * winston.js: Top-level include defining Winston. - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var winston = exports; - -// -// Expose version using `pkginfo` -// -require('pkginfo')(module, 'version'); - -// -// Include transports defined by default by winston -// -winston.transports = require('./winston/transports'); - -// -// Expose utility methods -// -var common = require('./winston/common'); -winston.hash = common.hash; -winston.clone = common.clone; -winston.longestElement = common.longestElement; -winston.exception = require('./winston/exception'); -winston.config = require('./winston/config'); -winston.addColors = winston.config.addColors; - -// -// Expose core Logging-related prototypes. -// -winston.Container = require('./winston/container').Container; -winston.Logger = require('./winston/logger').Logger; -winston.Transport = require('./winston/transports/transport').Transport; - -// -// We create and expose a default `Container` to `winston.loggers` so that the -// programmer may manage multiple `winston.Logger` instances without any additional overhead. -// -// ### some-file1.js -// -// var logger = require('winston').loggers.get('something'); -// -// ### some-file2.js -// -// var logger = require('winston').loggers.get('something'); -// -winston.loggers = new winston.Container(); - -// -// We create and expose a 'defaultLogger' so that the programmer may do the -// following without the need to create an instance of winston.Logger directly: -// -// var winston = require('winston'); -// winston.log('info', 'some message'); -// winston.error('some error'); -// -var defaultLogger = new winston.Logger({ - transports: [new winston.transports.Console()] -}); - -// -// Pass through the target methods onto `winston. -// -var methods = [ - 'log', - 'add', - 'remove', - 'profile', - 'startTimer', - 'extend', - 'cli', - 'handleExceptions', - 'unhandleExceptions' -]; -common.setLevels(winston, null, defaultLogger.levels); -methods.forEach(function (method) { - winston[method] = function () { - return defaultLogger[method].apply(defaultLogger, arguments); - }; -}); - -// -// ### function cli () -// Configures the default winston logger to have the -// settings for command-line interfaces: no timestamp, -// colors enabled, padded output, and additional levels. -// -winston.cli = function () { - winston.padLevels = true; - common.setLevels(winston, defaultLogger.levels, winston.config.cli.levels); - defaultLogger.setLevels(winston.config.cli.levels); - winston.config.addColors(winston.config.cli.colors); - - if (defaultLogger.transports.console) { - defaultLogger.transports.console.colorize = true; - defaultLogger.transports.console.timestamp = false; - } - - return winston; -}; - -// -// ### function setLevels (target) -// #### @target {Object} Target levels to use -// Sets the `target` levels specified on the default winston logger. -// -winston.setLevels = function (target) { - common.setLevels(winston, defaultLogger.levels, target); - defaultLogger.setLevels(target); -}; - -// -// Define getters / setters for appropriate properties of the -// default logger which need to be exposed by winston. -// -['emitErrs', 'exitOnError', 'padLevels', 'level', 'levelLength', 'stripColors'].forEach(function (prop) { - Object.defineProperty(winston, prop, { - get: function () { - return defaultLogger[prop]; - }, - set: function (val) { - defaultLogger[prop] = val; - } - }); -}); - -// -// @default {Object} -// The default transports and exceptionHandlers for -// the default winston logger. -// -Object.defineProperty(winston, 'default', { - get: function () { - return { - transports: defaultLogger.transports, - exceptionHandlers: defaultLogger.exceptionHandlers - }; - } -}); diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/common.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/common.js deleted file mode 100644 index 9b8abeb..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/common.js +++ /dev/null @@ -1,264 +0,0 @@ -/* - * common.js: Internal helper and utility functions for winston - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var util = require('util'), - crypto = require('crypto'), - config = require('./config'); - -// -// ### function setLevels (target, past, current) -// #### @target {Object} Object on which to set levels. -// #### @past {Object} Previous levels set on target. -// #### @current {Object} Current levels to set on target. -// Create functions on the target objects for each level -// in current.levels. If past is defined, remove functions -// for each of those levels. -// -exports.setLevels = function (target, past, current, isDefault) { - if (past) { - Object.keys(past).forEach(function (level) { - delete target[level]; - }); - } - - target.levels = current || config.npm.levels; - if (target.padLevels) { - target.levelLength = exports.longestElement(Object.keys(target.levels)); - } - - // - // Define prototype methods for each log level - // e.g. target.log('info', msg) <=> target.info(msg) - // - Object.keys(target.levels).forEach(function (level) { - target[level] = function (msg) { - var args = Array.prototype.slice.call(arguments), - callback = typeof args[args.length - 1] === 'function' || !args[args.length - 1] ? args.pop() : null, - meta = args.length === 2 ? args.pop() : null; - - return target.log(level, msg, meta, callback); - }; - }); - - return target; -}; - -// -// ### function longestElement -// #### @xs {Array} Array to calculate against -// Returns the longest element in the `xs` array. -// -exports.longestElement = function (xs) { - return Math.max.apply( - null, - xs.map(function (x) { return x.length; }) - ); -}; - -// -// ### function clone (obj) -// #### @obj {Object} Object to clone. -// Helper method for deep cloning pure JSON objects -// i.e. JSON objects that are either literals or objects (no Arrays, etc) -// -exports.clone = function (obj) { - // we only need to clone refrence types (Object) - if (!(obj instanceof Object)) { - return obj; - } - else if (obj instanceof Date) { - return obj; - } - - var copy = {}; - for (var i in obj) { - if (Array.isArray(obj[i])) { - copy[i] = obj[i].slice(0); - } - else if (obj[i] instanceof Buffer) { - copy[i] = obj[i].slice(0); - } - else if (typeof obj[i] != 'function') { - copy[i] = obj[i] instanceof Object ? exports.clone(obj[i]) : obj[i]; - } - } - - return copy; -}; - -// -// ### function log (options) -// #### @options {Object} All information about the log serialization. -// Generic logging function for returning timestamped strings -// with the following options: -// -// { -// level: 'level to add to serialized message', -// message: 'message to serialize', -// meta: 'additional logging metadata to serialize', -// colorize: false, // Colorizes output (only if `.json` is false) -// timestamp: true // Adds a timestamp to the serialized message -// } -// -exports.log = function (options) { - var timestampFn = typeof options.timestamp === 'function' ? options.timestamp : exports.timestamp, - timestamp = options.timestamp ? timestampFn() : null, - meta = options.meta ? exports.clone(options.meta) : null, - output; - - // - // raw mode is intended for outputing winston as streaming JSON to STDOUT - // - if (options.raw) { - output = meta || {}; - output.level = options.level; - output.message = options.message.stripColors; - return JSON.stringify(output); - } - - // - // json mode is intended for pretty printing multi-line json to the terminal - // - if (options.json) { - output = meta || {}; - output.level = options.level; - output.message = options.message; - - if (timestamp) { - output.timestamp = timestamp; - } - - return typeof options.stringify === 'function' - ? options.stringify(output) - : JSON.stringify(output, function(key, value) { - if (value instanceof Buffer) { - return value.toString('base64'); - } - return value; - }); - } - - output = timestamp ? timestamp + ' - ' : ''; - output += options.colorize ? config.colorize(options.level) : options.level; - output += (': ' + options.message); - - if (meta) { - if (typeof meta !== 'object') { - output += ' ' + meta; - } - else if (Object.keys(meta).length > 0) { - output += ' ' + exports.serialize(meta); - } - } - - return output; -}; - -exports.capitalize = function (str) { - return str && str[0].toUpperCase() + str.slice(1); -}; - -// -// ### function hash (str) -// #### @str {string} String to hash. -// Utility function for creating unique ids -// e.g. Profiling incoming HTTP requests on the same tick -// -exports.hash = function (str) { - return crypto.createHash('sha1').update(str).digest('hex'); -}; - -// -// ## Borrowed from node.js core -// I wanted a universal lowercase header message, as opposed to the `DEBUG` -// (i.e. all uppercase header) used only in `util.debug()` -// -var months = ['Jan', 'Feb', 'Mar', 'Apr', - 'May', 'Jun', 'Jul', 'Aug', - 'Sep', 'Oct', 'Nov', 'Dec']; - -// -// ### function pad (n) -// Returns a padded string if `n < 10`. -// -exports.pad = function (n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); -}; - -// -// ### function timestamp () -// Returns a timestamp string for the current time. -// -exports.timestamp = function () { - var d = new Date(); - var time = [ - exports.pad(d.getHours()), - exports.pad(d.getMinutes()), - exports.pad(d.getSeconds()) - ].join(':'); - - return [d.getDate(), months[d.getMonth()], time].join(' '); -}; - -// -// ### function serialize (obj, key) -// #### @obj {Object|literal} Object to serialize -// #### @key {string} **Optional** Optional key represented by obj in a larger object -// Performs simple comma-separated, `key=value` serialization for Loggly when -// logging to non-JSON inputs. -// -exports.serialize = function (obj, key) { - if (obj === null) { - obj = 'null'; - } - else if (obj === undefined) { - obj = 'undefined'; - } - else if (obj === false) { - obj = 'false'; - } - - if (typeof obj !== 'object') { - return key ? key + '=' + obj : obj; - } - - if (obj instanceof Buffer) { - return key ? key + '=' + obj.toString('base64') : obj.toString('base64'); - } - - var msg = '', - keys = Object.keys(obj), - length = keys.length; - - for (var i = 0; i < length; i++) { - if (Array.isArray(obj[keys[i]])) { - msg += keys[i] + '=['; - - for (var j = 0, l = obj[keys[i]].length; j < l; j++) { - msg += exports.serialize(obj[keys[i]][j]); - if (j < l - 1) { - msg += ', '; - } - } - - msg += ']'; - } - else if (obj[keys[i]] instanceof Date) { - msg += keys[i] + '=' + obj[keys[i]]; - } - else { - msg += exports.serialize(obj[keys[i]], keys[i]); - } - - if (i < length - 1) { - msg += ', '; - } - } - - return msg; -}; diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/config.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/config.js deleted file mode 100644 index 45e9283..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/config.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * config.js: Default settings for all levels that winston knows about - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var colors = require('colors'); - -var config = exports, - allColors = exports.allColors = {}; - -config.addColors = function (colors) { - mixin(allColors, colors); -}; - -config.colorize = function (level) { - return level[allColors[level]]; -}; - -// -// Export config sets -// -config.cli = require('./config/cli-config'); -config.npm = require('./config/npm-config'); -config.syslog = require('./config/syslog-config'); - -// -// Add colors for pre-defined config sets -// -config.addColors(config.npm.colors); -config.addColors(config.syslog.colors); - -function mixin (target) { - var args = Array.prototype.slice.call(arguments, 1); - - args.forEach(function (a) { - var keys = Object.keys(a); - for (var i = 0; i < keys.length; i++) { - target[keys[i]] = a[keys[i]]; - } - }); - return target; -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/config/cli-config.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/config/cli-config.js deleted file mode 100644 index 9798ddc..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/config/cli-config.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * cli-config.js: Config that conform to commonly used CLI logging levels. - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var cliConfig = exports; - -cliConfig.levels = { - silly: 0, - input: 1, - verbose: 2, - prompt: 3, - info: 4, - data: 5, - help: 6, - warn: 7, - debug: 8, - error: 9 -}; - -cliConfig.colors = { - silly: 'magenta', - input: 'grey', - verbose: 'cyan', - prompt: 'grey', - info: 'green', - data: 'grey', - help: 'cyan', - warn: 'yellow', - debug: 'blue', - error: 'red' -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/config/npm-config.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/config/npm-config.js deleted file mode 100644 index 464f735..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/config/npm-config.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * npm-config.js: Config that conform to npm logging levels. - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var npmConfig = exports; - -npmConfig.levels = { - silly: 0, - verbose: 1, - info: 2, - warn: 3, - debug: 4, - error: 5 -}; - -npmConfig.colors = { - silly: 'magenta', - verbose: 'cyan', - info: 'green', - warn: 'yellow', - debug: 'blue', - error: 'red' -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/config/syslog-config.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/config/syslog-config.js deleted file mode 100644 index a198abc..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/config/syslog-config.js +++ /dev/null @@ -1,31 +0,0 @@ -/* - * syslog-config.js: Config that conform to syslog logging levels. - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var syslogConfig = exports; - -syslogConfig.levels = { - debug: 0, - info: 1, - notice: 2, - warning: 3, - error: 4, - crit: 5, - alert: 6, - emerg: 7 -}; - -syslogConfig.colors = { - debug: 'blue', - info: 'green', - notice: 'yellow', - warning: 'red', - error: 'red', - crit: 'red', - alert: 'yellow', - emerg: 'red' -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/container.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/container.js deleted file mode 100644 index 0e67b20..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/container.js +++ /dev/null @@ -1,101 +0,0 @@ -/* - * container.js: Inversion of control container for winston logger instances - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var common = require('./common'), - winston = require('../winston'); - -// -// ### function Container (options) -// #### @options {Object} Default pass-thru options for Loggers -// Constructor function for the Container object responsible for managing -// a set of `winston.Logger` instances based on string ids. -// -var Container = exports.Container = function (options) { - this.loggers = {}; - this.options = options || {}; - this.default = { - transports: [ - new winston.transports.Console({ - level: 'silly', - colorize: false - }) - ] - } -}; - -// -// ### function get / add (id, options) -// #### @id {string} Id of the Logger to get -// #### @options {Object} **Optional** Options for the Logger instance -// Retreives a `winston.Logger` instance for the specified `id`. If -// an instance does not exist, one is created. -// -Container.prototype.get = Container.prototype.add = function (id, options) { - if (!this.loggers[id]) { - options = common.clone(options || this.options || this.default); - options.transports = options.transports || []; - - if (options.transports.length === 0 && (!options || !options['console'])) { - options.transports.push(this.default.transports[0]); - } - - Object.keys(options).forEach(function (key) { - if (key === 'transports') { - return; - } - - var name = common.capitalize(key); - - if (!winston.transports[name]) { - throw new Error('Cannot add unknown transport: ' + name); - } - - var namedOptions = options[key]; - namedOptions.id = id; - options.transports.push(new (winston.transports[name])(namedOptions)); - }); - - this.loggers[id] = new winston.Logger(options); - } - - return this.loggers[id]; -}; - -// -// ### function close (id) -// #### @id {string} **Optional** Id of the Logger instance to find -// Returns a boolean value indicating if this instance -// has a logger with the specified `id`. -// -Container.prototype.has = function (id) { - return !!this.loggers[id]; -}; - -// -// ### function close (id) -// #### @id {string} **Optional** Id of the Logger instance to close -// Closes a `Logger` instance with the specified `id` if it exists. -// If no `id` is supplied then all Loggers are closed. -// -Container.prototype.close = function (id) { - var self = this; - - function _close (id) { - if (!self.loggers[id]) { - return; - } - - self.loggers[id].close(); - delete self.loggers[id]; - } - - return id ? _close(id) : Object.keys(this.loggers).forEach(function (id) { - _close(id); - }); -}; - diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/exception.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/exception.js deleted file mode 100644 index 2a01e91..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/exception.js +++ /dev/null @@ -1,55 +0,0 @@ -/* - * exception.js: Utility methods for gathing information about uncaughtExceptions. - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var os = require('os'), - stackTrace = require('stack-trace'); - -var exception = exports; - -exception.getAllInfo = function (err) { - return { - process: exception.getProcessInfo(), - os: exception.getOsInfo(), - trace: exception.getTrace(err), - stack: err.stack.split('\n') - }; -}; - -exception.getProcessInfo = function () { - return { - pid: process.pid, - uid: process.getuid(), - gid: process.getgid(), - cwd: process.cwd(), - execPath: process.execPath, - version: process.version, - argv: process.argv, - memoryUsage: process.memoryUsage() - }; -}; - -exception.getOsInfo = function () { - return { - loadavg: os.loadavg(), - uptime: os.uptime() - }; -}; - -exception.getTrace = function (err) { - var trace = err ? stackTrace.parse(err) : stackTrace.get(); - return trace.map(function (site) { - return { - column: site.getColumnNumber(), - file: site.getFileName(), - function: site.getFunctionName(), - line: site.getLineNumber(), - method: site.getMethodName(), - native: site.isNative(), - } - }); -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/logger.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/logger.js deleted file mode 100644 index baaa057..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/logger.js +++ /dev/null @@ -1,515 +0,0 @@ -/* - * logger.js: Core logger object used by winston. - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var events = require('events'), - util = require('util'), - async = require('async'), - config = require('./config'), - common = require('./common'), - exception = require('./exception'); - -// -// Time constants -// -var ticksPerMillisecond = 10000; - -// -// ### function Logger (options) -// #### @options {Object} Options for this instance. -// Constructor function for the Logger object responsible -// for persisting log messages and metadata to one or more transports. -// -var Logger = exports.Logger = function (options) { - events.EventEmitter.call(this); - options = options || {}; - - var self = this, - handleExceptions = false; - - // - // Set Levels and default logging level - // - this.padLevels = options.padLevels || false; - this.setLevels(options.levels); - if (options.colors) { - config.addColors(options.colors); - } - - // - // Hoist other options onto this instance. - // - this.level = options.level || 'info'; - this.emitErrs = options.emitErrs || false; - this.stripColors = options.stripColors || false; - this.exitOnError = typeof options.exitOnError !== 'undefined' - ? options.exitOnError - : true; - - // - // Setup other intelligent default settings. - // - this.transports = {}; - this.rewriters = []; - this.exceptionHandlers = {}; - this.profilers = {}; - this._names = []; - this._hnames = []; - - if (options.transports) { - options.transports.forEach(function (transport) { - self.add(transport, null, true); - - if (transport.handleExceptions) { - handleExceptions = true; - } - }); - } - - if (options.rewriters) { - options.rewriters.forEach(function(rewriter) { - self.addRewriter(rewriter); - }); - } - - if (options.exceptionHandlers) { - handleExceptions = true; - options.exceptionHandlers.forEach(function (handler) { - self._hnames.push(handler.name); - self.exceptionHandlers[handler.name] = handler; - }); - } - - if (options.handleExceptions || handleExceptions) { - this.handleExceptions(); - } -}; - -// -// Inherit from `events.EventEmitter`. -// -util.inherits(Logger, events.EventEmitter); - -// -// ### function extend (target) -// #### @target {Object} Target to extend. -// Extends the target object with a 'log' method -// along with a method for each level in this instance. -// -Logger.prototype.extend = function (target) { - var self = this; - ['log', 'profile', 'startTimer'].concat(Object.keys(this.levels)).forEach(function (method) { - target[method] = function () { - return self[method].apply(self, arguments); - }; - }); - - return this; -}; - -// -// ### function log (level, msg, [meta], callback) -// #### @level {string} Level at which to log the message. -// #### @msg {string} Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} Continuation to respond to when complete. -// Core logging method exposed to Winston. Metadata is optional. -// -Logger.prototype.log = function (level, msg) { - var self = this, - callback, - meta; - - if (arguments.length === 3) { - if (typeof arguments[2] === 'function') { - meta = {}; - callback = arguments[2]; - } - else if (typeof arguments[2] === 'object') { - meta = arguments[2]; - } - } - else if (arguments.length === 4) { - meta = arguments[2]; - callback = arguments[3]; - } - - // If we should pad for levels, do so - if (this.padLevels) { - msg = new Array(this.levelLength - level.length).join(' ') + msg; - } - - function onError (err) { - if (callback) { - callback(err); - } - else if (self.emitErrs) { - self.emit('error', err); - }; - } - - if (this.transports.length === 0) { - return onError(new Error('Cannot log with no transports.')); - } - else if (typeof self.levels[level] === 'undefined') { - return onError(new Error('Unknown log level: ' + level)); - } - - this.rewriters.forEach(function(rewriter) { - meta = rewriter(level, msg, meta); - }); - - // - // For consideration of terminal 'color" programs like colors.js, - // which can add ANSI escape color codes to strings, we destyle the - // ANSI color escape codes when `this.stripColors` is set. - // - // see: http://en.wikipedia.org/wiki/ANSI_escape_code - // - if (this.stripColors) { - var code = /\u001b\[\d+m/g; - msg = ('' + msg).replace(code, ''); - } - - for (var i = 0, l = this._names.length; i < l; i++) { - var transport = this.transports[this._names[i]]; - if ((transport.level && self.levels[transport.level] <= self.levels[level]) - || (!transport.level && self.levels[self.level] <= self.levels[level])) { - transport.log(level, msg, meta, function (err) { - self.emit('logging', transport, level, msg, meta); - }); - } - } - - // - // Immediately respond to the callback - // - if (callback) { - callback(null, level, msg, meta); - } - - return this; -}; - -// -// ### function close () -// Cleans up resources (streams, event listeners) for all -// transports associated with this instance (if necessary). -// -Logger.prototype.close = function () { - var self = this; - - this._names.forEach(function (name) { - var transport = self.transports[name]; - if (transport && transport.close) { - transport.close(); - } - }); -}; - -// -// ### function handleExceptions () -// Handles `uncaughtException` events for the current process -// -Logger.prototype.handleExceptions = function () { - var args = Array.prototype.slice.call(arguments), - handlers = [], - self = this; - - args.forEach(function (a) { - if (Array.isArray(a)) { - handlers = handlers.concat(a); - } - else { - handlers.push(a); - } - }); - - handlers.forEach(function (handler) { - self.exceptionHandlers[handler.name] = handler; - }); - - this._hnames = Object.keys(self.exceptionHandlers); - - if (!this.catchExceptions) { - this.catchExceptions = this._uncaughtException.bind(this); - process.on('uncaughtException', this.catchExceptions); - } -}; - -// -// ### function unhandleExceptions () -// Removes any handlers to `uncaughtException` events -// for the current process -// -Logger.prototype.unhandleExceptions = function () { - var self = this; - - if (this.catchExceptions) { - Object.keys(this.exceptionHandlers).forEach(function (name) { - if (handler.close) { - handler.close(); - } - }); - - this.exceptionHandlers = {}; - Object.keys(this.transports).forEach(function (name) { - var transport = self.transports[name]; - if (transport.handleExceptions) { - transport.handleExceptions = false; - } - }) - - process.removeListener('uncaughtException', this.catchExceptions); - this.catchExceptions = false; - } -}; - -// -// ### function add (transport, [options]) -// #### @transport {Transport} Prototype of the Transport object to add. -// #### @options {Object} **Optional** Options for the Transport to add. -// #### @instance {Boolean} **Optional** Value indicating if `transport` is already instantiated. -// Adds a transport of the specified type to this instance. -// -Logger.prototype.add = function (transport, options, created) { - var instance = created ? transport : (new (transport)(options)); - - if (!instance.name && !instance.log) { - throw new Error('Unknown transport with no log() method'); - } - else if (this.transports[instance.name]) { - throw new Error('Transport already attached: ' + instance.name); - } - - this.transports[instance.name] = instance; - this._names = Object.keys(this.transports); - - // - // Listen for the `error` event on the new Transport - // - instance._onError = this._onError.bind(this, instance) - instance.on('error', instance._onError); - - // - // If this transport has `handleExceptions` set to `true` - // and we are not already handling exceptions, do so. - // - if (transport.handleExceptions && !this.catchExceptions) { - this.handleExceptions(); - } - - return this; -}; - -// -// ### function addRewriter (transport, [options]) -// #### @transport {Transport} Prototype of the Transport object to add. -// #### @options {Object} **Optional** Options for the Transport to add. -// #### @instance {Boolean} **Optional** Value indicating if `transport` is already instantiated. -// Adds a transport of the specified type to this instance. -// -Logger.prototype.addRewriter = function(rewriter) { - this.rewriters.push(rewriter); -} - -// -// ### function clear () -// Remove all transports from this instance -// -Logger.prototype.clear = function () { - for (var name in this.transports) { - this.remove({ name: name }); - } -}; - -// -// ### function remove (transport) -// #### @transport {Transport} Transport to remove. -// Removes a transport of the specified type from this instance. -// -Logger.prototype.remove = function (transport) { - var name = transport.name || transport.prototype.name; - - if (!this.transports[name]) { - throw new Error('Transport ' + name + ' not attached to this instance'); - } - - var instance = this.transports[name]; - delete this.transports[name]; - this._names = Object.keys(this.transports); - - if (instance.close) { - instance.close(); - } - - instance.removeListener('error', instance._onError); - return this; -}; - -var ProfileHandler = function (logger) { - this.logger = logger; - - this.start = Date.now(); - - this.done = function (msg) { - var args, callback, meta; - args = Array.prototype.slice.call(arguments); - callback = typeof args[args.length - 1] === 'function' ? args.pop() : null; - meta = typeof args[args.length - 1] === 'object' ? args.pop() : {}; - - meta.duration = (Date.now()) - this.start + 'ms'; - - return this.logger.info(msg, meta, callback); - } -} - -Logger.prototype.startTimer = function () { - return new ProfileHandler(this); -} - -// -// ### function profile (id, [msg, meta, callback]) -// #### @id {string} Unique id of the profiler -// #### @msg {string} **Optional** Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} **Optional** Continuation to respond to when complete. -// Tracks the time inbetween subsequent calls to this method -// with the same `id` parameter. The second call to this method -// will log the difference in milliseconds along with the message. -// -Logger.prototype.profile = function (id) { - var now = Date.now(), then, args, - msg, meta, callback; - - if (this.profilers[id]) { - then = this.profilers[id]; - delete this.profilers[id]; - - // Support variable arguments: msg, meta, callback - args = Array.prototype.slice.call(arguments); - callback = typeof args[args.length - 1] === 'function' ? args.pop() : null; - meta = typeof args[args.length - 1] === 'object' ? args.pop() : {}; - msg = args.length === 2 ? args[1] : id; - - // Set the duration property of the metadata - meta.duration = now - then + 'ms'; - return this.info(msg, meta, callback); - } - else { - this.profilers[id] = now; - } - - return this; -}; - -// -// ### function setLevels (target) -// #### @target {Object} Target levels to use on this instance -// Sets the `target` levels specified on this instance. -// -Logger.prototype.setLevels = function (target) { - return common.setLevels(this, this.levels, target); -}; - -// -// ### function cli () -// Configures this instance to have the default -// settings for command-line interfaces: no timestamp, -// colors enabled, padded output, and additional levels. -// -Logger.prototype.cli = function () { - this.padLevels = true; - this.setLevels(config.cli.levels); - config.addColors(config.cli.colors); - - if (this.transports.console) { - this.transports.console.colorize = true; - this.transports.console.timestamp = false; - } - - return this; -}; - -// -// ### @private function _uncaughtException (err) -// #### @err {Error} Error to handle -// Logs all relevant information around the `err` and -// exits the current process. -// -Logger.prototype._uncaughtException = function (err) { - var self = this, - responded = false, - info = exception.getAllInfo(err), - handlers = this._getExceptionHandlers(), - timeout, - doExit; - - // - // Calculate if we should exit on this error - // - doExit = typeof this.exitOnError === 'function' - ? this.exitOnError(err) - : this.exitOnError; - - function logAndWait(transport, next) { - transport.logException('uncaughtException', info, next, err); - } - - function gracefulExit() { - if (doExit && !responded) { - // - // Remark: Currently ignoring any exceptions from transports - // when catching uncaught exceptions. - // - clearTimeout(timeout); - responded = true; - process.exit(1); - } - } - - if (!handlers || handlers.length === 0) { - return gracefulExit(); - } - - // - // Log to all transports and allow the operation to take - // only up to `3000ms`. - // - async.forEach(handlers, logAndWait, gracefulExit); - if (doExit) { - timeout = setTimeout(gracefulExit, 3000); - } -}; - -// -// ### @private function _getExceptionHandlers () -// Returns the list of transports and exceptionHandlers -// for this instance. -// -Logger.prototype._getExceptionHandlers = function () { - var self = this; - - return this._hnames.map(function (name) { - return self.exceptionHandlers[name]; - }).concat(this._names.map(function (name) { - return self.transports[name].handleExceptions && self.transports[name]; - })).filter(Boolean); -}; - -// -// ### @private function _onError (transport, err) -// #### @transport {Object} Transport on which the error occured -// #### @err {Error} Error that occurred on the transport -// Bubbles the error, `err`, that occured on the specified `transport` -// up from this instance if `emitErrs` has been set. -// -Logger.prototype._onError = function (transport, err) { - if (this.emitErrs) { - this.emit('error', err, transport); - } -}; diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/transports.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/transports.js deleted file mode 100644 index 5080634..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/transports.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * transports.js: Set of all transports Winston knows about - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var fs = require('fs'), - path = require('path'), - common = require('./common'); - -var transports = exports; - -// -// Setup all transports as lazy-loaded getters. -// -fs.readdirSync(path.join(__dirname, 'transports')).forEach(function (file) { - var transport = file.replace('.js', ''), - name = common.capitalize(transport); - - if (transport === 'transport') { - return; - } - - transports.__defineGetter__(name, function () { - return require('./transports/' + transport)[name]; - }); -}); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/transports/console.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/transports/console.js deleted file mode 100644 index 835d075..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/transports/console.js +++ /dev/null @@ -1,87 +0,0 @@ -/* - * console.js: Transport for outputting to the console - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var events = require('events'), - util = require('util'), - colors = require('colors'), - common = require('../common'), - Transport = require('./transport').Transport; - -// -// ### function Console (options) -// #### @options {Object} Options for this instance. -// Constructor function for the Console transport object responsible -// for persisting log messages and metadata to a terminal or TTY. -// -var Console = exports.Console = function (options) { - Transport.call(this, options); - options = options || {}; - - this.name = 'console'; - this.json = options.json || false; - this.colorize = options.colorize || false; - this.timestamp = typeof options.timestamp !== 'undefined' ? options.timestamp : false; - - if (this.json) { - this.stringify = options.stringify || function (obj) { - return JSON.stringify(obj, null, 2); - }; - } -}; - -// -// Inherit from `winston.Transport`. -// -util.inherits(Console, Transport); - -// -// Expose the name of this Transport on the prototype -// -Console.prototype.name = 'console'; - -// -// ### function log (level, msg, [meta], callback) -// #### @level {string} Level at which to log the message. -// #### @msg {string} Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} Continuation to respond to when complete. -// Core logging method exposed to Winston. Metadata is optional. -// -Console.prototype.log = function (level, msg, meta, callback) { - if (this.silent) { - return callback(null, true); - } - - var self = this, - output; - - output = common.log({ - colorize: this.colorize, - json: this.json, - level: level, - message: msg, - meta: meta, - stringify: this.stringify, - timestamp: this.timestamp, - raw: this.raw - }); - - if (level === 'error' || level === 'debug') { - util.error(output); - } - else { - util.puts(output); - } - - // - // Emit the `logged` event immediately because the event loop - // will not exit until `process.stdout` has drained anyway. - // - self.emit('logged'); - callback(null, true); -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/transports/couchdb.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/transports/couchdb.js deleted file mode 100644 index 61ad74a..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/transports/couchdb.js +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Couchdb.js: Transport for logging to Couchdb - * - * (C) 2011 Max Ogden - * MIT LICENSE - * - */ - -var events = require('events'), - http = require('http'), - util = require('util'), - common = require('../common'), - Transport = require('./transport').Transport; - -// -// ### function Couchdb (options) -// #### @options {Object} Options for this instance. -// Constructor function for the Console transport object responsible -// for making arbitrary HTTP requests whenever log messages and metadata -// are received. -// -var Couchdb = exports.Couchdb = function (options) { - Transport.call(this, options); - - this.name = 'Couchdb'; - this.db = options.db; - this.user = options.user; - this.pass = options.pass; - this.host = options.host || 'localhost'; - this.port = options.port || 5984; - - if (options.auth) { - // - // TODO: add http basic auth options for outgoing HTTP requests - // - } - - if (options.ssl) { - // - // TODO: add ssl support for outgoing HTTP requests - // - } -}; - -// -// Inherit from `winston.Transport`. -// -util.inherits(Couchdb, Transport); - -// -// Expose the name of this Transport on the prototype -// -Couchdb.prototype.name = 'Couchdb'; - -// -// ### function log (level, msg, [meta], callback) -// #### @level {string} Level at which to log the message. -// #### @msg {string} Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} Continuation to respond to when complete. -// Core logging method exposed to Winston. Metadata is optional. -// -Couchdb.prototype.log = function (level, msg, meta, callback) { - if (this.silent) { - return callback(null, true); - } - - var self = this, - message = common.clone(meta || {}), - options, - req; - - message.level = level; - message.message = msg; - - // Prepare options for outgoing HTTP request - options = { - host: this.host, - port: this.port, - path: "/" + this.db, - method: "POST", - headers: {"content-type": "application/json"} - }; - - if (options.user && options.pass) { - options.headers["Authorization"] = "Basic " + new Buffer(options.user + ":" + options.pass).toString('base64'); - } - - // Perform HTTP logging request - req = http.request(options, function (res) { - // - // No callback on request, fire and forget about the response - // - self.emit('logged', res); - }); - - req.on('error', function (err) { - // - // Propagate the `error` back up to the `Logger` that this - // instance belongs to. - // - self.emit('error', err); - }); - - // - // Write logging event to the outgoing request body - // - req.write(JSON.stringify({ - method: 'log', - params: { - timestamp: new Date(), // RFC3339/ISO8601 format instead of common.timestamp() - msg: msg, - level: level, - meta: meta - } - })); - - req.end(); - - // Always return true, regardless of any errors - callback(null, true); -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/transports/file.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/transports/file.js deleted file mode 100644 index 0a96c01..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/transports/file.js +++ /dev/null @@ -1,332 +0,0 @@ -/* - * file.js: Transport for outputting to a local log file - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var events = require('events'), - fs = require('fs'), - path = require('path'), - util = require('util'), - colors = require('colors'), - common = require('../common'), - Transport = require('./transport').Transport; - -// -// ### function File (options) -// #### @options {Object} Options for this instance. -// Constructor function for the File transport object responsible -// for persisting log messages and metadata to one or more files. -// -var File = exports.File = function (options) { - Transport.call(this, options); - - // - // Helper function which throws an `Error` in the event - // that any of the rest of the arguments is present in `options`. - // - function throwIf (target /*, illegal... */) { - Array.prototype.slice.call(arguments, 1).forEach(function (name) { - if (options[name]) { - throw new Error('Cannot set ' + name + ' and ' + target + 'together'); - } - }); - } - - if (options.filename || options.dirname) { - throwIf('filename or dirname', 'stream'); - this._basename = this.filename = path.basename(options.filename) || 'winston.log'; - this.dirname = options.dirname || path.dirname(options.filename); - this.options = options.options || { flags: 'a' }; - } - else if (options.stream) { - throwIf('stream', 'filename', 'maxsize'); - this.stream = options.stream; - } - else { - throw new Error('Cannot log to file without filename or stream.'); - } - - this.json = options.json !== false; - this.colorize = options.colorize || false; - this.maxsize = options.maxsize || null; - this.maxFiles = options.maxFiles || null; - this.timestamp = typeof options.timestamp !== 'undefined' ? options.timestamp : false; - - // - // Internal state variables representing the number - // of files this instance has created and the current - // size (in bytes) of the current logfile. - // - this._size = 0; - this._created = 0; - this._buffer = []; - this._draining = false; -}; - -// -// Inherit from `winston.Transport`. -// -util.inherits(File, Transport); - -// -// Expose the name of this Transport on the prototype -// -File.prototype.name = 'file'; - -// -// ### function log (level, msg, [meta], callback) -// #### @level {string} Level at which to log the message. -// #### @msg {string} Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} Continuation to respond to when complete. -// Core logging method exposed to Winston. Metadata is optional. -// -File.prototype.log = function (level, msg, meta, callback) { - if (this.silent) { - return callback(null, true); - } - - var self = this, output = common.log({ - level: level, - message: msg, - meta: meta, - json: this.json, - colorize: this.colorize, - timestamp: this.timestamp - }) + '\n'; - - this._size += output.length; - - if (!this.filename) { - // - // If there is no `filename` on this instance then it was configured - // with a raw `WriteableStream` instance and we should not perform any - // size restrictions. - // - this.stream.write(output); - self._lazyDrain(); - } - else { - this.open(function (err) { - if (err) { - // - // If there was an error enqueue the message - // - return self._buffer.push(output); - } - - self.stream.write(output); - self._lazyDrain(); - }); - } - - callback(null, true); -}; - -// -// ### function open (callback) -// #### @callback {function} Continuation to respond to when complete -// Checks to see if a new file needs to be created based on the `maxsize` -// (if any) and the current size of the file used. -// -File.prototype.open = function (callback) { - if (this.opening) { - // - // If we are already attempting to open the next - // available file then respond with a value indicating - // that the message should be buffered. - // - return callback(true); - } - else if (!this.stream || (this.maxsize && this._size >= this.maxsize)) { - // - // If we dont have a stream or have exceeded our size, then create - // the next stream and respond with a value indicating that - // the message should be buffered. - // - callback(true); - return this._createStream(); - } - - // - // Otherwise we have a valid (and ready) stream. - // - callback(); -}; - -// -// ### function close () -// Closes the stream associated with this instance. -// -File.prototype.close = function () { - var self = this; - - if (this.stream) { - this.stream.end(); - this.stream.destroySoon(); - - this.stream.once('drain', function () { - self.emit('flush'); - self.emit('closed'); - }); - } -}; - -// -// ### function flush () -// Flushes any buffered messages to the current `stream` -// used by this instance. -// -File.prototype.flush = function () { - var self = this; - - // - // Iterate over the `_buffer` of enqueued messaged - // and then write them to the newly created stream. - // - this._buffer.forEach(function (str) { - process.nextTick(function () { - self.stream.write(str); - self._size += str.length; - }); - }); - - // - // Quickly truncate the `_buffer` once the write operations - // have been started - // - self._buffer.length = 0; - - // - // When the stream has drained we have flushed - // our buffer. - // - self.stream.once('drain', function () { - self.emit('flush'); - self.emit('logged'); - }); -}; - -// -// ### @private function _createStream () -// Attempts to open the next appropriate file for this instance -// based on the common state (such as `maxsize` and `_basename`). -// -File.prototype._createStream = function () { - var self = this; - this.opening = true; - - (function checkFile (target) { - var fullname = path.join(self.dirname, target); - - // - // Creates the `WriteStream` and then flushes any - // buffered messages. - // - function createAndFlush (size) { - if (self.stream) { - self.stream.end(); - self.stream.destroySoon(); - } - - self._size = size; - self.filename = target; - self.stream = fs.createWriteStream(fullname, self.options); - - // - // When the current stream has finished flushing - // then we can be sure we have finished opening - // and thus can emit the `open` event. - // - self.once('flush', function () { - self.opening = false; - self.emit('open', fullname); - }); - - // - // Remark: It is possible that in the time it has taken to find the - // next logfile to be written more data than `maxsize` has been buffered, - // but for sensible limits (10s - 100s of MB) this seems unlikely in less - // than one second. - // - self.flush(); - } - - fs.stat(fullname, function (err, stats) { - if (err) { - if (err.code !== 'ENOENT') { - return self.emit('error', err); - } - - return createAndFlush(0); - } - - if (!stats || (self.maxsize && stats.size >= self.maxsize)) { - // - // If `stats.size` is greater than the `maxsize` for - // this instance then try again - // - return checkFile(self._getFile(true)); - } - - createAndFlush(stats.size); - }); - })(this._getFile()); -}; - -// -// ### @private function _getFile () -// Gets the next filename to use for this instance -// in the case that log filesizes are being capped. -// -File.prototype._getFile = function (inc) { - var self = this, - ext = path.extname(this._basename), - basename = path.basename(this._basename, ext), - remaining; - - if (inc) { - // - // Increment the number of files created or - // checked by this instance. - // - // Check for maxFiles option and delete file - if (this.maxFiles && (this._created >= (this.maxFiles - 1))) { - remaining = this._created - (this.maxFiles - 1); - if (remaining === 0) { - fs.unlinkSync(path.join(this.dirname, basename + ext)); - } - else { - fs.unlinkSync(path.join(this.dirname, basename + remaining + ext)); - } - } - - this._created += 1; - } - - return this._created - ? basename + this._created + ext - : basename + ext; -}; - -// -// ### @private function _lazyDrain () -// Lazily attempts to emit the `logged` event when `this.stream` has -// drained. This is really just a simple mutex that only works because -// Node.js is single-threaded. -// -File.prototype._lazyDrain = function () { - var self = this; - - if (!this._draining && this.stream) { - this._draining = true; - - this.stream.once('drain', function () { - this._draining = false; - self.emit('logged'); - }); - } -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/transports/loggly.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/transports/loggly.js deleted file mode 100644 index dd5762b..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/transports/loggly.js +++ /dev/null @@ -1,161 +0,0 @@ -/* - * loggly.js: Transport for logginh to remote Loggly API - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var events = require('events'), - loggly = require('loggly'), - util = require('util'), - async = require('async'), - common = require('../common'), - Transport = require('./transport').Transport; - -// -// ### function Loggly (options) -// #### @options {Object} Options for this instance. -// Constructor function for the Loggly transport object responsible -// for persisting log messages and metadata to Loggly; 'LaaS'. -// -var Loggly = exports.Loggly = function (options) { - Transport.call(this, options); - - function valid() { - return options.inputToken - || options.inputName && options.auth - || options.inputName && options.inputs && options.inputs[options.inputName] - || options.id && options.inputs && options.inputs[options.id]; - } - - if (!options.subdomain) { - throw new Error('Loggly Subdomain is required'); - } - - if (!valid()) { - throw new Error('Target input token or name is required.'); - } - - this.name = 'loggly'; - this.logBuffer = []; - - this.client = loggly.createClient({ - subdomain: options.subdomain, - auth: options.auth || null, - json: options.json || false - }); - - if (options.inputToken) { - this.inputToken = options.inputToken; - this.ready = true; - } - else if (options.inputs && (options.inputs[options.inputName] - || options.inputs[options.id])) { - this.inputToken = options.inputs[options.inputName] || options.inputs[options.id]; - this.ready = true; - } - else if (options.inputName) { - this.ready = false; - this.inputName = options.inputName; - - var self = this; - this.client.getInput(this.inputName, function (err, input) { - if (err) { - throw err; - } - - self.inputToken = input.input_token; - self.ready = true; - }); - } -}; - -// -// Inherit from `winston.Transport`. -// -util.inherits(Loggly, Transport); - -// -// Expose the name of this Transport on the prototype -// -Loggly.prototype.name = 'loggly'; - -// -// ### function log (level, msg, [meta], callback) -// #### @level {string} Level at which to log the message. -// #### @msg {string} Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} Continuation to respond to when complete. -// Core logging method exposed to Winston. Metadata is optional. -// -Loggly.prototype.log = function (level, msg, meta, callback) { - if (this.silent) { - return callback(null, true); - } - - var self = this, - message = common.clone(meta || {}); - - message.level = level; - message.message = msg; - - if (!this.ready) { - // - // If we haven't gotten the input token yet - // add this message to the log buffer. - // - this.logBuffer.push(message); - } - else if (this.ready && this.logBuffer.length > 0) { - // - // Otherwise if we have buffered messages - // add this message to the buffer and flush them. - // - this.logBuffer.push(message); - this.flush(); - } - else { - // - // Otherwise just log the message as normal - // - this.client.log(this.inputToken, message, function () { - self.emit('logged'); - }); - } - - callback(null, true); -}; - -// -// ### function flush () -// Flushes any buffered messages to the current `stream` -// used by this instance. -// -Loggly.prototype.flush = function () { - var self = this; - - function logMsg (msg, next) { - self.client.log(self.inputToken, msg, function (err) { - if (err) { - self.emit('error', err); - } - - next(); - }); - } - - // - // Initiate calls to loggly for each message in the buffer - // - async.forEach(this.logBuffer, logMsg, function () { - self.emit('logged'); - }); - - process.nextTick(function () { - // - // Then quickly truncate the list - // - self.logBuffer.length = 0; - }); -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/transports/transport.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/transports/transport.js deleted file mode 100644 index 1489cb5..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/transports/transport.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * transport.js: Base Transport object for all Winston transports. - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var events = require('events'), - util = require('util'); - -// -// ### function Transport (options) -// #### @options {Object} Options for this instance. -// Constructor function for the Tranport object responsible -// base functionality for all winston transports. -// -var Transport = exports.Transport = function (options) { - events.EventEmitter.call(this); - - options = options || {}; - this.level = options.level || 'info'; - this.silent = options.silent || false; - this.raw = options.raw || false; - - this.handleExceptions = options.handleExceptions || false; -}; - -// -// Inherit from `events.EventEmitter`. -// -util.inherits(Transport, events.EventEmitter); - -// -// ### function logException (msg, meta, callback) -// #### @msg {string} Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} Continuation to respond to when complete. -// Logs the specified `msg`, `meta` and responds to the callback once the log -// operation is complete to ensure that the event loop will not exit before -// all logging has completed. -// -Transport.prototype.logException = function (msg, meta, callback) { - var self = this; - - function onLogged () { - self.removeListener('error', onError); - callback(); - } - - function onError () { - self.removeListener('logged', onLogged); - callback(); - } - - this.once('logged', onLogged); - this.once('error', onError); - this.log('error', msg, meta, function () { }); -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/transports/webhook.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/transports/webhook.js deleted file mode 100644 index bf8eb27..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/lib/winston/transports/webhook.js +++ /dev/null @@ -1,136 +0,0 @@ -/* - * webhook.js: Transport for logging to remote http endpoints ( POST / RECEIVE webhooks ) - * - * (C) 2011 Marak Squires - * MIT LICENCE - * - */ - -var events = require('events'), - http = require('http'), - https = require('https'), - util = require('util'), - common = require('../common'), - Transport = require('./transport').Transport; - -// -// ### function WebHook (options) -// #### @options {Object} Options for this instance. -// Constructor function for the Console transport object responsible -// for making arbitrary HTTP requests whenever log messages and metadata -// are received. -// -var Webhook = exports.Webhook = function (options) { - Transport.call(this, options); - - this.name = 'webhook'; - this.host = options.host || 'localhost'; - this.port = options.port || 8080; - this.method = options.method || 'POST'; - this.path = options.path || '/winston-log'; - - if (options.auth) { - this.auth = {}; - this.auth.username = options.auth.username || ''; - this.auth.password = options.auth.password || ''; - } - - if (options.ssl) { - this.ssl = {}; - this.ssl.key = options.ssl.key || null; - this.ssl.cert = options.ssl.cert || null; - this.ssl.ca = options.ssl.ca; - } -}; - -// -// Inherit from `winston.Transport`. -// -util.inherits(Webhook, Transport); - -// -// Expose the name of this Transport on the prototype -// -Webhook.prototype.name = 'webhook'; - -// -// ### function log (level, msg, [meta], callback) -// #### @level {string} Level at which to log the message. -// #### @msg {string} Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} Continuation to respond to when complete. -// Core logging method exposed to Winston. Metadata is optional. -// -Webhook.prototype.log = function (level, msg, meta, callback) { - if (this.silent) { - return callback(null, true); - } - - var self = this, - message = common.clone(meta), - options, - req; - - message.level = level; - message.message = msg; - - // Prepare options for outgoing HTTP request - options = { - host: this.host, - port: this.port, - path: this.path, - method: this.method, - headers: { 'Content-Type': 'application/json' } - }; - - if (this.ssl) { - options.ca = this.ssl.ca; - options.key = this.ssl.key; - options.cert = this.ssl.cert; - } - - if (this.auth) { - // Encode `Authorization` header used by Basic Auth - options.headers['Authorization'] = 'Basic ' + new Buffer( - this.auth.username + ':' + this.auth.password, 'utf8' - ).toString('base64'); - } - - // Perform HTTP logging request - req = (self.ssl ? https : http).request(options, function (res) { - // - // No callback on request, fire and forget about the response - // - self.emit('logged'); - }); - - req.on('error', function (err) { - // - // Propagate the `error` back up to the `Logger` that this - // instance belongs to. - // - self.emit('error', err); - }); - - // - // Write logging event to the outgoing request body - // - // jsonMessage is currently conforming to JSON-RPC v1.0, - // but without the unique id since there is no anticipated response - // see: http://en.wikipedia.org/wiki/JSON-RPC - // - req.write(JSON.stringify({ - method: 'log', - params: { - timestamp: new Date(), - msg: msg, - level: level, - meta: meta - } - })); - - req.end(); - - // Always return true, regardless of any errors - callback(null, true); -}; diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/eyes/LICENSE b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/eyes/LICENSE deleted file mode 100644 index a1edd93..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/eyes/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2009 cloudhead - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/eyes/Makefile b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/eyes/Makefile deleted file mode 100644 index a121dea..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/eyes/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -test: - @@node test/eyes-test.js - -.PHONY: test diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/eyes/README.md b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/eyes/README.md deleted file mode 100644 index 7a92158..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/eyes/README.md +++ /dev/null @@ -1,72 +0,0 @@ -eyes -==== - -a customizable value inspector for Node.js - -synopsis --------- - -I was tired of looking at cluttered output in the console -- something needed to be done, -`sys.inspect()` didn't display regexps correctly, and was too verbose, and I had an hour or two to spare. -So I decided to have some fun. _eyes_ were born. - -![eyes-ss](http://dl.dropbox.com/u/251849/eyes-js-ss.gif) - -_example of the output of a user-customized eyes.js inspector_ - -*eyes* also deals with circular objects in an intelligent way, and can pretty-print object literals. - -usage ------ - - var inspect = require('eyes').inspector({styles: {all: 'magenta'}}); - - inspect(something); // inspect with the settings passed to `inspector` - -or - - var eyes = require('eyes'); - - eyes.inspect(something); // inspect with the default settings - -you can pass a _label_ to `inspect()`, to keep track of your inspections: - - eyes.inspect(something, "a random value"); - -If you want to return the output of eyes without printing it, you can set it up this way: - - var inspect = require('eyes').inspector({ stream: null }); - - sys.puts(inspect({ something: 42 })); - -customization -------------- - -These are the default styles and settings used by _eyes_. - styles: { // Styles applied to stdout - all: 'cyan', // Overall style applied to everything - label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]` - other: 'inverted', // Objects which don't have a literal representation, such as functions - key: 'bold', // The keys in object literals, like 'a' in `{a: 1}` - - special: 'grey', // null, undefined... - string: 'green', - number: 'magenta', - bool: 'blue', // true false - regexp: 'green', // /\d+/ - }, - pretty: true, // Indent object literals - hideFunctions: false, // Don't output functions at all - stream: process.stdout, // Stream to write to, or null - maxLength: 2048 // Truncate output if longer - -You can overwrite them with your own, by passing a similar object to `inspector()` or `inspect()`. - - var inspect = require('eyes').inspector({ - styles: { - all: 'magenta', - special: 'bold' - }, - maxLength: 512 - }); - diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/eyes/lib/eyes.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/eyes/lib/eyes.js deleted file mode 100644 index 10d964b..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/eyes/lib/eyes.js +++ /dev/null @@ -1,236 +0,0 @@ -// -// Eyes.js - a customizable value inspector for Node.js -// -// usage: -// -// var inspect = require('eyes').inspector({styles: {all: 'magenta'}}); -// inspect(something); // inspect with the settings passed to `inspector` -// -// or -// -// var eyes = require('eyes'); -// eyes.inspect(something); // inspect with the default settings -// -var eyes = exports, - stack = []; - -eyes.defaults = { - styles: { // Styles applied to stdout - all: 'cyan', // Overall style applied to everything - label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]` - other: 'inverted', // Objects which don't have a literal representation, such as functions - key: 'bold', // The keys in object literals, like 'a' in `{a: 1}` - special: 'grey', // null, undefined... - string: 'green', - number: 'magenta', - bool: 'blue', // true false - regexp: 'green', // /\d+/ - }, - pretty: true, // Indent object literals - hideFunctions: false, - showHidden: false, - stream: process.stdout, - maxLength: 2048 // Truncate output if longer -}; - -// Return a curried inspect() function, with the `options` argument filled in. -eyes.inspector = function (options) { - var that = this; - return function (obj, label, opts) { - return that.inspect.call(that, obj, label, - merge(options || {}, opts || {})); - }; -}; - -// If we have a `stream` defined, use it to print a styled string, -// if not, we just return the stringified object. -eyes.inspect = function (obj, label, options) { - options = merge(this.defaults, options || {}); - - if (options.stream) { - return this.print(stringify(obj, options), label, options); - } else { - return stringify(obj, options) + (options.styles ? '\033[39m' : ''); - } -}; - -// Output using the 'stream', and an optional label -// Loop through `str`, and truncate it after `options.maxLength` has been reached. -// Because escape sequences are, at this point embeded within -// the output string, we can't measure the length of the string -// in a useful way, without separating what is an escape sequence, -// versus a printable character (`c`). So we resort to counting the -// length manually. -eyes.print = function (str, label, options) { - for (var c = 0, i = 0; i < str.length; i++) { - if (str.charAt(i) === '\033') { i += 4 } // `4` because '\033[25m'.length + 1 == 5 - else if (c === options.maxLength) { - str = str.slice(0, i - 1) + '…'; - break; - } else { c++ } - } - return options.stream.write.call(options.stream, (label ? - this.stylize(label, options.styles.label, options.styles) + ': ' : '') + - this.stylize(str, options.styles.all, options.styles) + '\033[0m' + "\n"); -}; - -// Apply a style to a string, eventually, -// I'd like this to support passing multiple -// styles. -eyes.stylize = function (str, style, styles) { - var codes = { - 'bold' : [1, 22], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'cyan' : [36, 39], - 'magenta' : [35, 39], - 'blue' : [34, 39], - 'yellow' : [33, 39], - 'green' : [32, 39], - 'red' : [31, 39], - 'grey' : [90, 39] - }, endCode; - - if (style && codes[style]) { - endCode = (codes[style][1] === 39 && styles.all) ? codes[styles.all][0] - : codes[style][1]; - return '\033[' + codes[style][0] + 'm' + str + - '\033[' + endCode + 'm'; - } else { return str } -}; - -// Convert any object to a string, ready for output. -// When an 'array' or an 'object' are encountered, they are -// passed to specialized functions, which can then recursively call -// stringify(). -function stringify(obj, options) { - var that = this, stylize = function (str, style) { - return eyes.stylize(str, options.styles[style], options.styles) - }, index, result; - - if ((index = stack.indexOf(obj)) !== -1) { - return stylize(new(Array)(stack.length - index + 1).join('.'), 'special'); - } - stack.push(obj); - - result = (function (obj) { - switch (typeOf(obj)) { - case "string" : obj = stringifyString(obj.indexOf("'") === -1 ? "'" + obj + "'" - : '"' + obj + '"'); - return stylize(obj, 'string'); - case "regexp" : return stylize('/' + obj.source + '/', 'regexp'); - case "number" : return stylize(obj + '', 'number'); - case "function" : return options.stream ? stylize("Function", 'other') : '[Function]'; - case "null" : return stylize("null", 'special'); - case "undefined": return stylize("undefined", 'special'); - case "boolean" : return stylize(obj + '', 'bool'); - case "date" : return stylize(obj.toUTCString()); - case "array" : return stringifyArray(obj, options, stack.length); - case "object" : return stringifyObject(obj, options, stack.length); - } - })(obj); - - stack.pop(); - return result; -}; - -// Escape invisible characters in a string -function stringifyString (str, options) { - return str.replace(/\\/g, '\\\\') - .replace(/\n/g, '\\n') - .replace(/[\u0001-\u001F]/g, function (match) { - return '\\0' + match[0].charCodeAt(0).toString(8); - }); -} - -// Convert an array to a string, such as [1, 2, 3]. -// This function calls stringify() for each of the elements -// in the array. -function stringifyArray(ary, options, level) { - var out = []; - var pretty = options.pretty && (ary.length > 4 || ary.some(function (o) { - return (o !== null && typeof(o) === 'object' && Object.keys(o).length > 0) || - (Array.isArray(o) && o.length > 0); - })); - var ws = pretty ? '\n' + new(Array)(level * 4 + 1).join(' ') : ' '; - - for (var i = 0; i < ary.length; i++) { - out.push(stringify(ary[i], options)); - } - - if (out.length === 0) { - return '[]'; - } else { - return '[' + ws - + out.join(',' + (pretty ? ws : ' ')) - + (pretty ? ws.slice(0, -4) : ws) + - ']'; - } -}; - -// Convert an object to a string, such as {a: 1}. -// This function calls stringify() for each of its values, -// and does not output functions or prototype values. -function stringifyObject(obj, options, level) { - var out = []; - var pretty = options.pretty && (Object.keys(obj).length > 2 || - Object.keys(obj).some(function (k) { return typeof(obj[k]) === 'object' })); - var ws = pretty ? '\n' + new(Array)(level * 4 + 1).join(' ') : ' '; - - var keys = options.showHidden ? Object.keys(obj) : Object.getOwnPropertyNames(obj); - keys.forEach(function (k) { - if (Object.prototype.hasOwnProperty.call(obj, k) - && !(obj[k] instanceof Function && options.hideFunctions)) { - out.push(eyes.stylize(k, options.styles.key, options.styles) + ': ' + - stringify(obj[k], options)); - } - }); - - if (out.length === 0) { - return '{}'; - } else { - return "{" + ws - + out.join(',' + (pretty ? ws : ' ')) - + (pretty ? ws.slice(0, -4) : ws) + - "}"; - } -}; - -// A better `typeof` -function typeOf(value) { - var s = typeof(value), - types = [Object, Array, String, RegExp, Number, Function, Boolean, Date]; - - if (s === 'object' || s === 'function') { - if (value) { - types.forEach(function (t) { - if (value instanceof t) { s = t.name.toLowerCase() } - }); - } else { s = 'null' } - } - return s; -} - -function merge(/* variable args */) { - var objs = Array.prototype.slice.call(arguments); - var target = {}; - - objs.forEach(function (o) { - Object.keys(o).forEach(function (k) { - if (k === 'styles') { - if (! o.styles) { - target.styles = false; - } else { - target.styles = {} - for (var s in o.styles) { - target.styles[s] = o.styles[s]; - } - } - } else { - target[k] = o[k]; - } - }); - }); - return target; -} - diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/eyes/package.json b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/eyes/package.json deleted file mode 100644 index ad90430..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/eyes/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "eyes", - "description": "a customizable value inspector", - "url": "http://github.com/cloudhead/eyes.js", - "keywords": [ - "inspector", - "debug", - "inspect", - "print" - ], - "author": { - "name": "Alexis Sellier", - "email": "self@cloudhead.net" - }, - "contributors": [ - { - "name": "Charlie Robbins", - "email": "charlie@nodejitsu.com" - } - ], - "licenses": [ - "MIT" - ], - "dependencies": {}, - "main": "./lib/eyes", - "version": "0.1.7", - "scripts": { - "test": "node test/*-test.js" - }, - "directories": { - "lib": "./lib", - "test": "./test" - }, - "engines": { - "node": "> 0.1.90" - }, - "_id": "eyes@0.1.7", - "devDependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "eyes@0.1.x" -} diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/eyes/test/eyes-test.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/eyes/test/eyes-test.js deleted file mode 100644 index 1f9606a..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/eyes/test/eyes-test.js +++ /dev/null @@ -1,56 +0,0 @@ -var util = require('util'); -var eyes = require('../lib/eyes'); - -eyes.inspect({ - number: 42, - string: "John Galt", - regexp: /[a-z]+/, - array: [99, 168, 'x', {}], - func: function () {}, - bool: false, - nil: null, - undef: undefined, - object: {attr: []} -}, "native types"); - -eyes.inspect({ - number: new(Number)(42), - string: new(String)("John Galt"), - regexp: new(RegExp)(/[a-z]+/), - array: new(Array)(99, 168, 'x', {}), - bool: new(Boolean)(false), - object: new(Object)({attr: []}), - date: new(Date) -}, "wrapped types"); - -var obj = {}; -obj.that = { self: obj }; -obj.self = obj; - -eyes.inspect(obj, "circular object"); -eyes.inspect({hello: 'moto'}, "small object"); -eyes.inspect({hello: new(Array)(6) }, "big object"); -eyes.inspect(["hello 'world'", 'hello "world"'], "quotes"); -eyes.inspect({ - recommendations: [{ - id: 'a7a6576c2c822c8e2bd81a27e41437d8', - key: [ 'spree', 3.764316258020699 ], - value: { - _id: 'a7a6576c2c822c8e2bd81a27e41437d8', - _rev: '1-2e2d2f7fd858c4a5984bcf809d22ed98', - type: 'domain', - domain: 'spree', - weight: 3.764316258020699, - product_id: 30 - } - }] -}, 'complex'); - -eyes.inspect([null], "null in array"); - -var inspect = eyes.inspector({ stream: null }); - -util.puts(inspect('something', "something")); -util.puts(inspect("something else")); - -util.puts(inspect(["no color"], null, { styles: false })); diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/.npmignore b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/.npmignore deleted file mode 100644 index 8f08029..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -test/data -test/data/* -node_modules -npm-debug.log \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/README.md b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/README.md deleted file mode 100644 index 926cb63..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/README.md +++ /dev/null @@ -1,227 +0,0 @@ -# node-loggly - -A client implementation for Loggly in node.js - -## Installation - -### Installing npm (node package manager) -``` bash - $ curl http://npmjs.org/install.sh | sh -``` - -### Installing node-loggly -``` bash - $ [sudo] npm install loggly -``` - -## Usage - -The node-loggly library is compliant with the [Loggly API][0]. Using node-loggly is easy for a variety of scenarios: logging, working with devices and inputs, searching, and facet searching. - -### Getting Started -Before we can do anything with Loggly, we have to create a client with valid credentials. We will authenticate for you automatically: - -``` js - var loggly = require('loggly'); - var config = { - subdomain: "your-subdomain", - auth: { - username: "your-username", - password: "your-password" - } - }; - var client = loggly.createClient(config); -``` - -### Logging -There are two ways to send log information to Loggly via node-loggly. The first is to simply call client.log with an appropriate input token: - -``` js - client.log('your-really-long-input-token', '127.0.0.1 - Theres no place like home', function (err, result) { - // Do something once you've logged - }); -``` - -Note that the callback in the above example is optional, if you prefer the 'fire and forget' method of logging: - -``` js - client.log('your-really-long-input-token', '127.0.0.1 - Theres no place like home'); -``` - -The second way to send log information to Loggly is to do so once you've retrieved an input directly from Loggly: - -``` js - client.getInput('your-input-name', function (err, input) { - input.log('127.0.0.1 - Theres no place like home'); - }); -``` - -Again the callback in the above example is optional and you can pass it if you'd like to. - -### Logging Shallow JSON Object Literals as a String -In addition to logging pure strings it is also possible to pass shallow JSON object literals (i.e. no nested objects) to client.log(..) or input.log(..) methods, which will get converted into the [Loggly recommended string representation][1]. So - -``` js - var source = { - foo: 1, - bar: 2, - buzz: 3 - }; - - input.log(source); -``` - -will be logged as: - -``` - foo=1,bar=2,buzz=3 -``` - -### Logging Objects to JSON Enabled Loggly Inputs -It is also possible to log complex objects using the new JSON capabilities of Loggly. To enable JSON functionality in the client simply add 'json: true' to the configuration: - -``` js - var config = { - subdomain: "your-subdomain", - auth: { - username: "your-username", - password: "your-password" - }, - json: true - }; -``` - -When the json flag is enabled, objects will be converted to JSON using JSON.stringify before being transmitted to Loggly. So - -``` js - var source = { - foo: 1, - bar: 2, - buzz: { - sheep: 'jumped', - times: 10 - } - }; - - input.log(source); -``` - -will be logged as: - -``` json - { "foo": 1, "bar": 2, "buzz": {"sheep": "jumped", "times": 10 }} -``` - -### Searching -[Searching][3] with node-loggly is easy. All you have to do is use the search() method defined on each Loggly client: - -``` js - var util = require('util'); - - client.search('404', function (err, results) { - // Inspect the result set - util.inspect(results.data); - }); -``` - -The search() exposes a chainable interface that allows you to set additional search parameters such as: ip, input name, rows, start, end, etc. - -``` js - var util = require('util'); - - client.search('404') - .meta({ ip: '127.0.0.1', inputname: test }) - .context({ rows: 10 }) - .run(function (err, results) { - // Inspect the result set - util.inspect(results.data); - }); -``` - -The context of the search (set using the `.context()` method) represents additional parameters in the Loggly API besides the search query itself. See the [Search API documentation][9] for a list of all options. - -Metadata set using the `.meta()` method is data that is set in the query parameter of your Loggly search, but `:` delimited. For more information about search queries in Loggly, check out the [Search Language Guide][4] on the [Loggly Wiki][5]. - -### Facet Searching -Loggly also exposes searches that can return counts of events over a time range. These are called [facets][6]. The valid facets are 'ip', 'date', and 'input'. Performing a facet search is very similar to a normal search: - -``` js - var util = require('util'); - - client.facet('ip', '404') - .context({ buckets: 10 }) - .run(function (err, results) { - // Inspect the result set - util.inspect(results.data); - }); -``` - -The chaining and options for the facet method(s) are the same as the search method above. - -### Working with Devices and Inputs -Loggly exposes several entities that are available through node-loggly: inputs and devices. For more information about these terms, checkout the [Loggly Jargon][7] on the wiki. There are several methods available in node-loggly to work with these entities: - -``` js - // - // Returns all inputs associated with your account - // - client.getInputs(function (err, inputs) { /* ... */ }); - - // - // Returns an input with the specified name - // - client.getInput('input-name', function (err, input) { /* ... */ }); - - // - // Returns all devices associated with your account - // - client.getDevices(function (err, devices) { /* ... */ }); -``` - -## Run Tests -All of the node-loggly tests are written in [vows][8], and cover all of the use cases described above. You will need to add your Loggly username, password, subdomain, and a two test inputs to test/data/test-config.json before running tests. When configuring the test inputs on Loggly, the first test input should be named 'test' using the HTTP service. The second input should be name 'test_json' using the HTTP service with the JSON logging option enabled: - -``` js - { - "subdomain": "your-subdomain", - "auth": { - "username": "your-username", - "password": "your-password" - }, - "inputs": { - "test": { - // - // Token and ID of your plain-text input. - // - "token": "your-really-long-token-you-got-when-you-created-an-http-input", - "id": 000 - }, - "test_json": { - // - // Token and ID of your JSON input. - // - "token": "your-really-long-token-you-got-when-you-created-an-http-input", - "id": 001 - }, - } - } -``` - -Once you have valid Loggly credentials you can run tests with [vows][8]: - -``` bash - $ npm test -``` - -#### Author: [Charlie Robbins](http://www.github.com/indexzero) -#### Contributors: [Marak Squires](http://github.com/marak), [hij1nx](http://github.com/hij1nx), [Kord Campbell](http://loggly.com), [Erik Hedenström](http://github.com/ehedenst), - -[0]: http://wiki.loggly.com/apidocumentation -[1]: http://wiki.loggly.com/loggingfromcode -[3]: http://wiki.loggly.com/retrieve_events#search_uri -[4]: http://wiki.loggly.com/searchguide -[5]: http://wiki.loggly.com/ -[6]: http://wiki.loggly.com/retrieve_events#facet_uris -[7]: http://wiki.loggly.com/loggingjargon -[8]: http://vowsjs.org -[9]: http://wiki.loggly.com/retrieve_events#optional diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/docco.css b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/docco.css deleted file mode 100644 index bd54134..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/docco.css +++ /dev/null @@ -1,194 +0,0 @@ -/*--------------------- Layout and Typography ----------------------------*/ -body { - font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; - font-size: 15px; - line-height: 22px; - color: #252519; - margin: 0; padding: 0; -} -a { - color: #261a3b; -} - a:visited { - color: #261a3b; - } -p { - margin: 0 0 15px 0; -} -h4, h5, h6 { - color: #333; - margin: 6px 0 6px 0; - font-size: 13px; -} - h2, h3 { - margin-bottom: 0; - color: #000; - } - h1 { - margin-top: 40px; - margin-bottom: 15px; - color: #000; - } -#container { - position: relative; -} -#background { - position: fixed; - top: 0; left: 525px; right: 0; bottom: 0; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - z-index: -1; -} -#jump_to, #jump_page { - background: white; - -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; - -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; - font: 10px Arial; - text-transform: uppercase; - cursor: pointer; - text-align: right; -} -#jump_to, #jump_wrapper { - position: fixed; - right: 0; top: 0; - padding: 5px 10px; -} - #jump_wrapper { - padding: 0; - display: none; - } - #jump_to:hover #jump_wrapper { - display: block; - } - #jump_page { - padding: 5px 0 3px; - margin: 0 0 25px 25px; - } - #jump_page .source { - display: block; - padding: 5px 10px; - text-decoration: none; - border-top: 1px solid #eee; - } - #jump_page .source:hover { - background: #f5f5ff; - } - #jump_page .source:first-child { - } -table td { - border: 0; - outline: 0; -} - td.docs, th.docs { - max-width: 450px; - min-width: 450px; - min-height: 5px; - padding: 10px 25px 1px 50px; - overflow-x: hidden; - vertical-align: top; - text-align: left; - } - .docs pre { - margin: 15px 0 15px; - padding-left: 15px; - } - .docs p tt, .docs p code { - background: #f8f8ff; - border: 1px solid #dedede; - font-size: 12px; - padding: 0 0.2em; - } - .pilwrap { - position: relative; - } - .pilcrow { - font: 12px Arial; - text-decoration: none; - color: #454545; - position: absolute; - top: 3px; left: -20px; - padding: 1px 2px; - opacity: 0; - -webkit-transition: opacity 0.2s linear; - } - td.docs:hover .pilcrow { - opacity: 1; - } - td.code, th.code { - padding: 14px 15px 16px 25px; - width: 100%; - vertical-align: top; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - } - pre, tt, code { - font-size: 12px; line-height: 18px; - font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; - margin: 0; padding: 0; - } - - -/*---------------------- Syntax Highlighting -----------------------------*/ -td.linenos { background-color: #f0f0f0; padding-right: 10px; } -span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } -body .hll { background-color: #ffffcc } -body .c { color: #408080; font-style: italic } /* Comment */ -body .err { border: 1px solid #FF0000 } /* Error */ -body .k { color: #954121 } /* Keyword */ -body .o { color: #666666 } /* Operator */ -body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ -body .cp { color: #BC7A00 } /* Comment.Preproc */ -body .c1 { color: #408080; font-style: italic } /* Comment.Single */ -body .cs { color: #408080; font-style: italic } /* Comment.Special */ -body .gd { color: #A00000 } /* Generic.Deleted */ -body .ge { font-style: italic } /* Generic.Emph */ -body .gr { color: #FF0000 } /* Generic.Error */ -body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -body .gi { color: #00A000 } /* Generic.Inserted */ -body .go { color: #808080 } /* Generic.Output */ -body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -body .gs { font-weight: bold } /* Generic.Strong */ -body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -body .gt { color: #0040D0 } /* Generic.Traceback */ -body .kc { color: #954121 } /* Keyword.Constant */ -body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ -body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ -body .kp { color: #954121 } /* Keyword.Pseudo */ -body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ -body .kt { color: #B00040 } /* Keyword.Type */ -body .m { color: #666666 } /* Literal.Number */ -body .s { color: #219161 } /* Literal.String */ -body .na { color: #7D9029 } /* Name.Attribute */ -body .nb { color: #954121 } /* Name.Builtin */ -body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ -body .no { color: #880000 } /* Name.Constant */ -body .nd { color: #AA22FF } /* Name.Decorator */ -body .ni { color: #999999; font-weight: bold } /* Name.Entity */ -body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -body .nf { color: #0000FF } /* Name.Function */ -body .nl { color: #A0A000 } /* Name.Label */ -body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -body .nt { color: #954121; font-weight: bold } /* Name.Tag */ -body .nv { color: #19469D } /* Name.Variable */ -body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -body .w { color: #bbbbbb } /* Text.Whitespace */ -body .mf { color: #666666 } /* Literal.Number.Float */ -body .mh { color: #666666 } /* Literal.Number.Hex */ -body .mi { color: #666666 } /* Literal.Number.Integer */ -body .mo { color: #666666 } /* Literal.Number.Oct */ -body .sb { color: #219161 } /* Literal.String.Backtick */ -body .sc { color: #219161 } /* Literal.String.Char */ -body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ -body .s2 { color: #219161 } /* Literal.String.Double */ -body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -body .sh { color: #219161 } /* Literal.String.Heredoc */ -body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -body .sx { color: #954121 } /* Literal.String.Other */ -body .sr { color: #BB6688 } /* Literal.String.Regex */ -body .s1 { color: #219161 } /* Literal.String.Single */ -body .ss { color: #19469D } /* Literal.String.Symbol */ -body .bp { color: #954121 } /* Name.Builtin.Pseudo */ -body .vc { color: #19469D } /* Name.Variable.Class */ -body .vg { color: #19469D } /* Name.Variable.Global */ -body .vi { color: #19469D } /* Name.Variable.Instance */ -body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly.html deleted file mode 100644 index 7afcf68..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly.html +++ /dev/null @@ -1,16 +0,0 @@ - loggly.js

        loggly.js

        /*
        - * loggly.js: Wrapper for node-loggly object
        - *
        - * (C) 2010 Nodejitsu Inc.
        - * MIT LICENSE
        - *
        - */
        -
        -var loggly = exports;

        Export node-loggly core client APIs

        loggly.createClient  = require('./loggly/core').createClient;
        -loggly.Loggly        = require('./loggly/core').Loggly;
        -loggly.Config        = require('./loggly/config').Config;

        Export Resources for node-loggly

        loggly.Input  = require('./loggly/input').Input;
        -loggly.Facet  = require('./loggly/facet').Facet;
        -loggly.Device = require('./loggly/device').Device;
        -loggly.Search = require('./loggly/search').Search;
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly/common.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly/common.html deleted file mode 100644 index 94336be..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly/common.html +++ /dev/null @@ -1,126 +0,0 @@ - common.js

        common.js

        /*
        - * common.js: Common utility functions for requesting against Loggly APIs
        - *
        - * (C) 2010 Nodejitsu Inc.
        - * MIT LICENSE
        - *
        - */
        -
        -var request = require('request'),
        -    loggly = require('../loggly');
        -
        -var common = exports;

        Failure HTTP Response codes based -off Loggly specification.

        var failCodes = common.failCodes = {
        -  400: "Bad Request",
        -  401: "Unauthorized",
        -  403: "Forbidden",
        -  404: "Not Found",
        -  409: "Conflict / Duplicate",
        -  410: "Gone",
        -  500: "Internal Server Error",
        -  501: "Not Implemented",
        -  503: "Throttled"
        -};

        Success HTTP Response codes based -off Loggly specification.

        var successCodes = common.successCodes = {
        -  200: "OK",
        -  201: "Created", 
        -  202: "Accepted",
        -  203: "Non-authoritative information",
        -  204: "Deleted",
        -};

        Core method that actually sends requests to Loggly. -This method is designed to be flexible w.r.t. arguments -and continuation passing given the wide range of different -requests required to fully implement the Loggly API.

        - -

        Continuations: - 1. 'callback': The callback passed into every node-loggly method - 2. 'success': A callback that will only be called on successful requests. - This is used throughout node-loggly to conditionally - do post-request processing such as JSON parsing.

        - -

        Possible Arguments (1 & 2 are equivalent): - 1. common.loggly('some-fully-qualified-url', auth, callback, success) - 2. common.loggly('GET', 'some-fully-qualified-url', auth, callback, success) - 3. common.loggly('DELETE', 'some-fully-qualified-url', auth, callback, success) - 4. common.loggly({ method: 'POST', uri: 'some-url', body: { some: 'body'} }, callback, success)

        common.loggly = function () {
        -  var args = Array.prototype.slice.call(arguments),
        -      success = args.pop(),
        -      callback = args.pop(),
        -      requestBody, 
        -      headers,
        -      method, 
        -      auth, 
        -      uri;
        -  

        Now that we've popped off the two callbacks -We can make decisions about other arguments

          if (args.length == 1) {
        -    if (typeof args[0] === 'string') {

        If we got a string assume that it's the URI

              method = 'GET';
        -      uri    = args[0];
        -    }
        -    else {
        -      method      = args[0]['method'] || 'GET',
        -      uri         = args[0]['uri'];
        -      requestBody = args[0]['body'];
        -      auth        = args[0]['auth'];
        -      headers     = args[0]['headers'];
        -    }
        -  }
        -  else if (args.length == 2) {
        -    method = 'GET';
        -    uri    = args[0];
        -    auth   = args[1];
        -  }
        -  else {
        -    method = args[0];
        -    uri    = args[1];
        -    auth   = args[2];
        -  }
        -  
        -  function onError (err) {
        -    if (callback) {
        -      callback(err);
        -    }
        -  }
        -  
        -  var requestOptions = {
        -    uri: uri,
        -    method: method,
        -    headers: headers || {}
        -  };
        -  
        -  if (auth) {
        -    requestOptions.headers['authorization'] = 'Basic ' + new Buffer(auth.username + ':' + auth.password).toString('base64');
        -  }
        -  
        -  if (requestBody) {
        -    requestOptions.body = requestBody;
        -  }
        -  
        -  try {
        -    request(requestOptions, function (err, res, body) {
        -      if (err) {
        -        return onError(err);
        -      }
        -
        -      var statusCode = res.statusCode.toString();
        -      if (Object.keys(failCodes).indexOf(statusCode) !== -1) {
        -        return onError((new Error('Loggly Error (' + statusCode + '): ' + failCodes[statusCode])));
        -      }
        -
        -      success(res, body);
        -    });
        -  }
        -  catch (ex) {
        -    onError(ex);
        -  }
        -};

        function clone (obj) - Helper method for deep cloning pure JSON objects - i.e. JSON objects that are either literals or objects (no Arrays, etc)

        common.clone = function (obj) {
        -  var clone = {};
        -  for (var i in obj) {
        -    clone[i] = obj[i] instanceof Object ? common.clone(obj[i]) : obj[i];
        -  }
        -
        -  return clone;
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly/config.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly/config.html deleted file mode 100644 index 0f39f4a..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly/config.html +++ /dev/null @@ -1,41 +0,0 @@ - config.js

        config.js

        /*
        - * config.js: Configuration information for your Loggly account.
        - *            This information is only used for require('loggly')./\.+/ methods
        - *
        - * (C) 2010 Nodejitsu Inc.
        - * MIT LICENSE
        - *
        - */

        function createConfig (defaults) - Creates a new instance of the configuration - object based on default values

        exports.createConfig = function (defaults) {
        -  return new Config(defaults);
        -};

        Config (defaults) - Constructor for the Config object

        var Config = exports.Config = function (defaults) {
        -  if (!defaults.subdomain) {
        -    throw new Error('Subdomain is required to create an instance of Config');
        -  }
        -  
        -  this.subdomain = defaults.subdomain;
        -  this.json = defaults.json || null;
        -  this.auth = defaults.auth || null;
        -};
        - 
        -Config.prototype = {
        -  get subdomain () {
        -   return this._subdomain; 
        -  },
        -
        -  set subdomain (value) {
        -    this._subdomain = value;
        -  },
        -  
        -  get logglyUrl () {
        -    return 'https://' + [this._subdomain, 'loggly', 'com'].join('.') + '/api';
        -  },
        -  
        -  get inputUrl () {
        -    return 'https://logs.loggly.com/inputs/';
        -  }
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly/core.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly/core.html deleted file mode 100644 index 7d1a4bf..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly/core.html +++ /dev/null @@ -1,150 +0,0 @@ - core.js

        core.js

        /*
        - * core.js: Core functions for accessing Loggly
        - *
        - * (C) 2010 Nodejitsu Inc.
        - * MIT LICENSE
        - *
        - */
        -
        -var events = require('events'),
        -    qs = require('querystring'),
        -    config = require('./config'),
        -    common = require('./common'),
        -    Search = require('./search').Search,
        -    Facet = require('./facet').Facet,
        -    loggly = require('../loggly');

        function createClient (options) - Creates a new instance of a Loggly client.

        exports.createClient = function (options) {
        -  return new Loggly(config.createConfig(options));
        -};

        Loggly (config) - Constructor for the Loggly object

        var Loggly = exports.Loggly = function (config) {
        -  this.config = config;
        -};

        function log (callback) - logs args to input device

        Loggly.prototype.log = function (inputId, msg, callback) {
        -  var emitter = new (events.EventEmitter)(),
        -      message;
        -      
        -  if (msg instanceof Object) {
        -    message = this.config.json ? JSON.stringify(msg) : qs.unescape(qs.stringify(msg, ','));
        -  } else {
        -    message = this.config.json ? JSON.stringify({ message : msg }) : msg;
        -  }
        -
        -  var logOptions = {
        -    uri: this.config.inputUrl + inputId,
        -    method: 'POST', 
        -    body: message,
        -    headers: {
        -      'Content-Type': this.config.json ? 'application/json' : 'text/plain'
        -    }
        -  };
        -
        -  common.loggly(logOptions, callback, function (res, body) {
        -    try {
        -      var result = JSON.parse(body);
        -      if (callback) {
        -        callback(null, result);
        -      }
        -      
        -      emitter.emit('log', result);
        -    }
        -    catch (ex) {
        -      if (callback) {
        -        callback(new Error('Unspecified error from Loggly: ' + ex));
        -      }
        -    }
        -  }); 
        -  
        -  return emitter; 
        -};

        function search (query, callback) - Returns a new search object which can be chained - with options or called directly if @callback is passed - initially.

        - -

        Sample Usage:

        - -

        client.search('404') - .meta({ ip: '127.0.0.1' }) - .context({ rows: 100 }) - .run(function () { /* ... */ });

        Loggly.prototype.search = function (query, callback) {
        -  return new Search(query, this, callback);
        -};

        function facet (facet, query, [options], callback) - Performs a facet search against loggly with the - specified facet, query and options.

        Loggly.prototype.facet = function (facet, query, callback) {
        -  return new Facet(facet, query, this, callback);
        -};

        function getInputs ([raw], callback) - Returns a list of all inputs for the authenicated account

        Loggly.prototype.getInputs = function () {
        -  var self = this,
        -      args = Array.prototype.slice.call(arguments),
        -      callback = args.pop(),
        -      raw = args.length > 0 ? args[0] : false;
        -  
        -  common.loggly(this.logglyUrl('inputs'), this.config.auth, callback, function (res, body) {
        -    var inputs = [], 
        -        results = JSON.parse(body);
        -        
        -    if (!raw) {
        -      results.forEach(function (result) {
        -        inputs.push(new (loggly.Input)(self, result));
        -      });
        -      
        -      return callback(null, inputs);
        -    }
        -    
        -    callback(null, results);
        -  });
        -};

        function getInput (name, callback) - Returns the input with the specified name

        Loggly.prototype.getInput = function (name, callback) {
        -  var self = this;
        -  this.getInputs(true, function (err, results) {
        -    if (err) {
        -      return callback(err);
        -    }
        -    
        -    var matches = results.filter(function (r) { return r.name === name }),
        -        input = null;
        -        
        -    if (matches.length > 0) {
        -      input = new (loggly.Input)(self, matches[0]);
        -    }
        -    
        -    callback(null, input);
        -  });
        -};

        function addDevice (inputId, address, callback) - Adds the device at address to the input specified by inputId

        Loggly.prototype.addDeviceToInput = function (inputId, address, callback) {
        -  var addOptions = {
        -    uri: this.logglyUrl('devices'),
        -    auth: this.config.auth,
        -    method: 'POST', 
        -    headers: {
        -      'Content-Type': 'application/x-www-form-urlencoded'
        -    },
        -    body: qs.stringify({ 'input_id': inputId, 'ip': address }).replace('"', '')
        -  };
        -
        -  common.loggly(addOptions, callback, function (res, body) {
        -    callback(null, res);
        -  });
        -};

        function addDevice (inputId, callback) - Adds the calling device to the input

        Loggly.prototype.addDevice = function (inputId, callback) {

        Remark: This is not fully implemented yet

          callback(new Error('Not Implemented Yet...'));
        -  

        common.loggly(this.logglyUrl('inputs', inputId, 'adddevice'), this.config.auth, callback, function (res, body) { -});

        };

        function getDevices (callback) - Returns a list of all devices for the authenicated account

        Loggly.prototype.getDevices = function (callback) {
        -  var self = this;
        -  common.loggly(this.logglyUrl('devices'), this.config.auth, callback, function (res, body) {
        -    var results = JSON.parse(body),
        -        devices = [];
        -        
        -    results.forEach(function (result) {
        -      devices.push(new (loggly.Device)(self, result));
        -    });
        -    
        -    callback(null, devices);
        -  });
        -};

        function logglyUrl ([path, to, resource]) - Helper method that concats the string params into a url - to request against a loggly serverUrl.

        Loggly.prototype.logglyUrl = function (/* path, to, resource */) {
        -  var args = Array.prototype.slice.call(arguments);
        -  return [this.config.logglyUrl].concat(args).join('/');
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly/device.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly/device.html deleted file mode 100644 index 3cc7fc5..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly/device.html +++ /dev/null @@ -1,26 +0,0 @@ - device.js

        device.js

        /*
        - * device.js: Instance of a single Loggly device
        - *
        - * (C) 2010 Nodejitsu Inc.
        - * MIT LICENSE
        - *
        - */
        - 
        -var Device = exports.Device = function (client, details) {
        -  if (!details) throw new Error("Device must be constructed with at least basic details.")
        -
        -  this.client = client;
        -  this._setProperties(details);
        -};
        -
        -Device.prototype.addToInput = function (inputId, callback) {
        -  this.client.addDeviceToInput(inputId, this.id, callback);
        -};
        -  

        Sets the properties for this instance -Parameters: details

        Device.prototype._setProperties = function (details) {

        Copy the properties to this instance

          var self = this;
        -  Object.keys(details).forEach(function (key) {
        -    self[key] = details[key];
        -  });
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly/facet.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly/facet.html deleted file mode 100644 index 39fe2b3..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly/facet.html +++ /dev/null @@ -1,26 +0,0 @@ - facet.js

        facet.js

        /*
        - * facet.js: Chainable search functions for Loggly facet searches.
        - *
        - * (C) 2010 Nodejitsu Inc.
        - * MIT LICENSE
        - *
        - */
        -
        -var util = require('util'),
        -    Search = require('./search').Search;

        function Facet (facet, query, client, callback) - Chainable facet search object for Loggly API

        var Facet = exports.Facet = function (facet, query, client, callback) {
        -  if (['date', 'ip', 'input'].indexOf(facet) === -1) {
        -    var error = new Error('Cannot search with unknown facet: ' + facet); 
        -    
        -    if (callback) {
        -      return callback(error);
        -    }
        -    else {
        -      throw error;
        -    }
        -  }
        -  

        Set the baseUrl to be facet/:facet?

          this.baseUrl = ['facets', facet + '?'].join('/');
        -  

        Call the base constructor.

          Search.call(this, query, client, callback);
        -};

        Inherit from loggly.Search.

        util.inherits(Facet, Search);
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly/input.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly/input.html deleted file mode 100644 index 22bcac2..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly/input.html +++ /dev/null @@ -1,32 +0,0 @@ - input.js

        input.js

        /*
        - * input.js: Instance of a single Loggly input
        - *
        - * (C) 2010 Nodejitsu Inc.
        - * MIT LICENSE
        - *
        - */
        - 
        -var Input = exports.Input = function (client, details) {
        -  if (!details) {
        -    throw new Error("Input must be constructed with at least basic details.");
        -  }
        -  
        -  this.client = client;
        -  this._setProperties(details);
        -};
        -
        -Input.prototype.log = function (msg, callback) {
        -  return this.client.log(this.input_token, msg, callback);
        -};
        -  
        -Input.prototype.addDevice = function (address, callback) {
        -  this.client.addDeviceToInput(this.id, address, callback);
        -};
        -  

        Sets the properties for this instance -Parameters: details

        Input.prototype._setProperties = function (details) {

        Copy the properties to this instance

          var self = this;
        -  Object.keys(details).forEach(function (key) {
        -    self[key] = details[key];
        -  });
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly/search.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly/search.html deleted file mode 100644 index 0a13c0e..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/docs/loggly/search.html +++ /dev/null @@ -1,89 +0,0 @@ - search.js

        search.js

        /*
        - * search.js: chainable search functions for Loggly
        - *
        - * (C) 2010 Nodejitsu Inc.
        - * MIT LICENSE
        - *
        - */
        -
        -var qs = require('querystring'),
        -    timespan = require('timespan'),
        -    common = require('./common');

        function Search (query, client, callback) - Chainable search object for Loggly API

        var Search = exports.Search = function (query, client, callback) {
        -  this.query = query;
        -  this.client = client;
        -  
        -  if (!this.baseUrl) {
        -    this.baseUrl = 'search?';
        -  }
        -  

        If we're passed a callback, run immediately.

          if (callback) {
        -    this.callback = callback;
        -    this.run();
        -  }
        -};

        function meta (meta) - Sets the appropriate metadata for this search query: - e.g. ip, inputname

        Search.prototype.meta = function (meta) {
        -  this._meta = meta;
        -  return this;
        -};

        function context (context) - Sets the appropriate context for this search query: - e.g. rows, start, from, until, order, format, fields

        Search.prototype.context = function (context) {
        -  this._context = context;
        -  return this;
        -};

        function run (callback)

        - -

        @callback {function} Continuation to respond to when complete

        - -

        Runs the search query for for this instance with the query, metadata, -context, and other parameters that have been configured on it.

        Search.prototype.run = function (callback) {
        -  var rangeError;
        -  

        Trim the search query

          this.query.trim();
        -  

        Update the callback for this instance if it's passed

          this.callback = callback || this.callback;
        -  if (!this.callback) {
        -    throw new Error('Cannot run search without a callback function.');
        -  }
        -  

        If meta was passed, update the search query appropriately

          if (this._meta) {
        -    this.query += ' ' + qs.unescape(qs.stringify(this._meta, ' ', ':'));
        -  }

        Set the context for the query string

          this._context = this._context || {};
        -  this._context.q = this.query;
        -  this._checkRange();
        -
        -  var self = this, searchOptions = {
        -    uri: this.client.logglyUrl(this.baseUrl + qs.stringify(this._context)),
        -    auth: this.client.config.auth
        -  };
        -  
        -  common.loggly(searchOptions, this.callback, function (res, body) {
        -    self.callback(null, JSON.parse(body));
        -  });
        -  
        -  return this;
        -};

        function _checkRange ()

        - -

        Checks if the range that has been configured for this -instance is valid and updates if it is not.

        Search.prototype._checkRange = function () {
        -  if (!this._context || (!this._context.until && !this._context.from)) {
        -    return;
        -  }
        -  
        -  this._context.until = this._context.until || 'NOW';
        -  this._context.from  = this._context.from  || 'NOW-24HOURS';
        -  
        -  if (!timespan.parseDate(this._context.until)) {
        -    this._context.until = 'NOW';
        -  }
        -  
        -  if (!timespan.parseDate(this._context.from)) {
        -    this._context.from = 'NOW-24HOURS';
        -  }
        -  
        -  if (timespan.fromDates(this._context.from, this._context.until) < 0
        -    || this._context.until === this._context.from) {

        If the length of the timespan for this Search instance is -negative then set it to default values

            this._context.until = 'NOW';
        -    this._context.from = 'NOW-24HOURS';
        -  }
        -  
        -  return this;
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly.js deleted file mode 100644 index e55d2c2..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * loggly.js: Wrapper for node-loggly object - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var loggly = exports; - -// -// Export node-loggly core client APIs -// -loggly.createClient = require('./loggly/core').createClient; -loggly.serialize = require('./loggly/common').serialize; -loggly.Loggly = require('./loggly/core').Loggly; -loggly.Config = require('./loggly/config').Config; - -// -// Export Resources for node-loggly -// -loggly.Input = require('./loggly/input').Input; -loggly.Facet = require('./loggly/facet').Facet; -loggly.Device = require('./loggly/device').Device; -loggly.Search = require('./loggly/search').Search; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly/common.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly/common.js deleted file mode 100644 index dae938e..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly/common.js +++ /dev/null @@ -1,204 +0,0 @@ -/* - * common.js: Common utility functions for requesting against Loggly APIs - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var util = require('util'), - request = require('request'), - loggly = require('../loggly'); - -var common = exports; - -// -// Failure HTTP Response codes based -// off Loggly specification. -// -var failCodes = common.failCodes = { - 400: "Bad Request", - 401: "Unauthorized", - 403: "Forbidden", - 404: "Not Found", - 409: "Conflict / Duplicate", - 410: "Gone", - 500: "Internal Server Error", - 501: "Not Implemented", - 503: "Throttled" -}; - -// -// Success HTTP Response codes based -// off Loggly specification. -// -var successCodes = common.successCodes = { - 200: "OK", - 201: "Created", - 202: "Accepted", - 203: "Non-authoritative information", - 204: "Deleted", -}; - -// -// Core method that actually sends requests to Loggly. -// This method is designed to be flexible w.r.t. arguments -// and continuation passing given the wide range of different -// requests required to fully implement the Loggly API. -// -// Continuations: -// 1. 'callback': The callback passed into every node-loggly method -// 2. 'success': A callback that will only be called on successful requests. -// This is used throughout node-loggly to conditionally -// do post-request processing such as JSON parsing. -// -// Possible Arguments (1 & 2 are equivalent): -// 1. common.loggly('some-fully-qualified-url', auth, callback, success) -// 2. common.loggly('GET', 'some-fully-qualified-url', auth, callback, success) -// 3. common.loggly('DELETE', 'some-fully-qualified-url', auth, callback, success) -// 4. common.loggly({ method: 'POST', uri: 'some-url', body: { some: 'body'} }, callback, success) -// -common.loggly = function () { - var args = Array.prototype.slice.call(arguments), - success = args.pop(), - callback = args.pop(), - requestBody, - headers, - method, - auth, - uri; - - // - // Now that we've popped off the two callbacks - // We can make decisions about other arguments - // - if (args.length == 1) { - if (typeof args[0] === 'string') { - // - // If we got a string assume that it's the URI - // - method = 'GET'; - uri = args[0]; - } - else { - method = args[0]['method'] || 'GET', - uri = args[0]['uri']; - requestBody = args[0]['body']; - auth = args[0]['auth']; - headers = args[0]['headers']; - } - } - else if (args.length == 2) { - method = 'GET'; - uri = args[0]; - auth = args[1]; - } - else { - method = args[0]; - uri = args[1]; - auth = args[2]; - } - - function onError (err) { - if (callback) { - callback(err); - } - } - - var requestOptions = { - uri: uri, - method: method, - headers: headers || {} - }; - - if (auth) { - requestOptions.headers['authorization'] = 'Basic ' + new Buffer(auth.username + ':' + auth.password).toString('base64'); - } - - if (requestBody) { - requestOptions.body = requestBody; - } - - try { - request(requestOptions, function (err, res, body) { - if (err) { - return onError(err); - } - - var statusCode = res.statusCode.toString(); - if (Object.keys(failCodes).indexOf(statusCode) !== -1) { - return onError((new Error('Loggly Error (' + statusCode + '): ' + failCodes[statusCode]))); - } - - success(res, body); - }); - } - catch (ex) { - onError(ex); - } -}; - -// -// ### function serialize (obj, key) -// #### @obj {Object|literal} Object to serialize -// #### @key {string} **Optional** Optional key represented by obj in a larger object -// Performs simple comma-separated, `key=value` serialization for Loggly when -// logging to non-JSON inputs. -// -common.serialize = function (obj, key) { - if (obj === null) { - obj = 'null'; - } - else if (obj === undefined) { - obj = 'undefined'; - } - else if (obj === false) { - obj = 'false'; - } - - if (typeof obj !== 'object') { - return key ? key + '=' + obj : obj; - } - - var msg = '', - keys = Object.keys(obj), - length = keys.length; - - for (var i = 0; i < length; i++) { - if (Array.isArray(obj[keys[i]])) { - msg += keys[i] + '=[' - - for (var j = 0, l = obj[keys[i]].length; j < l; j++) { - msg += common.serialize(obj[keys[i]][j]); - if (j < l - 1) { - msg += ', '; - } - } - - msg += ']'; - } - else { - msg += common.serialize(obj[keys[i]], keys[i]); - } - - if (i < length - 1) { - msg += ', '; - } - } - - return msg; -}; - -// -// function clone (obj) -// Helper method for deep cloning pure JSON objects -// i.e. JSON objects that are either literals or objects (no Arrays, etc) -// -common.clone = function (obj) { - var clone = {}; - for (var i in obj) { - clone[i] = obj[i] instanceof Object ? common.clone(obj[i]) : obj[i]; - } - - return clone; -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly/config.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly/config.js deleted file mode 100644 index 2156ceb..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly/config.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * config.js: Configuration information for your Loggly account. - * This information is only used for require('loggly')./\.+/ methods - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -// -// function createConfig (defaults) -// Creates a new instance of the configuration -// object based on default values -// -exports.createConfig = function (defaults) { - return new Config(defaults); -}; - -// -// Config (defaults) -// Constructor for the Config object -// -var Config = exports.Config = function (defaults) { - if (!defaults.subdomain) { - throw new Error('Subdomain is required to create an instance of Config'); - } - - this.subdomain = defaults.subdomain; - this.json = defaults.json || null; - this.auth = defaults.auth || null; -}; - -Config.prototype = { - get subdomain () { - return this._subdomain; - }, - - set subdomain (value) { - this._subdomain = value; - }, - - get logglyUrl () { - return 'https://' + [this._subdomain, 'loggly', 'com'].join('.') + '/api'; - }, - - get inputUrl () { - return 'https://logs.loggly.com/inputs/'; - } -}; diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly/core.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly/core.js deleted file mode 100644 index 9be1553..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly/core.js +++ /dev/null @@ -1,211 +0,0 @@ -/* - * core.js: Core functions for accessing Loggly - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var events = require('events'), - qs = require('querystring'), - config = require('./config'), - common = require('./common'), - Search = require('./search').Search, - Facet = require('./facet').Facet, - loggly = require('../loggly'); - -// -// function createClient (options) -// Creates a new instance of a Loggly client. -// -exports.createClient = function (options) { - return new Loggly(config.createConfig(options)); -}; - -// -// Loggly (config) -// Constructor for the Loggly object -// -var Loggly = exports.Loggly = function (config) { - this.config = config; -}; - -// -// function log (callback) -// logs args to input device -// -Loggly.prototype.log = function (inputId, msg, callback) { - var emitter = new (events.EventEmitter)(), - message; - - if (msg instanceof Object) { - message = this.config.json ? JSON.stringify(msg) : common.serialize(msg); - } - else { - message = this.config.json ? JSON.stringify({ message : msg }) : msg; - } - - var logOptions = { - uri: this.config.inputUrl + inputId, - method: 'POST', - body: message, - headers: { - 'Content-Type': this.config.json ? 'application/json' : 'text/plain' - } - }; - - common.loggly(logOptions, callback, function (res, body) { - try { - var result = JSON.parse(body); - if (callback) { - callback(null, result); - } - - emitter.emit('log', result); - } - catch (ex) { - if (callback) { - callback(new Error('Unspecified error from Loggly: ' + ex)); - } - } - }); - - return emitter; -}; - -// -// function search (query, callback) -// Returns a new search object which can be chained -// with options or called directly if @callback is passed -// initially. -// -// Sample Usage: -// -// client.search('404') -// .meta({ ip: '127.0.0.1' }) -// .context({ rows: 100 }) -// .run(function () { /* ... */ }); -// -Loggly.prototype.search = function (query, callback) { - return new Search(query, this, callback); -}; - -// -// function facet (facet, query, [options], callback) -// Performs a facet search against loggly with the -// specified facet, query and options. -// -Loggly.prototype.facet = function (facet, query, callback) { - return new Facet(facet, query, this, callback); -}; - - -// -// function getInputs ([raw], callback) -// Returns a list of all inputs for the authenicated account -// -Loggly.prototype.getInputs = function () { - var self = this, - args = Array.prototype.slice.call(arguments), - callback = args.pop(), - raw = args.length > 0 ? args[0] : false; - - common.loggly(this.logglyUrl('inputs'), this.config.auth, callback, function (res, body) { - var inputs = [], - results = JSON.parse(body); - - if (!raw) { - results.forEach(function (result) { - inputs.push(new (loggly.Input)(self, result)); - }); - - return callback(null, inputs); - } - - callback(null, results); - }); -}; - -// -// function getInput (name, callback) -// Returns the input with the specified name -// -Loggly.prototype.getInput = function (name, callback) { - var self = this; - this.getInputs(true, function (err, results) { - if (err) { - return callback(err); - } - - var matches = results.filter(function (r) { return r.name === name }), - input = null; - - if (matches.length > 0) { - input = new (loggly.Input)(self, matches[0]); - } - - callback(null, input); - }); -}; - -// -// function addDevice (inputId, address, callback) -// Adds the device at address to the input specified by inputId -// -Loggly.prototype.addDeviceToInput = function (inputId, address, callback) { - var addOptions = { - uri: this.logglyUrl('devices'), - auth: this.config.auth, - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded' - }, - body: qs.stringify({ 'input_id': inputId, 'ip': address }).replace('"', '') - }; - - common.loggly(addOptions, callback, function (res, body) { - callback(null, res); - }); -}; - -// -// function addDevice (inputId, callback) -// Adds the calling device to the input -// -Loggly.prototype.addDevice = function (inputId, callback) { - // - // Remark: This is not fully implemented yet - // - callback(new Error('Not Implemented Yet...')); - - //common.loggly(this.logglyUrl('inputs', inputId, 'adddevice'), this.config.auth, callback, function (res, body) { - //}); -}; - -// -// function getDevices (callback) -// Returns a list of all devices for the authenicated account -// -Loggly.prototype.getDevices = function (callback) { - var self = this; - common.loggly(this.logglyUrl('devices'), this.config.auth, callback, function (res, body) { - var results = JSON.parse(body), - devices = []; - - results.forEach(function (result) { - devices.push(new (loggly.Device)(self, result)); - }); - - callback(null, devices); - }); -}; - -// -// function logglyUrl ([path, to, resource]) -// Helper method that concats the string params into a url -// to request against a loggly serverUrl. -// -Loggly.prototype.logglyUrl = function (/* path, to, resource */) { - var args = Array.prototype.slice.call(arguments); - return [this.config.logglyUrl].concat(args).join('/'); -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly/device.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly/device.js deleted file mode 100644 index a06d74a..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly/device.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * device.js: Instance of a single Loggly device - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var Device = exports.Device = function (client, details) { - if (!details) throw new Error("Device must be constructed with at least basic details.") - - this.client = client; - this._setProperties(details); -}; - -Device.prototype.addToInput = function (inputId, callback) { - this.client.addDeviceToInput(inputId, this.id, callback); -}; - -// -// Sets the properties for this instance -// Parameters: details -// -Device.prototype._setProperties = function (details) { - // Copy the properties to this instance - var self = this; - Object.keys(details).forEach(function (key) { - self[key] = details[key]; - }); -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly/facet.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly/facet.js deleted file mode 100644 index a17abf9..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly/facet.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * facet.js: Chainable search functions for Loggly facet searches. - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var util = require('util'), - Search = require('./search').Search; - -// -// function Facet (facet, query, client, callback) -// Chainable facet search object for Loggly API -// -var Facet = exports.Facet = function (facet, query, client, callback) { - if (['date', 'ip', 'input'].indexOf(facet) === -1) { - var error = new Error('Cannot search with unknown facet: ' + facet); - - if (callback) { - return callback(error); - } - else { - throw error; - } - } - - // - // Set the baseUrl to be facet/:facet? - // - this.baseUrl = ['facets', facet + '?'].join('/'); - - // - // Call the base constructor. - // - Search.call(this, query, client, callback); -}; - -// -// Inherit from `loggly.Search`. -// -util.inherits(Facet, Search); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly/input.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly/input.js deleted file mode 100644 index 1e02b85..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly/input.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * input.js: Instance of a single Loggly input - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var Input = exports.Input = function (client, details) { - if (!details) { - throw new Error("Input must be constructed with at least basic details."); - } - - this.client = client; - this._setProperties(details); -}; - -Input.prototype.log = function (msg, callback) { - return this.client.log(this.input_token, msg, callback); -}; - -Input.prototype.addDevice = function (address, callback) { - this.client.addDeviceToInput(this.id, address, callback); -}; - -// -// Sets the properties for this instance -// Parameters: details -// -Input.prototype._setProperties = function (details) { - // Copy the properties to this instance - var self = this; - Object.keys(details).forEach(function (key) { - self[key] = details[key]; - }); -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly/search.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly/search.js deleted file mode 100644 index 09dd437..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/lib/loggly/search.js +++ /dev/null @@ -1,130 +0,0 @@ -/* - * search.js: chainable search functions for Loggly - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var qs = require('querystring'), - timespan = require('timespan'), - common = require('./common'); - -// -// function Search (query, client, callback) -// Chainable search object for Loggly API -// -var Search = exports.Search = function (query, client, callback) { - this.query = query; - this.client = client; - - if (!this.baseUrl) { - this.baseUrl = 'search?'; - } - - // - // If we're passed a callback, run immediately. - // - if (callback) { - this.callback = callback; - this.run(); - } -}; - -// -// function meta (meta) -// Sets the appropriate metadata for this search query: -// e.g. ip, inputname -// -Search.prototype.meta = function (meta) { - this._meta = meta; - return this; -}; - -// -// function context (context) -// Sets the appropriate context for this search query: -// e.g. rows, start, from, until, order, format, fields -// -Search.prototype.context = function (context) { - this._context = context; - return this; -}; - -// -// ### function run (callback) -// #### @callback {function} Continuation to respond to when complete -// Runs the search query for for this instance with the query, metadata, -// context, and other parameters that have been configured on it. -// -Search.prototype.run = function (callback) { - var rangeError; - - // - // Trim the search query - // - this.query.trim(); - - // - // Update the callback for this instance if it's passed - // - this.callback = callback || this.callback; - if (!this.callback) { - throw new Error('Cannot run search without a callback function.'); - } - - // If meta was passed, update the search query appropriately - if (this._meta) { - this.query += ' ' + qs.unescape(qs.stringify(this._meta, ' ', ':')); - } - - // Set the context for the query string - this._context = this._context || {}; - this._context.q = this.query; - this._checkRange(); - - var self = this, searchOptions = { - uri: this.client.logglyUrl(this.baseUrl + qs.stringify(this._context)), - auth: this.client.config.auth - }; - - common.loggly(searchOptions, this.callback, function (res, body) { - self.callback(null, JSON.parse(body)); - }); - - return this; -}; - -// -// ### function _checkRange () -// Checks if the range that has been configured for this -// instance is valid and updates if it is not. -// -Search.prototype._checkRange = function () { - if (!this._context || (!this._context.until && !this._context.from)) { - return; - } - - this._context.until = this._context.until || 'NOW'; - this._context.from = this._context.from || 'NOW-24HOURS'; - - if (!timespan.parseDate(this._context.until)) { - this._context.until = 'NOW'; - } - - if (!timespan.parseDate(this._context.from)) { - this._context.from = 'NOW-24HOURS'; - } - - if (timespan.fromDates(this._context.from, this._context.until) < 0 - || this._context.until === this._context.from) { - // - // If the length of the timespan for this Search instance is - // negative then set it to default values - // - this._context.until = 'NOW'; - this._context.from = 'NOW-24HOURS'; - } - - return this; -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/LICENSE b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/LICENSE deleted file mode 100644 index a4a9aee..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/LICENSE +++ /dev/null @@ -1,55 +0,0 @@ -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of this License; and - -You must cause any modified files to carry prominent notices stating that You changed the files; and - -You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - -If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/README.md b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/README.md deleted file mode 100644 index e5839b5..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/README.md +++ /dev/null @@ -1,288 +0,0 @@ -# Request -- Simplified HTTP request method - -## Install - -
        -  npm install request
        -
        - -Or from source: - -
        -  git clone git://github.com/mikeal/request.git 
        -  cd request
        -  npm link
        -
        - -## Super simple to use - -Request is designed to be the simplest way possible to make http calls. It support HTTPS and follows redirects by default. - -```javascript -var request = require('request'); -request('http://www.google.com', function (error, response, body) { - if (!error && response.statusCode == 200) { - console.log(body) // Print the google web page. - } -}) -``` - -## Streaming - -You can stream any response to a file stream. - -```javascript -request('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png')) -``` - -You can also stream a file to a PUT or POST request. This method will also check the file extension against a mapping of file extensions to content-types, in this case `application/json`, and use the proper content-type in the PUT request if one is not already provided in the headers. - -```javascript -fs.createReadStream('file.json').pipe(request.put('http://mysite.com/obj.json')) -``` - -Request can also pipe to itself. When doing so the content-type and content-length will be preserved in the PUT headers. - -```javascript -request.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img.png')) -``` - -Now let's get fancy. - -```javascript -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - if (req.method === 'PUT') { - req.pipe(request.put('http://mysite.com/doodle.png')) - } else if (req.method === 'GET' || req.method === 'HEAD') { - request.get('http://mysite.com/doodle.png').pipe(resp) - } - } -}) -``` - -You can also pipe() from a http.ServerRequest instance and to a http.ServerResponse instance. The HTTP method and headers will be sent as well as the entity-body data. Which means that, if you don't really care about security, you can do: - -```javascript -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - var x = request('http://mysite.com/doodle.png') - req.pipe(x) - x.pipe(resp) - } -}) -``` - -And since pipe() returns the destination stream in node 0.5.x you can do one line proxying :) - -```javascript -req.pipe(request('http://mysite.com/doodle.png')).pipe(resp) -``` - -Also, none of this new functionality conflicts with requests previous features, it just expands them. - -```javascript -var r = request.defaults({'proxy':'http://localproxy.com'}) - -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - r.get('http://google.com/doodle.png').pipe(resp) - } -}) -``` - -You can still use intermediate proxies, the requests will still follow HTTP forwards, etc. - -## OAuth Signing - -```javascript -// Twitter OAuth -var qs = require('querystring') - , oauth = - { callback: 'http://mysite.com/callback/' - , consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - } - , url = 'https://api.twitter.com/oauth/request_token' - ; -request.post({url:url, oauth:oauth}, function (e, r, body) { - // Assume by some stretch of magic you aquired the verifier - var access_token = qs.parse(body) - , oauth = - { consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - , token: access_token.oauth_token - , verifier: VERIFIER - , token_secret: access_token.oauth_token_secret - } - , url = 'https://api.twitter.com/oauth/access_token' - ; - request.post({url:url, oauth:oauth}, function (e, r, body) { - var perm_token = qs.parse(body) - , oauth = - { consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - , token: perm_token.oauth_token - , token_secret: perm_token.oauth_token_secret - } - , url = 'https://api.twitter.com/1/users/show.json?' - , params = - { screen_name: perm_token.screen_name - , user_id: perm_token.user_id - } - ; - url += qs.stringify(params) - request.get({url:url, oauth:oauth, json:true}, function (e, r, user) { - console.log(user) - }) - }) -}) -``` - - - -### request(options, callback) - -The first argument can be either a url or an options object. The only required option is uri, all others are optional. - -* `uri` || `url` - fully qualified uri or a parsed url object from url.parse() -* `qs` - object containing querystring values to be appended to the uri -* `method` - http method, defaults to GET -* `headers` - http headers, defaults to {} -* `body` - entity body for POST and PUT requests. Must be buffer or string. -* `form` - sets `body` but to querystring representation of value and adds `Content-type: application/x-www-form-urlencoded; charset=utf-8` header. -* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. -* `multipart` - (experimental) array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See example below. -* `followRedirect` - follow HTTP 3xx responses as redirects. defaults to true. -* `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects. defaults to false. -* `maxRedirects` - the maximum number of redirects to follow, defaults to 10. -* `onResponse` - If true the callback will be fired on the "response" event instead of "end". If a function it will be called on "response" and not effect the regular semantics of the main callback on "end". -* `encoding` - Encoding to be used on `setEncoding` of response data. If set to `null`, the body is returned as a Buffer. -* `pool` - A hash object containing the agents for these requests. If omitted this request will use the global pool which is set to node's default maxSockets. -* `pool.maxSockets` - Integer containing the maximum amount of sockets in the pool. -* `timeout` - Integer containing the number of milliseconds to wait for a request to respond before aborting the request -* `proxy` - An HTTP proxy to be used. Support proxy Auth with Basic Auth the same way it's supported with the `url` parameter by embedding the auth info in the uri. -* `oauth` - Options for OAuth HMAC-SHA1 signing, see documentation above. -* `strictSSL` - Set to `true` to require that SSL certificates be valid. Note: to use your own certificate authority, you need to specify an agent that was created with that ca as an option. -* `jar` - Set to `false` if you don't want cookies to be remembered for future use or define your custom cookie jar (see examples section) - - -The callback argument gets 3 arguments. The first is an error when applicable (usually from the http.Client option not the http.ClientRequest object). The second in an http.ClientResponse object. The third is the response body String or Buffer. - -## Convenience methods - -There are also shorthand methods for different HTTP METHODs and some other conveniences. - -### request.defaults(options) - -This method returns a wrapper around the normal request API that defaults to whatever options you pass in to it. - -### request.put - -Same as request() but defaults to `method: "PUT"`. - -```javascript -request.put(url) -``` - -### request.post - -Same as request() but defaults to `method: "POST"`. - -```javascript -request.post(url) -``` - -### request.head - -Same as request() but defaults to `method: "HEAD"`. - -```javascript -request.head(url) -``` - -### request.del - -Same as request() but defaults to `method: "DELETE"`. - -```javascript -request.del(url) -``` - -### request.get - -Alias to normal request method for uniformity. - -```javascript -request.get(url) -``` -### request.cookie - -Function that creates a new cookie. - -```javascript -request.cookie('cookie_string_here') -``` -### request.jar - -Function that creates a new cookie jar. - -```javascript -request.jar() -``` - - -## Examples: - -```javascript - var request = require('request') - , rand = Math.floor(Math.random()*100000000).toString() - ; - request( - { method: 'PUT' - , uri: 'http://mikeal.iriscouch.com/testjs/' + rand - , multipart: - [ { 'content-type': 'application/json' - , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) - } - , { body: 'I am an attachment' } - ] - } - , function (error, response, body) { - if(response.statusCode == 201){ - console.log('document saved as: http://mikeal.iriscouch.com/testjs/'+ rand) - } else { - console.log('error: '+ response.statusCode) - console.log(body) - } - } - ) -``` -Cookies are enabled by default (so they can be used in subsequent requests). To disable cookies set jar to false (either in defaults or in the options sent). - -```javascript -var request = request.defaults({jar: false}) -request('http://www.google.com', function () { - request('http://images.google.com') -}) -``` - -If you to use a custom cookie jar (instead of letting request use its own global cookie jar) you do so by setting the jar default or by specifying it as an option: - -```javascript -var j = request.jar() -var request = request.defaults({jar:j}) -request('http://www.google.com', function () { - request('http://images.google.com') -}) -``` -OR - -```javascript -var j = request.jar() -var cookie = request.cookie('your_cookie_here') -j.add(cookie) -request({url: 'http://www.google.com', jar: j}, function () { - request('http://images.google.com') -}) -``` diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/forever.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/forever.js deleted file mode 100644 index ac853c0..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/forever.js +++ /dev/null @@ -1,103 +0,0 @@ -module.exports = ForeverAgent -ForeverAgent.SSL = ForeverAgentSSL - -var util = require('util') - , Agent = require('http').Agent - , net = require('net') - , tls = require('tls') - , AgentSSL = require('https').Agent - -function ForeverAgent(options) { - var self = this - self.options = options || {} - self.requests = {} - self.sockets = {} - self.freeSockets = {} - self.maxSockets = self.options.maxSockets || Agent.defaultMaxSockets - self.minSockets = self.options.minSockets || ForeverAgent.defaultMinSockets - self.on('free', function(socket, host, port) { - var name = host + ':' + port - if (self.requests[name] && self.requests[name].length) { - self.requests[name].shift().onSocket(socket) - } else if (self.sockets[name].length < self.minSockets) { - if (!self.freeSockets[name]) self.freeSockets[name] = [] - self.freeSockets[name].push(socket) - - // if an error happens while we don't use the socket anyway, meh, throw the socket away - function onIdleError() { - socket.destroy() - } - socket._onIdleError = onIdleError - socket.on('error', onIdleError) - } else { - // If there are no pending requests just destroy the - // socket and it will get removed from the pool. This - // gets us out of timeout issues and allows us to - // default to Connection:keep-alive. - socket.destroy(); - } - }) - -} -util.inherits(ForeverAgent, Agent) - -ForeverAgent.defaultMinSockets = 5 - - -ForeverAgent.prototype.createConnection = net.createConnection -ForeverAgent.prototype.addRequestNoreuse = Agent.prototype.addRequest -ForeverAgent.prototype.addRequest = function(req, host, port) { - var name = host + ':' + port - if (this.freeSockets[name] && this.freeSockets[name].length > 0 && !req.useChunkedEncodingByDefault) { - var idleSocket = this.freeSockets[name].pop() - idleSocket.removeListener('error', idleSocket._onIdleError) - delete idleSocket._onIdleError - req._reusedSocket = true - req.onSocket(idleSocket) - } else { - this.addRequestNoreuse(req, host, port) - } -} - -ForeverAgent.prototype.removeSocket = function(s, name, host, port) { - if (this.sockets[name]) { - var index = this.sockets[name].indexOf(s); - if (index !== -1) { - this.sockets[name].splice(index, 1); - } - } else if (this.sockets[name] && this.sockets[name].length === 0) { - // don't leak - delete this.sockets[name]; - delete this.requests[name]; - } - - if (this.freeSockets[name]) { - var index = this.freeSockets[name].indexOf(s) - if (index !== -1) { - this.freeSockets[name].splice(index, 1) - if (this.freeSockets[name].length === 0) { - delete this.freeSockets[name] - } - } - } - - if (this.requests[name] && this.requests[name].length) { - // If we have pending requests and a socket gets closed a new one - // needs to be created to take over in the pool for the one that closed. - this.createSocket(name, host, port).emit('free'); - } -} - -function ForeverAgentSSL (options) { - ForeverAgent.call(this, options) -} -util.inherits(ForeverAgentSSL, ForeverAgent) - -ForeverAgentSSL.prototype.createConnection = createConnectionSSL -ForeverAgentSSL.prototype.addRequestNoreuse = AgentSSL.prototype.addRequest - -function createConnectionSSL (port, host, options) { - options.port = port - options.host = host - return tls.connect(options) -} diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/main.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/main.js deleted file mode 100644 index f651202..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/main.js +++ /dev/null @@ -1,874 +0,0 @@ -// Copyright 2010-2012 Mikeal Rogers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -var http = require('http') - , https = false - , tls = false - , url = require('url') - , util = require('util') - , stream = require('stream') - , qs = require('querystring') - , mimetypes = require('./mimetypes') - , oauth = require('./oauth') - , uuid = require('./uuid') - , ForeverAgent = require('./forever') - , Cookie = require('./vendor/cookie') - , CookieJar = require('./vendor/cookie/jar') - , cookieJar = new CookieJar - , tunnel = require('./tunnel') - ; - -if (process.logging) { - var log = process.logging('request') -} - -try { - https = require('https') -} catch (e) {} - -try { - tls = require('tls') -} catch (e) {} - -function toBase64 (str) { - return (new Buffer(str || "", "ascii")).toString("base64") -} - -// Hacky fix for pre-0.4.4 https -if (https && !https.Agent) { - https.Agent = function (options) { - http.Agent.call(this, options) - } - util.inherits(https.Agent, http.Agent) - https.Agent.prototype._getConnection = function(host, port, cb) { - var s = tls.connect(port, host, this.options, function() { - // do other checks here? - if (cb) cb() - }) - return s - } -} - -function isReadStream (rs) { - if (rs.readable && rs.path && rs.mode) { - return true - } -} - -function copy (obj) { - var o = {} - Object.keys(obj).forEach(function (i) { - o[i] = obj[i] - }) - return o -} - -var isUrl = /^https?:/ - -var globalPool = {} - -function Request (options) { - stream.Stream.call(this) - this.readable = true - this.writable = true - - if (typeof options === 'string') { - options = {uri:options} - } - - var reserved = Object.keys(Request.prototype) - for (var i in options) { - if (reserved.indexOf(i) === -1) { - this[i] = options[i] - } else { - if (typeof options[i] === 'function') { - delete options[i] - } - } - } - options = copy(options) - - this.init(options) -} -util.inherits(Request, stream.Stream) -Request.prototype.init = function (options) { - var self = this - - if (!options) options = {} - - if (!self.pool) self.pool = globalPool - self.dests = [] - self.__isRequestRequest = true - - // Protect against double callback - if (!self._callback && self.callback) { - self._callback = self.callback - self.callback = function () { - if (self._callbackCalled) return // Print a warning maybe? - self._callback.apply(self, arguments) - self._callbackCalled = true - } - } - - if (self.url) { - // People use this property instead all the time so why not just support it. - self.uri = self.url - delete self.url - } - - if (!self.uri) { - throw new Error("options.uri is a required argument") - } else { - if (typeof self.uri == "string") self.uri = url.parse(self.uri) - } - if (self.proxy) { - if (typeof self.proxy == 'string') self.proxy = url.parse(self.proxy) - - // do the HTTP CONNECT dance using koichik/node-tunnel - if (http.globalAgent && self.uri.protocol === "https:") { - self.tunnel = true - var tunnelFn = self.proxy.protocol === "http:" - ? tunnel.httpsOverHttp : tunnel.httpsOverHttps - - var tunnelOptions = { proxy: { host: self.proxy.hostname - , port: +self.proxy.port } - , ca: this.ca } - - self.agent = tunnelFn(tunnelOptions) - self.tunnel = true - } - } - - self._redirectsFollowed = self._redirectsFollowed || 0 - self.maxRedirects = (self.maxRedirects !== undefined) ? self.maxRedirects : 10 - self.followRedirect = (self.followRedirect !== undefined) ? self.followRedirect : true - self.followAllRedirects = (self.followAllRedirects !== undefined) ? self.followAllRedirects : false; - if (self.followRedirect || self.followAllRedirects) - self.redirects = self.redirects || [] - - self.headers = self.headers ? copy(self.headers) : {} - - self.setHost = false - if (!self.headers.host) { - self.headers.host = self.uri.hostname - if (self.uri.port) { - if ( !(self.uri.port === 80 && self.uri.protocol === 'http:') && - !(self.uri.port === 443 && self.uri.protocol === 'https:') ) - self.headers.host += (':'+self.uri.port) - } - self.setHost = true - } - - self.jar(options.jar) - - if (!self.uri.pathname) {self.uri.pathname = '/'} - if (!self.uri.port) { - if (self.uri.protocol == 'http:') {self.uri.port = 80} - else if (self.uri.protocol == 'https:') {self.uri.port = 443} - } - - if (self.proxy && !self.tunnel) { - self.port = self.proxy.port - self.host = self.proxy.hostname - } else { - self.port = self.uri.port - self.host = self.uri.hostname - } - - if (self.onResponse === true) { - self.onResponse = self.callback - delete self.callback - } - - self.clientErrorHandler = function (error) { - if (self._aborted) return - - if (self.setHost) delete self.headers.host - if (self.req._reusedSocket && error.code === 'ECONNRESET' - && self.agent.addRequestNoreuse) { - self.agent = { addRequest: self.agent.addRequestNoreuse.bind(self.agent) } - self.start() - self.req.end() - return - } - if (self.timeout && self.timeoutTimer) { - clearTimeout(self.timeoutTimer); - self.timeoutTimer = null; - } - self.emit('error', error) - } - if (self.onResponse) self.on('error', function (e) {self.onResponse(e)}) - if (self.callback) self.on('error', function (e) {self.callback(e)}) - - if (options.form) { - self.form(options.form) - } - - if (options.oauth) { - self.oauth(options.oauth) - } - - if (self.uri.auth && !self.headers.authorization) { - self.headers.authorization = "Basic " + toBase64(self.uri.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':')) - } - if (self.proxy && self.proxy.auth && !self.headers['proxy-authorization'] && !self.tunnel) { - self.headers['proxy-authorization'] = "Basic " + toBase64(self.proxy.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':')) - } - - if (options.qs) self.qs(options.qs) - - if (self.uri.path) { - self.path = self.uri.path - } else { - self.path = self.uri.pathname + (self.uri.search || "") - } - - if (self.path.length === 0) self.path = '/' - - if (self.proxy && !self.tunnel) self.path = (self.uri.protocol + '//' + self.uri.host + self.path) - - if (options.json) { - self.json(options.json) - } else if (options.multipart) { - self.multipart(options.multipart) - } - - if (self.body) { - var length = 0 - if (!Buffer.isBuffer(self.body)) { - if (Array.isArray(self.body)) { - for (var i = 0; i < self.body.length; i++) { - length += self.body[i].length - } - } else { - self.body = new Buffer(self.body) - length = self.body.length - } - } else { - length = self.body.length - } - if (length) { - self.headers['content-length'] = length - } else { - throw new Error('Argument error, options.body.') - } - } - - var protocol = self.proxy && !self.tunnel ? self.proxy.protocol : self.uri.protocol - , defaultModules = {'http:':http, 'https:':https} - , httpModules = self.httpModules || {} - ; - self.httpModule = httpModules[protocol] || defaultModules[protocol] - - if (!self.httpModule) throw new Error("Invalid protocol") - - if (options.ca) self.ca = options.ca - - if (!self.agent) { - if (options.agentOptions) self.agentOptions = options.agentOptions - - if (options.agentClass) { - self.agentClass = options.agentClass - } else if (options.forever) { - self.agentClass = protocol === 'http:' ? ForeverAgent : ForeverAgent.SSL - } else { - self.agentClass = self.httpModule.Agent - } - } - - if (self.pool === false) { - self.agent = false - } else { - self.agent = self.agent || self.getAgent() - if (self.maxSockets) { - // Don't use our pooling if node has the refactored client - self.agent.maxSockets = self.maxSockets - } - if (self.pool.maxSockets) { - // Don't use our pooling if node has the refactored client - self.agent.maxSockets = self.pool.maxSockets - } - } - - self.once('pipe', function (src) { - if (self.ntick) throw new Error("You cannot pipe to this stream after the first nextTick() after creation of the request stream.") - self.src = src - if (isReadStream(src)) { - if (!self.headers['content-type'] && !self.headers['Content-Type']) - self.headers['content-type'] = mimetypes.lookup(src.path.slice(src.path.lastIndexOf('.')+1)) - } else { - if (src.headers) { - for (var i in src.headers) { - if (!self.headers[i]) { - self.headers[i] = src.headers[i] - } - } - } - if (src.method && !self.method) { - self.method = src.method - } - } - - self.on('pipe', function () { - console.error("You have already piped to this stream. Pipeing twice is likely to break the request.") - }) - }) - - process.nextTick(function () { - if (self._aborted) return - - if (self.body) { - if (Array.isArray(self.body)) { - self.body.forEach(function(part) { - self.write(part) - }) - } else { - self.write(self.body) - } - self.end() - } else if (self.requestBodyStream) { - console.warn("options.requestBodyStream is deprecated, please pass the request object to stream.pipe.") - self.requestBodyStream.pipe(self) - } else if (!self.src) { - self.headers['content-length'] = 0 - self.end() - } - self.ntick = true - }) -} - -Request.prototype.getAgent = function () { - var Agent = this.agentClass - var options = {} - if (this.agentOptions) { - for (var i in this.agentOptions) { - options[i] = this.agentOptions[i] - } - } - if (this.ca) options.ca = this.ca - - var poolKey = '' - - // different types of agents are in different pools - if (Agent !== this.httpModule.Agent) { - poolKey += Agent.name - } - - if (!this.httpModule.globalAgent) { - // node 0.4.x - options.host = this.host - options.port = this.port - if (poolKey) poolKey += ':' - poolKey += this.host + ':' + this.port - } - - if (options.ca) { - if (poolKey) poolKey += ':' - poolKey += options.ca - } - - if (!poolKey && Agent === this.httpModule.Agent && this.httpModule.globalAgent) { - // not doing anything special. Use the globalAgent - return this.httpModule.globalAgent - } - - // already generated an agent for this setting - if (this.pool[poolKey]) return this.pool[poolKey] - - return this.pool[poolKey] = new Agent(options) -} - -Request.prototype.start = function () { - var self = this - - if (self._aborted) return - - self._started = true - self.method = self.method || 'GET' - self.href = self.uri.href - if (log) log('%method %href', self) - self.req = self.httpModule.request(self, function (response) { - if (self._aborted) return - if (self._paused) response.pause() - - self.response = response - response.request = self - - if (self.httpModule === https && - self.strictSSL && - !response.client.authorized) { - var sslErr = response.client.authorizationError - self.emit('error', new Error('SSL Error: '+ sslErr)) - return - } - - if (self.setHost) delete self.headers.host - if (self.timeout && self.timeoutTimer) { - clearTimeout(self.timeoutTimer); - self.timeoutTimer = null; - } - - if (response.headers['set-cookie'] && (!self._disableCookies)) { - response.headers['set-cookie'].forEach(function(cookie) { - if (self._jar) self._jar.add(new Cookie(cookie)) - else cookieJar.add(new Cookie(cookie)) - }) - } - - if (response.statusCode >= 300 && response.statusCode < 400 && - (self.followAllRedirects || - (self.followRedirect && (self.method !== 'PUT' && self.method !== 'POST' && self.method !== 'DELETE'))) && - response.headers.location) { - if (self._redirectsFollowed >= self.maxRedirects) { - self.emit('error', new Error("Exceeded maxRedirects. Probably stuck in a redirect loop.")) - return - } - self._redirectsFollowed += 1 - - if (!isUrl.test(response.headers.location)) { - response.headers.location = url.resolve(self.uri.href, response.headers.location) - } - self.uri = response.headers.location - self.redirects.push( - { statusCode : response.statusCode - , redirectUri: response.headers.location - } - ) - self.method = 'GET'; // Force all redirects to use GET - delete self.req - delete self.agent - delete self._started - if (self.headers) { - delete self.headers.host - } - if (log) log('Redirect to %uri', self) - self.init() - return // Ignore the rest of the response - } else { - self._redirectsFollowed = self._redirectsFollowed || 0 - // Be a good stream and emit end when the response is finished. - // Hack to emit end on close because of a core bug that never fires end - response.on('close', function () { - if (!self._ended) self.response.emit('end') - }) - - if (self.encoding) { - if (self.dests.length !== 0) { - console.error("Ingoring encoding parameter as this stream is being piped to another stream which makes the encoding option invalid.") - } else { - response.setEncoding(self.encoding) - } - } - - self.dests.forEach(function (dest) { - self.pipeDest(dest) - }) - - response.on("data", function (chunk) { - self._destdata = true - self.emit("data", chunk) - }) - response.on("end", function (chunk) { - self._ended = true - self.emit("end", chunk) - }) - response.on("close", function () {self.emit("close")}) - - self.emit('response', response) - - if (self.onResponse) { - self.onResponse(null, response) - } - if (self.callback) { - var buffer = [] - var bodyLen = 0 - self.on("data", function (chunk) { - buffer.push(chunk) - bodyLen += chunk.length - }) - self.on("end", function () { - if (self._aborted) return - - if (buffer.length && Buffer.isBuffer(buffer[0])) { - var body = new Buffer(bodyLen) - var i = 0 - buffer.forEach(function (chunk) { - chunk.copy(body, i, 0, chunk.length) - i += chunk.length - }) - if (self.encoding === null) { - response.body = body - } else { - response.body = body.toString() - } - } else if (buffer.length) { - response.body = buffer.join('') - } - - if (self._json) { - try { - response.body = JSON.parse(response.body) - } catch (e) {} - } - - self.callback(null, response, response.body) - }) - } - } - }) - - if (self.timeout && !self.timeoutTimer) { - self.timeoutTimer = setTimeout(function() { - self.req.abort() - var e = new Error("ETIMEDOUT") - e.code = "ETIMEDOUT" - self.emit("error", e) - }, self.timeout) - - // Set additional timeout on socket - in case if remote - // server freeze after sending headers - if (self.req.setTimeout) { // only works on node 0.6+ - self.req.setTimeout(self.timeout, function(){ - if (self.req) { - self.req.abort() - var e = new Error("ESOCKETTIMEDOUT") - e.code = "ESOCKETTIMEDOUT" - self.emit("error", e) - } - }) - } - } - - self.req.on('error', self.clientErrorHandler) - - self.emit('request', self.req) -} - -Request.prototype.abort = function() { - this._aborted = true; - - if (this.req) { - this.req.abort() - } - else if (this.response) { - this.response.abort() - } - - this.emit("abort") -} - -Request.prototype.pipeDest = function (dest) { - var response = this.response - // Called after the response is received - if (dest.headers) { - dest.headers['content-type'] = response.headers['content-type'] - if (response.headers['content-length']) { - dest.headers['content-length'] = response.headers['content-length'] - } - } - if (dest.setHeader) { - for (var i in response.headers) { - dest.setHeader(i, response.headers[i]) - } - dest.statusCode = response.statusCode - } - if (this.pipefilter) this.pipefilter(response, dest) -} - -// Composable API -Request.prototype.setHeader = function (name, value, clobber) { - if (clobber === undefined) clobber = true - if (clobber || !this.headers.hasOwnProperty(name)) this.headers[name] = value - else this.headers[name] += ',' + value - return this -} -Request.prototype.setHeaders = function (headers) { - for (i in headers) {this.setHeader(i, headers[i])} - return this -} -Request.prototype.qs = function (q, clobber) { - var uri = { - protocol: this.uri.protocol, - host: this.uri.host, - pathname: this.uri.pathname, - query: clobber ? q : qs.parse(this.uri.query), - hash: this.uri.hash - }; - if (!clobber) for (var i in q) uri.query[i] = q[i] - - this.uri= url.parse(url.format(uri)) - - return this -} -Request.prototype.form = function (form) { - this.headers['content-type'] = 'application/x-www-form-urlencoded; charset=utf-8' - this.body = qs.stringify(form).toString('utf8') - return this -} -Request.prototype.multipart = function (multipart) { - var self = this - self.body = [] - - if (!self.headers['content-type']) { - self.headers['content-type'] = 'multipart/related;boundary="frontier"'; - } else { - self.headers['content-type'] = self.headers['content-type'].split(';')[0] + ';boundary="frontier"'; - } - - if (!multipart.forEach) throw new Error('Argument error, options.multipart.') - - multipart.forEach(function (part) { - var body = part.body - if(!body) throw Error('Body attribute missing in multipart.') - delete part.body - var preamble = '--frontier\r\n' - Object.keys(part).forEach(function(key){ - preamble += key + ': ' + part[key] + '\r\n' - }) - preamble += '\r\n' - self.body.push(new Buffer(preamble)) - self.body.push(new Buffer(body)) - self.body.push(new Buffer('\r\n')) - }) - self.body.push(new Buffer('--frontier--')) - return self -} -Request.prototype.json = function (val) { - this.setHeader('content-type', 'application/json') - this.setHeader('accept', 'application/json') - this._json = true - if (typeof val === 'boolean') { - if (typeof this.body === 'object') this.body = JSON.stringify(this.body) - } else { - this.body = JSON.stringify(val) - } - return this -} -Request.prototype.oauth = function (_oauth) { - var form - if (this.headers['content-type'] && - this.headers['content-type'].slice(0, 'application/x-www-form-urlencoded'.length) === - 'application/x-www-form-urlencoded' - ) { - form = qs.parse(this.body) - } - if (this.uri.query) { - form = qs.parse(this.uri.query) - } - if (!form) form = {} - var oa = {} - for (var i in form) oa[i] = form[i] - for (var i in _oauth) oa['oauth_'+i] = _oauth[i] - if (!oa.oauth_version) oa.oauth_version = '1.0' - if (!oa.oauth_timestamp) oa.oauth_timestamp = Math.floor( (new Date()).getTime() / 1000 ).toString() - if (!oa.oauth_nonce) oa.oauth_nonce = uuid().replace(/-/g, '') - - oa.oauth_signature_method = 'HMAC-SHA1' - - var consumer_secret = oa.oauth_consumer_secret - delete oa.oauth_consumer_secret - var token_secret = oa.oauth_token_secret - delete oa.oauth_token_secret - - var baseurl = this.uri.protocol + '//' + this.uri.host + this.uri.pathname - var signature = oauth.hmacsign(this.method, baseurl, oa, consumer_secret, token_secret) - - // oa.oauth_signature = signature - for (var i in form) { - if ( i.slice(0, 'oauth_') in _oauth) { - // skip - } else { - delete oa['oauth_'+i] - } - } - this.headers.authorization = - 'OAuth '+Object.keys(oa).sort().map(function (i) {return i+'="'+oauth.rfc3986(oa[i])+'"'}).join(',') - this.headers.authorization += ',oauth_signature="'+oauth.rfc3986(signature)+'"' - return this -} -Request.prototype.jar = function (jar) { - var cookies - - if (this._redirectsFollowed === 0) { - this.originalCookieHeader = this.headers.cookie - } - - if (jar === false) { - // disable cookies - cookies = false; - this._disableCookies = true; - } else if (jar) { - // fetch cookie from the user defined cookie jar - cookies = jar.get({ url: this.uri.href }) - } else { - // fetch cookie from the global cookie jar - cookies = cookieJar.get({ url: this.uri.href }) - } - - if (cookies && cookies.length) { - var cookieString = cookies.map(function (c) { - return c.name + "=" + c.value - }).join("; ") - - if (this.originalCookieHeader) { - // Don't overwrite existing Cookie header - this.headers.cookie = this.originalCookieHeader + '; ' + cookieString - } else { - this.headers.cookie = cookieString - } - } - this._jar = jar - return this -} - - -// Stream API -Request.prototype.pipe = function (dest, opts) { - if (this.response) { - if (this._destdata) { - throw new Error("You cannot pipe after data has been emitted from the response.") - } else if (this._ended) { - throw new Error("You cannot pipe after the response has been ended.") - } else { - stream.Stream.prototype.pipe.call(this, dest, opts) - this.pipeDest(dest) - return dest - } - } else { - this.dests.push(dest) - stream.Stream.prototype.pipe.call(this, dest, opts) - return dest - } -} -Request.prototype.write = function () { - if (!this._started) this.start() - this.req.write.apply(this.req, arguments) -} -Request.prototype.end = function (chunk) { - if (chunk) this.write(chunk) - if (!this._started) this.start() - this.req.end() -} -Request.prototype.pause = function () { - if (!this.response) this._paused = true - else this.response.pause.apply(this.response, arguments) -} -Request.prototype.resume = function () { - if (!this.response) this._paused = false - else this.response.resume.apply(this.response, arguments) -} -Request.prototype.destroy = function () { - if (!this._ended) this.end() -} - -// organize params for post, put, head, del -function initParams(uri, options, callback) { - if ((typeof options === 'function') && !callback) callback = options; - if (typeof options === 'object') { - options.uri = uri; - } else if (typeof uri === 'string') { - options = {uri:uri}; - } else { - options = uri; - uri = options.uri; - } - return { uri: uri, options: options, callback: callback }; -} - -function request (uri, options, callback) { - if ((typeof options === 'function') && !callback) callback = options; - if (typeof options === 'object') { - options.uri = uri; - } else if (typeof uri === 'string') { - options = {uri:uri}; - } else { - options = uri; - } - - if (callback) options.callback = callback; - var r = new Request(options) - return r -} - -module.exports = request - -request.defaults = function (options) { - var def = function (method) { - var d = function (uri, opts, callback) { - var params = initParams(uri, opts, callback); - for (var i in options) { - if (params.options[i] === undefined) params.options[i] = options[i] - } - return method(params.uri, params.options, params.callback) - } - return d - } - var de = def(request) - de.get = def(request.get) - de.post = def(request.post) - de.put = def(request.put) - de.head = def(request.head) - de.del = def(request.del) - de.cookie = def(request.cookie) - de.jar = def(request.jar) - return de -} - -request.forever = function (agentOptions, optionsArg) { - var options = {} - if (optionsArg) { - for (option in optionsArg) { - options[option] = optionsArg[option] - } - } - if (agentOptions) options.agentOptions = agentOptions - options.forever = true - return request.defaults(options) -} - -request.get = request -request.post = function (uri, options, callback) { - var params = initParams(uri, options, callback); - params.options.method = 'POST'; - return request(params.uri, params.options, params.callback) -} -request.put = function (uri, options, callback) { - var params = initParams(uri, options, callback); - params.options.method = 'PUT' - return request(params.uri, params.options, params.callback) -} -request.head = function (uri, options, callback) { - var params = initParams(uri, options, callback); - params.options.method = 'HEAD' - if (params.options.body || - params.options.requestBodyStream || - (params.options.json && typeof params.options.json !== 'boolean') || - params.options.multipart) { - throw new Error("HTTP HEAD requests MUST NOT include a request body.") - } - return request(params.uri, params.options, params.callback) -} -request.del = function (uri, options, callback) { - var params = initParams(uri, options, callback); - params.options.method = 'DELETE' - return request(params.uri, params.options, params.callback) -} -request.jar = function () { - return new CookieJar -} -request.cookie = function (str) { - if (str && str.uri) str = str.uri - if (typeof str !== 'string') throw new Error("The cookie function only accepts STRING as param") - return new Cookie(str) -} diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/mimetypes.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/mimetypes.js deleted file mode 100644 index 59b21b4..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/mimetypes.js +++ /dev/null @@ -1,152 +0,0 @@ -// from http://github.com/felixge/node-paperboy -exports.types = { - "3gp":"video/3gpp", - "aiff":"audio/x-aiff", - "arj":"application/x-arj-compressed", - "asf":"video/x-ms-asf", - "asx":"video/x-ms-asx", - "au":"audio/ulaw", - "avi":"video/x-msvideo", - "bcpio":"application/x-bcpio", - "ccad":"application/clariscad", - "cod":"application/vnd.rim.cod", - "com":"application/x-msdos-program", - "cpio":"application/x-cpio", - "cpt":"application/mac-compactpro", - "csh":"application/x-csh", - "css":"text/css", - "deb":"application/x-debian-package", - "dl":"video/dl", - "doc":"application/msword", - "drw":"application/drafting", - "dvi":"application/x-dvi", - "dwg":"application/acad", - "dxf":"application/dxf", - "dxr":"application/x-director", - "etx":"text/x-setext", - "ez":"application/andrew-inset", - "fli":"video/x-fli", - "flv":"video/x-flv", - "gif":"image/gif", - "gl":"video/gl", - "gtar":"application/x-gtar", - "gz":"application/x-gzip", - "hdf":"application/x-hdf", - "hqx":"application/mac-binhex40", - "html":"text/html", - "ice":"x-conference/x-cooltalk", - "ico":"image/x-icon", - "ief":"image/ief", - "igs":"model/iges", - "ips":"application/x-ipscript", - "ipx":"application/x-ipix", - "jad":"text/vnd.sun.j2me.app-descriptor", - "jar":"application/java-archive", - "jpeg":"image/jpeg", - "jpg":"image/jpeg", - "js":"text/javascript", - "json":"application/json", - "latex":"application/x-latex", - "lsp":"application/x-lisp", - "lzh":"application/octet-stream", - "m":"text/plain", - "m3u":"audio/x-mpegurl", - "m4v":"video/mp4", - "man":"application/x-troff-man", - "me":"application/x-troff-me", - "midi":"audio/midi", - "mif":"application/x-mif", - "mime":"www/mime", - "mkv":" video/x-matrosk", - "movie":"video/x-sgi-movie", - "mp4":"video/mp4", - "mp41":"video/mp4", - "mp42":"video/mp4", - "mpg":"video/mpeg", - "mpga":"audio/mpeg", - "ms":"application/x-troff-ms", - "mustache":"text/plain", - "nc":"application/x-netcdf", - "oda":"application/oda", - "ogm":"application/ogg", - "pbm":"image/x-portable-bitmap", - "pdf":"application/pdf", - "pgm":"image/x-portable-graymap", - "pgn":"application/x-chess-pgn", - "pgp":"application/pgp", - "pm":"application/x-perl", - "png":"image/png", - "pnm":"image/x-portable-anymap", - "ppm":"image/x-portable-pixmap", - "ppz":"application/vnd.ms-powerpoint", - "pre":"application/x-freelance", - "prt":"application/pro_eng", - "ps":"application/postscript", - "qt":"video/quicktime", - "ra":"audio/x-realaudio", - "rar":"application/x-rar-compressed", - "ras":"image/x-cmu-raster", - "rgb":"image/x-rgb", - "rm":"audio/x-pn-realaudio", - "rpm":"audio/x-pn-realaudio-plugin", - "rtf":"text/rtf", - "rtx":"text/richtext", - "scm":"application/x-lotusscreencam", - "set":"application/set", - "sgml":"text/sgml", - "sh":"application/x-sh", - "shar":"application/x-shar", - "silo":"model/mesh", - "sit":"application/x-stuffit", - "skt":"application/x-koan", - "smil":"application/smil", - "snd":"audio/basic", - "sol":"application/solids", - "spl":"application/x-futuresplash", - "src":"application/x-wais-source", - "stl":"application/SLA", - "stp":"application/STEP", - "sv4cpio":"application/x-sv4cpio", - "sv4crc":"application/x-sv4crc", - "svg":"image/svg+xml", - "swf":"application/x-shockwave-flash", - "tar":"application/x-tar", - "tcl":"application/x-tcl", - "tex":"application/x-tex", - "texinfo":"application/x-texinfo", - "tgz":"application/x-tar-gz", - "tiff":"image/tiff", - "tr":"application/x-troff", - "tsi":"audio/TSP-audio", - "tsp":"application/dsptype", - "tsv":"text/tab-separated-values", - "unv":"application/i-deas", - "ustar":"application/x-ustar", - "vcd":"application/x-cdlink", - "vda":"application/vda", - "vivo":"video/vnd.vivo", - "vrm":"x-world/x-vrml", - "wav":"audio/x-wav", - "wax":"audio/x-ms-wax", - "webm":"video/webm", - "wma":"audio/x-ms-wma", - "wmv":"video/x-ms-wmv", - "wmx":"video/x-ms-wmx", - "wrl":"model/vrml", - "wvx":"video/x-ms-wvx", - "xbm":"image/x-xbitmap", - "xlw":"application/vnd.ms-excel", - "xml":"text/xml", - "xpm":"image/x-xpixmap", - "xwd":"image/x-xwindowdump", - "xyz":"chemical/x-pdb", - "zip":"application/zip" -}; - -exports.lookup = function(ext, defaultType) { - defaultType = defaultType || 'application/octet-stream'; - - return (ext in exports.types) - ? exports.types[ext] - : defaultType; -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/oauth.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/oauth.js deleted file mode 100644 index 31b9dc6..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/oauth.js +++ /dev/null @@ -1,34 +0,0 @@ -var crypto = require('crypto') - , qs = require('querystring') - ; - -function sha1 (key, body) { - return crypto.createHmac('sha1', key).update(body).digest('base64') -} - -function rfc3986 (str) { - return encodeURIComponent(str) - .replace('!','%21') - .replace('*','%2A') - .replace('(','%28') - .replace(')','%29') - .replace("'",'%27') - ; -} - -function hmacsign (httpMethod, base_uri, params, consumer_secret, token_secret, body) { - // adapted from https://dev.twitter.com/docs/auth/oauth - var base = - (httpMethod || 'GET') + "&" + - encodeURIComponent( base_uri ) + "&" + - Object.keys(params).sort().map(function (i) { - // big WTF here with the escape + encoding but it's what twitter wants - return escape(rfc3986(i)) + "%3D" + escape(rfc3986(params[i])) - }).join("%26") - var key = consumer_secret + '&' - if (token_secret) key += token_secret - return sha1(key, base) -} - -exports.hmacsign = hmacsign -exports.rfc3986 = rfc3986 \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/package.json b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/package.json deleted file mode 100644 index 3779d19..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "request", - "description": "Simplified HTTP request client.", - "tags": [ - "http", - "simple", - "util", - "utility" - ], - "version": "2.9.153", - "author": { - "name": "Mikeal Rogers", - "email": "mikeal.rogers@gmail.com" - }, - "repository": { - "type": "git", - "url": "git://github.com/mikeal/request.git" - }, - "bugs": { - "url": "http://github.com/mikeal/request/issues" - }, - "engines": [ - "node >= 0.3.6" - ], - "main": "./main", - "scripts": { - "test": "node tests/run.js" - }, - "_id": "request@2.9.153", - "dependencies": {}, - "devDependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "request@2.9.x" -} diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/googledoodle.png b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/googledoodle.png deleted file mode 100644 index f80c9c5..0000000 Binary files a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/googledoodle.png and /dev/null differ diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/run.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/run.js deleted file mode 100644 index 6011846..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/run.js +++ /dev/null @@ -1,37 +0,0 @@ -var spawn = require('child_process').spawn - , exitCode = 0 - ; - -var tests = [ - 'test-body.js' - , 'test-cookie.js' - , 'test-cookiejar.js' - , 'test-defaults.js' - , 'test-errors.js' - , 'test-headers.js' - , 'test-httpModule.js' - , 'test-https.js' - , 'test-https-strict.js' - , 'test-oauth.js' - , 'test-pipes.js' - , 'test-proxy.js' - , 'test-qs.js' - , 'test-redirect.js' - , 'test-timeout.js' - , 'test-tunnel.js' -] - -var next = function () { - if (tests.length === 0) process.exit(exitCode); - - var file = tests.shift() - console.log(file) - var proc = spawn('node', [ 'tests/' + file ]) - proc.stdout.pipe(process.stdout) - proc.stderr.pipe(process.stderr) - proc.on('exit', function (code) { - exitCode += code || 0 - next() - }) -} -next() diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/server.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/server.js deleted file mode 100644 index 921f512..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/server.js +++ /dev/null @@ -1,82 +0,0 @@ -var fs = require('fs') - , http = require('http') - , path = require('path') - , https = require('https') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - ; - -exports.createServer = function (port) { - port = port || 6767 - var s = http.createServer(function (req, resp) { - s.emit(req.url, req, resp); - }) - s.port = port - s.url = 'http://localhost:'+port - return s; -} - -exports.createSSLServer = function(port, opts) { - port = port || 16767 - - var options = { 'key' : path.join(__dirname, 'ssl', 'test.key') - , 'cert': path.join(__dirname, 'ssl', 'test.crt') - } - if (opts) { - for (var i in opts) options[i] = opts[i] - } - - for (var i in options) { - options[i] = fs.readFileSync(options[i]) - } - - var s = https.createServer(options, function (req, resp) { - s.emit(req.url, req, resp); - }) - s.port = port - s.url = 'https://localhost:'+port - return s; -} - -exports.createPostStream = function (text) { - var postStream = new stream.Stream(); - postStream.writeable = true; - postStream.readable = true; - setTimeout(function () {postStream.emit('data', new Buffer(text)); postStream.emit('end')}, 0); - return postStream; -} -exports.createPostValidator = function (text) { - var l = function (req, resp) { - var r = ''; - req.on('data', function (chunk) {r += chunk}) - req.on('end', function () { - if (r !== text) console.log(r, text); - assert.equal(r, text) - resp.writeHead(200, {'content-type':'text/plain'}) - resp.write('OK') - resp.end() - }) - } - return l; -} -exports.createGetResponse = function (text, contentType) { - var l = function (req, resp) { - contentType = contentType || 'text/plain' - resp.writeHead(200, {'content-type':contentType}) - resp.write(text) - resp.end() - } - return l; -} -exports.createChunkResponse = function (chunks, contentType) { - var l = function (req, resp) { - contentType = contentType || 'text/plain' - resp.writeHead(200, {'content-type':contentType}) - chunks.forEach(function (chunk) { - resp.write(chunk) - }) - resp.end() - } - return l; -} diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/squid.conf b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/squid.conf deleted file mode 100644 index 0d4a3b6..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/squid.conf +++ /dev/null @@ -1,77 +0,0 @@ -# -# Recommended minimum configuration: -# -acl manager proto cache_object -acl localhost src 127.0.0.1/32 ::1 -acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1 - -# Example rule allowing access from your local networks. -# Adapt to list your (internal) IP networks from where browsing -# should be allowed -acl localnet src 10.0.0.0/8 # RFC1918 possible internal network -acl localnet src 172.16.0.0/12 # RFC1918 possible internal network -acl localnet src 192.168.0.0/16 # RFC1918 possible internal network -acl localnet src fc00::/7 # RFC 4193 local private network range -acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines - -acl SSL_ports port 443 -acl Safe_ports port 80 # http -acl Safe_ports port 21 # ftp -acl Safe_ports port 443 # https -acl Safe_ports port 70 # gopher -acl Safe_ports port 210 # wais -acl Safe_ports port 1025-65535 # unregistered ports -acl Safe_ports port 280 # http-mgmt -acl Safe_ports port 488 # gss-http -acl Safe_ports port 591 # filemaker -acl Safe_ports port 777 # multiling http -acl CONNECT method CONNECT - -# -# Recommended minimum Access Permission configuration: -# -# Only allow cachemgr access from localhost -http_access allow manager localhost -http_access deny manager - -# Deny requests to certain unsafe ports -http_access deny !Safe_ports - -# Deny CONNECT to other than secure SSL ports -#http_access deny CONNECT !SSL_ports - -# We strongly recommend the following be uncommented to protect innocent -# web applications running on the proxy server who think the only -# one who can access services on "localhost" is a local user -#http_access deny to_localhost - -# -# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS -# - -# Example rule allowing access from your local networks. -# Adapt localnet in the ACL section to list your (internal) IP networks -# from where browsing should be allowed -http_access allow localnet -http_access allow localhost - -# And finally deny all other access to this proxy -http_access deny all - -# Squid normally listens to port 3128 -http_port 3128 - -# We recommend you to use at least the following line. -hierarchy_stoplist cgi-bin ? - -# Uncomment and adjust the following to add a disk cache directory. -#cache_dir ufs /usr/local/var/cache 100 16 256 - -# Leave coredumps in the first cache dir -coredump_dir /usr/local/var/cache - -# Add any of your own refresh_pattern entries above these. -refresh_pattern ^ftp: 1440 20% 10080 -refresh_pattern ^gopher: 1440 0% 1440 -refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 -refresh_pattern . 0 20% 4320 diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.cnf b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.cnf deleted file mode 100644 index 425a889..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.cnf +++ /dev/null @@ -1,20 +0,0 @@ -[ req ] -default_bits = 1024 -days = 3650 -distinguished_name = req_distinguished_name -attributes = req_attributes -prompt = no -output_password = password - -[ req_distinguished_name ] -C = US -ST = CA -L = Oakland -O = request -OU = request Certificate Authority -CN = requestCA -emailAddress = mikeal@mikealrogers.com - -[ req_attributes ] -challengePassword = password challenge - diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.crl b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.crl deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.crt b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.crt deleted file mode 100644 index b4524e4..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.crt +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICvTCCAiYCCQDn+P/MSbDsWjANBgkqhkiG9w0BAQUFADCBojELMAkGA1UEBhMC -VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMRAwDgYDVQQKEwdyZXF1 -ZXN0MSYwJAYDVQQLEx1yZXF1ZXN0IENlcnRpZmljYXRlIEF1dGhvcml0eTESMBAG -A1UEAxMJcmVxdWVzdENBMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlrZWFscm9n -ZXJzLmNvbTAeFw0xMjAzMDEyMjUwNTZaFw0yMjAyMjcyMjUwNTZaMIGiMQswCQYD -VQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNVBAcTB09ha2xhbmQxEDAOBgNVBAoT -B3JlcXVlc3QxJjAkBgNVBAsTHXJlcXVlc3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5 -MRIwEAYDVQQDEwlyZXF1ZXN0Q0ExJjAkBgkqhkiG9w0BCQEWF21pa2VhbEBtaWtl -YWxyb2dlcnMuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC7t9pQUAK4 -5XJYTI6NrF0n3G2HZsfN+rPYSVzzL8SuVyb1tHXos+vbPm3NKI4E8X1yVAXU8CjJ -5SqXnp4DAypAhaseho81cbhk7LXUhFz78OvAa+OD+xTAEAnNQ8tGUr4VGyplEjfD -xsBVuqV2j8GPNTftr+drOCFlqfAgMrBn4wIDAQABMA0GCSqGSIb3DQEBBQUAA4GB -ADVdTlVAL45R+PACNS7Gs4o81CwSclukBu4FJbxrkd4xGQmurgfRrYYKjtqiopQm -D7ysRamS3HMN9/VKq2T7r3z1PMHPAy7zM4uoXbbaTKwlnX4j/8pGPn8Ca3qHXYlo -88L/OOPc6Di7i7qckS3HFbXQCTiULtxWmy97oEuTwrAj ------END CERTIFICATE----- diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.csr b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.csr deleted file mode 100644 index e48c56e..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.csr +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIICBjCCAW8CAQAwgaIxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEQMA4GA1UE -BxMHT2FrbGFuZDEQMA4GA1UEChMHcmVxdWVzdDEmMCQGA1UECxMdcmVxdWVzdCBD -ZXJ0aWZpY2F0ZSBBdXRob3JpdHkxEjAQBgNVBAMTCXJlcXVlc3RDQTEmMCQGCSqG -SIb3DQEJARYXbWlrZWFsQG1pa2VhbHJvZ2Vycy5jb20wgZ8wDQYJKoZIhvcNAQEB -BQADgY0AMIGJAoGBALu32lBQArjlclhMjo2sXSfcbYdmx836s9hJXPMvxK5XJvW0 -deiz69s+bc0ojgTxfXJUBdTwKMnlKpeengMDKkCFqx6GjzVxuGTstdSEXPvw68Br -44P7FMAQCc1Dy0ZSvhUbKmUSN8PGwFW6pXaPwY81N+2v52s4IWWp8CAysGfjAgMB -AAGgIzAhBgkqhkiG9w0BCQcxFBMScGFzc3dvcmQgY2hhbGxlbmdlMA0GCSqGSIb3 -DQEBBQUAA4GBAGJO7grHeVHXetjHEK8urIxdnvfB2qeZeObz4GPKIkqUurjr0rfj -bA3EK1kDMR5aeQWR8RunixdM16Q6Ry0lEdLVWkdSwRN9dmirIHT9cypqnD/FYOia -SdezZ0lUzXgmJIwRYRwB1KSMMocIf52ll/xC2bEGg7/ZAEuAyAgcZV3X ------END CERTIFICATE REQUEST----- diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.key b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.key deleted file mode 100644 index a53e7f7..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.key +++ /dev/null @@ -1,18 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,C8B5887048377F02 - -nyD5ZH0Wup2uWsDvurq5mKDaDrf8lvNn9w0SH/ZkVnfR1/bkwqrFriqJWvZNUG+q -nS0iBYczsWLJnbub9a1zLOTENWUKVD5uqbC3aGHhnoUTNSa27DONgP8gHOn6JgR+ -GAKo01HCSTiVT4LjkwN337QKHnMP2fTzg+IoC/CigvMcq09hRLwU1/guq0GJKGwH -gTxYNuYmQC4Tjh8vdS4liF+Ve/P3qPR2CehZrIOkDT8PHJBGQJRo4xGUIB7Tpk38 -VCk+UZ0JCS2coY8VkY/9tqFJp/ZnnQQVmaNbdRqg7ECKL+bXnNo7yjzmazPZmPe3 -/ShbE0+CTt7LrjCaQAxWbeDzqfo1lQfgN1LulTm8MCXpQaJpv7v1VhIhQ7afjMYb -4thW/ypHPiYS2YJCAkAVlua9Oxzzh1qJoh8Df19iHtpd79Q77X/qf+1JvITlMu0U -gi7yEatmQcmYNws1mtTC1q2DXrO90c+NZ0LK/Alse6NRL/xiUdjug2iHeTf/idOR -Gg/5dSZbnnlj1E5zjSMDkzg6EHAFmHV4jYGSAFLEQgp4V3ZhMVoWZrvvSHgKV/Qh -FqrAK4INr1G2+/QTd09AIRzfy3/j6yD4A9iNaOsEf9Ua7Qh6RcALRCAZTWR5QtEf -dX+iSNJ4E85qXs0PqwkMDkoaxIJ+tmIRJY7y8oeylV8cfGAi8Soubt/i3SlR8IHC -uDMas/2OnwafK3N7ODeE1i7r7wkzQkSHaEz0TrF8XRnP25jAICCSLiMdAAjKfxVb -EvzsFSuAy3Jt6bU3hSLY9o4YVYKE+68ITMv9yNjvTsEiW+T+IbN34w== ------END RSA PRIVATE KEY----- diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.srl b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.srl deleted file mode 100644 index 17128db..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.srl +++ /dev/null @@ -1 +0,0 @@ -ADF62016AA40C9C3 diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.cnf b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.cnf deleted file mode 100644 index cd1fd1e..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.cnf +++ /dev/null @@ -1,19 +0,0 @@ -[ req ] -default_bits = 1024 -days = 3650 -distinguished_name = req_distinguished_name -attributes = req_attributes -prompt = no - -[ req_distinguished_name ] -C = US -ST = CA -L = Oakland -O = request -OU = testing -CN = testing.request.mikealrogers.com -emailAddress = mikeal@mikealrogers.com - -[ req_attributes ] -challengePassword = password challenge - diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.crt b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.crt deleted file mode 100644 index efe96ce..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.crt +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICejCCAeMCCQCt9iAWqkDJwzANBgkqhkiG9w0BAQUFADCBojELMAkGA1UEBhMC -VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMRAwDgYDVQQKEwdyZXF1 -ZXN0MSYwJAYDVQQLEx1yZXF1ZXN0IENlcnRpZmljYXRlIEF1dGhvcml0eTESMBAG -A1UEAxMJcmVxdWVzdENBMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlrZWFscm9n -ZXJzLmNvbTAeFw0xMjAzMDEyMjUwNTZaFw0yMjAyMjcyMjUwNTZaMIGjMQswCQYD -VQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNVBAcTB09ha2xhbmQxEDAOBgNVBAoT -B3JlcXVlc3QxEDAOBgNVBAsTB3Rlc3RpbmcxKTAnBgNVBAMTIHRlc3RpbmcucmVx -dWVzdC5taWtlYWxyb2dlcnMuY29tMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlr -ZWFscm9nZXJzLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDgVl0jMumvOpmM -20W5v9yhGgZj8hPhEQF/N7yCBVBn/rWGYm70IHC8T/pR5c0LkWc5gdnCJEvKWQjh -DBKxZD8FAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEABShRkNgFbgs4vUWW9R9deNJj -7HJoiTmvkmoOC7QzcYkjdgHbOxsSq3rBnwxsVjY9PAtPwBn0GRspOeG7KzKRgySB -kb22LyrCFKbEOfKO/+CJc80ioK9zEPVjGsFMyAB+ftYRqM+s/4cQlTg/m89l01wC -yapjN3RxZbInGhWR+jA= ------END CERTIFICATE----- diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.csr b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.csr deleted file mode 100644 index a8e7595..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.csr +++ /dev/null @@ -1,11 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIBgjCCASwCAQAwgaMxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEQMA4GA1UE -BxMHT2FrbGFuZDEQMA4GA1UEChMHcmVxdWVzdDEQMA4GA1UECxMHdGVzdGluZzEp -MCcGA1UEAxMgdGVzdGluZy5yZXF1ZXN0Lm1pa2VhbHJvZ2Vycy5jb20xJjAkBgkq -hkiG9w0BCQEWF21pa2VhbEBtaWtlYWxyb2dlcnMuY29tMFwwDQYJKoZIhvcNAQEB -BQADSwAwSAJBAOBWXSMy6a86mYzbRbm/3KEaBmPyE+ERAX83vIIFUGf+tYZibvQg -cLxP+lHlzQuRZzmB2cIkS8pZCOEMErFkPwUCAwEAAaAjMCEGCSqGSIb3DQEJBzEU -ExJwYXNzd29yZCBjaGFsbGVuZ2UwDQYJKoZIhvcNAQEFBQADQQBD3E5WekQzCEJw -7yOcqvtPYIxGaX8gRKkYfLPoj3pm3GF5SGqtJKhylKfi89szHXgktnQgzff9FN+A -HidVJ/3u ------END CERTIFICATE REQUEST----- diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.js deleted file mode 100644 index 05e21c1..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.js +++ /dev/null @@ -1,28 +0,0 @@ -var fs = require("fs") -var https = require("https") -var options = { key: fs.readFileSync("./server.key") - , cert: fs.readFileSync("./server.crt") } - -var server = https.createServer(options, function (req, res) { - res.writeHead(200) - res.end() - server.close() -}) -server.listen(1337) - -var ca = fs.readFileSync("./ca.crt") -var agent = new https.Agent({ host: "localhost", port: 1337, ca: ca }) - -https.request({ host: "localhost" - , method: "HEAD" - , port: 1337 - , headers: { host: "testing.request.mikealrogers.com" } - , agent: agent - , ca: [ ca ] - , path: "/" }, function (res) { - if (res.client.authorized) { - console.log("node test: OK") - } else { - throw new Error(res.client.authorizationError) - } -}).end() diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.key b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.key deleted file mode 100644 index 72d8698..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.key +++ /dev/null @@ -1,9 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIBOwIBAAJBAOBWXSMy6a86mYzbRbm/3KEaBmPyE+ERAX83vIIFUGf+tYZibvQg -cLxP+lHlzQuRZzmB2cIkS8pZCOEMErFkPwUCAwEAAQJAK+r8ZM2sze8s7FRo/ApB -iRBtO9fCaIdJwbwJnXKo4RKwZDt1l2mm+fzZ+/QaQNjY1oTROkIIXmnwRvZWfYlW -gQIhAPKYsG+YSBN9o8Sdp1DMyZ/rUifKX3OE6q9tINkgajDVAiEA7Ltqh01+cnt0 -JEnud/8HHcuehUBLMofeg0G+gCnSbXECIQCqDvkXsWNNLnS/3lgsnvH0Baz4sbeJ -rjIpuVEeg8eM5QIgbu0+9JmOV6ybdmmiMV4yAncoF35R/iKGVHDZCAsQzDECIQDZ -0jGz22tlo5YMcYSqrdD3U4sds1pwiAaWFRbCunoUJw== ------END RSA PRIVATE KEY----- diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/npm-ca.crt b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/npm-ca.crt deleted file mode 100644 index fde2fe9..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/npm-ca.crt +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIChzCCAfACCQDauvz/KHp8ejANBgkqhkiG9w0BAQUFADCBhzELMAkGA1UEBhMC -VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMQwwCgYDVQQKEwNucG0x -IjAgBgNVBAsTGW5wbSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxDjAMBgNVBAMTBW5w -bUNBMRcwFQYJKoZIhvcNAQkBFghpQGl6cy5tZTAeFw0xMTA5MDUwMTQ3MTdaFw0y -MTA5MDIwMTQ3MTdaMIGHMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNV -BAcTB09ha2xhbmQxDDAKBgNVBAoTA25wbTEiMCAGA1UECxMZbnBtIENlcnRpZmlj -YXRlIEF1dGhvcml0eTEOMAwGA1UEAxMFbnBtQ0ExFzAVBgkqhkiG9w0BCQEWCGlA -aXpzLm1lMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLI4tIqPpRW+ACw9GE -OgBlJZwK5f8nnKCLK629Pv5yJpQKs3DENExAyOgDcyaF0HD0zk8zTp+ZsLaNdKOz -Gn2U181KGprGKAXP6DU6ByOJDWmTlY6+Ad1laYT0m64fERSpHw/hjD3D+iX4aMOl -y0HdbT5m1ZGh6SJz3ZqxavhHLQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAC4ySDbC -l7W1WpLmtLGEQ/yuMLUf6Jy/vr+CRp4h+UzL+IQpCv8FfxsYE7dhf/bmWTEupBkv -yNL18lipt2jSvR3v6oAHAReotvdjqhxddpe5Holns6EQd1/xEZ7sB1YhQKJtvUrl -ZNufy1Jf1r0ldEGeA+0ISck7s+xSh9rQD2Op ------END CERTIFICATE----- diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/test.crt b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/test.crt deleted file mode 100644 index b357f86..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/test.crt +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICQzCCAawCCQCO/XWtRFck1jANBgkqhkiG9w0BAQUFADBmMQswCQYDVQQGEwJU -SDEQMA4GA1UECBMHQmFuZ2tvazEOMAwGA1UEBxMFU2lsb20xGzAZBgNVBAoTElRo -ZSBSZXF1ZXN0IE1vZHVsZTEYMBYGA1UEAxMPcmVxdWVzdC5leGFtcGxlMB4XDTEx -MTIwMzAyMjkyM1oXDTIxMTEzMDAyMjkyM1owZjELMAkGA1UEBhMCVEgxEDAOBgNV -BAgTB0Jhbmdrb2sxDjAMBgNVBAcTBVNpbG9tMRswGQYDVQQKExJUaGUgUmVxdWVz -dCBNb2R1bGUxGDAWBgNVBAMTD3JlcXVlc3QuZXhhbXBsZTCBnzANBgkqhkiG9w0B -AQEFAAOBjQAwgYkCgYEAwmctddZqlA48+NXs0yOy92DijcQV1jf87zMiYAIlNUto -wghVbTWgJU5r0pdKrD16AptnWJTzKanhItEX8XCCPgsNkq1afgTtJP7rNkwu3xcj -eIMkhJg/ay4ZnkbnhYdsii5VTU5prix6AqWRAhbkBgoA+iVyHyof8wvZyKBoFTMC -AwEAATANBgkqhkiG9w0BAQUFAAOBgQB6BybMJbpeiABgihDfEVBcAjDoQ8gUMgwV -l4NulugfKTDmArqnR9aPd4ET5jX5dkMP4bwCHYsvrcYDeWEQy7x5WWuylOdKhua4 -L4cEi2uDCjqEErIG3cc1MCOk6Cl6Ld6tkIzQSf953qfdEACRytOeUqLNQcrXrqeE -c7U8F6MWLQ== ------END CERTIFICATE----- diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/test.key b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/test.key deleted file mode 100644 index b85810d..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/test.key +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXgIBAAKBgQDCZy111mqUDjz41ezTI7L3YOKNxBXWN/zvMyJgAiU1S2jCCFVt -NaAlTmvSl0qsPXoCm2dYlPMpqeEi0RfxcII+Cw2SrVp+BO0k/us2TC7fFyN4gySE -mD9rLhmeRueFh2yKLlVNTmmuLHoCpZECFuQGCgD6JXIfKh/zC9nIoGgVMwIDAQAB -AoGBALXFwfUf8vHTSmGlrdZS2AGFPvEtuvldyoxi9K5u8xmdFCvxnOcLsF2RsTHt -Mu5QYWhUpNJoG+IGLTPf7RJdj/kNtEs7xXqWy4jR36kt5z5MJzqiK+QIgiO9UFWZ -fjUb6oeDnTIJA9YFBdYi97MDuL89iU/UK3LkJN3hd4rciSbpAkEA+MCkowF5kSFb -rkOTBYBXZfiAG78itDXN6DXmqb9XYY+YBh3BiQM28oxCeQYyFy6pk/nstnd4TXk6 -V/ryA2g5NwJBAMgRKTY9KvxJWbESeMEFe2iBIV0c26/72Amgi7ZKUCLukLfD4tLF -+WSZdmTbbqI1079YtwaiOVfiLm45Q/3B0eUCQAaQ/0eWSGE+Yi8tdXoVszjr4GXb -G81qBi91DMu6U1It+jNfIba+MPsiHLcZJMVb4/oWBNukN7bD1nhwFWdlnu0CQQCf -Is9WHkdvz2RxbZDxb8verz/7kXXJQJhx5+rZf7jIYFxqX3yvTNv3wf2jcctJaWlZ -fVZwB193YSivcgt778xlAkEAprYUz3jczjF5r2hrgbizPzPDR94tM5BTO3ki2v3w -kbf+j2g7FNAx6kZiVN8XwfLc8xEeUGiPKwtq3ddPDFh17w== ------END RSA PRIVATE KEY----- diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-body.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-body.js deleted file mode 100644 index 9d2e188..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-body.js +++ /dev/null @@ -1,95 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetBuffer : - { resp : server.createGetResponse(new Buffer("TESTING!")) - , encoding: null - , expectBody: new Buffer("TESTING!") - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--frontier\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--frontier\r\n\r\n' + - 'Oh hi.' + - '\r\n--frontier--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - test.uri = s.url + '/' + i - request(test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) - diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-cookie.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-cookie.js deleted file mode 100644 index f17cfb3..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-cookie.js +++ /dev/null @@ -1,29 +0,0 @@ -var Cookie = require('../vendor/cookie') - , assert = require('assert'); - -var str = 'sid="s543qactge.wKE61E01Bs%2BKhzmxrwrnug="; path=/; httpOnly; expires=Sat, 04 Dec 2010 23:27:28 GMT'; -var cookie = new Cookie(str); - -// test .toString() -assert.equal(cookie.toString(), str); - -// test .path -assert.equal(cookie.path, '/'); - -// test .httpOnly -assert.equal(cookie.httpOnly, true); - -// test .name -assert.equal(cookie.name, 'sid'); - -// test .value -assert.equal(cookie.value, '"s543qactge.wKE61E01Bs%2BKhzmxrwrnug="'); - -// test .expires -assert.equal(cookie.expires instanceof Date, true); - -// test .path default -var cookie = new Cookie('foo=bar', { url: 'http://foo.com/bar' }); -assert.equal(cookie.path, '/bar'); - -console.log('All tests passed'); diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-cookiejar.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-cookiejar.js deleted file mode 100644 index 76fcd71..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-cookiejar.js +++ /dev/null @@ -1,90 +0,0 @@ -var Cookie = require('../vendor/cookie') - , Jar = require('../vendor/cookie/jar') - , assert = require('assert'); - -function expires(ms) { - return new Date(Date.now() + ms).toUTCString(); -} - -// test .get() expiration -(function() { - var jar = new Jar; - var cookie = new Cookie('sid=1234; path=/; expires=' + expires(1000)); - jar.add(cookie); - setTimeout(function(){ - var cookies = jar.get({ url: 'http://foo.com/foo' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], cookie); - setTimeout(function(){ - var cookies = jar.get({ url: 'http://foo.com/foo' }); - assert.equal(cookies.length, 0); - }, 1000); - }, 5); -})(); - -// test .get() path support -(function() { - var jar = new Jar; - var a = new Cookie('sid=1234; path=/'); - var b = new Cookie('sid=1111; path=/foo/bar'); - var c = new Cookie('sid=2222; path=/'); - jar.add(a); - jar.add(b); - jar.add(c); - - // should remove the duplicates - assert.equal(jar.cookies.length, 2); - - // same name, same path, latter prevails - var cookies = jar.get({ url: 'http://foo.com/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], c); - - // same name, diff path, path specifity prevails, latter prevails - var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], b); - - var jar = new Jar; - var a = new Cookie('sid=1111; path=/foo/bar'); - var b = new Cookie('sid=1234; path=/'); - jar.add(a); - jar.add(b); - - var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], a); - - var cookies = jar.get({ url: 'http://foo.com/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], b); - - var jar = new Jar; - var a = new Cookie('sid=1111; path=/foo/bar'); - var b = new Cookie('sid=3333; path=/foo/bar'); - var c = new Cookie('pid=3333; path=/foo/bar'); - var d = new Cookie('sid=2222; path=/foo/'); - var e = new Cookie('sid=1234; path=/'); - jar.add(a); - jar.add(b); - jar.add(c); - jar.add(d); - jar.add(e); - - var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); - assert.equal(cookies.length, 2); - assert.equal(cookies[0], b); - assert.equal(cookies[1], c); - - var cookies = jar.get({ url: 'http://foo.com/foo/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], d); - - var cookies = jar.get({ url: 'http://foo.com/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], e); -})(); - -setTimeout(function() { - console.log('All tests passed'); -}, 1200); diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-defaults.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-defaults.js deleted file mode 100644 index 6c8b58f..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-defaults.js +++ /dev/null @@ -1,68 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); - -s.listen(s.port, function () { - var counter = 0; - s.on('/get', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.method, 'GET') - resp.writeHead(200, {'Content-Type': 'text/plain'}); - resp.end('TESTING!'); - }); - - // test get(string, function) - request.defaults({headers:{foo:"bar"}})(s.url + '/get', function (e, r, b){ - if (e) throw e; - assert.deepEqual("TESTING!", b); - counter += 1; - }); - - s.on('/post', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.headers['content-type'], 'application/json'); - assert.equal(req.method, 'POST') - resp.writeHead(200, {'Content-Type': 'application/json'}); - resp.end(JSON.stringify({foo:'bar'})); - }); - - // test post(string, object, function) - request.defaults({headers:{foo:"bar"}}).post(s.url + '/post', {json: true}, function (e, r, b){ - if (e) throw e; - assert.deepEqual('bar', b.foo); - counter += 1; - }); - - s.on('/del', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.method, 'DELETE') - resp.writeHead(200, {'Content-Type': 'application/json'}); - resp.end(JSON.stringify({foo:'bar'})); - }); - - // test .del(string, function) - request.defaults({headers:{foo:"bar"}, json:true}).del(s.url + '/del', function (e, r, b){ - if (e) throw e; - assert.deepEqual('bar', b.foo); - counter += 1; - }); - - s.on('/head', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.method, 'HEAD') - resp.writeHead(200, {'Content-Type': 'text/plain'}); - resp.end(); - }); - - // test head.(object, function) - request.defaults({headers:{foo:"bar"}}).head({uri: s.url + '/head'}, function (e, r, b){ - if (e) throw e; - counter += 1; - console.log(counter.toString() + " tests passed.") - s.close() - }); - -}) diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-errors.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-errors.js deleted file mode 100644 index 1986a59..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-errors.js +++ /dev/null @@ -1,37 +0,0 @@ -var server = require('./server') - , events = require('events') - , assert = require('assert') - , request = require('../main.js') - ; - -var local = 'http://localhost:8888/asdf' - -try { - request({uri:local, body:{}}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Argument error, options.body.') -} - -try { - request({uri:local, multipart: 'foo'}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Argument error, options.multipart.') -} - -try { - request({uri:local, multipart: [{}]}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Body attribute missing in multipart.') -} - -try { - request(local, {multipart: [{}]}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Body attribute missing in multipart.') -} - -console.log("All tests passed.") diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-headers.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-headers.js deleted file mode 100644 index 31fe3f4..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-headers.js +++ /dev/null @@ -1,52 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , Cookie = require('../vendor/cookie') - , Jar = require('../vendor/cookie/jar') - , s = server.createServer() - -s.listen(s.port, function () { - var serverUri = 'http://localhost:' + s.port - , numTests = 0 - , numOutstandingTests = 0 - - function createTest(requestObj, serverAssertFn) { - var testNumber = numTests; - numTests += 1; - numOutstandingTests += 1; - s.on('/' + testNumber, function (req, res) { - serverAssertFn(req, res); - res.writeHead(200); - res.end(); - }); - requestObj.url = serverUri + '/' + testNumber - request(requestObj, function (err, res, body) { - assert.ok(!err) - assert.equal(res.statusCode, 200) - numOutstandingTests -= 1 - if (numOutstandingTests === 0) { - console.log(numTests + ' tests passed.') - s.close() - } - }) - } - - // Issue #125: headers.cookie shouldn't be replaced when a cookie jar isn't specified - createTest({headers: {cookie: 'foo=bar'}}, function (req, res) { - assert.ok(req.headers.cookie) - assert.equal(req.headers.cookie, 'foo=bar') - }) - - // Issue #125: headers.cookie + cookie jar - var jar = new Jar() - jar.add(new Cookie('quux=baz')); - createTest({jar: jar, headers: {cookie: 'foo=bar'}}, function (req, res) { - assert.ok(req.headers.cookie) - assert.equal(req.headers.cookie, 'foo=bar; quux=baz') - }) - - // There should be no cookie header when neither headers.cookie nor a cookie jar is specified - createTest({}, function (req, res) { - assert.ok(!req.headers.cookie) - }) -}) diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-httpModule.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-httpModule.js deleted file mode 100644 index 1866de2..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-httpModule.js +++ /dev/null @@ -1,94 +0,0 @@ -var http = require('http') - , https = require('https') - , server = require('./server') - , assert = require('assert') - , request = require('../main.js') - - -var faux_requests_made = {'http':0, 'https':0} -function wrap_request(name, module) { - // Just like the http or https module, but note when a request is made. - var wrapped = {} - Object.keys(module).forEach(function(key) { - var value = module[key]; - - if(key != 'request') - wrapped[key] = value; - else - wrapped[key] = function(options, callback) { - faux_requests_made[name] += 1 - return value.apply(this, arguments) - } - }) - - return wrapped; -} - - -var faux_http = wrap_request('http', http) - , faux_https = wrap_request('https', https) - , plain_server = server.createServer() - , https_server = server.createSSLServer() - - -plain_server.listen(plain_server.port, function() { - plain_server.on('/plain', function (req, res) { - res.writeHead(200) - res.end('plain') - }) - plain_server.on('/to_https', function (req, res) { - res.writeHead(301, {'location':'https://localhost:'+https_server.port + '/https'}) - res.end() - }) - - https_server.listen(https_server.port, function() { - https_server.on('/https', function (req, res) { - res.writeHead(200) - res.end('https') - }) - https_server.on('/to_plain', function (req, res) { - res.writeHead(302, {'location':'http://localhost:'+plain_server.port + '/plain'}) - res.end() - }) - - run_tests() - run_tests({}) - run_tests({'http:':faux_http}) - run_tests({'https:':faux_https}) - run_tests({'http:':faux_http, 'https:':faux_https}) - }) -}) - -function run_tests(httpModules) { - var to_https = 'http://localhost:'+plain_server.port+'/to_https' - var to_plain = 'https://localhost:'+https_server.port+'/to_plain' - - request(to_https, {'httpModules':httpModules}, function (er, res, body) { - assert.ok(!er, 'Bounce to SSL worked') - assert.equal(body, 'https', 'Received HTTPS server body') - done() - }) - - request(to_plain, {'httpModules':httpModules}, function (er, res, body) { - assert.ok(!er, 'Bounce to plaintext server worked') - assert.equal(body, 'plain', 'Received HTTPS server body') - done() - }) -} - - -var passed = 0; -function done() { - passed += 1 - var expected = 10 - - if(passed == expected) { - plain_server.close() - https_server.close() - - assert.equal(faux_requests_made.http, 4, 'Wrapped http module called appropriately') - assert.equal(faux_requests_made.https, 4, 'Wrapped https module called appropriately') - - console.log((expected+2) + ' tests passed.') - } -} diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-https-strict.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-https-strict.js deleted file mode 100644 index f53fc14..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-https-strict.js +++ /dev/null @@ -1,97 +0,0 @@ -// a test where we validate the siguature of the keys -// otherwise exactly the same as the ssl test - -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , fs = require('fs') - , path = require('path') - , opts = { key: path.resolve(__dirname, 'ssl/ca/server.key') - , cert: path.resolve(__dirname, 'ssl/ca/server.crt') } - , s = server.createSSLServer(null, opts) - , caFile = path.resolve(__dirname, 'ssl/ca/ca.crt') - , ca = fs.readFileSync(caFile) - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--frontier\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--frontier\r\n\r\n' + - 'Oh hi.' + - '\r\n--frontier--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - test.uri = s.url + '/' + i - test.strictSSL = true - test.ca = ca - test.headers = { host: 'testing.request.mikealrogers.com' } - request(test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-https.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-https.js deleted file mode 100644 index df7330b..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-https.js +++ /dev/null @@ -1,86 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - -var s = server.createSSLServer(); - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--frontier\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--frontier\r\n\r\n' + - 'Oh hi.' + - '\r\n--frontier--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - test.uri = s.url + '/' + i - request(test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-oauth.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-oauth.js deleted file mode 100644 index e9d3290..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-oauth.js +++ /dev/null @@ -1,117 +0,0 @@ -var hmacsign = require('../oauth').hmacsign - , assert = require('assert') - , qs = require('querystring') - , request = require('../main') - ; - -function getsignature (r) { - var sign - r.headers.authorization.slice('OAuth '.length).replace(/,\ /g, ',').split(',').forEach(function (v) { - if (v.slice(0, 'oauth_signature="'.length) === 'oauth_signature="') sign = v.slice('oauth_signature="'.length, -1) - }) - return decodeURIComponent(sign) -} - -// Tests from Twitter documentation https://dev.twitter.com/docs/auth/oauth - -var reqsign = hmacsign('POST', 'https://api.twitter.com/oauth/request_token', - { oauth_callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11' - , oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g' - , oauth_nonce: 'QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk' - , oauth_signature_method: 'HMAC-SHA1' - , oauth_timestamp: '1272323042' - , oauth_version: '1.0' - }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98") - -console.log(reqsign) -console.log('8wUi7m5HFQy76nowoCThusfgB+Q=') -assert.equal(reqsign, '8wUi7m5HFQy76nowoCThusfgB+Q=') - -var accsign = hmacsign('POST', 'https://api.twitter.com/oauth/access_token', - { oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g' - , oauth_nonce: '9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8' - , oauth_signature_method: 'HMAC-SHA1' - , oauth_token: '8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc' - , oauth_timestamp: '1272323047' - , oauth_verifier: 'pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY' - , oauth_version: '1.0' - }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "x6qpRnlEmW9JbQn4PQVVeVG8ZLPEx6A0TOebgwcuA") - -console.log(accsign) -console.log('PUw/dHA4fnlJYM6RhXk5IU/0fCc=') -assert.equal(accsign, 'PUw/dHA4fnlJYM6RhXk5IU/0fCc=') - -var upsign = hmacsign('POST', 'http://api.twitter.com/1/statuses/update.json', - { oauth_consumer_key: "GDdmIQH6jhtmLUypg82g" - , oauth_nonce: "oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y" - , oauth_signature_method: "HMAC-SHA1" - , oauth_token: "819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw" - , oauth_timestamp: "1272325550" - , oauth_version: "1.0" - , status: 'setting up my twitter 私のさえずりを設定する' - }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA") - -console.log(upsign) -console.log('yOahq5m0YjDDjfjxHaXEsW9D+X0=') -assert.equal(upsign, 'yOahq5m0YjDDjfjxHaXEsW9D+X0=') - - -var rsign = request.post( - { url: 'https://api.twitter.com/oauth/request_token' - , oauth: - { callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11' - , consumer_key: 'GDdmIQH6jhtmLUypg82g' - , nonce: 'QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk' - , timestamp: '1272323042' - , version: '1.0' - , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" - } - }) - -setTimeout(function () { - console.log(getsignature(rsign)) - assert.equal(reqsign, getsignature(rsign)) -}) - -var raccsign = request.post( - { url: 'https://api.twitter.com/oauth/access_token' - , oauth: - { consumer_key: 'GDdmIQH6jhtmLUypg82g' - , nonce: '9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8' - , signature_method: 'HMAC-SHA1' - , token: '8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc' - , timestamp: '1272323047' - , verifier: 'pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY' - , version: '1.0' - , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" - , token_secret: "x6qpRnlEmW9JbQn4PQVVeVG8ZLPEx6A0TOebgwcuA" - } - }) - -setTimeout(function () { - console.log(getsignature(raccsign)) - assert.equal(accsign, getsignature(raccsign)) -}, 1) - -var rupsign = request.post( - { url: 'http://api.twitter.com/1/statuses/update.json' - , oauth: - { consumer_key: "GDdmIQH6jhtmLUypg82g" - , nonce: "oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y" - , signature_method: "HMAC-SHA1" - , token: "819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw" - , timestamp: "1272325550" - , version: "1.0" - , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" - , token_secret: "J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA" - } - , form: {status: 'setting up my twitter 私のさえずりを設定する'} - }) -setTimeout(function () { - console.log(getsignature(rupsign)) - assert.equal(upsign, getsignature(rupsign)) -}, 1) - - - - diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-params.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-params.js deleted file mode 100644 index 8354f6d..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-params.js +++ /dev/null @@ -1,92 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetBuffer : - { resp : server.createGetResponse(new Buffer("TESTING!")) - , encoding: null - , expectBody: new Buffer("TESTING!") - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--frontier\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--frontier\r\n\r\n' + - 'Oh hi.' + - '\r\n--frontier--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - //test.uri = s.url + '/' + i - request(s.url + '/' + i, test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-pipes.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-pipes.js deleted file mode 100644 index 1869874..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-pipes.js +++ /dev/null @@ -1,202 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , fs = require('fs') - , request = require('../main.js') - , path = require('path') - , util = require('util') - ; - -var s = server.createServer(3453); - -function ValidationStream(str) { - this.str = str - this.buf = '' - this.on('data', function (data) { - this.buf += data - }) - this.on('end', function () { - assert.equal(this.str, this.buf) - }) - this.writable = true -} -util.inherits(ValidationStream, stream.Stream) -ValidationStream.prototype.write = function (chunk) { - this.emit('data', chunk) -} -ValidationStream.prototype.end = function (chunk) { - if (chunk) emit('data', chunk) - this.emit('end') -} - -s.listen(s.port, function () { - counter = 0; - - var check = function () { - counter = counter - 1 - if (counter === 0) { - console.log('All tests passed.') - setTimeout(function () { - process.exit(); - }, 500) - } - } - - // Test pipeing to a request object - s.once('/push', server.createPostValidator("mydata")); - - var mydata = new stream.Stream(); - mydata.readable = true - - counter++ - var r1 = request.put({url:'http://localhost:3453/push'}, function () { - check(); - }) - mydata.pipe(r1) - - mydata.emit('data', 'mydata'); - mydata.emit('end'); - - - // Test pipeing from a request object. - s.once('/pull', server.createGetResponse("mypulldata")); - - var mypulldata = new stream.Stream(); - mypulldata.writable = true - - counter++ - request({url:'http://localhost:3453/pull'}).pipe(mypulldata) - - var d = ''; - - mypulldata.write = function (chunk) { - d += chunk; - } - mypulldata.end = function () { - assert.equal(d, 'mypulldata'); - check(); - }; - - - s.on('/cat', function (req, resp) { - if (req.method === "GET") { - resp.writeHead(200, {'content-type':'text/plain-test', 'content-length':4}); - resp.end('asdf') - } else if (req.method === "PUT") { - assert.equal(req.headers['content-type'], 'text/plain-test'); - assert.equal(req.headers['content-length'], 4) - var validate = ''; - - req.on('data', function (chunk) {validate += chunk}) - req.on('end', function () { - resp.writeHead(201); - resp.end(); - assert.equal(validate, 'asdf'); - check(); - }) - } - }) - s.on('/pushjs', function (req, resp) { - if (req.method === "PUT") { - assert.equal(req.headers['content-type'], 'text/javascript'); - check(); - } - }) - s.on('/catresp', function (req, resp) { - request.get('http://localhost:3453/cat').pipe(resp) - }) - s.on('/doodle', function (req, resp) { - if (req.headers['x-oneline-proxy']) { - resp.setHeader('x-oneline-proxy', 'yup') - } - resp.writeHead('200', {'content-type':'image/png'}) - fs.createReadStream(path.join(__dirname, 'googledoodle.png')).pipe(resp) - }) - s.on('/onelineproxy', function (req, resp) { - var x = request('http://localhost:3453/doodle') - req.pipe(x) - x.pipe(resp) - }) - - counter++ - fs.createReadStream(__filename).pipe(request.put('http://localhost:3453/pushjs')) - - counter++ - request.get('http://localhost:3453/cat').pipe(request.put('http://localhost:3453/cat')) - - counter++ - request.get('http://localhost:3453/catresp', function (e, resp, body) { - assert.equal(resp.headers['content-type'], 'text/plain-test'); - assert.equal(resp.headers['content-length'], 4) - check(); - }) - - var doodleWrite = fs.createWriteStream(path.join(__dirname, 'test.png')) - - counter++ - request.get('http://localhost:3453/doodle').pipe(doodleWrite) - - doodleWrite.on('close', function () { - assert.deepEqual(fs.readFileSync(path.join(__dirname, 'googledoodle.png')), fs.readFileSync(path.join(__dirname, 'test.png'))) - check() - }) - - process.on('exit', function () { - fs.unlinkSync(path.join(__dirname, 'test.png')) - }) - - counter++ - request.get({uri:'http://localhost:3453/onelineproxy', headers:{'x-oneline-proxy':'nope'}}, function (err, resp, body) { - assert.equal(resp.headers['x-oneline-proxy'], 'yup') - check() - }) - - s.on('/afterresponse', function (req, resp) { - resp.write('d') - resp.end() - }) - - counter++ - var afterresp = request.post('http://localhost:3453/afterresponse').on('response', function () { - var v = new ValidationStream('d') - afterresp.pipe(v) - v.on('end', check) - }) - - s.on('/forward1', function (req, resp) { - resp.writeHead(302, {location:'/forward2'}) - resp.end() - }) - s.on('/forward2', function (req, resp) { - resp.writeHead('200', {'content-type':'image/png'}) - resp.write('d') - resp.end() - }) - - counter++ - var validateForward = new ValidationStream('d') - validateForward.on('end', check) - request.get('http://localhost:3453/forward1').pipe(validateForward) - - // Test pipe options - s.once('/opts', server.createGetResponse('opts response')); - - var optsStream = new stream.Stream(); - optsStream.writable = true - - var optsData = ''; - optsStream.write = function (buf) { - optsData += buf; - if (optsData === 'opts response') { - setTimeout(check, 10); - } - } - - optsStream.end = function () { - assert.fail('end called') - }; - - counter++ - request({url:'http://localhost:3453/opts'}).pipe(optsStream, { end : false }) -}) diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-proxy.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-proxy.js deleted file mode 100644 index 647157c..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-proxy.js +++ /dev/null @@ -1,39 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , fs = require('fs') - , request = require('../main.js') - , path = require('path') - , util = require('util') - ; - -var port = 6768 - , called = false - , proxiedHost = 'google.com' - ; - -var s = server.createServer(port) -s.listen(port, function () { - s.on('http://google.com/', function (req, res) { - called = true - assert.equal(req.headers.host, proxiedHost) - res.writeHeader(200) - res.end() - }) - request ({ - url: 'http://'+proxiedHost, - proxy: 'http://localhost:'+port - /* - //should behave as if these arguments where passed: - url: 'http://localhost:'+port, - headers: {host: proxiedHost} - //*/ - }, function (err, res, body) { - s.close() - }) -}) - -process.on('exit', function () { - assert.ok(called, 'the request must be made to the proxy server') -}) diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-qs.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-qs.js deleted file mode 100644 index 1aac22b..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-qs.js +++ /dev/null @@ -1,28 +0,0 @@ -var request = request = require('../main.js') - , assert = require('assert') - ; - - -// Test adding a querystring -var req1 = request.get({ uri: 'http://www.google.com', qs: { q : 'search' }}) -setTimeout(function() { - assert.equal('/?q=search', req1.path) -}, 1) - -// Test replacing a querystring value -var req2 = request.get({ uri: 'http://www.google.com?q=abc', qs: { q : 'search' }}) -setTimeout(function() { - assert.equal('/?q=search', req2.path) -}, 1) - -// Test appending a querystring value to the ones present in the uri -var req3 = request.get({ uri: 'http://www.google.com?x=y', qs: { q : 'search' }}) -setTimeout(function() { - assert.equal('/?x=y&q=search', req3.path) -}, 1) - -// Test leaving a querystring alone -var req4 = request.get({ uri: 'http://www.google.com?x=y'}) -setTimeout(function() { - assert.equal('/?x=y', req4.path) -}, 1) diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-redirect.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-redirect.js deleted file mode 100644 index 54fc19b..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-redirect.js +++ /dev/null @@ -1,159 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , Cookie = require('../vendor/cookie') - , Jar = require('../vendor/cookie/jar') - -var s = server.createServer() - -s.listen(s.port, function () { - var server = 'http://localhost:' + s.port; - var hits = {} - var passed = 0; - - bouncer(301, 'temp') - bouncer(302, 'perm') - bouncer(302, 'nope') - - function bouncer(code, label) { - var landing = label+'_landing'; - - s.on('/'+label, function (req, res) { - hits[label] = true; - res.writeHead(code, {'location':server + '/'+landing}) - res.end() - }) - - s.on('/'+landing, function (req, res) { - if (req.method !== 'GET') { // We should only accept GET redirects - console.error("Got a non-GET request to the redirect destination URL"); - resp.writeHead(400); - resp.end(); - return; - } - // Make sure the cookie doesn't get included twice, see #139: - assert.equal(req.headers.cookie, 'foo=bar; quux=baz'); - hits[landing] = true; - res.writeHead(200) - res.end(landing) - }) - } - - // Permanent bounce - var jar = new Jar() - jar.add(new Cookie('quux=baz')) - request({uri: server+'/perm', jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.perm, 'Original request is to /perm') - assert.ok(hits.perm_landing, 'Forward to permanent landing URL') - assert.equal(body, 'perm_landing', 'Got permanent landing content') - passed += 1 - } finally { - done() - } - }) - - // Temporary bounce - request({uri: server+'/temp', jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(hits.temp_landing, 'Forward to temporary landing URL') - assert.equal(body, 'temp_landing', 'Got temporary landing content') - passed += 1 - } finally { - done() - } - }) - - // Prevent bouncing. - request({uri:server+'/nope', jar: jar, headers: {cookie: 'foo=bar'}, followRedirect:false}, function (er, res, body) { - try { - assert.ok(hits.nope, 'Original request to /nope') - assert.ok(!hits.nope_landing, 'No chasing the redirect') - assert.equal(res.statusCode, 302, 'Response is the bounce itself') - passed += 1 - } finally { - done() - } - }) - - // Should not follow post redirects by default - request.post(server+'/temp', { jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect when post') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - } finally { - done() - } - }) - - // Should follow post redirects when followAllRedirects true - request.post({uri:server+'/temp', followAllRedirects:true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(hits.temp_landing, 'Forward to temporary landing URL') - assert.equal(body, 'temp_landing', 'Got temporary landing content') - passed += 1 - } finally { - done() - } - }) - - request.post({uri:server+'/temp', followAllRedirects:false, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - } finally { - done() - } - }) - - // Should not follow delete redirects by default - request.del(server+'/temp', { jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect when delete') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - } finally { - done() - } - }) - - // Should not follow delete redirects even if followRedirect is set to true - request.del(server+'/temp', { followRedirect: true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect when delete') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - } finally { - done() - } - }) - - // Should follow delete redirects when followAllRedirects true - request.del(server+'/temp', {followAllRedirects:true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(hits.temp_landing, 'Forward to temporary landing URL') - assert.equal(body, 'temp_landing', 'Got temporary landing content') - passed += 1 - } finally { - done() - } - }) - - var reqs_done = 0; - function done() { - reqs_done += 1; - if(reqs_done == 9) { - console.log(passed + ' tests passed.') - s.close() - } - } -}) diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-timeout.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-timeout.js deleted file mode 100644 index 673f8ad..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-timeout.js +++ /dev/null @@ -1,87 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); -var expectedBody = "waited"; -var remainingTests = 5; - -s.listen(s.port, function () { - // Request that waits for 200ms - s.on('/timeout', function (req, resp) { - setTimeout(function(){ - resp.writeHead(200, {'content-type':'text/plain'}) - resp.write(expectedBody) - resp.end() - }, 200); - }); - - // Scenario that should timeout - var shouldTimeout = { - url: s.url + "/timeout", - timeout:100 - } - - - request(shouldTimeout, function (err, resp, body) { - assert.equal(err.code, "ETIMEDOUT"); - checkDone(); - }) - - - // Scenario that shouldn't timeout - var shouldntTimeout = { - url: s.url + "/timeout", - timeout:300 - } - - request(shouldntTimeout, function (err, resp, body) { - assert.equal(err, null); - assert.equal(expectedBody, body) - checkDone(); - }) - - // Scenario with no timeout set, so shouldn't timeout - var noTimeout = { - url: s.url + "/timeout" - } - - request(noTimeout, function (err, resp, body) { - assert.equal(err); - assert.equal(expectedBody, body) - checkDone(); - }) - - // Scenario with a negative timeout value, should be treated a zero or the minimum delay - var negativeTimeout = { - url: s.url + "/timeout", - timeout:-1000 - } - - request(negativeTimeout, function (err, resp, body) { - assert.equal(err.code, "ETIMEDOUT"); - checkDone(); - }) - - // Scenario with a float timeout value, should be rounded by setTimeout anyway - var floatTimeout = { - url: s.url + "/timeout", - timeout: 100.76 - } - - request(floatTimeout, function (err, resp, body) { - assert.equal(err.code, "ETIMEDOUT"); - checkDone(); - }) - - function checkDone() { - if(--remainingTests == 0) { - s.close(); - console.log("All tests passed."); - } - } -}) - diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-tunnel.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-tunnel.js deleted file mode 100644 index 58131b9..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-tunnel.js +++ /dev/null @@ -1,61 +0,0 @@ -// test that we can tunnel a https request over an http proxy -// keeping all the CA and whatnot intact. -// -// Note: this requires that squid is installed. -// If the proxy fails to start, we'll just log a warning and assume success. - -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , fs = require('fs') - , path = require('path') - , caFile = path.resolve(__dirname, 'ssl/npm-ca.crt') - , ca = fs.readFileSync(caFile) - , child_process = require('child_process') - , sqConf = path.resolve(__dirname, 'squid.conf') - , sqArgs = ['-f', sqConf, '-N', '-d', '5'] - , proxy = 'http://localhost:3128' - , hadError = null - -var squid = child_process.spawn('squid', sqArgs); -var ready = false - -squid.stderr.on('data', function (c) { - console.error('SQUIDERR ' + c.toString().trim().split('\n') - .join('\nSQUIDERR ')) - ready = c.toString().match(/ready to serve requests/i) -}) - -squid.stdout.on('data', function (c) { - console.error('SQUIDOUT ' + c.toString().trim().split('\n') - .join('\nSQUIDOUT ')) -}) - -squid.on('exit', function (c) { - console.error('exit '+c) - if (c && !ready) { - console.error('squid must be installed to run this test.') - c = null - hadError = null - process.exit(0) - return - } - - if (c) { - hadError = hadError || new Error('Squid exited with '+c) - } - if (hadError) throw hadError -}) - -setTimeout(function F () { - if (!ready) return setTimeout(F, 100) - request({ uri: 'https://registry.npmjs.org/request/' - , proxy: 'http://localhost:3128' - , ca: ca - , json: true }, function (er, body) { - hadError = er - console.log(er || typeof body) - if (!er) console.log("ok") - squid.kill('SIGKILL') - }) -}, 100) diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tunnel.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tunnel.js deleted file mode 100644 index 453786c..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/tunnel.js +++ /dev/null @@ -1,229 +0,0 @@ -'use strict'; - -var net = require('net'); -var tls = require('tls'); -var http = require('http'); -var https = require('https'); -var events = require('events'); -var assert = require('assert'); -var util = require('util'); - - -exports.httpOverHttp = httpOverHttp; -exports.httpsOverHttp = httpsOverHttp; -exports.httpOverHttps = httpOverHttps; -exports.httpsOverHttps = httpsOverHttps; - - -function httpOverHttp(options) { - var agent = new TunnelingAgent(options); - agent.request = http.request; - return agent; -} - -function httpsOverHttp(options) { - var agent = new TunnelingAgent(options); - agent.request = http.request; - agent.createSocket = createSecureSocket; - return agent; -} - -function httpOverHttps(options) { - var agent = new TunnelingAgent(options); - agent.request = https.request; - return agent; -} - -function httpsOverHttps(options) { - var agent = new TunnelingAgent(options); - agent.request = https.request; - agent.createSocket = createSecureSocket; - return agent; -} - - -function TunnelingAgent(options) { - var self = this; - self.options = options || {}; - self.proxyOptions = self.options.proxy || {}; - self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; - self.requests = []; - self.sockets = []; - - self.on('free', function onFree(socket, host, port) { - for (var i = 0, len = self.requests.length; i < len; ++i) { - var pending = self.requests[i]; - if (pending.host === host && pending.port === port) { - // Detect the request to connect same origin server, - // reuse the connection. - self.requests.splice(i, 1); - pending.request.onSocket(socket); - return; - } - } - socket.destroy(); - self.removeSocket(socket); - }); -} -util.inherits(TunnelingAgent, events.EventEmitter); - -TunnelingAgent.prototype.addRequest = function addRequest(req, host, port) { - var self = this; - - if (self.sockets.length >= this.maxSockets) { - // We are over limit so we'll add it to the queue. - self.requests.push({host: host, port: port, request: req}); - return; - } - - // If we are under maxSockets create a new one. - self.createSocket({host: host, port: port, request: req}, function(socket) { - socket.on('free', onFree); - socket.on('close', onCloseOrRemove); - socket.on('agentRemove', onCloseOrRemove); - req.onSocket(socket); - - function onFree() { - self.emit('free', socket, host, port); - } - - function onCloseOrRemove(err) { - self.removeSocket(); - socket.removeListener('free', onFree); - socket.removeListener('close', onCloseOrRemove); - socket.removeListener('agentRemove', onCloseOrRemove); - } - }); -}; - -TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { - var self = this; - var placeholder = {}; - self.sockets.push(placeholder); - - var connectOptions = mergeOptions({}, self.proxyOptions, { - method: 'CONNECT', - path: options.host + ':' + options.port, - agent: false - }); - if (connectOptions.proxyAuth) { - connectOptions.headers = connectOptions.headers || {}; - connectOptions.headers['Proxy-Authorization'] = 'Basic ' + - new Buffer(connectOptions.proxyAuth).toString('base64'); - } - - debug('making CONNECT request'); - var connectReq = self.request(connectOptions); - connectReq.useChunkedEncodingByDefault = false; // for v0.6 - connectReq.once('response', onResponse); // for v0.6 - connectReq.once('upgrade', onUpgrade); // for v0.6 - connectReq.once('connect', onConnect); // for v0.7 or later - connectReq.once('error', onError); - connectReq.end(); - - function onResponse(res) { - // Very hacky. This is necessary to avoid http-parser leaks. - res.upgrade = true; - } - - function onUpgrade(res, socket, head) { - // Hacky. - process.nextTick(function() { - onConnect(res, socket, head); - }); - } - - function onConnect(res, socket, head) { - connectReq.removeAllListeners(); - socket.removeAllListeners(); - - if (res.statusCode === 200) { - assert.equal(head.length, 0); - debug('tunneling connection has established'); - self.sockets[self.sockets.indexOf(placeholder)] = socket; - cb(socket); - } else { - debug('tunneling socket could not be established, statusCode=%d', - res.statusCode); - var error = new Error('tunneling socket could not be established, ' + - 'sutatusCode=' + res.statusCode); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - } - } - - function onError(cause) { - connectReq.removeAllListeners(); - - debug('tunneling socket could not be established, cause=%s\n', - cause.message, cause.stack); - var error = new Error('tunneling socket could not be established, ' + - 'cause=' + cause.message); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - } -}; - -TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { - var pos = this.sockets.indexOf(socket) - if (pos === -1) { - return; - } - this.sockets.splice(pos, 1); - - var pending = this.requests.shift(); - if (pending) { - // If we have pending requests and a socket gets closed a new one - // needs to be created to take over in the pool for the one that closed. - this.createSocket(pending, function(socket) { - pending.request.onSocket(socket); - }); - } -}; - -function createSecureSocket(options, cb) { - var self = this; - TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { - // 0 is dummy port for v0.6 - var secureSocket = tls.connect(0, mergeOptions({}, self.options, { - socket: socket - })); - cb(secureSocket); - }); -} - - -function mergeOptions(target) { - for (var i = 1, len = arguments.length; i < len; ++i) { - var overrides = arguments[i]; - if (typeof overrides === 'object') { - var keys = Object.keys(overrides); - for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { - var k = keys[j]; - if (overrides[k] !== undefined) { - target[k] = overrides[k]; - } - } - } - } - return target; -} - - -var debug; -if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { - debug = function() { - var args = Array.prototype.slice.call(arguments); - if (typeof args[0] === 'string') { - args[0] = 'TUNNEL: ' + args[0]; - } else { - args.unshift('TUNNEL:'); - } - console.error.apply(console, args); - } -} else { - debug = function() {}; -} -exports.debug = debug; // for test diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/uuid.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/uuid.js deleted file mode 100644 index 1d83bd5..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/uuid.js +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = function () { - var s = [], itoh = '0123456789ABCDEF'; - - // Make array of random hex digits. The UUID only has 32 digits in it, but we - // allocate an extra items to make room for the '-'s we'll be inserting. - for (var i = 0; i <36; i++) s[i] = Math.floor(Math.random()*0x10); - - // Conform to RFC-4122, section 4.4 - s[14] = 4; // Set 4 high bits of time_high field to version - s[19] = (s[19] & 0x3) | 0x8; // Specify 2 high bits of clock sequence - - // Convert to hex chars - for (var i = 0; i <36; i++) s[i] = itoh[s[i]]; - - // Insert '-'s - s[8] = s[13] = s[18] = s[23] = '-'; - - return s.join(''); -} diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/vendor/cookie/index.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/vendor/cookie/index.js deleted file mode 100644 index 1eb2eaa..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/vendor/cookie/index.js +++ /dev/null @@ -1,60 +0,0 @@ -/*! - * Tobi - Cookie - * Copyright(c) 2010 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var url = require('url'); - -/** - * Initialize a new `Cookie` with the given cookie `str` and `req`. - * - * @param {String} str - * @param {IncomingRequest} req - * @api private - */ - -var Cookie = exports = module.exports = function Cookie(str, req) { - this.str = str; - - // First key is the name - this.name = str.substr(0, str.indexOf('=')).trim(); - - // Map the key/val pairs - str.split(/ *; */).reduce(function(obj, pair){ - var p = pair.indexOf('='); - if(p > 0) - obj[pair.substring(0, p).trim()] = pair.substring(p + 1).trim(); - else - obj[pair.trim()] = true; - return obj; - }, this); - - // Assign value - this.value = this[this.name]; - - // Expires - this.expires = this.expires - ? new Date(this.expires) - : Infinity; - - // Default or trim path - this.path = this.path - ? this.path.trim(): req - ? url.parse(req.url).pathname: '/'; -}; - -/** - * Return the original cookie string. - * - * @return {String} - * @api public - */ - -Cookie.prototype.toString = function(){ - return this.str; -}; diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/vendor/cookie/jar.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/vendor/cookie/jar.js deleted file mode 100644 index 34920e0..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/request/vendor/cookie/jar.js +++ /dev/null @@ -1,72 +0,0 @@ -/*! -* Tobi - CookieJar -* Copyright(c) 2010 LearnBoost -* MIT Licensed -*/ - -/** -* Module dependencies. -*/ - -var url = require('url'); - -/** -* Initialize a new `CookieJar`. -* -* @api private -*/ - -var CookieJar = exports = module.exports = function CookieJar() { - this.cookies = []; -}; - -/** -* Add the given `cookie` to the jar. -* -* @param {Cookie} cookie -* @api private -*/ - -CookieJar.prototype.add = function(cookie){ - this.cookies = this.cookies.filter(function(c){ - // Avoid duplication (same path, same name) - return !(c.name == cookie.name && c.path == cookie.path); - }); - this.cookies.push(cookie); -}; - -/** -* Get cookies for the given `req`. -* -* @param {IncomingRequest} req -* @return {Array} -* @api private -*/ - -CookieJar.prototype.get = function(req){ - var path = url.parse(req.url).pathname - , now = new Date - , specificity = {}; - return this.cookies.filter(function(cookie){ - if (0 == path.indexOf(cookie.path) && now < cookie.expires - && cookie.path.length > (specificity[cookie.name] || 0)) - return specificity[cookie.name] = cookie.path.length; - }); -}; - -/** -* Return Cookie string for the given `req`. -* -* @param {IncomingRequest} req -* @return {String} -* @api private -*/ - -CookieJar.prototype.cookieString = function(req){ - var cookies = this.get(req); - if (cookies.length) { - return cookies.map(function(cookie){ - return cookie.name + '=' + cookie.value; - }).join('; '); - } -}; diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/.npmignore b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/.npmignore deleted file mode 100644 index e3bc275..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules/ -node_modules/* -npm-debug.log \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/CHANGELOG.md b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/CHANGELOG.md deleted file mode 100644 index 1effdd2..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/CHANGELOG.md +++ /dev/null @@ -1,15 +0,0 @@ -#VERSION HISTORY - -##2.0 -* [Breaking] Refactored this to work in node.js. Backwards compatibility to existing browser API coming in future 2.x releases. (indexzero) - -## 1.2 -* Added TimeSpan.FromDates Constructor to take two dates - and create a TimeSpan from the difference. (mstum) - -## 1.1 -* Changed naming to follow JavaScript standards (mstum) -* Added Documentation (mstum) - -## 1.0 -* Initial Revision (mstum) diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/LICENSE b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/LICENSE deleted file mode 100644 index 071d8fb..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010 Michael Stum, Charlie Robbins - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/README.md b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/README.md deleted file mode 100644 index 2bb9904..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/README.md +++ /dev/null @@ -1,199 +0,0 @@ -# timespan - -A simple implementation of TimeSpans in Javascript. - -## Installation in node.js - -### Installing npm (node package manager) -``` bash - $ curl http://npmjs.org/install.sh | sh -``` - -### Installing timespan -``` bash - [sudo] npm install timespan -``` - -## Usage -You have two options when creating a new TimeSpan object: either explicitly instantiate it using the TimeSpan constructor function or use a helper method to create from a specific length of time. - -### Using the new constructor - -``` js - var timespan = require('timespan'); - var ts = new timespan.TimeSpan(); -``` - -The constructor takes 5 parameters, all which are optional and which can be used to initialize the TimeSpan to a given value. These parameters are: `milliseconds`, `seconds`, `minutes`, `hours`, `days`. - -``` js - // - // Initializes the TimeSpan to 4 Minutes, 16 Seconds and 0 Milliseconds. - // - var ts = new TimeSpan(0,16,4) - - // - // Initializes the TimeSpan to 3 hours, 4 minutes, 10 seconds and 0 msecs. - // - var ts = new TimeSpan(0,10,64,2); -``` - -### Using Construction Helper Method(s) -You can initialize a new TimeSpan by calling one of these Functions: - -``` js - timespan.FromSeconds(/* seconds */); - timespan.FromMinutes(/* minutes */); - timespan.FromHours(/* hours */); - timespan.FromDays(/* hours */); - - // - // This behaves differently, see below - // - timespan.FromDates(start, end); -``` - -The first four helper methods take a single numeric parameter and create a new TimeSpan instance. e.g. `timespan.FromSeconds(45)` is equivalent to `new TimeSpan(0,45)`. If the parameter is invalid/not a number, it will just be treated as 0 no error will be thrown. - -`timespan.FromDates()` is different as it takes two dates. The TimeSpan will be the difference between these dates. - -If the second date is earlier than the first date, the TimeSpan will have a negative value. You can pass in "true" as the third parameter to force the TimeSpan to be positive always. - -``` js - var date1 = new Date(2010, 3, 1, 10, 10, 5, 0); - var date2 = new Date(2010, 3, 1, 10, 10, 10, 0); - var ts = TimeSpan.FromDates(date2, date1); - var ts2 = TimeSpan.FromDates(date2, date1, true); - - // - // -5, because we put the later date first - // - console.log(ts.totalSeconds()); - - // - // 5, because we passed true as third parameter - // - console.log(ts2.totalSeconds()); -``` - - -### Adding / Subtracting TimeSpans -There are several functions to add or subtract time: - -``` js - ts.addMilliseconds() - ts.addSeconds() - ts.addMinutes() - ts.addHours() - ts.addDays() - ts.subtractMilliseconds() - ts.subtractSeconds() - ts.subtractMinutes() - ts.subtractHours() - ts.subtractDays() -``` - -All these functions take a single numeric parameter. If the parameter is invalid, not a number, or missing it will be ignored and no Error is thrown. - -``` js - var ts = new TimeSpan(); - ts.addSeconds(30); - ts.addMinutes(2); - ts.subtractSeconds(60); - - // - // ts will now be a timespan of 1 minute and 30 seconds - // -``` - -The parameter can be negative to negate the operation `ts.addSeconds(-30)` is equivalent to `ts.subtractSeconds(30)`. - -### Interacting with Other TimeSpan instances -These are the functions that interact with another TimeSpan: - -``` js - ts.add() - ts.subtract() - ts.equals() -``` - -add and subtract add/subtract the other TimeSpan to the current one: - -``` js - var ts = TimeSpan.FromSeconds(30); - var ts2 = TimeSpan.FromMinutes(2); - ts.add(ts2); - - // - // ts is now a TimeSpan of 2 Minutes, 30 Seconds - // ts2 is unchanged - // -``` - -equals checks if two TimeSpans have the same time: - -``` js - var ts = TimeSpan.FromSeconds(30); - var ts2 = TimeSpan.FromSeconds(30); - var eq = ts.equals(ts2); // true - ts2.addSeconds(1); - var eq2 = ts.equals(ts2); // false -``` - -### Retrieving the Value of a TimeSpan -There are two sets of functions to retreive the function of the TimeSpan: those that deal with the full value in various measurements and another that gets the individual components. - -#### Retrieve the full value - -``` js - ts.totalMilliseconds() - ts.totalSeconds() - ts.totalMinutes() - ts.totalHours() - ts.totalDays() -``` - -These functions convert the value to the given format and return it. The result can be a floating point number. These functions take a single parameter roundDown which can be set to true to round the value down to an Integer. - -``` js - var ts = TimeSpan.fromSeconds(90); - console.log(ts.totalMilliseconds()); // 90000 - console.log(ts.totalSeconds()); // 90 - console.log(ts.totalMinutes()); // 1.5 - console.log(ts.totalMinutes(true)); // 1 -``` - -#### Retrieve a component of the TimeSpan - -``` js - ts.milliseconds - ts.seconds - ts.minutes - ts.hours - ts.days -``` - -These functions return a component of the TimeSpan that could be used to represent a clock. - -``` js - var ts = TimeSpan.FromSeconds(90); - console.log(ts.seconds()); // 30 - console.log(ts.minutes()); // 1 -``` - -Basically these value never "overflow" - seconds will only return 0 to 59, hours only 0 to 23 etc. Days could grow infinitely. All of these functions automatically round down the result: - -``` js - var ts = TimeSpan.FromDays(2); - ts.addHours(12); - console.log(ts.days()); // 2 - console.log(ts.hours()); // 12 -``` - -## Remark about Backwards Compatibility -Version 0.2.x was designed to work with [node.js][0] and backwards compatibility to the browser-based usage was not considered a high priority. This will be fixed in future versions, but for now if you need to use this in the browser, you can find the 0.1.x code under `/browser`. - -#### Author: [Michael Stum](http://www.stum.de) -#### Contributors: [Charlie Robbins](http://github.com/indexzero) - -[0]: http://nodejs.org \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/browser/TimeSpan-1.2.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/browser/TimeSpan-1.2.js deleted file mode 100644 index bc8149d..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/browser/TimeSpan-1.2.js +++ /dev/null @@ -1,226 +0,0 @@ -/*! -* JavaScript TimeSpan Library -* -* Copyright (c) 2010 Michael Stum, http://www.Stum.de/ -* -* Permission is hereby granted, free of charge, to any person obtaining -* a copy of this software and associated documentation files (the -* "Software"), to deal in the Software without restriction, including -* without limitation the rights to use, copy, modify, merge, publish, -* distribute, sublicense, and/or sell copies of the Software, and to -* permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice shall be -* included in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -/*global window: false */ -"use strict"; -(function () { - // Constructor function, all parameters are optional - var TimeSpan = window.TimeSpan = function (milliseconds, seconds, minutes, hours, days) { - var version = "1.2", - // Millisecond-constants - msecPerSecond = 1000, - msecPerMinute = 60000, - msecPerHour = 3600000, - msecPerDay = 86400000, - // Internally we store the TimeSpan as Milliseconds - msecs = 0, - - // Helper functions - isNumeric = function (input) { - return !isNaN(parseFloat(input)) && isFinite(input); - }; - - // Constructor Logic - if (isNumeric(days)) { - msecs += (days * msecPerDay); - } - if (isNumeric(hours)) { - msecs += (hours * msecPerHour); - } - if (isNumeric(minutes)) { - msecs += (minutes * msecPerMinute); - } - if (isNumeric(seconds)) { - msecs += (seconds * msecPerSecond); - } - if (isNumeric(milliseconds)) { - msecs += milliseconds; - } - - // Addition Functions - this.addMilliseconds = function (milliseconds) { - if (!isNumeric(milliseconds)) { - return; - } - msecs += milliseconds; - }; - this.addSeconds = function (seconds) { - if (!isNumeric(seconds)) { - return; - } - msecs += (seconds * msecPerSecond); - }; - this.addMinutes = function (minutes) { - if (!isNumeric(minutes)) { - return; - } - msecs += (minutes * msecPerMinute); - }; - this.addHours = function (hours) { - if (!isNumeric(hours)) { - return; - } - msecs += (hours * msecPerHour); - }; - this.addDays = function (days) { - if (!isNumeric(days)) { - return; - } - msecs += (days * msecPerDay); - }; - - // Subtraction Functions - this.subtractMilliseconds = function (milliseconds) { - if (!isNumeric(milliseconds)) { - return; - } - msecs -= milliseconds; - }; - this.subtractSeconds = function (seconds) { - if (!isNumeric(seconds)) { - return; - } - msecs -= (seconds * msecPerSecond); - }; - this.subtractMinutes = function (minutes) { - if (!isNumeric(minutes)) { - return; - } - msecs -= (minutes * msecPerMinute); - }; - this.subtractHours = function (hours) { - if (!isNumeric(hours)) { - return; - } - msecs -= (hours * msecPerHour); - }; - this.subtractDays = function (days) { - if (!isNumeric(days)) { - return; - } - msecs -= (days * msecPerDay); - }; - - // Functions to interact with other TimeSpans - this.isTimeSpan = true; - this.add = function (otherTimeSpan) { - if (!otherTimeSpan.isTimeSpan) { - return; - } - msecs += otherTimeSpan.totalMilliseconds(); - }; - this.subtract = function (otherTimeSpan) { - if (!otherTimeSpan.isTimeSpan) { - return; - } - msecs -= otherTimeSpan.totalMilliseconds(); - }; - this.equals = function (otherTimeSpan) { - if (!otherTimeSpan.isTimeSpan) { - return; - } - return msecs === otherTimeSpan.totalMilliseconds(); - }; - - // Getters - this.totalMilliseconds = function (roundDown) { - var result = msecs; - if (roundDown === true) { - result = Math.floor(result); - } - return result; - }; - this.totalSeconds = function (roundDown) { - var result = msecs / msecPerSecond; - if (roundDown === true) { - result = Math.floor(result); - } - return result; - }; - this.totalMinutes = function (roundDown) { - var result = msecs / msecPerMinute; - if (roundDown === true) { - result = Math.floor(result); - } - return result; - }; - this.totalHours = function (roundDown) { - var result = msecs / msecPerHour; - if (roundDown === true) { - result = Math.floor(result); - } - return result; - }; - this.totalDays = function (roundDown) { - var result = msecs / msecPerDay; - if (roundDown === true) { - result = Math.floor(result); - } - return result; - }; - // Return a Fraction of the TimeSpan - this.milliseconds = function () { - return msecs % 1000; - }; - this.seconds = function () { - return Math.floor(msecs / msecPerSecond) % 60; - }; - this.minutes = function () { - return Math.floor(msecs / msecPerMinute) % 60; - }; - this.hours = function () { - return Math.floor(msecs / msecPerHour) % 24; - }; - this.days = function () { - return Math.floor(msecs / msecPerDay); - }; - - // Misc. Functions - this.getVersion = function () { - return version; - }; - }; - - // "Static Constructors" - TimeSpan.FromSeconds = function (seconds) { - return new TimeSpan(0, seconds, 0, 0, 0); - }; - TimeSpan.FromMinutes = function (minutes) { - return new TimeSpan(0, 0, minutes, 0, 0); - }; - TimeSpan.FromHours = function (hours) { - return new TimeSpan(0, 0, 0, hours, 0); - }; - TimeSpan.FromDays = function (days) { - return new TimeSpan(0, 0, 0, 0, days); - }; - TimeSpan.FromDates = function (firstDate, secondDate, forcePositive) { - var differenceMsecs = secondDate.valueOf() - firstDate.valueOf(); - if(forcePositive === true) { - differenceMsecs = Math.abs(differenceMsecs); - } - return new TimeSpan(differenceMsecs, 0, 0, 0, 0); - }; -}()); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/browser/TimeSpan-1.2.min.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/browser/TimeSpan-1.2.min.js deleted file mode 100644 index 0326cbb..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/browser/TimeSpan-1.2.min.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(function(){var a=window.TimeSpan=function(g,i,h,j,k){var l="1.2",d=1e3,c=6e4,e=3.6e6,f=8.64e7,a=0,b=function(a){return !isNaN(parseFloat(a))&&isFinite(a)};if(b(k))a+=k*f;if(b(j))a+=j*e;if(b(h))a+=h*c;if(b(i))a+=i*d;if(b(g))a+=g;this.addMilliseconds=function(c){if(!b(c))return;a+=c};this.addSeconds=function(c){if(!b(c))return;a+=c*d};this.addMinutes=function(d){if(!b(d))return;a+=d*c};this.addHours=function(c){if(!b(c))return;a+=c*e};this.addDays=function(c){if(!b(c))return;a+=c*f};this.subtractMilliseconds=function(c){if(!b(c))return;a-=c};this.subtractSeconds=function(c){if(!b(c))return;a-=c*d};this.subtractMinutes=function(d){if(!b(d))return;a-=d*c};this.subtractHours=function(c){if(!b(c))return;a-=c*e};this.subtractDays=function(c){if(!b(c))return;a-=c*f};this.isTimeSpan=true;this.add=function(b){if(!b.isTimeSpan)return;a+=b.totalMilliseconds()};this.subtract=function(b){if(!b.isTimeSpan)return;a-=b.totalMilliseconds()};this.equals=function(b){if(!b.isTimeSpan)return;return a===b.totalMilliseconds()};this.totalMilliseconds=function(c){var b=a;if(c===true)b=Math.floor(b);return b};this.totalSeconds=function(c){var b=a/d;if(c===true)b=Math.floor(b);return b};this.totalMinutes=function(d){var b=a/c;if(d===true)b=Math.floor(b);return b};this.totalHours=function(c){var b=a/e;if(c===true)b=Math.floor(b);return b};this.totalDays=function(c){var b=a/f;if(c===true)b=Math.floor(b);return b};this.milliseconds=function(){return a%1e3};this.seconds=function(){return Math.floor(a/d)%60};this.minutes=function(){return Math.floor(a/c)%60};this.hours=function(){return Math.floor(a/e)%24};this.days=function(){return Math.floor(a/f)};this.getVersion=function(){return l}};a.FromSeconds=function(b){return new a(0,b,0,0,0)};a.FromMinutes=function(b){return new a(0,0,b,0,0)};a.FromHours=function(b){return new a(0,0,0,b,0)};a.FromDays=function(b){return new a(0,0,0,0,b)};a.FromDates=function(e,d,c){var b=d.valueOf()-e.valueOf();if(c===true)b=Math.abs(b);return new a(b,0,0,0,0)}})() \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/docs/docco.css b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/docs/docco.css deleted file mode 100644 index bd54134..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/docs/docco.css +++ /dev/null @@ -1,194 +0,0 @@ -/*--------------------- Layout and Typography ----------------------------*/ -body { - font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; - font-size: 15px; - line-height: 22px; - color: #252519; - margin: 0; padding: 0; -} -a { - color: #261a3b; -} - a:visited { - color: #261a3b; - } -p { - margin: 0 0 15px 0; -} -h4, h5, h6 { - color: #333; - margin: 6px 0 6px 0; - font-size: 13px; -} - h2, h3 { - margin-bottom: 0; - color: #000; - } - h1 { - margin-top: 40px; - margin-bottom: 15px; - color: #000; - } -#container { - position: relative; -} -#background { - position: fixed; - top: 0; left: 525px; right: 0; bottom: 0; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - z-index: -1; -} -#jump_to, #jump_page { - background: white; - -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; - -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; - font: 10px Arial; - text-transform: uppercase; - cursor: pointer; - text-align: right; -} -#jump_to, #jump_wrapper { - position: fixed; - right: 0; top: 0; - padding: 5px 10px; -} - #jump_wrapper { - padding: 0; - display: none; - } - #jump_to:hover #jump_wrapper { - display: block; - } - #jump_page { - padding: 5px 0 3px; - margin: 0 0 25px 25px; - } - #jump_page .source { - display: block; - padding: 5px 10px; - text-decoration: none; - border-top: 1px solid #eee; - } - #jump_page .source:hover { - background: #f5f5ff; - } - #jump_page .source:first-child { - } -table td { - border: 0; - outline: 0; -} - td.docs, th.docs { - max-width: 450px; - min-width: 450px; - min-height: 5px; - padding: 10px 25px 1px 50px; - overflow-x: hidden; - vertical-align: top; - text-align: left; - } - .docs pre { - margin: 15px 0 15px; - padding-left: 15px; - } - .docs p tt, .docs p code { - background: #f8f8ff; - border: 1px solid #dedede; - font-size: 12px; - padding: 0 0.2em; - } - .pilwrap { - position: relative; - } - .pilcrow { - font: 12px Arial; - text-decoration: none; - color: #454545; - position: absolute; - top: 3px; left: -20px; - padding: 1px 2px; - opacity: 0; - -webkit-transition: opacity 0.2s linear; - } - td.docs:hover .pilcrow { - opacity: 1; - } - td.code, th.code { - padding: 14px 15px 16px 25px; - width: 100%; - vertical-align: top; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - } - pre, tt, code { - font-size: 12px; line-height: 18px; - font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; - margin: 0; padding: 0; - } - - -/*---------------------- Syntax Highlighting -----------------------------*/ -td.linenos { background-color: #f0f0f0; padding-right: 10px; } -span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } -body .hll { background-color: #ffffcc } -body .c { color: #408080; font-style: italic } /* Comment */ -body .err { border: 1px solid #FF0000 } /* Error */ -body .k { color: #954121 } /* Keyword */ -body .o { color: #666666 } /* Operator */ -body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ -body .cp { color: #BC7A00 } /* Comment.Preproc */ -body .c1 { color: #408080; font-style: italic } /* Comment.Single */ -body .cs { color: #408080; font-style: italic } /* Comment.Special */ -body .gd { color: #A00000 } /* Generic.Deleted */ -body .ge { font-style: italic } /* Generic.Emph */ -body .gr { color: #FF0000 } /* Generic.Error */ -body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -body .gi { color: #00A000 } /* Generic.Inserted */ -body .go { color: #808080 } /* Generic.Output */ -body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -body .gs { font-weight: bold } /* Generic.Strong */ -body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -body .gt { color: #0040D0 } /* Generic.Traceback */ -body .kc { color: #954121 } /* Keyword.Constant */ -body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ -body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ -body .kp { color: #954121 } /* Keyword.Pseudo */ -body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ -body .kt { color: #B00040 } /* Keyword.Type */ -body .m { color: #666666 } /* Literal.Number */ -body .s { color: #219161 } /* Literal.String */ -body .na { color: #7D9029 } /* Name.Attribute */ -body .nb { color: #954121 } /* Name.Builtin */ -body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ -body .no { color: #880000 } /* Name.Constant */ -body .nd { color: #AA22FF } /* Name.Decorator */ -body .ni { color: #999999; font-weight: bold } /* Name.Entity */ -body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -body .nf { color: #0000FF } /* Name.Function */ -body .nl { color: #A0A000 } /* Name.Label */ -body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -body .nt { color: #954121; font-weight: bold } /* Name.Tag */ -body .nv { color: #19469D } /* Name.Variable */ -body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -body .w { color: #bbbbbb } /* Text.Whitespace */ -body .mf { color: #666666 } /* Literal.Number.Float */ -body .mh { color: #666666 } /* Literal.Number.Hex */ -body .mi { color: #666666 } /* Literal.Number.Integer */ -body .mo { color: #666666 } /* Literal.Number.Oct */ -body .sb { color: #219161 } /* Literal.String.Backtick */ -body .sc { color: #219161 } /* Literal.String.Char */ -body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ -body .s2 { color: #219161 } /* Literal.String.Double */ -body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -body .sh { color: #219161 } /* Literal.String.Heredoc */ -body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -body .sx { color: #954121 } /* Literal.String.Other */ -body .sr { color: #BB6688 } /* Literal.String.Regex */ -body .s1 { color: #219161 } /* Literal.String.Single */ -body .ss { color: #19469D } /* Literal.String.Symbol */ -body .bp { color: #954121 } /* Name.Builtin.Pseudo */ -body .vc { color: #19469D } /* Name.Variable.Class */ -body .vg { color: #19469D } /* Name.Variable.Global */ -body .vi { color: #19469D } /* Name.Variable.Instance */ -body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/docs/time-span.html b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/docs/time-span.html deleted file mode 100644 index 9eb2cc9..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/docs/time-span.html +++ /dev/null @@ -1,692 +0,0 @@ - time-span.js

        time-span.js

        /*
        -* JavaScript TimeSpan Library
        -*
        -* Copyright (c) 2010 Michael Stum, Charlie Robbins
        -* 
        -* Permission is hereby granted, free of charge, to any person obtaining
        -* a copy of this software and associated documentation files (the
        -* "Software"), to deal in the Software without restriction, including
        -* without limitation the rights to use, copy, modify, merge, publish,
        -* distribute, sublicense, and/or sell copies of the Software, and to
        -* permit persons to whom the Software is furnished to do so, subject to
        -* the following conditions:
        -* 
        -* The above copyright notice and this permission notice shall be
        -* included in all copies or substantial portions of the Software.
        -* 
        -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
        -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
        -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
        -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
        -* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
        -* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
        -* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        -*/

        Time constants

        var msecPerSecond = 1000,
        -    msecPerMinute = 60000,
        -    msecPerHour = 3600000,
        -    msecPerDay = 86400000;

        Timespan Parsers

        var timeSpanWithDays = /^(\d+):(\d+):(\d+):(\d+)(\.\d+)?/,
        -    timeSpanNoDays = /^(\d+):(\d+):(\d+)(\.\d+)?/;

        function TimeSpan (milliseconds, seconds, minutes, hours, days)

        - -

        @milliseconds {Number} Number of milliseconds for this instance.

        - -

        @seconds {Number} Number of seconds for this instance.

        - -

        @minutes {Number} Number of minutes for this instance.

        - -

        @hours {Number} Number of hours for this instance.

        - -

        @days {Number} Number of days for this instance.

        - -

        Constructor function for the TimeSpan object which represents a length -of positive or negative milliseconds componentized into milliseconds, -seconds, hours, and days.

        var TimeSpan = exports.TimeSpan = function (milliseconds, seconds, minutes, hours, days) {
        -  this.msecs = 0;
        -  
        -  if (isNumeric(days)) {
        -    this.msecs += (days * msecPerDay);
        -  }
        -  
        -  if (isNumeric(hours)) {
        -    this.msecs += (hours * msecPerHour);
        -  }
        -  
        -  if (isNumeric(minutes)) {
        -    this.msecs += (minutes * msecPerMinute);
        -  }
        -  
        -  if (isNumeric(seconds)) {
        -    this.msecs += (seconds * msecPerSecond);
        -  }
        -  
        -  if (isNumeric(milliseconds)) {
        -    this.msecs += milliseconds;
        -  }
        -};

        Factory methods

        - -

        Helper methods for creating new TimeSpan objects -from various criteria: milliseconds, seconds, minutes, -hours, days, strings and other TimeSpan instances.

        function fromMilliseconds (milliseconds)

        - -

        @milliseconds {Number} Amount of milliseconds for the new TimeSpan instance.

        - -

        Creates a new TimeSpan instance with the specified milliseconds.

        exports.fromMilliseconds = function (milliseconds) {
        -  if (!isNumeric(milliseconds)) {
        -    return;
        -  }
        -  
        -  return new TimeSpan(milliseconds, 0, 0, 0, 0);
        -}

        function fromSeconds (seconds)

        - -

        @milliseconds {Number} Amount of seconds for the new TimeSpan instance.

        - -

        Creates a new TimeSpan instance with the specified seconds.

        exports.fromSeconds = function (seconds) {
        -  if (!isNumeric(seconds)) {
        -    return;
        -  }
        -  
        -  return new TimeSpan(0, seconds, 0, 0, 0);
        -};

        function fromMinutes (milliseconds)

        - -

        @milliseconds {Number} Amount of minutes for the new TimeSpan instance.

        - -

        Creates a new TimeSpan instance with the specified minutes.

        exports.fromMinutes = function (minutes) {
        -  if (!isNumeric(minutes)) {
        -    return;
        -  }
        -  
        -  return new TimeSpan(0, 0, minutes, 0, 0);
        -};

        function fromHours (hours)

        - -

        @milliseconds {Number} Amount of hours for the new TimeSpan instance.

        - -

        Creates a new TimeSpan instance with the specified hours.

        exports.fromHours = function (hours) {
        -  if (!isNumeric(hours)) {
        -    return;
        -  }
        -  
        -  return new TimeSpan(0, 0, 0, hours, 0);
        -};

        function fromDays (days)

        - -

        @milliseconds {Number} Amount of days for the new TimeSpan instance.

        - -

        Creates a new TimeSpan instance with the specified days.

        exports.fromDays = function (days) {
        -  if (!isNumeric(days)) {
        -    return;
        -  }
        -  
        -  return new TimeSpan(0, 0, 0, 0, days);
        -};

        function parse (str)

        - -

        @str {string} Timespan string to parse.

        - -

        Creates a new TimeSpan instance from the specified -string, str.

        exports.parse = function (str) {
        -  var match, milliseconds;
        -  
        -  function parseMilliseconds (value) {
        -    return value ? parseFloat('0' + value) * 1000 : 0;
        -  }
        -  

        If we match against a full TimeSpan:

          if ((match = str.match(timeSpanWithDays))) {
        -    return new TimeSpan(parseMilliseconds(match[5]), match[4], match[3], match[2], match[1]);
        -  }
        -  

        If we match against a partial TimeSpan:

          if ((match = str.match(timeSpanNoDays))) {
        -    return new TimeSpan(parseMilliseconds(match[4]), match[3], match[2], match[1], 0);
        -  }
        -  
        -  return null;
        -};
        -
        -var months  = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

        List of default singular time modifiers and associated -computation algoritm. Assumes in order, smallest to greatest -performing carry forward additiona / subtraction for each -Date-Time component.

        var parsers = {
        -  'milliseconds': {
        -    exp: /(\d+)milli[second]?[s]?/i,
        -    get: function (date) { return date.getMilliseconds(date) },
        -    set: function (val, date) { date.setMilliseconds(val) },
        -    compute: function (delta, date, computed) {
        -      var round = delta > 0 ? Math.floor : Math.ceil;
        -      if (delta) {
        -        computed.seconds += round.call(null, delta / 1000);
        -        computed.milliseconds += delta % 1000;
        -      }
        -      
        -      if (Math.abs(computed.milliseconds) >= 1000) {
        -        computed.seconds += round.call(null, computed.milliseconds / 1000)
        -        computed.milliseconds = computed.milliseconds % 1000;
        -      }
        -
        -      return computed;
        -    }
        -  },
        -  'seconds': {
        -    exp: /(\d+)second[s]?/i,
        -    get: function (date) { return date.getSeconds(date) },
        -    set: function (val, date) { date.setSeconds(val) },
        -    compute: function (delta, date, computed) {
        -      var round = delta > 0 ? Math.floor : Math.ceil;
        -      if (delta) {
        -        computed.minutes += round.call(null, delta / 60);
        -        computed.seconds += delta % 60;
        -      }
        -      
        -      if (Math.abs(computed.seconds) >= 60) {
        -        computed.minutes += round.call(null, computed.seconds / 60);
        -        computed.seconds = computed.seconds % 60; 
        -      }
        -      
        -      return computed;
        -    }
        -  },
        -  'minutes': {
        -    exp: /(\d+)minute[s]?/i,
        -    get: function (date) { return date.getMinutes(date) },
        -    set: function (val, date) { date.setMinutes(val) },
        -    compute: function (delta, date, computed) {
        -      var round = delta > 0 ? Math.floor : Math.ceil;
        -      if (delta) { 
        -        computed.hours += round.call(null, delta / 60);
        -        computed.minutes += delta % 60;
        -      }
        -      
        -      if (Math.abs(computed.minutes) >= 60) {
        -        computed.hours += round.call(null, computed.minutes / 60);
        -        computed.minutes = computed.minutes % 60; 
        -      }
        -      
        -      return computed;
        -    }
        -  },
        -  'hours': {
        -    exp: /(\d+)hour[s]?/i,
        -    get: function (date) { return date.getHours(date) },
        -    set: function (val, date) { date.setHours(val) },
        -    compute: function (delta, date, computed) {
        -      var round = delta > 0 ? Math.floor : Math.ceil;
        -      if (delta) { 
        -        computed.days += round.call(null, delta / 24);
        -        computed.hours += delta % 24;
        -      }
        -      
        -      if (Math.abs(computed.hours) >= 24) {
        -        computed.days += round.call(null, computed.hours / 24);
        -        computed.hours = computed.hours % 24;
        -      }
        -      
        -      return computed;
        -    }
        -  },
        -  'days': {
        -    exp: /(\d+)day[s]?/i,
        -    get: function (date) { return date.getDate(date) },
        -    set: function (val, date) { date.setDate(val) },
        -    compute: function (delta, date, computed) {
        -      var sign     = delta >= 0 ? 1 : -1,
        -          opsign   = delta >= 0 ? -1 : 1,
        -          clean    = 0,
        -          original = delta,
        -          month    = computed.months,
        -          days     = months[month];
        -      
        -      if (delta) {          
        -        while (Math.abs(delta) >= days) {
        -          month += sign * 1;
        -          computed.months += sign * 1;
        -          delta += opsign * days;
        -        
        -          if (month < 0) { month = 11 }
        -          else if (month > 11) { month = 0 }
        -        
        -          days = months[month];
        -        }
        -      
        -        computed.days += (sign * delta);
        -      }
        -      
        -      if (computed.days < 0) {
        -        clean = -1;
        -      }
        -      else if (computed.days > months[computed.months]) {
        -        clean = 1;
        -      }
        -      
        -      if (clean !== 0) {
        -        computed.months += clean;
        -        if (computed.months < 0) { computed.months = 11 }
        -        else if (computed.months > 11) { computed.months = 0 }
        -        computed.days = months[computed.months] + computed.days;
        -      }
        -            
        -      return computed;
        -    }
        -  },
        -  'months': {
        -    exp: /(\d+)month[s]?/i,
        -    get: function (date) { return date.getMonth(date) },
        -    set: function (val, date) { date.setMonth(val) },
        -    compute: function (delta, date, computed) {
        -      var round = delta > 0 ? Math.floor : Math.ceil;
        -      if (delta) { 
        -        computed.years += round.call(null, delta / 12);
        -        computed.months += delta % 12;
        -      }
        -      
        -      if (computed.months > 11) {
        -        computed.years += Math.floor((computed.months + 1) / 12);
        -        computed.months = ((computed.months + 1) % 12) - 1;
        -      }
        -      
        -      return computed;
        -    }
        -  },
        -  'years': {
        -    exp: /(\d+)year[s]?/i,
        -    get: function (date) { return date.getFullYear(date) },
        -    set: function (val, date) { date.setFullYear(val) },
        -    compute: function (delta, date, computed) {
        -      if (delta) { 
        -        computed.years += delta;
        -      }
        -      
        -      return computed;
        -    }
        -  }
        -};

        Compute the list of parser names for -later use.

        var parserNames = Object.keys(parsers);

        function parseDate (str)

        - -

        @str {string} String to parse into a date

        - -

        Parses the specified liberal Date-Time string according to -ISO8601 and:

        - -
          -
        1. 2010-04-03T12:34:15Z+12MINUTES
        2. -
        3. NOW-4HOURS
        4. -
        - -

        Valid modifiers for the more liberal Date-Time string(s):

        - -
        YEAR, YEARS
        -MONTH, MONTHS
        -DAY, DAYS
        -HOUR, HOURS
        -MINUTE, MINUTES
        -SECOND, SECONDS
        -MILLI, MILLIS, MILLISECOND, MILLISECONDS
        -
        exports.parseDate = function (str) {
        -  var simple = Date.parse(str),
        -      iso = '^([^Z]+)',
        -      zulu = 'Z([\\+|\\-])?',
        -      diff = {},
        -      base,
        -      sign,
        -      complex,
        -      inspect,
        -      dateTime,
        -      modifiers;
        -
        -  if (/now/i.test(str)) {
        -    iso = '^(NOW)';
        -    zulu = zulu.replace(/Z/, 'NOW');
        -  }

        If Date string supplied actually conforms -to UTC Time (ISO8601), return a new Date.

          if (!isNaN(simple)) {
        -    return new Date(simple);
        -  }
        -  

        Create the RegExp for the end component -of the target str to parse.

          parserNames.forEach(function (group) {
        -    zulu += '(\\d+[a-zA-Z]+)?';
        -  });
        -  

        Parse the ISO8601 component, and the end -component from the target str.

          dateTime = str.match(new RegExp(iso, 'i'));
        -  modifiers = str.match(new RegExp(zulu, 'i'));
        -  

        If there was no match on either part then -it must be a bad value.

          if (!dateTime || !modifiers) {
        -    return null;
        -  }
        -    

        Create a new Date object from the ISO8601 -component of the target str.

          base = /now/i.test(dateTime[1]) ? Date.now() : Date.parse(dateTime[1]);
        -  complex = new Date(base);
        -  sign = modifiers[1] === '+' ? 1 : -1;
        -  

        Parse the individual component spans (months, years, etc) -from the modifier strings that we parsed from the end -of the target str.

          modifiers.slice(2).filter(Boolean).forEach(function (modifier) {
        -    parserNames.forEach(function (name) {
        -      var match;
        -      if (!(match = modifier.match(parsers[name].exp))) {
        -        return;
        -      }
        -      
        -      diff[name] = sign * parseInt(match[1], 10);
        -    })
        -  });
        -  

        Compute the total diff by iteratively computing -the partial components from smallest to largest.

          var computed = {
        -    milliseconds: complex.getMilliseconds(),
        -    seconds: complex.getSeconds(),
        -    minutes: complex.getMinutes(),
        -    hours: complex.getHours(),
        -    days: complex.getDate(),
        -    months: complex.getMonth(),
        -    years: complex.getFullYear()
        -  };
        -  
        -  parserNames.forEach(function (name) {    
        -    computed = parsers[name].compute(diff[name], complex, computed);
        -  });
        -  
        -  return new Date(
        -    Date.UTC(
        -      computed.years,
        -      computed.months,
        -      computed.days,
        -      computed.hours,
        -      computed.minutes,
        -      computed.seconds,
        -      computed.milliseconds
        -    )
        -  );
        -};

        function fromDates (start, end, abs)

        - -

        @start {Date} Start date of the TimeSpan instance to return

        - -

        @end {Date} End date of the TimeSpan instance to return

        - -

        @abs {boolean} Value indicating to return an absolute value

        - -

        Returns a new TimeSpan instance representing the difference between -the start and end Dates.

        exports.fromDates = function (start, end, abs) {
        -  if (!start instanceof Date) {
        -    start = exports.parseDate(start);
        -  }
        -  
        -  if (!end instanceof Date) {
        -    end = exports.parseDate(end);
        -  }
        -  
        -  var differenceMsecs = end.valueOf() - start.valueOf();
        -  if (abs) {
        -    differenceMsecs = Math.abs(differenceMsecs);
        -  }
        -
        -  return new TimeSpan(differenceMsecs, 0, 0, 0, 0);
        -};

        Module Helpers

        - -

        Module-level helpers for various utilities such as: -instanceOf, parsability, and cloning.

        function test (str)

        - -

        @str {string} String value to test if it is a TimeSpan

        - -

        Returns a value indicating if the specified string, str, -is a parsable TimeSpan value.

        exports.test = function (str) {
        -  return timeSpanWithDays.test(str) || timeSpanNoDays.test(str);
        -};

        function instanceOf (timeSpan)

        - -

        @timeSpan {Object} Object to check TimeSpan quality.

        - -

        Returns a value indicating if the specified timeSpan is -in fact a TimeSpan instance.

        exports.instanceOf = function (timeSpan) {
        -  return timeSpan instanceof TimeSpan;
        -};

        function clone (timeSpan)

        - -

        @timeSpan {TimeSpan} TimeSpan object to clone.

        - -

        Returns a new TimeSpan instance with the same value -as the timeSpan object supplied.

        exports.clone = function (timeSpan) {
        -  if (!(timeSpan instanceof TimeSpan)) {
        -    return;
        -  }
        -  
        -  return exports.fromMilliseconds(timeSpan.totalMilliseconds());
        -};

        Addition

        - -

        Methods for adding TimeSpan instances, -milliseconds, seconds, hours, and days to other -TimeSpan instances.

        function add (timeSpan)

        - -

        @timeSpan {TimeSpan} TimeSpan to add to this instance

        - -

        Adds the specified timeSpan to this instance.

        TimeSpan.prototype.add = function (timeSpan) {
        -  if (!(timeSpan instanceof TimeSpan)) {
        -    return;
        -  }
        -  
        -  this.msecs += timeSpan.totalMilliseconds();
        -};

        function addMilliseconds (milliseconds)

        - -

        @milliseconds {Number} Number of milliseconds to add.

        - -

        Adds the specified milliseconds to this instance.

        TimeSpan.prototype.addMilliseconds = function (milliseconds) {
        -  if (!isNumeric(milliseconds)) {
        -    return;
        -  }
        -  
        -  this.msecs += milliseconds;
        -};

        function addSeconds (seconds)

        - -

        @seconds {Number} Number of seconds to add.

        - -

        Adds the specified seconds to this instance.

        TimeSpan.prototype.addSeconds = function (seconds) {
        -  if (!isNumeric(seconds)) {
        -    return;
        -  }
        -  
        -  this.msecs += (seconds * msecPerSecond);
        -};

        function addMinutes (minutes)

        - -

        @minutes {Number} Number of minutes to add.

        - -

        Adds the specified minutes to this instance.

        TimeSpan.prototype.addMinutes = function (minutes) {
        -  if (!isNumeric(minutes)) {
        -    return;
        -  }
        -  
        -  this.msecs += (minutes * msecPerMinute);
        -};

        function addHours (hours)

        - -

        @hours {Number} Number of hours to add.

        - -

        Adds the specified hours to this instance.

        TimeSpan.prototype.addHours = function (hours) {
        -  if (!isNumeric(hours)) {
        -    return;
        -  }
        -  
        -  this.msecs += (hours * msecPerHour);
        -};

        function addDays (days)

        - -

        @days {Number} Number of days to add.

        - -

        Adds the specified days to this instance.

        TimeSpan.prototype.addDays = function (days) {
        -  if (!isNumeric(days)) {
        -    return;
        -  }
        -  
        -  this.msecs += (days * msecPerDay);
        -};

        Subtraction

        - -

        Methods for subtracting TimeSpan instances, -milliseconds, seconds, hours, and days from other -TimeSpan instances.

        function subtract (timeSpan)

        - -

        @timeSpan {TimeSpan} TimeSpan to subtract from this instance.

        - -

        Subtracts the specified timeSpan from this instance.

        TimeSpan.prototype.subtract = function (timeSpan) {
        -  if (!(timeSpan instanceof TimeSpan)) {
        -    return;
        -  }
        -  
        -  this.msecs -= timeSpan.totalMilliseconds();
        -};

        function subtractMilliseconds (milliseconds)

        - -

        @milliseconds {Number} Number of milliseconds to subtract.

        - -

        Subtracts the specified milliseconds from this instance.

        TimeSpan.prototype.subtractMilliseconds = function (milliseconds) {
        -  if (!isNumeric(milliseconds)) {
        -    return;
        -  }
        -  
        -  this.msecs -= milliseconds;
        -};

        function subtractSeconds (seconds)

        - -

        @seconds {Number} Number of seconds to subtract.

        - -

        Subtracts the specified seconds from this instance.

        TimeSpan.prototype.subtractSeconds = function (seconds) {
        -  if (!isNumeric(seconds)) {
        -    return;
        -  }
        -  
        -  this.msecs -= (seconds * msecPerSecond);
        -};

        function subtractMinutes (minutes)

        - -

        @minutes {Number} Number of minutes to subtract.

        - -

        Subtracts the specified minutes from this instance.

        TimeSpan.prototype.subtractMinutes = function (minutes) {
        -  if (!isNumeric(minutes)) {
        -    return;
        -  }
        -  
        -  this.msecs -= (minutes * msecPerMinute);
        -};

        function subtractHours (hours)

        - -

        @hours {Number} Number of hours to subtract.

        - -

        Subtracts the specified hours from this instance.

        TimeSpan.prototype.subtractHours = function (hours) {
        -  if (!isNumeric(hours)) {
        -    return;
        -  }
        -  
        -  this.msecs -= (hours * msecPerHour);
        -};

        function subtractDays (days)

        - -

        @days {Number} Number of days to subtract.

        - -

        Subtracts the specified days from this instance.

        TimeSpan.prototype.subtractDays = function (days) {
        -  if (!isNumeric(days)) {
        -    return;
        -  }
        -  
        -  this.msecs -= (days * msecPerDay);
        -};

        Getters

        - -

        Methods for retrieving components of a TimeSpan -instance: milliseconds, seconds, minutes, hours, and days.

        function totalMilliseconds (roundDown)

        - -

        @roundDown {boolean} Value indicating if the value should be rounded down.

        - -

        Returns the total number of milliseconds for this instance, rounding down -to the nearest integer if roundDown is set.

        TimeSpan.prototype.totalMilliseconds = function (roundDown) {
        -  var result = this.msecs;
        -  if (roundDown === true) {
        -    result = Math.floor(result);
        -  }
        -  
        -  return result;
        -};

        function totalSeconds (roundDown)

        - -

        @roundDown {boolean} Value indicating if the value should be rounded down.

        - -

        Returns the total number of seconds for this instance, rounding down -to the nearest integer if roundDown is set.

        TimeSpan.prototype.totalSeconds = function (roundDown) {
        -  var result = this.msecs / msecPerSecond;
        -  if (roundDown === true) {
        -    result = Math.floor(result);
        -  }
        -  
        -  return result;
        -};

        function totalMinutes (roundDown)

        - -

        @roundDown {boolean} Value indicating if the value should be rounded down.

        - -

        Returns the total number of minutes for this instance, rounding down -to the nearest integer if roundDown is set.

        TimeSpan.prototype.totalMinutes = function (roundDown) {
        -  var result = this.msecs / msecPerMinute;
        -  if (roundDown === true) {
        -    result = Math.floor(result);
        -  }
        -  
        -  return result;
        -};

        function totalHours (roundDown)

        - -

        @roundDown {boolean} Value indicating if the value should be rounded down.

        - -

        Returns the total number of hours for this instance, rounding down -to the nearest integer if roundDown is set.

        TimeSpan.prototype.totalHours = function (roundDown) {
        -  var result = this.msecs / msecPerHour;
        -  if (roundDown === true) {
        -    result = Math.floor(result);
        -  }
        -  
        -  return result;
        -};

        function totalDays (roundDown)

        - -

        @roundDown {boolean} Value indicating if the value should be rounded down.

        - -

        Returns the total number of days for this instance, rounding down -to the nearest integer if roundDown is set.

        TimeSpan.prototype.totalDays = function (roundDown) {
        -  var result = this.msecs / msecPerDay;
        -  if (roundDown === true) {
        -    result = Math.floor(result);
        -  }
        -  
        -  return result;
        -};

        @milliseconds

        - -

        Returns the length of this TimeSpan instance in milliseconds.

        TimeSpan.prototype.__defineGetter__('milliseconds', function () {
        -  return this.msecs % 1000;
        -});

        @seconds

        - -

        Returns the length of this TimeSpan instance in seconds.

        TimeSpan.prototype.__defineGetter__('seconds', function () {
        -  return Math.floor(this.msecs / msecPerSecond) % 60;
        -});

        @minutes

        - -

        Returns the length of this TimeSpan instance in minutes.

        TimeSpan.prototype.__defineGetter__('minutes', function () {
        -  return Math.floor(this.msecs / msecPerMinute) % 60;
        -});

        @hours

        - -

        Returns the length of this TimeSpan instance in hours.

        TimeSpan.prototype.__defineGetter__('hours', function () {
        -  return Math.floor(this.msecs / msecPerHour) % 24;
        -});

        @days

        - -

        Returns the length of this TimeSpan instance in days.

        TimeSpan.prototype.__defineGetter__('days', function () {
        -  return Math.floor(this.msecs / msecPerDay);
        -});

        Instance Helpers

        - -

        Various help methods for performing utilities -such as equality and serialization

        function equals (timeSpan)

        - -

        @timeSpan {TimeSpan} TimeSpan instance to assert equal

        - -

        Returns a value indicating if the specified timeSpan is equal -in milliseconds to this instance.

        TimeSpan.prototype.equals = function (timeSpan) {
        -  if (!(timeSpan instanceof TimeSpan)) {
        -    return;
        -  }
        -  
        -  return this.msecs === timeSpan.totalMilliseconds();
        -};

        function toString ()

        - -

        Returns a string representation of this TimeSpan -instance according to current format.

        TimeSpan.prototype.toString = function () {
        -  if (!this.format) {
        -    return this._format();
        -  };
        -  
        -  return this.format(this);
        -};

        @private function _format ()

        - -

        Returns the default string representation of this instance.

        TimeSpan.prototype._format = function () {
        -  return [
        -    this.days,
        -    this.hours,
        -    this.minutes,
        -    this.seconds + '.' + this.milliseconds
        -  ].join(':')
        -};

        @private function isNumeric (input)

        - -

        @input {Number} Value to check numeric quality of.

        - -

        Returns a value indicating the numeric quality of the -specified input.

        function isNumeric (input) {
        -  return input && !isNaN(parseFloat(input)) && isFinite(input);
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/lib/time-span.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/lib/time-span.js deleted file mode 100644 index 23a9cc8..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/lib/time-span.js +++ /dev/null @@ -1,827 +0,0 @@ -/* -* JavaScript TimeSpan Library -* -* Copyright (c) 2010 Michael Stum, Charlie Robbins -* -* Permission is hereby granted, free of charge, to any person obtaining -* a copy of this software and associated documentation files (the -* "Software"), to deal in the Software without restriction, including -* without limitation the rights to use, copy, modify, merge, publish, -* distribute, sublicense, and/or sell copies of the Software, and to -* permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice shall be -* included in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -// -// ### Time constants -// -var msecPerSecond = 1000, - msecPerMinute = 60000, - msecPerHour = 3600000, - msecPerDay = 86400000; - -// -// ### Timespan Parsers -// -var timeSpanWithDays = /^(\d+):(\d+):(\d+):(\d+)(\.\d+)?/, - timeSpanNoDays = /^(\d+):(\d+):(\d+)(\.\d+)?/; - -// -// ### function TimeSpan (milliseconds, seconds, minutes, hours, days) -// #### @milliseconds {Number} Number of milliseconds for this instance. -// #### @seconds {Number} Number of seconds for this instance. -// #### @minutes {Number} Number of minutes for this instance. -// #### @hours {Number} Number of hours for this instance. -// #### @days {Number} Number of days for this instance. -// Constructor function for the `TimeSpan` object which represents a length -// of positive or negative milliseconds componentized into milliseconds, -// seconds, hours, and days. -// -var TimeSpan = exports.TimeSpan = function (milliseconds, seconds, minutes, hours, days) { - this.msecs = 0; - - if (isNumeric(days)) { - this.msecs += (days * msecPerDay); - } - - if (isNumeric(hours)) { - this.msecs += (hours * msecPerHour); - } - - if (isNumeric(minutes)) { - this.msecs += (minutes * msecPerMinute); - } - - if (isNumeric(seconds)) { - this.msecs += (seconds * msecPerSecond); - } - - if (isNumeric(milliseconds)) { - this.msecs += milliseconds; - } -}; - -// -// ## Factory methods -// Helper methods for creating new TimeSpan objects -// from various criteria: milliseconds, seconds, minutes, -// hours, days, strings and other `TimeSpan` instances. -// - -// -// ### function fromMilliseconds (milliseconds) -// #### @milliseconds {Number} Amount of milliseconds for the new TimeSpan instance. -// Creates a new `TimeSpan` instance with the specified `milliseconds`. -// -exports.fromMilliseconds = function (milliseconds) { - if (!isNumeric(milliseconds)) { return } - return new TimeSpan(milliseconds, 0, 0, 0, 0); -} - -// -// ### function fromSeconds (seconds) -// #### @milliseconds {Number} Amount of seconds for the new TimeSpan instance. -// Creates a new `TimeSpan` instance with the specified `seconds`. -// -exports.fromSeconds = function (seconds) { - if (!isNumeric(seconds)) { return } - return new TimeSpan(0, seconds, 0, 0, 0); -}; - -// -// ### function fromMinutes (milliseconds) -// #### @milliseconds {Number} Amount of minutes for the new TimeSpan instance. -// Creates a new `TimeSpan` instance with the specified `minutes`. -// -exports.fromMinutes = function (minutes) { - if (!isNumeric(minutes)) { return } - return new TimeSpan(0, 0, minutes, 0, 0); -}; - -// -// ### function fromHours (hours) -// #### @milliseconds {Number} Amount of hours for the new TimeSpan instance. -// Creates a new `TimeSpan` instance with the specified `hours`. -// -exports.fromHours = function (hours) { - if (!isNumeric(hours)) { return } - return new TimeSpan(0, 0, 0, hours, 0); -}; - -// -// ### function fromDays (days) -// #### @milliseconds {Number} Amount of days for the new TimeSpan instance. -// Creates a new `TimeSpan` instance with the specified `days`. -// -exports.fromDays = function (days) { - if (!isNumeric(days)) { return } - return new TimeSpan(0, 0, 0, 0, days); -}; - -// -// ### function parse (str) -// #### @str {string} Timespan string to parse. -// Creates a new `TimeSpan` instance from the specified -// string, `str`. -// -exports.parse = function (str) { - var match, milliseconds; - - function parseMilliseconds (value) { - return value ? parseFloat('0' + value) * 1000 : 0; - } - - // If we match against a full TimeSpan: - // [days]:[hours]:[minutes]:[seconds].[milliseconds]? - if ((match = str.match(timeSpanWithDays))) { - return new TimeSpan(parseMilliseconds(match[5]), match[4], match[3], match[2], match[1]); - } - - // If we match against a partial TimeSpan: - // [hours]:[minutes]:[seconds].[milliseconds]? - if ((match = str.match(timeSpanNoDays))) { - return new TimeSpan(parseMilliseconds(match[4]), match[3], match[2], match[1], 0); - } - - return null; -}; - -// -// List of default singular time modifiers and associated -// computation algoritm. Assumes in order, smallest to greatest -// performing carry forward additiona / subtraction for each -// Date-Time component. -// -var parsers = { - 'milliseconds': { - exp: /(\d+)milli(?:second)?[s]?/i, - compute: function (delta, computed) { - return _compute(delta, computed, { - current: 'milliseconds', - next: 'seconds', - max: 1000 - }); - } - }, - 'seconds': { - exp: /(\d+)second[s]?/i, - compute: function (delta, computed) { - return _compute(delta, computed, { - current: 'seconds', - next: 'minutes', - max: 60 - }); - } - }, - 'minutes': { - exp: /(\d+)minute[s]?/i, - compute: function (delta, computed) { - return _compute(delta, computed, { - current: 'minutes', - next: 'hours', - max: 60 - }); - } - }, - 'hours': { - exp: /(\d+)hour[s]?/i, - compute: function (delta, computed) { - return _compute(delta, computed, { - current: 'hours', - next: 'days', - max: 24 - }); - } - }, - 'days': { - exp: /(\d+)day[s]?/i, - compute: function (delta, computed) { - var days = monthDays(computed.months, computed.years), - sign = delta >= 0 ? 1 : -1, - opsign = delta >= 0 ? -1 : 1, - clean = 0; - - function update (months) { - if (months < 0) { - computed.years -= 1; - return 11; - } - else if (months > 11) { - computed.years += 1; - return 0 - } - - return months; - } - - if (delta) { - while (Math.abs(delta) >= days) { - computed.months += sign * 1; - computed.months = update(computed.months); - delta += opsign * days; - days = monthDays(computed.months, computed.years); - } - - computed.days += (opsign * delta); - } - - if (computed.days < 0) { clean = -1 } - else if (computed.days > months[computed.months]) { clean = 1 } - - if (clean === -1 || clean === 1) { - computed.months += clean; - computed.months = update(computed.months); - computed.days = months[computed.months] + computed.days; - } - - return computed; - } - }, - 'months': { - exp: /(\d+)month[s]?/i, - compute: function (delta, computed) { - var round = delta > 0 ? Math.floor : Math.ceil; - if (delta) { - computed.years += round.call(null, delta / 12); - computed.months += delta % 12; - } - - if (computed.months > 11) { - computed.years += Math.floor((computed.months + 1) / 12); - computed.months = ((computed.months + 1) % 12) - 1; - } - - return computed; - } - }, - 'years': { - exp: /(\d+)year[s]?/i, - compute: function (delta, computed) { - if (delta) { computed.years += delta; } - return computed; - } - } -}; - -// -// Compute the list of parser names for -// later use. -// -var parserNames = Object.keys(parsers); - -// -// ### function parseDate (str) -// #### @str {string} String to parse into a date -// Parses the specified liberal Date-Time string according to -// ISO8601 **and**: -// -// 1. `2010-04-03T12:34:15Z+12MINUTES` -// 2. `NOW-4HOURS` -// -// Valid modifiers for the more liberal Date-Time string(s): -// -// YEAR, YEARS -// MONTH, MONTHS -// DAY, DAYS -// HOUR, HOURS -// MINUTE, MINUTES -// SECOND, SECONDS -// MILLI, MILLIS, MILLISECOND, MILLISECONDS -// -exports.parseDate = function (str) { - var dateTime = Date.parse(str), - iso = '^([^Z]+)', - zulu = 'Z([\\+|\\-])?', - diff = {}, - computed, - modifiers, - sign; - - // - // If Date string supplied actually conforms - // to UTC Time (ISO8601), return a new Date. - // - if (!isNaN(dateTime)) { - return new Date(dateTime); - } - - // - // Create the `RegExp` for the end component - // of the target `str` to parse. - // - parserNames.forEach(function (group) { - zulu += '(\\d+[a-zA-Z]+)?'; - }); - - if (/^NOW/i.test(str)) { - // - // If the target `str` is a liberal `NOW-*`, - // then set the base `dateTime` appropriately. - // - dateTime = Date.now(); - zulu = zulu.replace(/Z/, 'NOW'); - } - else { - // - // Parse the `ISO8601` component, and the end - // component from the target `str`. - // - dateTime = str.match(new RegExp(iso, 'i')); - dateTime = Date.parse(dateTime[1]); - } - - // - // If there was no match on either part then - // it must be a bad value. - // - if (!dateTime || !(modifiers = str.match(new RegExp(zulu, 'i')))) { - return null; - } - - // - // Create a new `Date` object from the `ISO8601` - // component of the target `str`. - // - dateTime = new Date(dateTime); - sign = modifiers[1] === '+' ? 1 : -1; - - // - // Create an Object-literal for consistently accessing - // the various components of the computed Date. - // - var computed = { - milliseconds: dateTime.getMilliseconds(), - seconds: dateTime.getSeconds(), - minutes: dateTime.getMinutes(), - hours: dateTime.getHours(), - days: dateTime.getDate(), - months: dateTime.getMonth(), - years: dateTime.getFullYear() - }; - - // - // Parse the individual component spans (months, years, etc) - // from the modifier strings that we parsed from the end - // of the target `str`. - // - modifiers.slice(2).filter(Boolean).forEach(function (modifier) { - parserNames.forEach(function (name) { - var match; - if (!(match = modifier.match(parsers[name].exp))) { - return; - } - - diff[name] = sign * parseInt(match[1], 10); - }) - }); - - // - // Compute the total `diff` by iteratively computing - // the partial components from smallest to largest. - // - parserNames.forEach(function (name) { - computed = parsers[name].compute(diff[name], computed); - }); - - return new Date( - Date.UTC( - computed.years, - computed.months, - computed.days, - computed.hours, - computed.minutes, - computed.seconds, - computed.milliseconds - ) - ); -}; - -// -// ### function fromDates (start, end, abs) -// #### @start {Date} Start date of the `TimeSpan` instance to return -// #### @end {Date} End date of the `TimeSpan` instance to return -// #### @abs {boolean} Value indicating to return an absolute value -// Returns a new `TimeSpan` instance representing the difference between -// the `start` and `end` Dates. -// -exports.fromDates = function (start, end, abs) { - if (typeof start === 'string') { - start = exports.parseDate(start); - } - - if (typeof end === 'string') { - end = exports.parseDate(end); - } - - if (!(start instanceof Date && end instanceof Date)) { - return null; - } - - var differenceMsecs = end.valueOf() - start.valueOf(); - if (abs) { - differenceMsecs = Math.abs(differenceMsecs); - } - - return new TimeSpan(differenceMsecs, 0, 0, 0, 0); -}; - -// -// ## Module Helpers -// Module-level helpers for various utilities such as: -// instanceOf, parsability, and cloning. -// - -// -// ### function test (str) -// #### @str {string} String value to test if it is a TimeSpan -// Returns a value indicating if the specified string, `str`, -// is a parsable `TimeSpan` value. -// -exports.test = function (str) { - return timeSpanWithDays.test(str) || timeSpanNoDays.test(str); -}; - -// -// ### function instanceOf (timeSpan) -// #### @timeSpan {Object} Object to check TimeSpan quality. -// Returns a value indicating if the specified `timeSpan` is -// in fact a `TimeSpan` instance. -// -exports.instanceOf = function (timeSpan) { - return timeSpan instanceof TimeSpan; -}; - -// -// ### function clone (timeSpan) -// #### @timeSpan {TimeSpan} TimeSpan object to clone. -// Returns a new `TimeSpan` instance with the same value -// as the `timeSpan` object supplied. -// -exports.clone = function (timeSpan) { - if (!(timeSpan instanceof TimeSpan)) { return } - return exports.fromMilliseconds(timeSpan.totalMilliseconds()); -}; - -// -// ## Addition -// Methods for adding `TimeSpan` instances, -// milliseconds, seconds, hours, and days to other -// `TimeSpan` instances. -// - -// -// ### function add (timeSpan) -// #### @timeSpan {TimeSpan} TimeSpan to add to this instance -// Adds the specified `timeSpan` to this instance. -// -TimeSpan.prototype.add = function (timeSpan) { - if (!(timeSpan instanceof TimeSpan)) { return } - this.msecs += timeSpan.totalMilliseconds(); -}; - -// -// ### function addMilliseconds (milliseconds) -// #### @milliseconds {Number} Number of milliseconds to add. -// Adds the specified `milliseconds` to this instance. -// -TimeSpan.prototype.addMilliseconds = function (milliseconds) { - if (!isNumeric(milliseconds)) { return } - this.msecs += milliseconds; -}; - -// -// ### function addSeconds (seconds) -// #### @seconds {Number} Number of seconds to add. -// Adds the specified `seconds` to this instance. -// -TimeSpan.prototype.addSeconds = function (seconds) { - if (!isNumeric(seconds)) { return } - - this.msecs += (seconds * msecPerSecond); -}; - -// -// ### function addMinutes (minutes) -// #### @minutes {Number} Number of minutes to add. -// Adds the specified `minutes` to this instance. -// -TimeSpan.prototype.addMinutes = function (minutes) { - if (!isNumeric(minutes)) { return } - this.msecs += (minutes * msecPerMinute); -}; - -// -// ### function addHours (hours) -// #### @hours {Number} Number of hours to add. -// Adds the specified `hours` to this instance. -// -TimeSpan.prototype.addHours = function (hours) { - if (!isNumeric(hours)) { return } - this.msecs += (hours * msecPerHour); -}; - -// -// ### function addDays (days) -// #### @days {Number} Number of days to add. -// Adds the specified `days` to this instance. -// -TimeSpan.prototype.addDays = function (days) { - if (!isNumeric(days)) { return } - this.msecs += (days * msecPerDay); -}; - -// -// ## Subtraction -// Methods for subtracting `TimeSpan` instances, -// milliseconds, seconds, hours, and days from other -// `TimeSpan` instances. -// - -// -// ### function subtract (timeSpan) -// #### @timeSpan {TimeSpan} TimeSpan to subtract from this instance. -// Subtracts the specified `timeSpan` from this instance. -// -TimeSpan.prototype.subtract = function (timeSpan) { - if (!(timeSpan instanceof TimeSpan)) { return } - this.msecs -= timeSpan.totalMilliseconds(); -}; - -// -// ### function subtractMilliseconds (milliseconds) -// #### @milliseconds {Number} Number of milliseconds to subtract. -// Subtracts the specified `milliseconds` from this instance. -// -TimeSpan.prototype.subtractMilliseconds = function (milliseconds) { - if (!isNumeric(milliseconds)) { return } - this.msecs -= milliseconds; -}; - -// -// ### function subtractSeconds (seconds) -// #### @seconds {Number} Number of seconds to subtract. -// Subtracts the specified `seconds` from this instance. -// -TimeSpan.prototype.subtractSeconds = function (seconds) { - if (!isNumeric(seconds)) { return } - this.msecs -= (seconds * msecPerSecond); -}; - -// -// ### function subtractMinutes (minutes) -// #### @minutes {Number} Number of minutes to subtract. -// Subtracts the specified `minutes` from this instance. -// -TimeSpan.prototype.subtractMinutes = function (minutes) { - if (!isNumeric(minutes)) { return } - this.msecs -= (minutes * msecPerMinute); -}; - -// -// ### function subtractHours (hours) -// #### @hours {Number} Number of hours to subtract. -// Subtracts the specified `hours` from this instance. -// -TimeSpan.prototype.subtractHours = function (hours) { - if (!isNumeric(hours)) { return } - this.msecs -= (hours * msecPerHour); -}; - -// -// ### function subtractDays (days) -// #### @days {Number} Number of days to subtract. -// Subtracts the specified `days` from this instance. -// -TimeSpan.prototype.subtractDays = function (days) { - if (!isNumeric(days)) { return } - this.msecs -= (days * msecPerDay); -}; - -// -// ## Getters -// Methods for retrieving components of a `TimeSpan` -// instance: milliseconds, seconds, minutes, hours, and days. -// - -// -// ### function totalMilliseconds (roundDown) -// #### @roundDown {boolean} Value indicating if the value should be rounded down. -// Returns the total number of milliseconds for this instance, rounding down -// to the nearest integer if `roundDown` is set. -// -TimeSpan.prototype.totalMilliseconds = function (roundDown) { - var result = this.msecs; - if (roundDown === true) { - result = Math.floor(result); - } - - return result; -}; - -// -// ### function totalSeconds (roundDown) -// #### @roundDown {boolean} Value indicating if the value should be rounded down. -// Returns the total number of seconds for this instance, rounding down -// to the nearest integer if `roundDown` is set. -// -TimeSpan.prototype.totalSeconds = function (roundDown) { - var result = this.msecs / msecPerSecond; - if (roundDown === true) { - result = Math.floor(result); - } - - return result; -}; - -// -// ### function totalMinutes (roundDown) -// #### @roundDown {boolean} Value indicating if the value should be rounded down. -// Returns the total number of minutes for this instance, rounding down -// to the nearest integer if `roundDown` is set. -// -TimeSpan.prototype.totalMinutes = function (roundDown) { - var result = this.msecs / msecPerMinute; - if (roundDown === true) { - result = Math.floor(result); - } - - return result; -}; - -// -// ### function totalHours (roundDown) -// #### @roundDown {boolean} Value indicating if the value should be rounded down. -// Returns the total number of hours for this instance, rounding down -// to the nearest integer if `roundDown` is set. -// -TimeSpan.prototype.totalHours = function (roundDown) { - var result = this.msecs / msecPerHour; - if (roundDown === true) { - result = Math.floor(result); - } - - return result; -}; - -// -// ### function totalDays (roundDown) -// #### @roundDown {boolean} Value indicating if the value should be rounded down. -// Returns the total number of days for this instance, rounding down -// to the nearest integer if `roundDown` is set. -// -TimeSpan.prototype.totalDays = function (roundDown) { - var result = this.msecs / msecPerDay; - if (roundDown === true) { - result = Math.floor(result); - } - - return result; -}; - -// -// ### @milliseconds -// Returns the length of this `TimeSpan` instance in milliseconds. -// -TimeSpan.prototype.__defineGetter__('milliseconds', function () { - return this.msecs % 1000; -}); - -// -// ### @seconds -// Returns the length of this `TimeSpan` instance in seconds. -// -TimeSpan.prototype.__defineGetter__('seconds', function () { - return Math.floor(this.msecs / msecPerSecond) % 60; -}); - -// -// ### @minutes -// Returns the length of this `TimeSpan` instance in minutes. -// -TimeSpan.prototype.__defineGetter__('minutes', function () { - return Math.floor(this.msecs / msecPerMinute) % 60; -}); - -// -// ### @hours -// Returns the length of this `TimeSpan` instance in hours. -// -TimeSpan.prototype.__defineGetter__('hours', function () { - return Math.floor(this.msecs / msecPerHour) % 24; -}); - -// -// ### @days -// Returns the length of this `TimeSpan` instance in days. -// -TimeSpan.prototype.__defineGetter__('days', function () { - return Math.floor(this.msecs / msecPerDay); -}); - -// -// ## Instance Helpers -// Various help methods for performing utilities -// such as equality and serialization -// - -// -// ### function equals (timeSpan) -// #### @timeSpan {TimeSpan} TimeSpan instance to assert equal -// Returns a value indicating if the specified `timeSpan` is equal -// in milliseconds to this instance. -// -TimeSpan.prototype.equals = function (timeSpan) { - if (!(timeSpan instanceof TimeSpan)) { return } - return this.msecs === timeSpan.totalMilliseconds(); -}; - -// -// ### function toString () -// Returns a string representation of this `TimeSpan` -// instance according to current `format`. -// -TimeSpan.prototype.toString = function () { - if (!this.format) { return this._format() } - return this.format(this); -}; - -// -// ### @private function _format () -// Returns the default string representation of this instance. -// -TimeSpan.prototype._format = function () { - return [ - this.days, - this.hours, - this.minutes, - this.seconds + '.' + this.milliseconds - ].join(':') -}; - -// -// ### @private function isNumeric (input) -// #### @input {Number} Value to check numeric quality of. -// Returns a value indicating the numeric quality of the -// specified `input`. -// -function isNumeric (input) { - return input && !isNaN(parseFloat(input)) && isFinite(input); -}; - -// -// ### @private function _compute (delta, date, computed, options) -// #### @delta {Number} Channge in this component of the date -// #### @computed {Object} Currently computed date. -// #### @options {Object} Options for the computation -// Performs carry forward addition or subtraction for the -// `options.current` component of the `computed` date, carrying -// it forward to `options.next` depending on the maximum value, -// `options.max`. -// -function _compute (delta, computed, options) { - var current = options.current, - next = options.next, - max = options.max, - round = delta > 0 ? Math.floor : Math.ceil; - - if (delta) { - computed[next] += round.call(null, delta / max); - computed[current] += delta % max; - } - - if (Math.abs(computed[current]) >= max) { - computed[next] += round.call(null, computed[current] / max) - computed[current] = computed[current] % max; - } - - return computed; -} - - -// -// ### @private monthDays (month, year) -// #### @month {Number} Month to get days for. -// #### @year {Number} Year of the month to get days for. -// Returns the number of days in the specified `month` observing -// leap years. -// -var months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; -function monthDays (month, year) { - if (((year % 100 !== 0 && year % 4 === 0) - || year % 400 === 0) && month === 1) { - return 29; - } - - return months[month]; -} \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/package.json b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/package.json deleted file mode 100644 index e373ded..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/package.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "name": "timespan", - "description": "A JavaScript TimeSpan library for node.js (and soon the browser)", - "version": "2.2.0", - "author": { - "name": "Michael Stum", - "email": "blog@stum.de" - }, - "contributors": [ - { - "name": "Charlie Robbins", - "email": "charlie.robbins@gmail.com" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/indexzero/timespan.git" - }, - "keywords": [ - "time", - "dates", - "utilities", - "timespan" - ], - "devDependencies": { - "vows": ">= 0.5.2" - }, - "main": "./lib/time-span.js", - "scripts": { - "test": "vows test/*-test.js --spec" - }, - "engines": { - "node": ">= 0.2.0" - }, - "_id": "timespan@2.2.0", - "dependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "timespan@2.x.x" -} diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/test/date-parser-test.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/test/date-parser-test.js deleted file mode 100644 index 6f08973..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/test/date-parser-test.js +++ /dev/null @@ -1,72 +0,0 @@ -/* - * time-span-test.js: Tests for the TimeSpan module. - * - * (C) Charlie Robbins - * MIT LICENSE - * - */ - -var vows = require('vows'), - assert = require('assert'), - timeSpan = require('../lib/time-span'); - -vows.describe('time-span/date-time').addBatch({ - "When using the TimeSpan module": { - "the parseDate() method": { - "when passed a TimeSpan string using ISO8601 with explicit time modifiers": { - "which do not carry over": { - "should return the correct value": function () { - var target = new Date(Date.parse('2010-04-03T10:04:15Z')), - parsed = timeSpan.parseDate('2010-04-03T12:34:15Z-2HOURS30MINUTES'); - - assert.equal(target.toString(), parsed.toString()); - } - }, - "which carry under": { - "should return the correct value": function () { - var target = new Date(Date.parse('2010-03-29T12:34:15Z')), - parsed = timeSpan.parseDate('2010-04-01T12:34:15Z-72HOURS'); - - assert.equal(target.toString(), parsed.toString()); - } - }, - "which carry under a leap year": { - "should return the correct value": function () { - var target = new Date(Date.parse('2007-03-31T12:00:00Z')), - parsed = timeSpan.parseDate('2010-03-31T12:00:00Z-1096DAYS'); - - assert.equal(target.toString(), parsed.toString()); - } - }, - "which carry over": { - "should return the correct value": function () { - var target = new Date(Date.parse('2013-04-03T12:34:15Z')), - parsed = timeSpan.parseDate('2010-04-03T12:34:15Z+2YEARS365DAYS'); - - assert.equal(target.toString(), parsed.toString()); - } - } - }, - "when passed a TimeSpan string using NOW with explicit time modifiers": { - "which do not carry over": { - "should return the correct value": function () { - var now = new Date(Date.now()), - parsed = timeSpan.parseDate('NOW-2HOURS'); - - now.setHours(now.getHours() - 2 - (now.getTimezoneOffset() / 60)); - assert.equal(now.getHours(), parsed.getHours()); - } - }, - "which carry under": { - "should return the correct value": function () { - var now = new Date(Date.now()), - parsed = timeSpan.parseDate('NOW-72HOURS'); - - now.setHours(now.getHours() - 72 - (now.getTimezoneOffset() / 60)); - assert.equal(now.getHours(), parsed.getHours()); - } - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/test/helpers.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/test/helpers.js deleted file mode 100644 index 4a1b84a..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/test/helpers.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * helpers.js: Tests helpers for the TimeSpan module. - * - * (C) Charlie Robbins - * MIT LICENSE - * - */ - -var assert = require('assert'), - timeSpan = require('../lib/time-span') - -function capitalize(str) { - return str.charAt(0).toUpperCase() + str.slice(1); -} - -var helpers = exports, - components = ['milliseconds', 'seconds', 'minutes', 'hours', 'days']; - -// -// Tests all of the factory methods for the `TimeSpan` object: -// `fromMilliseconds`, `fromSeconds`, etc. -// -exports.testFactories = function (num) { - var context = {}; - - components.forEach(function (component) { - var method = 'from' + capitalize(component); - - context['the ' + method + '() method'] = function () { - var value = timeSpan[method](num); - assert.equal(value[component], num); - } - }); - - return context; -}; \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/test/time-span-test.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/test/time-span-test.js deleted file mode 100644 index 66a7be5..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/node_modules/timespan/test/time-span-test.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * time-span-test.js: Tests for the TimeSpan module. - * - * (C) Charlie Robbins - * MIT LICENSE - * - */ - -var vows = require('vows'), - assert = require('assert'), - timeSpan = require('../lib/time-span'), - helpers = require('./helpers'); - -vows.describe('time-span').addBatch({ - "When using the TimeSpan module": { - "the parse() method": { - "when passed a TimeSpan string with no days": { - "should return a valid TimeSpan object": function () { - var ts = timeSpan.parse("04:03:02.10"); - assert.equal(ts.hours, 4); - assert.equal(ts.minutes, 3); - assert.equal(ts.seconds, 2); - assert.equal(ts.milliseconds, 100); - } - }, - "when passed a TimeSpan string with days": { - "should return a valid TimeSpan object": function () { - var ts = timeSpan.parse("01:04:03:02.10"); - assert.equal(ts.days, 1); - assert.equal(ts.hours, 4); - assert.equal(ts.minutes, 3); - assert.equal(ts.seconds, 2); - assert.equal(ts.milliseconds, 100); - } - } - }, - "the test() method": { - "when passed a TimeSpan string with no days": { - "should return true": function () { - assert.isTrue(timeSpan.test("04:03:02.10")); - } - }, - "when passed a TimeSpan string with days": { - "should return true": function () { - assert.isTrue(timeSpan.test("01:04:03:02.10")); - } - }, - "when passed an invalid TimeSpan string": { - "should return false": function () { - assert.isFalse(timeSpan.test('xx:00:invalid')); - } - } - }, - "the fromDates() method": { - "with two Date values": function () { - var diff = 1000 * 60 * 60 * 12, - end = new Date(), - start = new Date(end.getTime() - diff); - - assert.equal(12, timeSpan.fromDates(start, end).hours); - }, - "with two string values": function () { - assert.equal(2, timeSpan.fromDates('NOW-4DAYS', 'NOW-2DAYS').days); - } - }, - "the factory methods": helpers.testFactories(10) - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/package.json b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/package.json deleted file mode 100644 index 8cc20bb..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/package.json +++ /dev/null @@ -1,58 +0,0 @@ -{ - "name": "loggly", - "description": "A client implementation for Loggly cloud Logging-as-a-Service API", - "version": "0.3.11", - "author": { - "name": "Charlie Robbins", - "email": "charlie.robbins@gmail.com" - }, - "contributors": [ - { - "name": "Marak Squires", - "email": "marak.squires@gmail.com" - }, - { - "name": "hij1nx", - "email": "hij1nx@me.com" - }, - { - "name": "Kord Campbell", - "email": "kordless@loggly.com" - }, - { - "name": "Erik Hedenstrom", - "email": "erik@hedenstroem.com" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/nodejitsu/node-loggly.git" - }, - "keywords": [ - "cloud computing", - "api", - "logging", - "loggly" - ], - "dependencies": { - "request": "2.9.x", - "timespan": "2.x.x" - }, - "devDependencies": { - "vows": "0.6.x" - }, - "main": "./lib/loggly", - "scripts": { - "test": "vows test/*-test.js --spec" - }, - "engines": { - "node": ">= 0.4.0" - }, - "_id": "loggly@0.3.11", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "loggly@0.3.x >=0.3.7" -} diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/test/common-test.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/test/common-test.js deleted file mode 100644 index 51c6b4a..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/test/common-test.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * common-test.js: Tests for Loggly `common` utility module - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - common = require('../lib/loggly/common'); - -vows.describe('node-loggly/common').addBatch({ - "When using the common module": { - "the clone() method": { - topic: function () { - this.obj = { - name: 'common', - deep: { - first: 'first', - second: 'second' - } - }; - return common.clone(this.obj); - }, - "should return a deep clone of the object": function (clone) { - assert.isFalse(this.obj.deep === clone.deep); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/test/device-test.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/test/device-test.js deleted file mode 100644 index 8124180..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/test/device-test.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * device-test.js: Tests for Loggly device requests - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - helpers = require('./helpers'); - -var options = {}, - config = helpers.loadConfig(), - loggly = require('../lib/loggly').createClient(config); - -vows.describe('node-loggly/devices').addBatch({ - "When using the node-loggly client": { - "the getDevices() method": { - topic: function () { - loggly.getDevices(this.callback); - }, - "should return a list of valid devices": function (err, devices) { - assert.isNull(err); - devices.forEach(function (device) { - helpers.assertDevice(device); - }); - } - }, - "the addDeviceToInput() method": { - topic: function () { - loggly.addDeviceToInput(config.inputs.test.id, '127.0.0.1', this.callback); - }, - "should respond with 200 status code": function (err, res) { - assert.isNull(err); - assert.equal(res.statusCode, 200); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/test/helpers.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/test/helpers.js deleted file mode 100644 index b8ed45c..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/test/helpers.js +++ /dev/null @@ -1,79 +0,0 @@ -/* - * helpers.js: Test helpers for node-loggly - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var fs = require('fs'), - util = require('util'), - path = require('path'), - vows = require('vows'), - assert = require('assert'), - loggly = require('../lib/loggly'); - -var helpers = exports; - -helpers.validConfig = function (config) { - return config - && config.subdomain !== 'test-subdomain' - && config.auth - && config.auth.username !== 'test-username' - && config.auth.password !== 'test-password' - && config.inputs - && config.inputs.test - && config.inputs.test_json; -}; - -helpers.loadConfig = function () { - try { - var configFile = path.join(__dirname, 'data', 'test-config.json'), - stats = fs.statSync(configFile) - config = JSON.parse(fs.readFileSync(configFile).toString()); - - if (!helpers.validConfig(config)) { - util.puts('Config file test-config.json must be updated with valid data before running tests'); - process.exit(0); - } - - helpers.config = config || {} - return config || {}; - } - catch (ex) { - util.puts('Error parsing test-config.json'); - ex.stack.split('\n').forEach(function (line) { - console.log(line); - }); - - process.exit(0); - } -}; - -helpers.assertInput = function (input) { - assert.instanceOf(input, loggly.Input); - assert.isNotNull(input.id); - assert.isNotNull(input.name); - assert.isNotNull(input.service); - assert.isNotNull(input.create); - assert.isNotNull(input.discover); - assert.isNotNull(input.discoverTime); - assert.isNotNull(input.description); -}; - -helpers.assertDevice = function (device) { - assert.instanceOf(device, loggly.Device); - assert.isNotNull(device.id); - assert.isNotNull(device.input); - assert.isNotNull(device.ipAddress); - assert.isNotNull(device.launched); - assert.isNotNull(device.resourceUri); -}; - -helpers.assertSearch = function (err, results) { - assert.isNull(err); - assert.isObject(results); - assert.isTrue(typeof results.data !== 'undefined'); - assert.isTrue(typeof results.numFound !== 'undefined'); - assert.isTrue(typeof results.context !== 'undefined'); -}; diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/test/input-test.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/test/input-test.js deleted file mode 100644 index 06cd763..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/test/input-test.js +++ /dev/null @@ -1,197 +0,0 @@ -/* - * input-test.js: Tests for Loggly input requests - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - helpers = require('./helpers'); - -var options = {}, - testContext = {}, - config = helpers.loadConfig(), - loggly = require('../lib/loggly').createClient(config), - logglyJSON = require('../lib/loggly').createClient(config); - -logglyJSON.config.json = true; - -vows.describe('node-loggly/inputs').addBatch({ - "When using the node-loggly client": { - "the getInputs() method": { - topic: function () { - loggly.getInputs(this.callback); - }, - "should return a list of valid inputs": function (err, inputs) { - assert.isNull(err); - inputs.forEach(function (input) { - helpers.assertInput(input); - }); - } - }, - "the getInput method": { - "when called with a plaintext input": { - topic: function () { - loggly.getInput('test', this.callback); - }, - "should return a valid input": function (err, input) { - assert.isNull(err); - helpers.assertInput(input); - }, - "of the format 'text'": function (err, input) { - assert.isNull(err); - assert.equal(input.format, 'text'); - }, - "that matches the first input in the test configuration": function (err, input) { - assert.equal(config.inputs.test.token,input.input_token); - assert.equal(config.inputs.test.id,input.id); - testContext.input = input; - } - }, - "when called with a json input": { - topic: function () { - logglyJSON.getInput('test_json', this.callback); - }, - "should return a valid input": function (err, input) { - assert.isNull(err); - helpers.assertInput(input); - }, - "of the format 'json'": function (err, input) { - assert.isNull(err); - assert.equal(input.format, 'json'); - }, - "that matches the second input in the test configuration": function (err, input) { - assert.equal(config.inputs.test_json.token,input.input_token); - assert.equal(config.inputs.test_json.id,input.id); - testContext.inputJSON = input; - } - } - } - } -}).addBatch({ - "When using the node-loggly client": { - "the log() method": { - "to a 'text' input": { - "when passed a callback": { - topic: function () { - loggly.log( - config.inputs.test.token, - 'this is a test logging message from /test/input-test.js', - this.callback); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - }, - "when not passed a callback": { - topic: function () { - var emitter = loggly.log(config.inputs.test.token, 'this is a test logging message from /test/input-test.js'); - emitter.on('log', this.callback.bind(null, null)); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - } - }, - "to a 'json' input": { - "when passed a callback": { - topic: function () { - logglyJSON.log( - config.inputs.test_json.token, - { - timestamp: new Date().getTime(), - message: 'this is a test logging message from /test/input-test.js' - }, - this.callback); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - }, - "when not passed a callback": { - topic: function () { - var emitter = logglyJSON.log( - config.inputs.test_json.token, - { - timestamp: new Date().getTime(), - message: 'this is a test logging message from /test/input-test.js' - } - ); - emitter.on('log', this.callback.bind(null, null)); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - } - } - } - } -}).addBatch({ - "When using an instance of an input": { - "the log() method of the 'text' instance": { - "when passed a callback": { - topic: function () { - testContext.input.log('this is a test logging message from /test/input-test.js', this.callback); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - }, - "when not passed a callback": { - topic: function () { - var emitter = testContext.input.log('this is a test logging message from /test/input-test.js'); - emitter.on('log', this.callback.bind(null, null)); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - } - }, - "the log() method of the 'json' instance": { - "when passed a callback": { - topic: function () { - testContext.inputJSON.log( - { - timestamp: new Date().getTime(), - message: 'this is a test logging message from /test/input-test.js' - }, - this.callback); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - }, - "when not passed a callback": { - topic: function () { - var emitter = testContext.inputJSON.log({ - timestamp: new Date().getTime(), - message: 'this is a test logging message from /test/input-test.js' - }); - emitter.on('log', this.callback.bind(null, null)); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/test/log-test.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/test/log-test.js deleted file mode 100644 index 876db63..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/test/log-test.js +++ /dev/null @@ -1,84 +0,0 @@ -/* - * log-test.js: Tests for vanilla logging with no authentication. - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - helpers = require('./helpers'); - -var config = helpers.loadConfig(), - loggly = require('../lib/loggly').createClient({ subdomain: config.subdomain }), - logglyJSON = require('../lib/loggly').createClient({ subdomain: config.subdomain, json: true }); - -vows.describe('node-loggly/inputs (no auth)').addBatch({ - "When using the node-loggly client without authentication": { - "the log() method": { - "to a 'text' input": { - "when passed a callback": { - topic: function () { - loggly.log( - config.inputs.test.token, - 'this is a test logging message from /test/input-test.js', - this.callback); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - }, - "when not passed a callback": { - topic: function () { - var emitter = loggly.log(config.inputs.test.token, 'this is a test logging message from /test/input-test.js'); - emitter.on('log', this.callback.bind(null, null)); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - } - }, - "to a 'json' input": { - "when passed a callback": { - topic: function () { - logglyJSON.log( - config.inputs.test_json.token, - { - timestamp: new Date().getTime(), - message: 'this is a test logging message from /test/input-test.js' - }, - this.callback); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - }, - "when not passed a callback": { - topic: function () { - var emitter = logglyJSON.log( - config.inputs.test_json.token, - { - timestamp: new Date().getTime(), - message: 'this is a test logging message from /test/input-test.js' - } - ); - emitter.on('log', this.callback.bind(null, null)); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/test/search-test.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/test/search-test.js deleted file mode 100644 index dac9da7..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/loggly/test/search-test.js +++ /dev/null @@ -1,84 +0,0 @@ -/* - * input-test.js: Tests for Loggly input requests - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - helpers = require('./helpers'); - -var options = {}, - testContext = {}, - config = helpers.loadConfig(), - loggly = require('../lib/loggly').createClient(config); - -vows.describe('node-loggly/search').addBatch({ - "When using the node-loggly client": { - "the search() method": { - "when searching without chaining": { - topic: function () { - loggly.search('logging message', this.callback); - }, - "should return a set of valid search results": function (err, results) { - helpers.assertSearch(err, results); - } - }, - "when searching with chaining": { - topic: function () { - loggly.search('logging message') - .meta({ inputname: 'test' }) - .run(this.callback); - }, - "should return a set of valid search results": function (err, results) { - helpers.assertSearch(err, results); - } - } - }, - "the facet() method": { - "when searching by ip": { - topic: function () { - loggly.facet('ip', 'test', this.callback); - }, - "should return a set of valid search results": function (err, results) { - helpers.assertSearch(err, results); - } - }, - "when using chained searches": { - topic: function () { - loggly.facet('ip', 'test') - .context({ from: 'NOW-1MONTH' }) - .run(this.callback); - }, - "should return a set of valid search results": function (err, results) { - helpers.assertSearch(err, results); - } - } - }, - "the _checkRange() method": { - "with invalid options set": { - "should correct them": function () { - var search = loggly.search('logging message') - .context({ from: 'NOW', until: '1DAY' }) - ._checkRange(); - - assert.equal(search._context.from, 'NOW-24HOURS'); - assert.equal(search._context.until, 'NOW'); - } - }, - "with valid options set": { - "should not modify them": function () { - var search = loggly.search('logging message') - .context({ from: 'NOW-2MONTHS', until: 'NOW' }) - ._checkRange(); - - assert.equal(search._context.from, 'NOW-2MONTHS'); - assert.equal(search._context.until, 'NOW'); - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/.npmignore b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/.npmignore deleted file mode 100644 index 3f31ac2..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -*.un~ -/node_modules diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/License b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/License deleted file mode 100644 index 11ec094..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/License +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011 Felix Geisendörfer (felix@debuggable.com) - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/Makefile b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/Makefile deleted file mode 100644 index a7ce31d..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -SHELL := /bin/bash - -test: - @./test/run.js - -release: - git push - git push --tags - npm publish . - -.PHONY: test diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/Readme.md b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/Readme.md deleted file mode 100644 index fcd1b97..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/Readme.md +++ /dev/null @@ -1,98 +0,0 @@ -# stack-trace - -Get v8 stack traces as an array of CallSite objects. - -## Install - -``` bash -npm install stack-trace -``` - -## Usage - -The stack-trace module makes it easy for you to capture the current stack: - -``` javascript -var stackTrace = require('stack-trace'); -var trace = stackTrace.get(); - -require('assert').strictEqual(trace[0].getFileName(), __filename); -``` - -However, sometimes you have already popped the stack you are interested in, -and all you have left is an `Error` object. This module can help: - -``` javascript -var stackTrace = require('stack-trace'); -var err = new Error('something went wrong'); -var trace = stackTrace.parse(err); - -require('assert').strictEqual(trace[0].getFileName(), __filename); -``` - -Please note that parsing the `Error#stack` property is not perfect, only -certain properties can be retrieved with it as noted in the API docs below. - -## Long stack traces - -stack-trace works great with [long-stack-traces][], when parsing an `err.stack` -that has crossed the event loop boundary, a `CallSite` object returning -`'----------------------------------------'` for `getFileName()` is created. -All other methods of the event loop boundary call site return `null`. - -[long-stack-traces]: https://github.com/tlrobinson/long-stack-traces - -## API - -### stackTrace.get([belowFn]) - -Returns an array of `CallSite` objects, where element `0` is the current call -site. - -When passing a function on the current stack as the `belowFn` parameter, the -returned array will only include `CallSite` objects below this function. - -### stackTrace.parse(err) - -Parses the `err.stack` property of an `Error` object into an array compatible -with those returned by `stackTrace.get()`. However, only the following methods -are implemented on the returned `CallSite` objects. - -* getTypeName -* getFunctionName -* getMethodName -* getFileName -* getLineNumber -* getColumnNumber -* isNative - -Note: Except `getFunctionName()`, all of the above methods return exactly the -same values as you would get from `stackTrace.get()`. `getFunctionName()` -is sometimes a little different, but still useful. - -### CallSite - -The official v8 CallSite object API can be found [here][v8stackapi]. A quick -excerpt: - -> A CallSite object defines the following methods: -> -> * **getThis**: returns the value of this -> * **getTypeName**: returns the type of this as a string. This is the name of the function stored in the constructor field of this, if available, otherwise the object's [[Class]] internal property. -> * **getFunction**: returns the current function -> * **getFunctionName**: returns the name of the current function, typically its name property. If a name property is not available an attempt will be made to try to infer a name from the function's context. -> * **getMethodName**: returns the name of the property of this or one of its prototypes that holds the current function -> * **getFileName**: if this function was defined in a script returns the name of the script -> * **getLineNumber**: if this function was defined in a script returns the current line number -> * **getColumnNumber**: if this function was defined in a script returns the current column number -> * **getEvalOrigin**: if this function was created using a call to eval returns a CallSite object representing the location where eval was called -> * **isToplevel**: is this a toplevel invocation, that is, is this the global object? -> * **isEval**: does this call take place in code defined by a call to eval? -> * **isNative**: is this call in native V8 code? -> * **isConstructor**: is this a constructor call? - -[v8stackapi]: http://code.google.com/p/v8/wiki/JavaScriptStackTraceApi - -## License - -stack-trace is licensed under the MIT license. diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/lib/stack-trace.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/lib/stack-trace.js deleted file mode 100644 index 085ff40..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/lib/stack-trace.js +++ /dev/null @@ -1,111 +0,0 @@ -exports.get = function(belowFn) { - var oldLimit = Error.stackTraceLimit; - Error.stackTraceLimit = Infinity; - - var dummyObject = {}; - Error.captureStackTrace(dummyObject, belowFn || exports.get); - - var v8Handler = Error.prepareStackTrace; - Error.prepareStackTrace = function(dummyObject, v8StackTrace) { - return v8StackTrace; - }; - - var v8StackTrace = dummyObject.stack; - Error.prepareStackTrace = v8Handler; - Error.stackTraceLimit = oldLimit; - - return v8StackTrace; -}; - -exports.parse = function(err) { - if (!err.stack) { - return []; - } - - var self = this; - var lines = err.stack.split('\n').slice(1); - - return lines - .map(function(line) { - if (line.match(/^\s*[-]{4,}$/)) { - return self._createParsedCallSite({ - fileName: line, - lineNumber: null, - functionName: null, - typeName: null, - methodName: null, - columnNumber: null, - 'native': null, - }); - } - - var lineMatch = line.match(/at (?:([^\s]+)\s+)?\(?(?:(.+?):(\d+):(\d+)|([^)]+))\)?/); - if (!lineMatch) { - return; - } - - var object = null; - var method = null; - var functionName = null; - var typeName = null; - var methodName = null; - var isNative = (lineMatch[5] === 'native'); - - if (lineMatch[1]) { - var methodMatch = lineMatch[1].match(/([^\.]+)(?:\.(.+))?/); - object = methodMatch[1]; - method = methodMatch[2]; - functionName = lineMatch[1]; - typeName = 'Object'; - } - - if (method) { - typeName = object; - methodName = method; - } - - if (method === '') { - methodName = null; - functionName = ''; - } - - var properties = { - fileName: lineMatch[2] || null, - lineNumber: parseInt(lineMatch[3], 10) || null, - functionName: functionName, - typeName: typeName, - methodName: methodName, - columnNumber: parseInt(lineMatch[4], 10) || null, - 'native': isNative, - }; - - return self._createParsedCallSite(properties); - }) - .filter(function(callSite) { - return !!callSite; - }); -}; - -exports._createParsedCallSite = function(properties) { - var methods = {}; - for (var property in properties) { - var prefix = 'get'; - if (property === 'native') { - prefix = 'is'; - } - var method = prefix + property.substr(0, 1).toUpperCase() + property.substr(1); - - (function(property) { - methods[method] = function() { - return properties[property]; - } - })(property); - } - - var callSite = Object.create(methods); - for (var property in properties) { - callSite[property] = properties[property]; - } - - return callSite; -}; diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/package.json b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/package.json deleted file mode 100644 index c97d0af..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/package.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "author": { - "name": "Felix Geisendörfer", - "email": "felix@debuggable.com", - "url": "http://debuggable.com/" - }, - "name": "stack-trace", - "description": "Get v8 stack traces as an array of CallSite objects.", - "version": "0.0.6", - "homepage": "https://github.com/felixge/node-stack-trace", - "repository": { - "type": "git", - "url": "git://github.com/felixge/node-stack-trace.git" - }, - "main": "./lib/stack-trace", - "engines": { - "node": "*" - }, - "dependencies": {}, - "devDependencies": { - "far": "0.0.3", - "long-stack-traces": "0.1.2" - }, - "_id": "stack-trace@0.0.6", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "stack-trace@0.0.x" -} diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/test/common.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/test/common.js deleted file mode 100644 index 2985c2f..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/test/common.js +++ /dev/null @@ -1,10 +0,0 @@ -var common = exports; - -var path = require('path'); -var root = path.dirname(__dirname); - -common.dir = { - lib: root + '/lib', -}; - -common.assert = require('assert'); diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/test/integration/test-get.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/test/integration/test-get.js deleted file mode 100644 index 53b2e61..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/test/integration/test-get.js +++ /dev/null @@ -1,49 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var stackTrace = require(common.dir.lib + '/stack-trace'); - -(function testBasic() { - var trace = stackTrace.get(); - - assert.strictEqual(trace[0].getFunction(), testBasic); - assert.strictEqual(trace[0].getFunctionName(), 'testBasic'); - assert.strictEqual(trace[0].getFileName(), __filename); -})(); - -(function testWrapper() { - (function testBelowFn() { - var trace = stackTrace.get(testBelowFn); - assert.strictEqual(trace[0].getFunction(), testWrapper); - assert.strictEqual(trace[0].getFunctionName(), 'testWrapper'); - })(); -})(); - - -(function deep1() { - (function deep2() { - (function deep3() { - (function deep4() { - (function deep5() { - (function deep6() { - (function deep7() { - (function deep8() { - (function deep9() { - (function deep10() { - (function deep10() { - var trace = stackTrace.get(); - var hasFirstCallSite = trace.some(function(callSite) { - return callSite.getFunctionName() === 'deep1'; - }); - - assert.ok(hasFirstCallSite); - })(); - })(); - })(); - })(); - })(); - })(); - })(); - })(); - })(); - })(); -})(); diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/test/integration/test-long-stack-trace.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/test/integration/test-long-stack-trace.js deleted file mode 100644 index 6106c4a..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/test/integration/test-long-stack-trace.js +++ /dev/null @@ -1,14 +0,0 @@ -var common = require('../common'); - -require('long-stack-traces'); -var assert = common.assert; -var stackTrace = require(common.dir.lib + '/stack-trace'); - -function badFn() { - var err = new Error('oh no'); - var trace = stackTrace.parse(err); - - assert.ok(trace[2].getFileName().match(/-----/)); -}; - -setTimeout(badFn, 10); diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/test/integration/test-parse.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/test/integration/test-parse.js deleted file mode 100644 index 4171a68..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/test/integration/test-parse.js +++ /dev/null @@ -1,135 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var stackTrace = require(common.dir.lib + '/stack-trace'); - -(function testBasic() { - var err = new Error('something went wrong'); - var trace = stackTrace.parse(err); - - assert.strictEqual(trace[0].getFileName(), __filename); - assert.strictEqual(trace[0].getFunctionName(), 'testBasic'); -})(); - -(function testWrapper() { - (function testBelowFn() { - var err = new Error('something went wrong'); - var trace = stackTrace.parse(err); - assert.strictEqual(trace[0].getFunctionName(), 'testBelowFn'); - assert.strictEqual(trace[1].getFunctionName(), 'testWrapper'); - })(); -})(); - -(function testNoStack() { - var err = {stack: undefined}; - var trace = stackTrace.parse(err); - - assert.deepEqual(trace, []); -})(); - - -(function testCorruptStack() { - var err = {}; - err.stack = -'AssertionError: true == false\n' + -' fuck' + -' at Test.run (/Users/felix/code/node-fast-or-slow/lib/test.js:45:10)\n' + -'oh no' + -' at TestCase.run (/Users/felix/code/node-fast-or-slow/lib/test_case.js:61:8)\n'; - - var trace = stackTrace.parse(err); - assert.equal(trace.length, 2); -})(); - -(function testCompareRealWithParsedStackTrace() { - var realTrace = stackTrace.get(); var err = new Error('something went wrong'); - var parsedTrace = stackTrace.parse(err); - - realTrace.forEach(function(real, i) { - var parsed = parsedTrace[i]; - - function compare(method, exceptions) { - var realValue = real[method](); - var parsedValue = parsed[method](); - - if (exceptions && exceptions[i]) { - realValue = exceptions[i]; - } - - var realJson = JSON.stringify(realValue); - var parsedJson = JSON.stringify(parsedValue); - - var message = - method + ': ' + realJson + ' != ' + parsedJson + ' (#' + i + ')'; - - assert.strictEqual(realValue, parsedValue, message); - } - - compare('getFileName'); - compare('getFunctionName', { - 3: 'Object..js', - 5: 'Function._load', - 6: 'Array.0', - 7: 'EventEmitter._tickCallback', - }); - compare('getTypeName'); - compare('getMethodName'); - compare('getLineNumber'); - compare('getColumnNumber', { - 0: 47 - }); - compare('isNative'); - }); -})(); - -(function testStackWithNativeCall() { - var err = {}; - err.stack = -'AssertionError: true == false\n' + -' at Test.fn (/Users/felix/code/node-fast-or-slow/test/fast/example/test-example.js:6:10)\n' + -' at Test.run (/Users/felix/code/node-fast-or-slow/lib/test.js:45:10)\n' + -' at TestCase.runNext (/Users/felix/code/node-fast-or-slow/lib/test_case.js:73:8)\n' + -' at TestCase.run (/Users/felix/code/node-fast-or-slow/lib/test_case.js:61:8)\n' + -' at Array.0 (native)\n' + -' at EventEmitter._tickCallback (node.js:126:26)'; - - var trace = stackTrace.parse(err); - var nativeCallSite = trace[4]; - - assert.strictEqual(nativeCallSite.getFileName(), null); - assert.strictEqual(nativeCallSite.getFunctionName(), 'Array.0'); - assert.strictEqual(nativeCallSite.getTypeName(), 'Array'); - assert.strictEqual(nativeCallSite.getMethodName(), '0'); - assert.strictEqual(nativeCallSite.getLineNumber(), null); - assert.strictEqual(nativeCallSite.getColumnNumber(), null); - assert.strictEqual(nativeCallSite.isNative(), true); -})(); - -(function testStackWithFileOnly() { - var err = {}; - err.stack = -'AssertionError: true == false\n' + -' at /Users/felix/code/node-fast-or-slow/lib/test_case.js:80:10'; - - var trace = stackTrace.parse(err); - var callSite = trace[0]; - - assert.strictEqual(callSite.getFileName(), '/Users/felix/code/node-fast-or-slow/lib/test_case.js'); - assert.strictEqual(callSite.getFunctionName(), null); - assert.strictEqual(callSite.getTypeName(), null); - assert.strictEqual(callSite.getMethodName(), null); - assert.strictEqual(callSite.getLineNumber(), 80); - assert.strictEqual(callSite.getColumnNumber(), 10); - assert.strictEqual(callSite.isNative(), false); -})(); - -(function testStackWithMultilineMessage() { - var err = {}; - err.stack = -'AssertionError: true == false\nAnd some more shit\n' + -' at /Users/felix/code/node-fast-or-slow/lib/test_case.js:80:10'; - - var trace = stackTrace.parse(err); - var callSite = trace[0]; - - assert.strictEqual(callSite.getFileName(), '/Users/felix/code/node-fast-or-slow/lib/test_case.js'); -})(); diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/test/run.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/test/run.js deleted file mode 100755 index 0bb8e82..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/node_modules/stack-trace/test/run.js +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node -var far = require('far').create(); - -far.add(__dirname); -far.include(/test-.*\.js$/); - -far.execute(); diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/package.json b/node_modules/flatiron/node_modules/prompt/node_modules/winston/package.json deleted file mode 100644 index 0ab45b5..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "winston", - "description": "A multi-transport async logging library for Node.js", - "version": "0.5.11", - "author": { - "name": "Charlie Robbins", - "email": "charlie.robbins@gmail.com" - }, - "contributors": [ - { - "name": "Matthew Bergman", - "email": "mzbphoto@gmail.com" - }, - { - "name": "Marak Squires", - "email": "marak@nodejitsu.com" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/flatiron/winston.git" - }, - "keywords": [ - "logging", - "sysadmin", - "tools" - ], - "dependencies": { - "async": "0.1.x", - "colors": "0.x.x", - "eyes": "0.1.x", - "loggly": "0.3.x >=0.3.7", - "pkginfo": "0.2.x", - "stack-trace": "0.0.x" - }, - "devDependencies": { - "vows": "0.6.x" - }, - "main": "./lib/winston", - "scripts": { - "test": "vows --spec --isolate" - }, - "engines": { - "node": ">= 0.4.0" - }, - "_id": "winston@0.5.11", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "winston@0.5.x" -} diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/cli-test.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/cli-test.js deleted file mode 100644 index 365fba3..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/cli-test.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * cli-test.js: Tests for the cli levels available in winston. - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -vows.describe('winston/logger/cli').addBatch({ - "When an instance of winston.Logger": { - topic: function () { - return new winston.Logger({ - transports: [ - new winston.transports.Console() - ] - }) - }, - "the cli() method": { - "should set the appropriate values on the logger": function (logger) { - logger.cli(); - assert.isTrue(logger.padLevels); - assert.isTrue(logger.transports.console.colorize); - assert.isFalse(logger.transports.console.timestamp); - Object.keys(winston.config.cli.levels).forEach(function (level) { - assert.isNumber(logger.levels[level]); - }); - - Object.keys(winston.config.cli.colors).forEach(function (color) { - assert.isString(winston.config.allColors[color]); - }); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/container-test.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/container-test.js deleted file mode 100644 index 2fcc26a..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/container-test.js +++ /dev/null @@ -1,99 +0,0 @@ -/* - * container-test.js: Tests for the Container object - * - * (C) 2011 Charlie Robbins - * MIT LICENSE - * - */ - -var assert = require('assert'), - fs = require('fs'), - http = require('http'), - path = require('path'), - vows = require('vows'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -vows.describe('winston/container').addBatch({ - "An instance of winston.Container": { - topic: new winston.Container(), - "the add() method": { - topic: function (container) { - return container.add('default-test'); - }, - "should correctly instantiate a Logger": function (logger) { - assert.instanceOf(logger, winston.Logger); - }, - "the get() method": { - topic: function (logger, container) { - this.callback.apply(this, arguments); - }, - "should respond with the logger previously created": function (existing, container) { - var logger = container.get('default-test'); - assert.isTrue(existing === logger); - } - }, - "the has() method": { - topic: function (logger, container) { - this.callback.apply(this, arguments); - }, - "should indicate `default-test` logger exists": function (existing, container) { - assert.isTrue(container.has('default-test')); - }, - "should indicate `not-has` logger doesnt exists": function (existing, container) { - assert.isFalse(container.has('not-has')); - } - }, - "the close() method": { - topic: function (logger, container) { - this.callback.apply(this, arguments); - }, - "should remove the specified logger": function (logger, container) { - container.close('default-test'); - assert.isTrue(!container.loggers['default-test']); - } - } - } - }, - "An instance of winston.Container with explicit transports": { - topic: function () { - this.port = 9412; - this.transports = [ - new winston.transports.Webhook({ - port: this.port - }) - ]; - - this.container = new winston.Container({ - transports: this.transports - }); - - return null; - }, - "the get() method": { - topic: function (container) { - var server = http.createServer(function (req, res) { - res.end(); - }); - - server.listen(this.port, this.callback.bind(this, null)); - }, - "should add the logger correctly": function () { - this.someLogger = this.container.get('some-logger'); - assert.isObject(this.someLogger.transports); - assert.instanceOf(this.someLogger.transports['webhook'], winston.transports.Webhook); - assert.strictEqual(this.someLogger.transports['webhook'], this.transports[0]); - }, - "a second call to get()": { - "should respond with the same transport object": function () { - this.someOtherLogger = this.container.get('some-other-logger'); - - assert.isObject(this.someOtherLogger.transports); - assert.instanceOf(this.someOtherLogger.transports['webhook'], winston.transports.Webhook); - assert.strictEqual(this.someOtherLogger.transports['webhook'], this.transports[0]); - assert.strictEqual(this.someOtherLogger.transports['webhook'], this.someLogger.transports['webhook']); - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/custom-timestamp-test.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/custom-timestamp-test.js deleted file mode 100644 index c9753e2..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/custom-timestamp-test.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * custom-timestamp-test.js: Test function as timestamp option for transport `{ timestamp: function () {} }` - * - * (C) 2011 Charlie Robbins, Tom Shinnick - * MIT LICENSE - * - */ - -var assert = require('assert'), - events = require('events'), - fs = require('fs'), - path = require('path'), - vows = require('vows'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -function assertTimestamp (basename, options) { - var filename = path.join(__dirname, 'fixtures', 'logs', basename + '.log'); - - try { fs.unlinkSync(filename) } - catch (ex) { } - - return { - topic: function () { - options.filename = filename; - var transport = new (winston.transports.File)(options); - - // We must wait until transport file has emitted the 'flush' - // event to be sure the file has been created and written - transport.once('flush', this.callback.bind(this, null, filename)); - transport.log('info', 'When a fake tree falls in the forest...', null, function () {}); - }, - "should log with the appropriate timestamp": function (_, filename) { - var data = fs.readFileSync(filename, 'utf8'); - assert.isNotNull(data.match(options.pattern)); - } - } -} - -vows.describe('winston/transport/timestamp').addBatch({ - "When timestamp option is used": { - "with file transport": { - "with value set to false": assertTimestamp('noTimestamp', { - pattern: /^info\:/, - json: false, - timestamp: false - }), - "with value set to true ": assertTimestamp('defaultTimestamp', { - pattern: /^\d\d? \w{3}/, - json: false, - timestamp: true - }), - "and function value": assertTimestamp('customTimestamp', { - pattern: /^\d{8}\./, - json: false, - timestamp: function () { - return '20110803.171657'; - } - }) - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/exception-test.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/exception-test.js deleted file mode 100644 index 6bc8aec..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/exception-test.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * exception-test.js: Tests for exception data gathering in winston. - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -vows.describe('winston/exception').addBatch({ - "When using the winston exception module": { - "the getProcessInfo() method": { - topic: winston.exception.getProcessInfo(), - "should respond with the appropriate data": function (info) { - helpers.assertProcessInfo(info); - } - }, - "the getOsInfo() method": { - topic: winston.exception.getOsInfo(), - "should respond with the appropriate data": function (info) { - helpers.assertOsInfo(info); - } - }, - "the getTrace() method": { - topic: winston.exception.getTrace(new Error()), - "should have the appropriate info": function (trace) { - helpers.assertTrace(trace); - } - }, - "the getAllInfo() method": { - topic: winston.exception.getAllInfo(new Error()), - "should have the appropriate info": function (info) { - assert.isObject(info); - assert.isArray(info.stack); - helpers.assertProcessInfo(info.process); - helpers.assertOsInfo(info.os); - helpers.assertTrace(info.trace); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/fixtures/.gitkeep b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/fixtures/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/fixtures/keys/agent2-cert.pem b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/fixtures/keys/agent2-cert.pem deleted file mode 100644 index 8e4354d..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/fixtures/keys/agent2-cert.pem +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIB7DCCAZYCCQC7gs0MDNn6MTANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJV -UzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQKEwZKb3llbnQxEDAO -BgNVBAsTB05vZGUuanMxDzANBgNVBAMTBmFnZW50MjEgMB4GCSqGSIb3DQEJARYR -cnlAdGlueWNsb3Vkcy5vcmcwHhcNMTEwMzE0MTgyOTEyWhcNMzgwNzI5MTgyOTEy -WjB9MQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYD -VQQKEwZKb3llbnQxEDAOBgNVBAsTB05vZGUuanMxDzANBgNVBAMTBmFnZW50MjEg -MB4GCSqGSIb3DQEJARYRcnlAdGlueWNsb3Vkcy5vcmcwXDANBgkqhkiG9w0BAQEF -AANLADBIAkEAyXb8FrRdKbhrKLgLSsn61i1C7w7fVVVd7OQsmV/7p9WB2lWFiDlC -WKGU9SiIz/A6wNZDUAuc2E+VwtpCT561AQIDAQABMA0GCSqGSIb3DQEBBQUAA0EA -C8HzpuNhFLCI3A5KkBS5zHAQax6TFUOhbpBCR0aTDbJ6F1liDTK1lmU/BjvPoj+9 -1LHwrmh29rK8kBPEjmymCQ== ------END CERTIFICATE----- diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/fixtures/keys/agent2-key.pem b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/fixtures/keys/agent2-key.pem deleted file mode 100644 index 522903c..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/fixtures/keys/agent2-key.pem +++ /dev/null @@ -1,9 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIBOgIBAAJBAMl2/Ba0XSm4ayi4C0rJ+tYtQu8O31VVXezkLJlf+6fVgdpVhYg5 -QlihlPUoiM/wOsDWQ1ALnNhPlcLaQk+etQECAwEAAQJBAMT6Bf34+UHKY1ObpsbH -9u2jsVblFq1rWvs8GPMY6oertzvwm3DpuSUp7PTgOB1nLTLYtCERbQ4ovtN8tn3p -OHUCIQDzIEGsoCr5vlxXvy2zJwu+fxYuhTZWMVuo1397L0VyhwIhANQh+yzqUgaf -WRtSB4T2W7ADtJI35ET61jKBty3CqJY3AiAIwju7dVW3A5WeD6Qc1SZGKZvp9yCb -AFI2BfVwwaY11wIgXF3PeGcvACMyMWsuSv7aPXHfliswAbkWuzcwA4TW01ECIGWa -cgsDvVFxmfM5NPSuT/UDTa6R5BFISB5ea0N0AR3I ------END RSA PRIVATE KEY----- diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/fixtures/logs/.gitkeep b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/fixtures/logs/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/fixtures/scripts/default-exceptions.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/fixtures/scripts/default-exceptions.js deleted file mode 100644 index ab26aa5..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/fixtures/scripts/default-exceptions.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * default-exceptions.js: A test fixture for logging exceptions with the default winston logger. - * - * (C) 2011 Charlie Robbins - * MIT LICENCE - * - */ - -var path = require('path'), - winston = require('../../../lib/winston'); - -winston.handleExceptions([ - new (winston.transports.File)({ - filename: path.join(__dirname, '..', 'logs', 'default-exception.log'), - handleExceptions: true - }) -]); - -setTimeout(function () { - throw new Error('OH NOES! It failed!'); -}, 1000); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/fixtures/scripts/exit-on-error.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/fixtures/scripts/exit-on-error.js deleted file mode 100644 index fa3dd65..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/fixtures/scripts/exit-on-error.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * default-exceptions.js: A test fixture for logging exceptions with the default winston logger. - * - * (C) 2011 Charlie Robbins - * MIT LICENCE - * - */ - -var path = require('path'), - winston = require('../../../lib/winston'); - -winston.exitOnError = function (err) { - return err.message !== 'Ignore this error'; -}; - -winston.handleExceptions([ - new (winston.transports.File)({ - filename: path.join(__dirname, '..', 'logs', 'exit-on-error.log'), - handleExceptions: true - }) -]); - -setTimeout(function () { - throw new Error('Ignore this error'); -}, 1000); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/fixtures/scripts/log-exceptions.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/fixtures/scripts/log-exceptions.js deleted file mode 100644 index 43ce7eb..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/fixtures/scripts/log-exceptions.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * log-exceptions.js: A test fixture for logging exceptions in winston. - * - * (C) 2011 Charlie Robbins - * MIT LICENCE - * - */ - -var path = require('path'), - winston = require('../../../lib/winston'); - -var logger = new (winston.Logger)({ - transports: [ - new (winston.transports.File)({ - filename: path.join(__dirname, '..', 'logs', 'exception.log'), - handleExceptions: true - }) - ] -}); - -logger.handleExceptions(); - -setTimeout(function () { - throw new Error('OH NOES! It failed!'); -}, 1000); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/fixtures/scripts/unhandle-exceptions.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/fixtures/scripts/unhandle-exceptions.js deleted file mode 100644 index 5d722a7..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/fixtures/scripts/unhandle-exceptions.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * unhandle-exceptions.js: A test fixture for using `.unhandleExceptions()` winston. - * - * (C) 2011 Charlie Robbins - * MIT LICENCE - * - */ - -var path = require('path'), - winston = require('../../../lib/winston'); - -var logger = new (winston.Logger)({ - transports: [ - new (winston.transports.File)({ - filename: path.join(__dirname, '..', 'logs', 'unhandle-exception.log'), - handleExceptions: true - }) - ] -}); - -logger.handleExceptions(); -logger.unhandleExceptions(); - -setTimeout(function () { - throw new Error('OH NOES! It failed!'); -}, 1000); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/helpers.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/helpers.js deleted file mode 100644 index f961f85..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/helpers.js +++ /dev/null @@ -1,179 +0,0 @@ -/* - * helpers.js: Test helpers for winston - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var assert = require('assert'), - fs = require('fs'), - path = require('path'), - spawn = require('child_process').spawn, - util = require('util'), - loggly = require('loggly'), - vows = require('vows'), - winston = require('../lib/winston'); - -var helpers = exports; - -helpers.loadConfig = function (dir) { - try { - if (helpers.config) return helpers.config; - var configFile = path.join(dir || __dirname, 'fixtures', 'test-config.json'), - stats = fs.statSync(configFile), - config = JSON.parse(fs.readFileSync(configFile).toString()); - - helpers.config = config; - return config; - } - catch (ex) { - console.error('test/fixtures/test-config.json must be created with valid data before running tests'); - return false; - } -}; - -helpers.size = function (obj) { - var size = 0, key; - for (key in obj) { - if (obj.hasOwnProperty(key)) { - size++; - } - } - - return size; -}; - -helpers.tryUnlink = function (file) { - try { fs.unlinkSync(file) } - catch (ex) { } -}; - -helpers.assertProcessInfo = function (info) { - assert.isNumber(info.pid); - assert.isNumber(info.uid); - assert.isNumber(info.gid); - assert.isString(info.cwd); - assert.isString(info.execPath); - assert.isString(info.version); - assert.isArray(info.argv); - assert.isObject(info.memoryUsage); -}; - -helpers.assertOsInfo = function (info) { - assert.isArray(info.loadavg); - assert.isNumber(info.uptime); -}; - -helpers.assertTrace = function (trace) { - trace.forEach(function (site) { - assert.isTrue(!site.column || typeof site.column === 'number'); - assert.isTrue(!site.line || typeof site.line === 'number'); - assert.isTrue(!site.file || typeof site.file === 'string'); - assert.isTrue(!site.method || typeof site.method === 'string'); - assert.isTrue(!site.function || typeof site.function === 'string'); - assert.isTrue(typeof site.native === 'boolean'); - }); -}; - -helpers.assertLogger = function (logger, level) { - assert.instanceOf(logger, winston.Logger); - assert.isFunction(logger.log); - assert.isFunction(logger.add); - assert.isFunction(logger.remove); - assert.equal(logger.level, level || "info"); - Object.keys(logger.levels).forEach(function (method) { - assert.isFunction(logger[method]); - }); -}; - -helpers.assertConsole = function (transport) { - assert.instanceOf(transport, winston.transports.Console); - assert.isFunction(transport.log); -}; - -helpers.assertFile = function (transport) { - assert.instanceOf(transport, winston.transports.File); - assert.isFunction(transport.log); -} - -helpers.assertLoggly = function (transport) { - assert.instanceOf(transport, winston.transports.Loggly); - assert.isFunction(transport.log); -}; - -helpers.assertWebhook = function (transport) { - assert.instanceOf(transport, winston.transports.Webhook); - assert.isFunction(transport.log); -}; - -helpers.assertCouchdb = function (transport) { - assert.instanceOf(transport, winston.transports.Couchdb); - assert.isFunction(transport.log); -}; - -helpers.assertHandleExceptions = function (options) { - return { - topic: function () { - var that = this, - child = spawn('node', [options.script]); - - helpers.tryUnlink(options.logfile); - child.on('exit', function () { - fs.readFile(options.logfile, that.callback); - }); - }, - "should save the error information to the specified file": function (err, data) { - assert.isTrue(!err); - data = JSON.parse(data); - - assert.isObject(data); - helpers.assertProcessInfo(data.process); - helpers.assertOsInfo(data.os); - helpers.assertTrace(data.trace); - } - } -} - -helpers.testNpmLevels = function (transport, assertMsg, assertFn) { - return helpers.testLevels(winston.config.npm.levels, transport, assertMsg, assertFn); -}; - -helpers.testSyslogLevels = function (transport, assertMsg, assertFn) { - return helpers.testLevels(winston.config.syslog.levels, transport, assertMsg, assertFn); -}; - -helpers.testLevels = function (levels, transport, assertMsg, assertFn) { - var tests = {}; - - Object.keys(levels).forEach(function (level) { - var test = { - topic: function () { - transport.log(level, 'test message', {}, this.callback.bind(this, null)); - } - }; - - test[assertMsg] = assertFn; - tests['with the ' + level + ' level'] = test; - }); - - var metadatatest = { - topic: function () { - transport.log('info', 'test message', { metadata: true }, this.callback.bind(this, null)); - } - }; - - metadatatest[assertMsg] = assertFn; - tests['when passed metadata'] = metadatatest; - - var primmetadatatest = { - topic: function () { - transport.log('info', 'test message', 'metadata', this.callback.bind(this, null)); - } - }; - - primmetadatatest[assertMsg] = assertFn; - tests['when passed primitive metadata'] = primmetadatatest; - - return tests; -}; diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/log-exception-test.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/log-exception-test.js deleted file mode 100644 index b077a0a..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/log-exception-test.js +++ /dev/null @@ -1,58 +0,0 @@ -/* - * exception-test.js: Tests for exception data gathering in winston. - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var assert = require('assert'), - path = require('path'), - spawn = require('child_process').spawn, - vows = require('vows'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -vows.describe('winston/logger/exceptions').addBatch({ - "When using winston": { - "the handleException() method": { - "with a custom winston.Logger instance": helpers.assertHandleExceptions({ - script: path.join(__dirname, 'fixtures', 'scripts', 'log-exceptions.js'), - logfile: path.join(__dirname, 'fixtures', 'logs', 'exception.log') - }), - "with the default winston logger": helpers.assertHandleExceptions({ - script: path.join(__dirname, 'fixtures', 'scripts', 'default-exceptions.js'), - logfile: path.join(__dirname, 'fixtures', 'logs', 'default-exception.log') - }), - "when a custom exitOnError function is set": { - topic: function () { - var that = this, - scriptDir = path.join(__dirname, 'fixtures', 'scripts'); - - that.child = spawn('node', [path.join(scriptDir, 'exit-on-error.js')]); - setTimeout(this.callback.bind(this), 1500); - }, - "should not exit the process": function () { - assert.isFalse(this.child.killed); - this.child.kill(); - } - } - }, - "the unhandleException() method": { - topic: function () { - var that = this, - child = spawn('node', [path.join(__dirname, 'fixtures', 'scripts', 'unhandle-exceptions.js')]), - exception = path.join(__dirname, 'fixtures', 'logs', 'unhandle-exception.log'); - - helpers.tryUnlink(exception); - child.on('exit', function () { - path.exists(exception, that.callback.bind(this, null)); - }); - }, - "should not write to the specified error file": function (err, exists) { - assert.isTrue(!err); - assert.isFalse(exists); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/log-rewriter-test.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/log-rewriter-test.js deleted file mode 100644 index 4753fcc..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/log-rewriter-test.js +++ /dev/null @@ -1,98 +0,0 @@ -/* - * log-rewriter-test.js: Tests for rewriting metadata in winston. - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var assert = require('assert'), - vows = require('vows'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -vows.describe('winston/logger/rewriter').addBatch({ - "An instance of winston.Logger": { - topic: new (winston.Logger)({transports: [ - new (winston.transports.Console)({ level: 'info' }) - ]}), - "the addRewriter() method": { - topic: function(logger) { - logger.addRewriter(function(level, msg, meta) { - meta.level = level; - meta.msg = msg; - meta.foo = 'bar'; - return meta; - }); - return logger; - }, - "should add the rewriter": function(logger) { - assert.equal(helpers.size(logger.rewriters), 1); - }, - "the log() method": { - topic: function(logger) { - logger.once('logging', this.callback); - logger.log('info', 'test message', {"a": "b"}); - }, - "should run the rewriter": function(transport, level, msg, meta) { - assert.equal(meta.a, 'b'); - assert.equal(meta.level, 'info'); - assert.equal(meta.msg, 'test message'); - assert.equal(meta.foo, 'bar'); - } - } - } - } -}).addBatch({ - "An instance of winston.Logger with explicit rewriter": { - topic: new (winston.Logger)({transports: [ - new (winston.transports.Console)({ level: 'info'}) - ], rewriters: [ - function(level, msg, meta) { - meta.level = level; - meta.msg = msg; - meta.foo = 'bar'; - return meta; - } - ]}), - "should add the rewriter": function(logger) { - assert.equal(helpers.size(logger.rewriters), 1); - }, - "the log() method": { - topic: function(logger) { - logger.once('logging', this.callback); - logger.log('info', 'test message', {"a": "b"}); - }, - "should run the rewriter": function(transport, level, msg, meta) { - assert.equal(meta.a, 'b'); - assert.equal(meta.level, 'info'); - assert.equal(meta.msg, 'test message'); - assert.equal(meta.foo, 'bar'); - } - } - } -}).addBatch({ - "An instance of winston.Logger with rewriters": { - topic: new (winston.Logger)({transports: [ - new (winston.transports.Console)({ level: 'info' }) - ], rewriters: [ - function(level, msg, meta) { - meta.numbers.push(1); - return meta; - }, - function(level, msg, meta) { - meta.numbers.push(2); - return meta; - } - ]}), - "the log() method": { - topic: function(logger) { - logger.once('logging', this.callback); - logger.log('info', 'test message', {"numbers": [0]}); - }, - "should run the rewriters in correct order": function(transport, level, msg, meta) { - assert.deepEqual(meta.numbers, [0, 1, 2]); - } - } - } -}).export(module); diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/logger-test.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/logger-test.js deleted file mode 100644 index 0105825..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/logger-test.js +++ /dev/null @@ -1,199 +0,0 @@ -/* - * logger-test.js: Tests for instances of the winston Logger - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -vows.describe('winton/logger').addBatch({ - "An instance of winston.Logger": { - topic: new (winston.Logger)({ transports: [new (winston.transports.Console)({ level: 'info' })] }), - "should have the correct methods / properties defined": function (logger) { - helpers.assertLogger(logger); - }, - "the add() with an unsupported transport": { - "should throw an error": function () { - assert.throws(function () { logger.add('unsupported') }, Error); - } - } - } -}).addBatch({ - "An instance of winston.Logger with no transports": { - topic: new (winston.Logger)({ emitErrs: true }), - "the log() method should throw an error": function (logger) { - assert.throws(function () { logger.log('anything') }, Error); - }, - "the extend() method called on an empty object": { - topic: function (logger) { - var empty = {}; - logger.extend(empty); - return empty; - }, - "should define the appropriate methods": function (extended) { - ['log', 'profile', 'startTimer'].concat(Object.keys(winston.config.npm.levels)).forEach(function (method) { - assert.isFunction(extended[method]); - }); - } - }, - "the add() method with a supported transport": { - topic: function (logger) { - return logger.add(winston.transports.Console); - }, - "should add the console Transport onto transports": function (logger) { - assert.equal(helpers.size(logger.transports), 1); - helpers.assertConsole(logger.transports.console); - }, - "should throw an error when the same Transport is added": function (logger) { - assert.throws(function () { logger.add(winston.transports.Console) }, Error); - }, - "the log() method": { - topic: function (logger) { - logger.once('logging', this.callback); - logger.log('info', 'test message'); - }, - "should emit the 'log' event with the appropriate transport": function (transport, ign) { - helpers.assertConsole(transport); - } - }, - "the profile() method": { - "when passed a callback": { - topic: function (logger) { - var that = this; - logger.profile('test1'); - setTimeout(function () { - logger.profile('test1', function (err, level, msg, meta) { - that.callback(err, level, msg, meta, logger); - }); - }, 1000); - }, - "should respond with the appropriate profile message": function (err, level, msg, meta, logger) { - assert.isNull(err); - assert.equal(level, 'info'); - assert.match(meta.duration, /(\d+)ms/); - assert.isTrue(typeof logger.profilers['test'] === 'undefined'); - } - }, - "when not passed a callback": { - topic: function (logger) { - var that = this; - logger.profile('test2'); - logger.once('logging', that.callback.bind(null, null)); - setTimeout(function () { - logger.profile('test2'); - }, 1000); - }, - "should respond with the appropriate profile message": function (err, transport, level, msg, meta) { - assert.isNull(err); - assert.equal(level, 'info'); - assert.match(meta.duration, /(\d+)ms/); - } - } - }, - "the startTimer() method": { - "when passed a callback": { - topic: function (logger) { - var that = this; - var timer = logger.startTimer() - setTimeout(function () { - timer.done('test', function (err, level, msg, meta) { - that.callback(err, level, msg, meta, logger); - }); - }, 1000); - }, - "should respond with the appropriate message": function (err, level, msg, meta, logger) { - assert.isNull(err); - assert.equal(level, 'info'); - assert.match(meta.duration, /(\d+)ms/); - } - }, - "when not passed a callback": { - topic: function (logger) { - var that = this; - var timer = logger.startTimer() - logger.once('logging', that.callback.bind(null, null)); - setTimeout(function () { - timer.done(); - }, 1000); - }, - "should respond with the appropriate message": function (err, transport, level, msg, meta) { - assert.isNull(err); - assert.equal(level, 'info'); - assert.match(meta.duration, /(\d+)ms/); - - var duration = parseInt(meta.duration); - assert.isNumber(duration); - assert.isTrue(duration > 900 && duration < 1100); - } - } - }, - "and adding an additional transport": { - topic: function (logger) { - return logger.add(winston.transports.File, { - filename: path.join(__dirname, 'fixtures', 'logs', 'testfile2.log') - }); - }, - "should be able to add multiple transports": function (logger) { - assert.equal(helpers.size(logger.transports), 2); - helpers.assertConsole(logger.transports.console); - helpers.assertFile(logger.transports.file); - } - } - } - } -}).addBatch({ - "The winston logger": { - topic: new (winston.Logger)({ - transports: [ - new (winston.transports.Console)(), - new (winston.transports.File)({ filename: path.join(__dirname, 'fixtures', 'logs', 'filelog.log' )}) - ] - }), - "should return have two transports": function (logger) { - assert.equal(helpers.size(logger.transports), 2); - }, - "the remove() with an unadded transport": { - "should throw an Error": function (logger) { - assert.throws(function () { logger.remove(winston.transports.Loggly) }, Error); - } - }, - "the remove() method with an added transport": { - topic: function (logger) { - return logger.remove(winston.transports.Console); - }, - "should remove the Console transport from transports": function (logger) { - assert.equal(helpers.size(logger.transports), 1); - helpers.assertFile(logger.transports.file); - }, - "and removing an additional transport": { - topic: function (logger) { - return logger.remove(winston.transports.File); - }, - "should remove File transport from transports": function (logger) { - assert.equal(helpers.size(logger.transports), 0); - } - } - } - } -}).addBatch({ - "The winston logger": { - topic: new (winston.Logger)({ - transports: [ - new (winston.transports.Console)(), - new (winston.transports.File)({ filename: path.join(__dirname, 'fixtures', 'logs', 'filelog.log' )}) - ] - }), - "the clear() method": { - "should remove all transports": function (logger) { - logger.clear(); - assert.equal(helpers.size(logger.transports), 0); - } - } - } -}).export(module); diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/transports/console-test.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/transports/console-test.js deleted file mode 100644 index 07f5a6e..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/transports/console-test.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * console-test.js: Tests for instances of the Console transport - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - winston = require('../../lib/winston'), - helpers = require('../helpers'); - -var npmTransport = new (winston.transports.Console)(), - syslogTransport = new (winston.transports.Console)({ levels: winston.config.syslog.levels }); - -vows.describe('winston/transports/console').addBatch({ - "An instance of the Console Transport": { - "with npm levels": { - "should have the proper methods defined": function () { - helpers.assertConsole(npmTransport); - }, - "the log() method": helpers.testNpmLevels(npmTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - }, - "with syslog levels": { - "should have the proper methods defined": function () { - helpers.assertConsole(syslogTransport); - }, - "the log() method": helpers.testSyslogLevels(syslogTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/transports/couchdb-test.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/transports/couchdb-test.js deleted file mode 100644 index d0057e8..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/transports/couchdb-test.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * couchdb-test.js: Tests for instances of the Couchdb transport - * - * (C) 2011 Max Ogden - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - fs = require('fs'), - http = require('http'), - assert = require('assert'), - winston = require('../../lib/winston'), - helpers = require('../helpers'); - -var couchdbTransport = new (winston.transports.Couchdb)({ - "host": "localhost", - "port": 4567, - "db": "logs" -}); - -var server = http.createServer(function (req, res) { - res.end(); -}); - -server.listen(4567); - -vows.describe('winston/transports/couchdb').addBatch({ - "An instance of the Couchdb Transport": { - "when passed valid options": { - "should have the proper methods defined": function () { - helpers.assertCouchdb(couchdbTransport); - }, - "the log() method": helpers.testNpmLevels(couchdbTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - } - } -}).addBatch({ - "When the tests are over": { - "the server should cleanup": function () { - server.close(); - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/transports/file-maxfiles-test.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/transports/file-maxfiles-test.js deleted file mode 100644 index a9fa89e..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/transports/file-maxfiles-test.js +++ /dev/null @@ -1,102 +0,0 @@ -/* - * file-maxfiles-test.js: Tests for instances of the File transport setting the max file size, - * and setting a number for max files created. - * maxSize * maxFiles = total storage used by winston. - * - * (C) 2011 Daniel Aristizabal - * MIT LICENSE - * - */ - -var assert = require('assert'), - exec = require('child_process').exec, - fs = require('fs'), - path = require('path'), - vows = require('vows'), - winston = require('../../lib/winston'), - helpers = require('../helpers'); - -var maxfilesTransport = new winston.transports.File({ - timestamp: false, - json: false, - filename: path.join(__dirname, '..', 'fixtures', 'logs', 'testmaxfiles.log'), - maxsize: 4096, - maxFiles: 3 -}); - -vows.describe('winston/transports/file/maxfiles').addBatch({ - "An instance of the File Transport": { - "when passed a valid filename": { - topic: maxfilesTransport, - "should be a valid transporter": function (transportTest) { - helpers.assertFile(transportTest); - }, - "should set the maxFiles option correctly": function (transportTest) { - assert.isNumber(transportTest.maxFiles); - } - }, - "when delete old test files": { - topic: function () { - exec('rm -rf ' + path.join(__dirname, '..', 'fixtures', 'logs', 'testmaxfiles*'), this.callback); - }, - "and when passed more files than the maxFiles": { - topic: function () { - var that = this, - created = 0; - - function data(ch) { - return new Array(1018).join(String.fromCharCode(65 + ch)); - }; - - function logKbytes(kbytes, txt) { - // - // With no timestamp and at the info level, - // winston adds exactly 7 characters: - // [info](4)[ :](2)[\n](1) - // - for (var i = 0; i < kbytes; i++) { - maxfilesTransport.log('info', data(txt), null, function () { }); - } - } - - maxfilesTransport.on('logged', function () { - if (++created === 6) { - return that.callback(); - } - - logKbytes(4, created); - }); - - logKbytes(4, created); - }, - "should be only 3 files called 5.log, 4.log and 3.log": function () { - for (var num = 0; num < 6; num++) { - var file = !num ? 'testmaxfiles.log' : 'testmaxfiles' + num + '.log', - fullpath = path.join(__dirname, '..', 'fixtures', 'logs', file); - - // There should be no files with that name - if (num >= 0 && num < 3) { - return assert.throws(function () { - fs.statSync(file); - }, Error); - } - - // The other files should be exist - assert.doesNotThrow(function () { - fs.statSync(file); - }, Error); - } - }, - "should have the correct content": function () { - ['D', 'E', 'F'].forEach(function (name, inx) { - var counter = inx + 3, - logsDir = path.join(__dirname, '..', 'fixtures', 'logs'), - content = fs.readFileSync(path.join(logsDir, 'testmaxfiles' + counter + '.log'), 'utf-8'); - // The content minus the 7 characters added by winston - assert.lengthOf(content.match(new RegExp(name, 'g')), 4068); - }); - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/transports/file-maxsize-test.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/transports/file-maxsize-test.js deleted file mode 100644 index 7d20e08..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/transports/file-maxsize-test.js +++ /dev/null @@ -1,82 +0,0 @@ -/* - * file-test.js: Tests for instances of the File transport - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var assert = require('assert'), - exec = require('child_process').exec, - fs = require('fs'), - path = require('path'), - vows = require('vows'), - winston = require('../../lib/winston'), - helpers = require('../helpers'); - -var maxsizeTransport = new winston.transports.File({ - timestamp: false, - json: false, - filename: path.join(__dirname, '..', 'fixtures', 'logs', 'testmaxsize.log'), - maxsize: 4096 -}); - -vows.describe('winston/transports/file/maxsize').addBatch({ - "An instance of the File Transport": { - "when passed a valid filename": { - "the log() method": { - topic: function () { - exec('rm -rf ' + path.join(__dirname, '..', 'fixtures', 'logs', 'testmaxsize*'), this.callback); - }, - "when passed more than the maxsize": { - topic: function () { - var that = this, - data = new Array(1018).join('-'); - - // - // Setup a list of files which we will later stat. - // - that.files = []; - - function logKbytes (kbytes) { - // - // With no timestamp and at the info level, - // winston adds exactly 7 characters: - // [info](4)[ :](2)[\n](1) - // - for (var i = 0; i < kbytes; i++) { - maxsizeTransport.log('info', data, null, function () { }); - } - } - - maxsizeTransport.on('open', function (file) { - var match = file.match(/(\d+)\.log$/), - count = match ? match[1] : 0; - - that.files.push(file); - - if (that.files.length === 5) { - return that.callback(); - } - - logKbytes(4); - }); - - logKbytes(4); - }, - "should create multiple files correctly": function () { - this.files.forEach(function (file) { - try { - var stats = fs.statSync(file); - assert.equal(stats.size, 4096); - } - catch (ex) { - assert.isNull(ex); - } - }); - } - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/transports/file-test.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/transports/file-test.js deleted file mode 100644 index c287794..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/transports/file-test.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * file-test.js: Tests for instances of the File transport - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - fs = require('fs'), - assert = require('assert'), - winston = require('../../lib/winston'), - helpers = require('../helpers'); - -var stream = fs.createWriteStream(path.join(__dirname, '..', 'fixtures', 'logs', 'testfile.log')), - fileTransport = new (winston.transports.File)({ filename: path.join(__dirname, '..', 'fixtures', 'logs', 'testfilename.log') }), - streamTransport = new (winston.transports.File)({ stream: stream }); - -vows.describe('winston/transports/file').addBatch({ - "An instance of the File Transport": { - "when passed a valid filename": { - "should have the proper methods defined": function () { - helpers.assertFile(fileTransport); - }, - "the log() method": helpers.testNpmLevels(fileTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - }, - "when passed a valid file stream": { - "should have the proper methods defined": function () { - helpers.assertFile(streamTransport); - }, - "the log() method": helpers.testNpmLevels(streamTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - } - } -}).addBatch({ - "These tests have a non-deterministic end": { - topic: function () { - setTimeout(this.callback, 200); - }, - "and this should be fixed before releasing": function () { - assert.isTrue(true); - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/transports/loggly-test.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/transports/loggly-test.js deleted file mode 100644 index 8271b90..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/transports/loggly-test.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * loggly-test.js: Tests for instances of the Loggly transport - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - winston = require('../../lib/winston'), - helpers = require('../helpers'); - -var config = helpers.loadConfig(); - -if (!config) { - return; -} - -var tokenTransport = new (winston.transports.Loggly)({ - subdomain: config.transports.loggly.subdomain, - inputToken: config.transports.loggly.inputToken - }), - nameTransport = new (winston.transports.Loggly)({ - subdomain: config.transports.loggly.subdomain, - inputName: config.transports.loggly.inputName, - auth: config.transports.loggly.auth - }); - -vows.describe('winston/transports/loggly').addBatch({ - "An instance of the Loggly Transport": { - "when passed an input token": { - "should have the proper methods defined": function () { - helpers.assertLoggly(tokenTransport); - }, - "the log() method": helpers.testNpmLevels(tokenTransport, "should log messages to loggly", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }), - "the log() method with no metadata": { - topic: function () { - tokenTransport.log('info', 'test-message', null, this.callback.bind(null, null)); - }, - "should respond immediately": function () { - assert.isTrue(true); - } - } - }, - "when passed an input name": { - "should have the proper methods defined": function () { - helpers.assertLoggly(nameTransport); - }, - "the log() method": helpers.testNpmLevels(nameTransport, "should log messages to loggly", function (ign, err, result) { - assert.isNull(err); - assert.isTrue(result === true || result.response === 'ok'); - }) - } - } -}).export(module); - diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/transports/webhook-test.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/transports/webhook-test.js deleted file mode 100644 index e106374..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/transports/webhook-test.js +++ /dev/null @@ -1,119 +0,0 @@ -/* - * webhook-test.js: Tests for instances of the Webhook transport - * - * (C) 2011 Marak Squires - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - fs = require('fs'), - http = require('http'), - https = require('https'), - assert = require('assert'), - winston = require('../../lib/winston'), - helpers = require('../helpers'); - -var webhookTransport = new (winston.transports.Webhook)({ - "host": "localhost", - "port": 8080, - "path": "/winston-test" -}); - -var httpsWebhookTransport = new (winston.transports.Webhook)({ - "host": "localhost", - "port": 8081, - "path": "/winston-test", - "ssl": true -}); - -var authWebhookTransport = new (winston.transports.Webhook)({ - "host": "localhost", - "port": 8080, - "path": "/winston-auth-test", - "auth": { - "username": "winston", - "password": "churchill" - } -}); - -var requestsAuthenticated = true; - -var server = http.createServer(function (req, res) { - if (req.url == '/winston-auth-test') { - // - // Test if request has been correctly authenticated - // - // Strip 'Basic' from Authorization header - var signature = req.headers['authorization'].substr(6); - requestsAuthenticated = requestsAuthenticated && - new Buffer(signature, 'base64').toString('utf8') == 'winston:churchill'; - } - res.end(); -}); - -server.listen(8080); - - -var httpsServer = https.createServer({ - cert: fs.readFileSync(path.join(__dirname, '..', 'fixtures', 'keys', 'agent2-cert.pem')), - key: fs.readFileSync(path.join(__dirname, '..', 'fixtures', 'keys', 'agent2-key.pem')) -}, function (req, res) { - res.end(); -}); - -httpsServer.listen(8081); - -vows.describe('winston/transports/webhook').addBatch({ - "An instance of the Webhook Transport": { - "when passed valid options": { - "should have the proper methods defined": function () { - helpers.assertWebhook(webhookTransport); - }, - "the log() method": helpers.testNpmLevels(webhookTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - } - }, - "An https instance of the Webhook Transport": { - "when passed valid options": { - "should have the proper methods defined": function () { - helpers.assertWebhook(httpsWebhookTransport); - }, - "the log() method": helpers.testNpmLevels(httpsWebhookTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - } - }, - "An http Basic Auth instance of the Webhook Transport": { - "when passed valid options": { - "should have the proper methods defined": function () { - helpers.assertWebhook(authWebhookTransport); - }, - "the log() method": helpers.testNpmLevels(authWebhookTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - } - } -}).addBatch({ - "When the tests are over": { - topic: function () { - // - // Delay destruction of the server since the - // WebHook transport responds before the request - // has actually be completed. - // - setTimeout(this.callback, 1000); - }, - "the server should cleanup": function () { - server.close(); - }, - "requests have been correctly authenticated": function () { - assert.ok(requestsAuthenticated); - } - } -}).export(module); diff --git a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/winston-test.js b/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/winston-test.js deleted file mode 100644 index e790cb9..0000000 --- a/node_modules/flatiron/node_modules/prompt/node_modules/winston/test/winston-test.js +++ /dev/null @@ -1,100 +0,0 @@ -/* - * logger-test.js: Tests for instances of the winston Logger - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var fs = require('fs'), - path = require('path'), - vows = require('vows'), - http = require('http'), - assert = require('assert'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -vows.describe('winston').addBatch({ - "The winston module": { - topic: function () { - winston.default.transports.console.level = 'silly'; - return null; - }, - "should have the correct methods defined": function () { - assert.isObject(winston.transports); - assert.isFunction(winston.Transport); - assert.isTrue(!winston.transports.Transport); - assert.isFunction(winston.transports.Console); - assert.isFunction(winston.transports.File); - assert.isFunction(winston.transports.Loggly); - assert.isFunction(winston.transports.Webhook); - assert.isObject(winston.default.transports.console); - assert.isFalse(winston.emitErrs); - assert.isObject(winston.config); - ['Logger', 'add', 'remove', 'extend'] - .concat(Object.keys(winston.config.npm.levels)) - .forEach(function (key) { - assert.isFunction(winston[key]); - }); - }, - "it should": { - topic: function () { - fs.readFile(path.join(__dirname, '..', 'package.json'), this.callback); - }, - "have the correct version set": function (err, data) { - assert.isNull(err); - data = JSON.parse(data.toString()); - assert.equal(winston.version, data.version); - } - }, - "the log() method": helpers.testNpmLevels(winston, "should respond without an error", function (err) { - assert.isNull(err); - }), - "the extend() method called on an empty object": { - topic: function (logger) { - var empty = {}; - winston.extend(empty); - return empty; - }, - "should define the appropriate methods": function (extended) { - ['log', 'profile', 'startTimer'].concat(Object.keys(winston.config.npm.levels)).forEach(function (method) { - assert.isFunction(extended[method]); - }); - } - } - } -}).addBatch({ - "The winston module": { - "the setLevels() method": { - topic: function () { - winston.setLevels(winston.config.syslog.levels); - return null; - }, - "should have the proper methods defined": function () { - assert.isObject(winston.transports); - assert.isFunction(winston.transports.Console); - assert.isFunction(winston.transports.Loggly); - assert.isFunction(winston.transports.Webhook); - assert.isObject(winston.default.transports.console); - assert.isFalse(winston.emitErrs); - assert.isObject(winston.config); - - var newLevels = Object.keys(winston.config.syslog.levels); - ['Logger', 'add', 'remove', 'extend'] - .concat(newLevels) - .forEach(function (key) { - assert.isFunction(winston[key]); - }); - - - Object.keys(winston.config.npm.levels) - .filter(function (key) { - return newLevels.indexOf(key) === -1; - }) - .forEach(function (key) { - assert.isTrue(typeof winston[key] === 'undefined'); - }); - } - } - } -}).export(module); diff --git a/node_modules/flatiron/node_modules/prompt/package.json b/node_modules/flatiron/node_modules/prompt/package.json deleted file mode 100644 index 3ae0f85..0000000 --- a/node_modules/flatiron/node_modules/prompt/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "prompt", - "description": "A beautiful command-line prompt for node.js", - "version": "0.1.12", - "author": { - "name": "Nodejitsu Inc.", - "email": "info@nodejitsu.com" - }, - "contributors": [ - { - "name": "Charlie Robbins", - "email": "charlie@nodejitsu.com" - }, - { - "name": "Joshua Holbrook", - "email": "josh.holbrook@gmail.com" - }, - { - "name": "Bradley Meck", - "email": "bradley.meck@gmail.com" - }, - { - "name": "Maciej Malecki", - "email": "maciej@nodejitsu.com" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/flatiron/prompt.git" - }, - "dependencies": { - "async": "0.1.x", - "colors": "0.x.x", - "pkginfo": "0.x.x", - "winston": "0.5.x" - }, - "devDependencies": { - "vows": "0.6.x" - }, - "main": "./lib/prompt", - "scripts": { - "test": "vows test/prompt-test.js --spec", - "test-all": "vows --spec" - }, - "engines": { - "node": ">= 0.4.0" - }, - "_id": "prompt@0.1.12", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "prompt@0.1.12" -} diff --git a/node_modules/flatiron/node_modules/prompt/test/helpers.js b/node_modules/flatiron/node_modules/prompt/test/helpers.js deleted file mode 100644 index ff9f233..0000000 --- a/node_modules/flatiron/node_modules/prompt/test/helpers.js +++ /dev/null @@ -1,102 +0,0 @@ -/* - * helpers.js: Test helpers for the prompt tests. - * - * (C) 2010, Nodejitsu Inc. - * - */ - -var events = require('events'), - stream = require('stream'), - util = require('util'), - prompt = require('../lib/prompt'); - -var helpers = exports; - -var MockReadWriteStream = helpers.MockReadWriteStream = function () { - // - // No need to do anything here, it's just a mock. - // -}; - -util.inherits(MockReadWriteStream, events.EventEmitter); - -['resume', 'pause', 'setEncoding', 'flush'].forEach(function (method) { - MockReadWriteStream.prototype[method] = function () { /* Mock */ }; -}); - -MockReadWriteStream.prototype.write = function (msg) { - this.emit('data', msg); -}; - -// -// Create some mock streams for asserting against -// in our prompt tests. -// -helpers.stdin = new MockReadWriteStream(); -helpers.stdout = new MockReadWriteStream(); -helpers.stderr = new MockReadWriteStream(); - -// -// Monkey punch `util.error` to silence console output -// and redirect to helpers.stderr for testing. -// -util.error = function () { - helpers.stderr.write.apply(helpers.stderr, arguments); -} - -helpers.properties = { - riffwabbles: { - name: 'riffwabbles', - validator: /^[\w|\-]+$/, - warning: 'riffwabbles can only be letters, numbers, and dashes', - default: 'foobizzles' - }, - username: { - name: 'username', - validator: /^[\w|\-]+$/, - warning: 'Username can only be letters, numbers, and dashes' - }, - notblank: { - name: 'notblank', - empty: false - }, - password: { - name: 'password', - hidden: true, - empty: false - }, - badValidator: { - name: 'bad-validator', - validator: ['cant', 'use', 'array'] - }, - animal: { - name: 'animal', - description: 'Enter an animal', - default: 'dog', - validator: /dog|cat/ - }, - sound: { - name: 'sound', - description: 'What sound does this animal make?', - validator: function (value) { - var animal = prompt.history(0).value; - - return animal === 'dog' && value === 'woof' - || animal === 'cat' && value === 'meow'; - } - }, - fnvalidator: { - name: 'fnvalidator', - validator: function (line) { - return line.slice(0,2) == 'fn'; - }, - warning: 'fnvalidator must start with "fn"' - }, - cbvalidator: { - name: 'cbvalidator', - validator: function (line, next) { - next(line.slice(0,2) == 'cb'); - }, - warning: 'cbvalidator must start with "cb"' - } -}; diff --git a/node_modules/flatiron/node_modules/prompt/test/interactive-prompt-test.js b/node_modules/flatiron/node_modules/prompt/test/interactive-prompt-test.js deleted file mode 100644 index 75ccc0c..0000000 --- a/node_modules/flatiron/node_modules/prompt/test/interactive-prompt-test.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * prompt-test.js: Tests for prompt. - * - * (C) 2010, Nodejitsu Inc. - * - */ - -var assert = require('assert'), - vows = require('vows'), - prompt = require('../lib/prompt'), - winston = require('winston').cli(), - helpers = require('./helpers'); - -vows.describe('prompt/interactive').addBatch({ - "When using prompt": { - topic: function () { - // - // Reset the prompt for interactive testing - // - prompt.started = false; - prompt.start(); - winston.info('These prompt tests are interactive'); - winston.info('Not following instructions will result in test failure'); - return null; - }, - "the getInput() method": { - "when passed a complex property with `hidden: true`": { - topic: function () { - winston.info('When prompted, enter: 12345 [backspace] [backspace] [enter]'); - prompt.getInput(helpers.properties.password, this.callback); - }, - "should respond with `123`": function (err, result) { - assert.isNull(err); - assert.equal(result, '123'); - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/flatiron/node_modules/prompt/test/prompt-test.js b/node_modules/flatiron/node_modules/prompt/test/prompt-test.js deleted file mode 100644 index 096f6ba..0000000 --- a/node_modules/flatiron/node_modules/prompt/test/prompt-test.js +++ /dev/null @@ -1,390 +0,0 @@ -/* - * prompt-test.js: Tests for prompt. - * - * (C) 2010, Nodejitsu Inc. - * - */ - -var assert = require('assert'), - vows = require('vows'), - prompt = require('../lib/prompt'), - helpers = require('./helpers'); - -vows.describe('prompt').addBatch({ - "When using prompt": { - topic: function () { - // - // Reset the prompt for mock testing - // - prompt.started = false; - prompt.start({ - stdin: helpers.stdin, - stdout: helpers.stdout - }); - - return null; - }, - "the readLine() method": { - topic: function () { - prompt.readLine(this.callback); - helpers.stdin.write('testing\n'); - }, - "should respond with data from the stdin stream": function (err, input) { - assert.isNull(err); - assert.equal(input, 'testing'); - } - }, - "the readLineHidden() method": { - "when given backspaces": { - topic: function () { - prompt.readLineHidden(this.callback); - helpers.stdin.write('no-\x08backspace.\x7f'); - helpers.stdin.write('\n'); - }, - "should remove the proper characters": function (err,input) { - assert.isNull(err); - assert.equal(input, 'nobackspace'); - } - }, - topic: function () { - prompt.readLineHidden(this.callback); - helpers.stdin.write('testing'); - helpers.stdin.write('\r\n'); - }, - "should respond with data from the stdin stream": function (err, input) { - assert.isNull(err); - assert.equal(input, 'testing'); - } - }, - "the getInput() method": { - "with a simple string prompt": { - topic: function () { - var that = this; - helpers.stdout.once('data', function (msg) { - that.msg = msg; - }) - - prompt.getInput('test input', this.callback); - helpers.stdin.write('test value\n'); - }, - "should prompt to stdout and respond with data": function (err, input) { - assert.isNull(err); - assert.equal(input, 'test value'); - assert.isTrue(this.msg.indexOf('test input') !== -1); - } - }, - "with any field that is not supposed to be empty": { - "and we don't provide any input": { - topic: function () { - var that = this; - helpers.stdout.once('data', function (msg) { - that.msg = msg; - }); - - helpers.stderr.once('data', function (msg) { - that.errmsg = msg; - }); - - prompt.getInput(helpers.properties.notblank, function () {}); - prompt.once('invalid', this.callback.bind(null, null)) - helpers.stdin.write('\n'); - }, - - "should prompt with an error": function (ign, prop, input) { - assert.isObject(prop); - assert.equal(input, ''); - assert.isTrue(this.errmsg.indexOf('Invalid input') !== -1); - assert.isTrue(this.msg.indexOf('notblank') !== -1); - } - } - }, - "with a hidden field that is not supposed to be empty": { - "and we provide valid input": { - topic: function () { - var that = this; - helpers.stdout.once('data', function (msg) { - that.msg = msg; - }); - - prompt.getInput('password', this.callback); - helpers.stdin.write('trustno1\n'); - }, - - "should prompt to stdout and respond with data": function (err, input) { - assert.isNull(err); - assert.equal(input, 'trustno1'); - assert.isTrue(this.msg.indexOf('password') !== -1); - } - }, - "and we don't provide an input": { - topic: function () { - var that = this; - helpers.stdout.once('data', function (msg) { - that.msg = msg; - }); - - helpers.stderr.once('data', function (msg) { - that.errmsg = msg; - }); - - prompt.getInput(helpers.properties.password, function () {}); - prompt.once('invalid', this.callback.bind(null, null)) - helpers.stdin.write('\n'); - }, - "should prompt with an error": function (ign, prop, input) { - assert.isObject(prop); - assert.equal(input, ''); - assert.isTrue(this.errmsg.indexOf('Invalid input') !== -1); - assert.isTrue(this.msg.indexOf('password') !== -1); - } - } - }, - "with a complex property prompt": { - "and a valid input": { - topic: function () { - var that = this; - helpers.stdout.once('data', function (msg) { - that.msg = msg; - }); - - prompt.getInput(helpers.properties.username, this.callback); - helpers.stdin.write('some-user\n'); - }, - "should prompt to stdout and respond with data": function (err, input) { - assert.isNull(err); - assert.equal(input, 'some-user'); - assert.isTrue(this.msg.indexOf('username') !== -1); - } - }, - "and an invalid input": { - topic: function () { - var that = this; - helpers.stdout.once('data', function (msg) { - that.msg = msg; - }); - - helpers.stderr.once('data', function (msg) { - that.errmsg = msg; - }) - - prompt.getInput(helpers.properties.username, this.callback); - - prompt.once('invalid', function () { - prompt.once('prompt', function () { - process.nextTick(function () { - helpers.stdin.write('some-user\n'); - }) - }) - }); - - helpers.stdin.write('some -user\n'); - }, - "should prompt with an error before completing the operation": function (err, input) { - assert.isNull(err); - assert.equal(input, 'some-user'); - assert.isTrue(this.errmsg.indexOf('Invalid input') !== -1); - assert.isTrue(this.msg.indexOf('username') !== -1); - } - }, - "with an invalid validator (array)": { - topic: function () { - prompt.getInput(helpers.properties.badValidator, this.callback); - }, - "should respond with an error": function (err, ign) { - assert.isTrue(!!err); - } - } - } - }, - "the get() method": { - "with a simple string prompt": { - "that is not a property in prompt.properties": { - topic: function () { - var that = this; - helpers.stdout.once('data', function (msg) { - that.msg = msg; - }) - - prompt.get('test input', this.callback); - helpers.stdin.write('test value\n'); - }, - "should prompt to stdout and respond with the value": function (err, result) { - assert.isNull(err); - assert.include(result, 'test input'); - assert.equal(result['test input'], 'test value'); - assert.isTrue(this.msg.indexOf('test input') !== -1); - } - }, - "that is a property name in prompt.properties": { - "with a default value": { - topic: function () { - var that = this; - - helpers.stdout.once('data', function (msg) { - that.msg = msg; - }); - - prompt.properties['riffwabbles'] = helpers.properties['riffwabbles']; - prompt.get('riffwabbles', this.callback); - helpers.stdin.write('\n'); - }, - "should prompt to stdout and respond with the default value": function (err, result) { - assert.isNull(err); - assert.isTrue(this.msg.indexOf('riffwabbles') !== -1); - assert.isTrue(this.msg.indexOf('(foobizzles)') !== -1); - assert.include(result, 'riffwabbles'); - assert.equal(result['riffwabbles'], helpers.properties['riffwabbles'].default); - } - }, - "with a sync function validator": { - topic: function () { - var that = this; - - helpers.stdout.once('data', function (msg) { - that.msg = msg; - }); - - prompt.get(helpers.properties.fnvalidator, this.callback); - helpers.stdin.write('fn123\n'); - }, - "should accept a value that is checked": function (err, result) { - assert.isNull(err); - assert.equal(result['fnvalidator'],'fn123'); - } - }, - "with a callback validator": { - topic: function () { - var that = this; - - helpers.stdout.once('data', function (msg) { - that.msg = msg; - }); - - prompt.get(helpers.properties.cbvalidator, this.callback); - helpers.stdin.write('cb123\n'); - }, - "should not accept a value that is correct": function (err, result) { - assert.isNull(err); - assert.equal(result['cbvalidator'],'cb123'); - } - } - } - }, - "skip prompt with prompt.overide": { - topic: function () { - prompt.override = { coconihet: 'whatever' } - prompt.get('coconihet', this.callback); - }, - "skips prompt and uses overide": function (err, results) { - assert.equal(results.coconihet, 'whatever') - } - } - }, - "the addProperties() method": { - topic: function () { - prompt.addProperties({}, ['foo', 'bar'], this.callback); - helpers.stdin.write('foo\n'); - helpers.stdin.write('bar\n'); - }, - "should add the properties to the object": function (err, obj) { - assert.isNull(err); - assert.isObject(obj); - assert.equal(obj.foo, 'foo'); - assert.equal(obj.bar, 'bar'); - } - } - } -}).addBatch({ - "When using prompt": { - "the history() method": { - "when used inside of a complex property": { - "with correct value(s)": { - topic: function () { - prompt.get([helpers.properties.animal, helpers.properties.sound], this.callback); - helpers.stdin.write('dog\n'); - helpers.stdin.write('woof\n'); - }, - "should respond with the values entered": function (err, result) { - assert.isTrue(!err); - assert.equal(result.animal, 'dog'); - assert.equal(result.sound, 'woof'); - } - }, - "with an incorrect value": { - topic: function () { - prompt.get([helpers.properties.animal, helpers.properties.sound], function () {}); - prompt.once('invalid', this.callback.bind(null, null)); - helpers.stdin.write('dog\n'); - helpers.stdin.write('meow\n'); - }, - "should prompt for the error": function (ign, property, line) { - assert.equal(property.name, 'sound'); - assert.equal(line, 'meow'); - } - } - } - } - } -}).addBatch({ - "when using prompt": { - topic: function () { - // - // Reset the prompt for mock testing - // - prompt.started = false; - prompt.start({ - stdin: helpers.stdin, - stdout: helpers.stdout - }); - - return null; - }, - "the get() method": { - topic: function () { - prompt.override = { xyz: 468, abc: 123 } - prompt.get(['xyz', 'abc'], this.callback); - }, - "should respond with overrides": function (err, results) { - assert.isNull(err); - assert.deepEqual(results, { xyz: 468, abc: 123 }); - } - } - } -}).addBatch({ - "when using prompt": { - topic: function () { - // - // Reset the prompt for mock testing - // - prompt.started = false; - prompt.start({ - stdin: helpers.stdin, - stdout: helpers.stdout - }); - - return null; - }, - "with fancy properties": { - "the get() method": { - topic: function () { - prompt.override = { UVW: 5423, DEF: 64235 } - prompt.get([{ - name:'UVW', - message: 'a custom message', - default: 6 - },{ - name:'DEF', - message: 'a custom message', - default: 6 - }], this.callback); - }, - "should respond with overrides": function (err, results) { - assert.isNull(err); - assert.deepEqual(results, { UVW: 5423, DEF: 64235 }); - } - } - } - } -}).export(module); - - diff --git a/node_modules/flatiron/package.json b/node_modules/flatiron/package.json deleted file mode 100644 index 46158e9..0000000 --- a/node_modules/flatiron/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "flatiron", - "description": "An elegant blend of convention and configuration for building apps in Node.js and the browser", - "version": "0.1.16", - "author": { - "name": "Nodejitsu Inc", - "email": "info@nodejitsu.com" - }, - "contributors": [ - { - "name": "Charlie Robbins", - "email": "charlie@nodejitsu.com" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/flatiron/flatiron.git" - }, - "dependencies": { - "broadway": "0.1.14", - "optimist": "0.3.1", - "prompt": "0.1.12", - "director": "1.0.9-1", - "pkginfo": "0.2.3" - }, - "devDependencies": { - "vows": "0.6.2" - }, - "main": "./lib/flatiron", - "bin": { - "flatiron": "./bin/flatiron" - }, - "scripts": { - "test": "vows --spec --isolate" - }, - "engines": { - "node": ">= 0.4.0" - }, - "_id": "flatiron@0.1.16", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "dist": { - "shasum": "92851c9d61295feebbde1dbd937857b2b8683fa7" - }, - "_from": "flatiron@0.1.16" -} diff --git a/node_modules/flatiron/scaffolds/cli/app.js b/node_modules/flatiron/scaffolds/cli/app.js deleted file mode 100644 index 4382a79..0000000 --- a/node_modules/flatiron/scaffolds/cli/app.js +++ /dev/null @@ -1,12 +0,0 @@ -var flatiron = require('flatiron'), - path = require('path'), - app = flatiron.app; - -app.config.file({ file: path.join(__dirname, 'config', 'config.json') }); - -app.use(flatiron.plugins.cli, { - source: path.join(__dirname, 'lib', 'commands'), - usage: 'Empty Flatiron Application, please fill out commands' -}); - -app.start(); diff --git a/node_modules/flatiron/scaffolds/cli/directories.json b/node_modules/flatiron/scaffolds/cli/directories.json deleted file mode 100644 index 8eaa3f5..0000000 --- a/node_modules/flatiron/scaffolds/cli/directories.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "config": "#ROOT/config", - "lib": "#ROOT/lib", - "commands": "#ROOT/lib/commands", - "test": "#ROOT/test" -} \ No newline at end of file diff --git a/node_modules/flatiron/scaffolds/cli/package.json b/node_modules/flatiron/scaffolds/cli/package.json deleted file mode 100644 index 7a30992..0000000 --- a/node_modules/flatiron/scaffolds/cli/package.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "description": "A Flatiron CLI application", - "version": "0.0.0", - "private": true, - "dependencies": { - }, - "devDependencies": { - "cli-easy": "0.1.0", - "vows": "0.6.1" - }, - "scripts": { - "test": "vows --spec", - "start": "node app.js" - } -} \ No newline at end of file diff --git a/node_modules/flatiron/scaffolds/http/app.js b/node_modules/flatiron/scaffolds/http/app.js deleted file mode 100644 index 80e0f74..0000000 --- a/node_modules/flatiron/scaffolds/http/app.js +++ /dev/null @@ -1,13 +0,0 @@ -var flatiron = require('flatiron'), - path = require('path'), - app = flatiron.app; - -app.config.file({ file: path.join(__dirname, 'config', 'config.json') }); - -app.use(flatiron.plugins.http); - -app.router.get('/', function () { - this.res.json({ 'hello': 'world' }) -}); - -app.start(3000); diff --git a/node_modules/flatiron/scaffolds/http/directories.json b/node_modules/flatiron/scaffolds/http/directories.json deleted file mode 100644 index 51815a7..0000000 --- a/node_modules/flatiron/scaffolds/http/directories.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "config": "#ROOT/config", - "lib": "#ROOT/lib", - "test": "#ROOT/test" -} \ No newline at end of file diff --git a/node_modules/flatiron/scaffolds/http/package.json b/node_modules/flatiron/scaffolds/http/package.json deleted file mode 100644 index 47915c3..0000000 --- a/node_modules/flatiron/scaffolds/http/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "description": "A Flatiron HTTP application", - "version": "0.0.0", - "private": true, - "dependencies": { - "union": "0.1.7" - }, - "devDependencies": { - "api-easy": "0.3.2", - "vows": "0.6.1" - }, - "scripts": { - "test": "vows --spec", - "start": "node app.js" - } -} \ No newline at end of file diff --git a/node_modules/flatiron/test/fixtures/sample-app/app/new-york/controller.js b/node_modules/flatiron/test/fixtures/sample-app/app/new-york/controller.js deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/flatiron/test/fixtures/sample-app/app/new-york/index.js b/node_modules/flatiron/test/fixtures/sample-app/app/new-york/index.js deleted file mode 100644 index e479918..0000000 --- a/node_modules/flatiron/test/fixtures/sample-app/app/new-york/index.js +++ /dev/null @@ -1,20 +0,0 @@ - -var app = require('../../../../../flatiron').app; - -app.log.info('somethign'); - -app.get('/blah', function () { - this.req; - this.res; - this.emit('next'); -}); - -app.sockets(function () { - this.on(['foo' 'bar'], function (socket) { - - }) -}); - -(function (app, options, done) { - app.get() -})(); \ No newline at end of file diff --git a/node_modules/flatiron/test/fixtures/sample-app/app/new-york/new-york.js b/node_modules/flatiron/test/fixtures/sample-app/app/new-york/new-york.js deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/flatiron/test/flatiron-test.js b/node_modules/flatiron/test/flatiron-test.js deleted file mode 100644 index 2bf8ceb..0000000 --- a/node_modules/flatiron/test/flatiron-test.js +++ /dev/null @@ -1,18 +0,0 @@ -var assert = require('assert'), - vows = require('vows'), - broadway = require('broadway'), - flatiron = require('../'); - -vows.describe('flatiron').addBatch({ - 'When using `flatiron`': { - '`flatiron.plugins`': { - topic: flatiron.plugins, - 'should contain all `broadway.plugins`': function (plugins) { - Object.keys(broadway.plugins).forEach(function (key) { - assert.include(plugins, key); - }); - } - } - } -}).export(module); - diff --git a/node_modules/resourceful/.npmignore b/node_modules/resourceful/.npmignore deleted file mode 100644 index 5171c54..0000000 --- a/node_modules/resourceful/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -npm-debug.log \ No newline at end of file diff --git a/node_modules/resourceful/.travis.yml b/node_modules/resourceful/.travis.yml deleted file mode 100644 index 4d5be77..0000000 --- a/node_modules/resourceful/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -language: node_js -node_js: - - 0.6 - - 0.7 - -notifications: - email: - - travis@nodejitsu.com - irc: "irc.freenode.org#nodejitsu" - diff --git a/node_modules/resourceful/LICENSE b/node_modules/resourceful/LICENSE deleted file mode 100644 index a83d179..0000000 --- a/node_modules/resourceful/LICENSE +++ /dev/null @@ -1,179 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -Copyright (c) 2009-2010 Alexis Sellier, Charlie Robbins, Nodejitsu Inc. diff --git a/node_modules/resourceful/README.md b/node_modules/resourceful/README.md deleted file mode 100644 index cc5450a..0000000 --- a/node_modules/resourceful/README.md +++ /dev/null @@ -1,671 +0,0 @@ - - - -# Synopsis -A storage agnostic resource-oriented ODM for building prototypical models with validation and sanitization. - -# Motivation -How often have you found yourself writing Model code in your application? Pretty often? Good! Unlike other "Object-Document Mappers" `resourceful` tries to only focus on two things: - - - A simple API for defining custom Model prototypes with validation. No sugar is required to instantiate prototypes defined by resourceful. - - - Define an extensibility model for databases to provide CRUD functionality to Models along with custom query, filtering or updating specific to that specific implementation (Mongo, CouchDB, Redis, etc). - -# Status - -[![Build Status](https://secure.travis-ci.org/flatiron/resourceful.png)](http://travis-ci.org/flatiron/resourceful) - -# Features -* Data Validation -* Simplified Data Model Management -* [Storage Engine Extensible](#engines) -* [Simplified Cache Control](#cache) - -# Installation - -``` bash -$ [sudo] npm install resourceful -``` - -# Usage - -## Simple case - -``` js -var resourceful = require('resourceful'); - -var Creature = resourceful.define('creature', function () { - // - // Specify a storage engine - // - this.use('couchdb'); - - // - // Specify some properties with validation - // - this.string('diet'); - this.bool('vertebrate'); - this.array('belly'); - - // - // Specify timestamp properties - // - this.timestamps(); -}); - -// -// Now that the `Creature` prototype is defined -// we can add custom logic to be available on all instances -// -Creature.prototype.feed = function (food) { - this.belly.push(food); -}; -``` - -## Defining resources -Here's the simplest of resources: - -``` js -var Creature = resourceful.define('creature'); -``` - -The returned `Creature` object is a *resource constructor*, in other words, a *function*. Now let's add some properties to this constructor: - -``` js -Creature.string('diet'); -Creature.bool('vertebrate'); -Creature.array('belly'); -Creature.object('children'); - -// Are equivalent to -Creature.property('diet'); // Defaults to String -Creature.property('vertebrate', Boolean); -Creature.property('belly', Array); -Creature.property('children', Object); -``` - -And add a method to the prototype: - -``` js -Creature.prototype.feed = function (food) { - this.belly.push(food); -}; -``` - -Now lets instantiate a Creature, and feed it: - -``` js -var wolf = new(Creature)({ - diet: 'carnivore', - vertebrate: true -}); - -wolf.feed('squirrel'); -console.dir(wolf.belly); -``` - -You can also define resources this way: - -``` js -var Creature = resourceful.define('creature', function () { - this.string('diet'); - this.bool('vertebrate'); - this.array('belly'); - - this.prototype.feed = function (food) { - this.belly.push(food); - }; -}); -``` - -## Defining properties with Resource.property -Lets define a *legs* property, which is the number of legs the creature has: - -``` js -Creature.number('legs'); -``` - -Note that this form is equivalent: - -``` js -Creature.property('legs', Number); -/* or */ -Creature.property('legs', 'number'); -``` - -If we wanted to constrain the possible values the property could take, we could pass in an object as the last parameter: - -``` js -Creature.number('legs', { - required: true, - - minimum: 0, - maximum: 8, - - assert: function (val) { - return val % 2 === 0; - } -}); -``` - -Now resourceful won't let `Creature` instances be saved unless the *legs* property has a value between `0` and `8`, and is *even*, - -This style is also valid for defining properties: - -``` js -Creature.number('legs') - .required() - .minimum(0) - .maximum(8) - .assert(function (val) { return val % 2 === 0 }); -``` - -If we want to access and modify an already defined property, we can do it this way: - -``` js -Creature.schema.properties['legs'].maximum(6); -``` - - -## Engines (saving and fetching resources) -By default, resourceful uses an in-memory engine. If we would like our resources to be persistent, we must use another engine, for example CouchDB. - -Engines are used for exposing different storage backends to resourceful. Resourceful currently has two bundled engines: - -* couchdb -* memory - -Engines can be specified when defining a resource with `this.use`: - -```js -var Creature = resource.define('creature', function () { - - this.use('couchdb', { - uri: 'http://example.jesusabdullah.net' - }); - - /* - - // - // alternately - // - this.use('memory'); - - // - // or, supposing `Engine` is defined as a resourceful engine: - // - this.use(Engine, { - 'uri': 'file:///tmp/datastore' - }); - - */ - -}); -``` - -## Using the CouchDB engine -First, one must create a CouchDB database for resourceful to use. One way to do this is to use Futon, located by default at [http://localhost:5984/_utils/](http://localhost:5984/_utils/). In this example, we name the database **myResourcefulDB**. - -Next, let resourceful know to use use this particular CouchDB database. - -``` js -var resourceful = require('resourceful'); - -resourceful.use('couchdb', {database: 'myResourcefulDB'}); -``` - -## Saving and fetching resources (engine agnostic) -Assuming we have already defined a ''Wolf'' resource with name, age, and fur properties, we can fetch and save wolf resources like this: - -``` js -Wolf.create({ name: 'Wolverine', age: 68 }, function (err, wolf) { - if (err) { throw new(Error)(err) } - - console.log(wolf); // { _id: 42, resource: 'wolf', name: 'Wolverine', age: 68 } - - wolf.age++; - wolf.save(function (err) { - if (!err) { - console.log('happy birthday ' + wolf.name + '!'); - } - }); -}); - -Wolf.get(42, function (err, wolf) { - if (err) { throw new(Error)(err) } - - wolf.update({ fur: 'curly' }, function (e, wolf) { - console.log(wolf.fur); // "curly" - }); -}); -``` - - -## Engine caching -Resourceful comes with a helper for managing an in-memory cache of your documents. This helps increase the speed of resourceful by avoiding extraneous interactions with the back-end. - -Unlike engines, caches have a completely synchronous API. This is acceptable since the calls are short and usually occur inside an asynchronously-executing procedure. - -## History -Resourceful's first engine was the couchdb engine, which was built using cradle. As such, the design of resourceful's engines is somewhat inferred from the design of couchdb itself. In particular, engine prototypes are often named and designed after http verbs, status reporting follows http status code conventions, and engines can be designed around stored views. - -That said: The memory engine, as it needs to do much less, can be considered to have the most minimal api possible for an engine, with a few exceptions. - -Both pieces of code are more-or-less self-documenting. - -# API - -## Resource Constructor -These methods are available on all user-defined resource constructors, as well as on the default `resourceful.Resource` constructor. - -* `Resource.get(id, [callback])`: Fetch a resource by *id*. -* `Resource.update(id, properties, [callback])`: Update a resource with properties. -* `Resource.destroy(id, [callback])`: Destroy a resource by *id*. -* `Resource.all([callback])`: Fetches all resources of this type. -* `Resource.find(properties, [callback])`: Find all resources of this type which satisfy `obj` conditions -* `Resource.save(inst, [callback])`: Saves the specified resource instance `inst` by overwriting all properties. -* `Resource.create(properties, [callback])`: Creates a new instance of the Resource with the specified `properties` -* `Resource.new(properties)`: Instantiates a new instance of the Resource with the `properties` - -## Resource Instance Methods - -* `Resource.prototype.save([callback])` -* `Resource.prototype.update(properties, [callback])` -* `Resource.prototype.destroy([callback])` -* `Resource.prototype.reload([callback])` - -## Engine Constructor -In general, it is safe to attach instance methods to your new engine. For example, `memory.js` keeps a counter (called `this.counter`) for creating new documents without a specified name. - -```js -var engine = new Engine({ - uri: 'protocol://path/to/database' -}); -``` - -At a minimum, the constructor should: - -### Interpret the 'uri' argument -The 'uri' argument should be treated as a unique ID to your particular data store. For example, this is a couchdb uri for the couchdb store. - -In most cases the uri argument will correspond to a database url, but that's not always true. In the case of "memory", it's simply a legal javascript object property name. - -### Initialize a store -A constructed engine should, in some way or another, initialize a connection to its data store. For couchdb, this means opening a new connection object with cradle and attaching it as `this.connection`. However, this isn't a good fit for all cases; the memory store, for example, simply creates a new property to a "stores" object if `stores["storeName"]` doesn't exist. - -## Engine Instance Members - -### protocol -Resourceful will parse out the "couchdb" from the protocol and attempt to use an included resource with that string as its `resource.protocol`. - -For third-party engines this may not seem critical but it's good practice to include anyway, for the purposes of inspection if nothing else. - -```js -Engine.prototype.protocol = 'file'; -``` - -The protocol method sets the protocol member is used by resourceful to add syntactic sugar such that you may do: - -```js -Resource.connect('couchdb://example.nodejitsu.com'); -``` - -## Engine Instance Methods -Resourceful allows flexibility in some prototype methods, but not in others. Authors are encouraged to add prototype methods that feel natural to expose; for instance, the couchdb engine exposes `this.prototype.head` for sending http HEAD requests. - -### request() -Unlike some of the other prototype methods, `request` does not have to follow any particular contract, as it's used by your engine internally to encapsulate an asynchronous request to your particular datastore. - -```js -this.request(function () { - - var update = key in this.store; - this.store[key] = val; - callback(null, resourceful.mixin({ status: update ? 200 : 201 }, val)); -}); -``` - -In the case of the memory datastore, this simply involves a process.nextTick helper: - -```js -Memory.prototype.request = function (fn) { - - var self = this; - - process.nextTick(function () { - fn.call(self); - }); -}; -``` - -In the couchdb engine, requests look more like: - -``` -this.request('post', doc, function (e, res) { - - if (e) { - return callback(e); - } - - res.status = 201; - callback(null, resourceful.mixin({}, doc, res)); -}); -``` - -An engine should expose the request interface that feels most natural given the transport. However, there are some conventions to follow: - -1. `this.request` should be asynchronous. -2. The callback should set 'this' to be the same context as outside the callback - -### save() -Because the engines api was written with couchdb in mind, 'doc' should include an appropriate http status under `doc.status`. - -`save` can be implemented using a combination of 'head', 'put' and 'post', as in the case of the couchdb engine. However, in the memory engine case `put` is an alias to `save` and `update` is implemented separately. See below: **head**, **put** and **update**. The following pattern should be followed across all engines: - -```js -engine.save('key', value, function (err, doc) { - - if (err) { - throw err; - } - - if (doc.status == 201) { - // Will be 201 instead of 200 if the document is created instead of modified - console.log('New document created!'); - } - - console.log(doc); -}); -``` - -### put() -`put` is typically used to represent operations that update or modify the database without creating new resources. However, it is acceptable to alias the 'save' method and allow for the creation of new resources. - -Because the engines api was written with couchdb in mind, 'doc' should include an appropriate http status under `doc.status`. The expected status is '201'. See below: **post**. This pattern should be followed across all engines: - -```js -engine.put('key', value, function (err, doc) { - - if (err) { - throw err; - } - - if (doc.status === 201) { - console.log('Document updated!'); - } - else { - throw new Error('Document did not update.'); - } - - console.log(doc); -}); -``` - -### post() -### create() -This pattern should be followed across all engines for implementations of these methods. However, they are *optional*. The memory engine defines `Engine.prototype.load` instead. For instance: - -```js -engine.create('key', value, function (err, doc) { - - if (err) { - throw err; - } - - if (doc.status === 201) { - console.log('Document updated!'); - } - else { - throw new Error('Status: '+doc.status); - } - - console.log(doc); -}); -``` - -`post` is typically used to represent operations that create new resources without modifying or updating existing ones. `create` should be implemented as an alias for `post`. - -Because the engines api was written with couchdb in mind, 'doc' should include an appropriate http status under `doc.status`. The expected status is '201'. - -### load() -This method is *optional* and is used to more or less replace the "create" and "post" methods along with "put" and "save". - -```js -// -// Example with the memory transport -// -var memory = new Memory(); - -memory.load([ { 'foo': 'bar' }, { 'bar': 'baz' }]); -``` - -In the above example, each object passed to memory.load is loaded as a new document. This approach is useful in cases where you already have a javascript representation of your store (as in the case of memory) and don't need to interact with a remote api as in the case of couchdb. - -### update() -`update` is used to modify existing resources by copying enumerable properties from the update object to the existing object (often called a "mixin" and implemented in javascript in `resourceful.mixin` and `utile.mixin`). Besides the mixin process (meaning your stored object won't lose existing properties), `update` is synonymous with `put`, and in fact uses `put` internally in the case of both the couchdb and memory engines. - -Because the engines api was written with couchdb in mind, 'doc' should include an appropriate http status under `doc.status`. The expected status is '201', as with `put`. This pattern should be followed across all engines: - -```js -engine.put('key', { 'foo': 'bar' }, function (err, doc) { - - if (err) { - throw err; - } - - if (doc.status === 201) { - console.log('Document updated!'); - } - else { - throw new Error('Document did not update.'); - } - - console.log(doc); // doc.foo should now be bar - -}); -``` - -### get() -This pattern should be followed across all engines: - -```js -engine.get('key', function (err, doc) { - - if (err) { - if (err.status === 404) { - console.log('Document was not there!'); - } - - throw err; - } - - console.log(doc); -}); -``` - -### destroy() -`destroy` is used to delete existing resources. - -Because the engines api was written with couchdb in mind, 'doc' should include an appropriate http status under `doc.status`. The expected status is '204', which stands for 'successfully deleted'. This pattern should be followed across all engines: - -```js -engine.get('key', function (err, doc) { - - if (err) { - throw err; - } - - // - // "status" should be the only property on `doc`. - // - if (doc.status !== 204) { - throw new Error('Status: '+doc.status); - } - - console.log('Successfully destroyed document.'); -}); -``` - -### find() -`find` is a shorthand for finding resources which in some cases can be implemented as a special case of `filter`, as with memory here: - -```js -Memory.prototype.find = function (conditions, callback) { - - this.filter(function (obj) { - return Object.keys(conditions).every(function (k) { - return conditions[k] === obj[k]; - }); - }, callback); -}; -``` - -This pattern should be followed across all engines: - -```js -engine.find({ 'foo': 'bar' }, function (err, docs) { - - if (err) { - throw err; - } - - // - // docs[0].foo === 'bar' - // - -}); -``` - -The couchdb version, however, uses special logic as couchdb uses temporary and stored views. - -``` - - IMPORTANT NOTE - -------------- - - `CouchDB.prototype.find` uses a temporary view. This is useful while testing but is slow and bad practice on a production couch. Please use `CouchDB.prototype.filter` instead. - -``` - -### filter() -The semantics of 'filter' vary slightly depending on the engine. The semantics of `filter()`, like those of `request()`, should reflect the particular idioms of the underlying transport. - -```js -// -// Example used with a Memory engine -// -engine.filter(filterfxn, function (err, docs) { - - if (err) { - throw err; - } - - // - // returned docs filtered by "filter" - // - -}); -``` - -The "memory" case simply applies a function against the store's documents. In contrast, the couchdb engine exposes an api for using stored mapreduce functions on the couch: - -```js -// -// Example used with a Couchdb engine -// -engine.filter("view", params, function (err, docs) { - - if (err) { - throw err; - } - - // - // returned docs filtered using the "view" mapreduce function on couch. - // - -}); -``` - -### sync() -`Engine.prototype.sync` is used to sync "design document" information with the database if necessary. This is specific to couchdb; for the 'memory' transport there is no conception of (or parallel to) a design document. - -```js -engine.sync(factory, function (err) { - - if (err) { - throw err; - } -}); -``` - -In the case where there is no doc or "stored procedures" of any kind to upload to the database, this step can be simplified to: - -```js -Engine.prototype.sync = function (factory, callback) { - - process.nextTick(function () { callback(); }); -}; -``` - -## Cache Constructor -This creates a new in-memory cache for your engine. The cache is automatically populated by resourceful. This means that you don't need to actually use the cache directly for many operations. In fact, the memory engine doesn't explicitly use resourceful.Cache at all. - -```js -var resourceful = require('resourceful'); - -var cache = new Cache(); -``` - -## Cache Instance Methods -`resourceful.Cache` has the following prototypes for interacting with the in-memory cache: - -* `Cache.prototype.get(id)`: Attempt to 'get' a cached document. -* `Cache.prototype.put(id, doc)`: Attempt to 'put' a document into the cache. -* `Cache.prototype.update(id, doc)`: Attempt to update a document in the cache. *This means that it will attempt to merge your old and new document instead of overwriting the old with the new!* -* `Cache.prototype.clear(id)`: Attempts to remove a document from the cache. Document 'overwriting' may be achieved with call to `.clear` followed by a call to `.put`. -* `Cache.prototype.has(id)`: Checks to see if a given document is in the cache or not. - -The couchdb engine explicity uses resourceful.Cache in two places, both in cases where fetching the document is prohibitive and can be avoided. The couchdb engine checks the cache for the object with which to merge new data before uploading: - -```js -Couchdb.prototype.update = function (id, doc, callback) { - - return this.cache.has(id) - ? this.put(id, resourceful.mixin({}, this.cache.get(id).toJSON(), doc), callback) - : this.request('merge', id, doc, callback); -}; -``` - -`object.toJSON` is a misnomer; Instead of returning json, `.toJSON()` returns a cloned object. This method is named as such because it's [detected and used by JSON.stringify](https://developer.mozilla.org/en/JSON#toJSON\(\)_method). - -The couchdb engine checks the cache for the object it wants to destroy: - -```js -if (this.cache.has(id)) { - - args.splice(1, -1, this.cache.get(id)._rev); - return this.request.apply(this, ['remove'].concat(args)); -} -``` - -In the above snippet (just a small part of the entire function), the couchdb engine uses the cache to get revision data without doing a GET. - -# Tests -All tests are written with [vows][0] and should be run with [npm][1]: - -```bash - $ npm test -``` - -[0]: http://vowsjs.org -[1]: http://npmjs.org - -# License -Copyright 2012 Nodejitsu, Inc. - -Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. - diff --git a/node_modules/resourceful/examples/creature-function.js b/node_modules/resourceful/examples/creature-function.js deleted file mode 100644 index 6d86f41..0000000 --- a/node_modules/resourceful/examples/creature-function.js +++ /dev/null @@ -1,22 +0,0 @@ -var resourceful = require('../lib/resourceful'); - -var Creature = resourceful.define('creature', function () { - this.string('diet'); - this.bool('vertebrate'); - this.array('belly'); - - this.timestamps(); - - this.prototype.feed = function (food) { - this.belly.push(food); - }; -}); - -var wolf = new(Creature)({ - diet: 'carnivore', - vertebrate: true -}); - -console.dir(wolf.belly); -wolf.feed('squirrel'); -console.dir(wolf.belly); diff --git a/node_modules/resourceful/examples/creature-inline.js b/node_modules/resourceful/examples/creature-inline.js deleted file mode 100644 index c877035..0000000 --- a/node_modules/resourceful/examples/creature-inline.js +++ /dev/null @@ -1,20 +0,0 @@ -var resourceful = require('../lib/resourceful'); - -var Creature = resourceful.define('creature'); - -Creature.string('diet'); -Creature.bool('vertebrate'); -Creature.array('belly'); - -Creature.prototype.feed = function (food) { - this.belly.push(food); -}; - -var wolf = new(Creature)({ - diet: 'carnivore', - vertebrate: true -}); - -console.dir(wolf.belly); -wolf.feed('squirrel'); -console.dir(wolf.belly); diff --git a/node_modules/resourceful/lib/browser.js b/node_modules/resourceful/lib/browser.js deleted file mode 100644 index ee4e7ed..0000000 --- a/node_modules/resourceful/lib/browser.js +++ /dev/null @@ -1,3 +0,0 @@ -window.resourceful = require('./resourceful'); - -require('./resourceful/engines/memory'); diff --git a/node_modules/resourceful/lib/resourceful.js b/node_modules/resourceful/lib/resourceful.js deleted file mode 100644 index 9a9ccc2..0000000 --- a/node_modules/resourceful/lib/resourceful.js +++ /dev/null @@ -1,27 +0,0 @@ -var resourceful = exports; - -resourceful.Cache = require('./resourceful/cache').Cache; -resourceful.cache = require('./resourceful/cache').cache; -resourceful.caches = require('./resourceful/cache').caches; - -resourceful.Resource = require('./resourceful/resource').Resource; -resourceful.define = require('./resourceful/core').define; -resourceful.defineProperty = require('./resourceful/core').defineProperty; -resourceful.init = require('./resourceful/init'); - -resourceful.use = require('./resourceful/core').use; -resourceful.connect = require('./resourceful/core').connect; -resourceful.typeOf = require('./resourceful/common').typeOf; -resourceful.connection = require('./resourceful/core').connection; -resourceful.mixin = require('./resourceful/common').mixin; -resourceful.clone = require('./resourceful/common').clone; -resourceful.resources = require('./resourceful/core').resources; -resourceful.register = require('./resourceful/core').register; -resourceful.unregister = require('./resourceful/core').unregister; -resourceful.engines = require('./resourceful/engines'); -resourceful.instantiate = require('./resourceful/core').instantiate; -resourceful.capitalize = require('./resourceful/common').capitalize; -resourceful.pluralize = require('./resourceful/common').pluralize; -resourceful.render = require('./resourceful/common').render; - -resourceful.resources.Resource = resourceful.define('resource'); diff --git a/node_modules/resourceful/lib/resourceful/cache.js b/node_modules/resourceful/lib/resourceful/cache.js deleted file mode 100644 index 426b887..0000000 --- a/node_modules/resourceful/lib/resourceful/cache.js +++ /dev/null @@ -1,67 +0,0 @@ -var resourceful = require('../resourceful'); - -exports.cache = true; -exports.caches = { - stores: [], - push: function (store) { - return this.stores.push(store); - }, - clear: function () { - this.stores.forEach(function (s) { s.clear(); }); - return this; - } -}; - -exports.Cache = function (options) { - this.size = 0; - this.store = {}; - - resourceful.caches.push(this); -}; - -exports.Cache.prototype.get = function (id) { - var that = this; - if (!resourceful.cache) return; - if (!id) { return; } - else if (Array.isArray(id)) { - return id.map(function (k) { - return that.store[k.toString()]; - }); - } - else { - return this.store[id.toString()]; - } -}; - -exports.Cache.prototype.put = function (id, obj) { - if (!resourceful.cache) return; - if (!this.has(id)) this.size++; - this.store[id] = obj; -}; - -exports.Cache.prototype.update = function (id, obj) { - if (!resourceful.cache) return; - if (id in this.store) { - for (var k in obj) { - try { this.store[id][k] = obj[k]; } - catch (ex) { } - } - } -}; - -exports.Cache.prototype.clear = function (id) { - if (!resourceful.cache) return; - if (id) { - this.size --; - delete(this.store[id]); - } - else { - this.size = 0; - this.store = {}; - } -}; - -exports.Cache.prototype.has = function (id) { - if (!resourceful.cache) return; - return id in this.store; -}; diff --git a/node_modules/resourceful/lib/resourceful/common.js b/node_modules/resourceful/lib/resourceful/common.js deleted file mode 100644 index 9c81a72..0000000 --- a/node_modules/resourceful/lib/resourceful/common.js +++ /dev/null @@ -1,76 +0,0 @@ -/* - * common.js: Common utility functions for resourceful. - * - * (C) 2011 Nodejitsu Inc. - * MIT LICENCE - * - */ - -var common = exports; - -common.mixin = function (target) { - var objs = Array.prototype.slice.call(arguments, 1); - objs.forEach(function (o) { - Object.keys(o).forEach(function (k) { - if (!o.__lookupGetter__(k)) { - target[k] = o[k]; - } - }); - }); - return target; -}; - -common.render = function (template, attributes) { - return ['map', 'reduce', 'rereduce'].reduce(function (view, f) { - if (template[f]) { - view[f] = Object.keys(attributes).reduce(function (str, k) { - var attribute = attributes[k]; - if (typeof(attribute) !== 'string') { - attribute = JSON.stringify(attribute); - } - - var re = new RegExp(('$' + k).replace(/([^\w\d])/g, '\\$1'), 'g'); - - return str.replace(re, attribute) - .replace(/"/g, "'"); - }, template[f].toString().replace(/\n/g, '').replace(/\s+/g, ' ')); - return view; - } else { - return view; - } - }, {}); -}; - -common.clone = function (object, filter) { - return Object.keys(object).reduce(filter ? function (obj, k) { - if (filter(k)) obj[k] = object[k]; - return obj; - } : function (obj, k) { - obj[k] = object[k]; - return obj; - }, {}); -}; - -common.typeOf = function (value) { - var derived = typeof(value); - - if (Array.isArray(value)) { - return 'array'; - } - else if (derived === 'object') { - return derived ? 'object' : 'null'; - } - else if (derived === 'function') { - return derived instanceof RegExp ? 'regexp' : 'function'; - } - - return derived; -}; - -common.capitalize = function (str) { - return str && str[0].toUpperCase() + str.slice(1); -}; - -common.pluralize = function (s) { - return /s$/.test(s) ? s : s + 's'; -}; diff --git a/node_modules/resourceful/lib/resourceful/core.js b/node_modules/resourceful/lib/resourceful/core.js deleted file mode 100644 index 21bd240..0000000 --- a/node_modules/resourceful/lib/resourceful/core.js +++ /dev/null @@ -1,252 +0,0 @@ -var events = require('events'), - common = require('./common'), - init = require('./init'); - -var resourceful = exports; - -resourceful.env = 'development'; -resourceful.autoMigrate = true; -resourceful.resources = {}; -resourceful.Resource = require('./resource').Resource; -resourceful.engines = require('./engines'); -resourceful.connection = new resourceful.engines.Memory(); - -// -// Select a storage engine -// -resourceful.use = function (engine, options) { - if (typeof(engine) === "string") { - engine = common.capitalize(engine); - - if (resourceful.engines[engine]) { - this.engine = resourceful.engines[engine]; - } - else { - throw new Error("unrecognised engine: " + engine); - } - } - else if (typeof engine === 'object') { - this.engine = engine; - } - else { - throw new Error("invalid engine "); - } - - this.connect(options || {}); - return this; -}; -// -// Connect to the resource's storage engine, or one specified by the URI protocol -// -resourceful.connect = function (/* [uri], [port], [options] */) { - var args = Array.prototype.slice.call(arguments), - options = {}, - protocol, - engine, - m; - - args.forEach(function (a) { - switch (typeof(a)) { - case 'number': options.port = parseInt(a, 10); break; - case 'string': options.uri = a; break; - case 'object': options = a; break; - } - }); - // Extract the optional 'protocol' - // ex: "couchdb://127.0.0.1" would have "database" as protocol. - if (m = options.uri && options.uri.match(/^([a-z]+):\/\//)) { - protocol = m[1]; - options.uri = options.uri.replace(protocol + '://', ''); - } - - if (protocol) { - engine = resourceful.engines[common.capitalize(protocol)]; - } - else { - engine = resourceful.engine || this.engine; - } - - this.connection = new(engine)(options); - - return this; -}; - -// -// Default Factory for creating new resources. -// -resourceful.define = function (name, definition) { - if ((typeof name === "function" || typeof name === 'object') && !definition) { - definition = name; - name = definition.name; - } - - if (name) { - name = common.capitalize(name); - } - else { - // Use the next available resource name - for (var i = 0; !name || (name in resourceful.resources); i++) { - name = 'Resource' + i; - } - } - - var Factory = function Factory (attrs) { - var self = this; - - resourceful.Resource.call(this); - - Object.defineProperty(this, '_properties', { - value: {}, - enumerable: false - }); - - Object.keys(Factory.properties).forEach(function (k) { - self._properties[k] = Factory.properties[k]['default']; - }); - - this._properties.resource = name; - - if (attrs) { - Object.keys(attrs).forEach(function (k) { - self._properties[k] = attrs[k]; - }); - } - - Object.keys(this._properties).forEach(function (k) { - resourceful.defineProperty(self, k, Factory.schema.properties[k]); - }); - }; - - // - // Setup inheritance - // - Factory.__proto__ = resourceful.Resource; - Factory.prototype.__proto__ = resourceful.Resource.prototype; - - // - // Setup intelligent defaults for various properties - // in the Resource Factory. - // - Factory.resource = name; - Factory.key = '_id'; - Factory.views = {}; - Factory._children = []; - Factory._parents = []; - - Factory.schema = { - name: name, - properties: { - _id: { type: 'string', unique: true } - }, - links: [] - }; - - Factory.hooks = { - before: {}, - after: {} - }; - - ['get', 'save', 'update', 'create', 'destroy'].forEach(function (m) { - Factory.hooks.before[m] = []; - Factory.hooks.after[m] = []; - }); - - Factory.emitter = new events.EventEmitter(); - - Object.keys(events.EventEmitter.prototype).forEach(function (k) { - Factory[k] = function () { - return Factory.emitter[k].apply(Factory.emitter, arguments); - }; - }); - - Factory.on('error', function () { - // - // TODO: Logging - // - }); - - if (typeof definition === 'object') { - // Use definition as schema - Factory.define(definition); - } else { - (definition || function () {}).call(Factory); - } - - Factory.init(); - - // Add this resource to the set of resources resourceful knows about - resourceful.register(name, Factory); - - return Factory; -}; - -resourceful.defineProperty = function (obj, property, schema) { - schema = schema || {}; - - // Call setter if needed - if (schema.set) { - obj.writeProperty(property, obj.readProperty(property), schema.set); - } - - // Sanitize defaults and per-creation properties - if (schema.sanitize) { - var val = obj.readProperty(property); - if (val !== undefined) { - obj.writeProperty(property, schema.sanitize(val)); - } - } - - Object.defineProperty(obj, property, { - get: function () { - return this.readProperty(property, schema.get); - }, - set: schema.sanitize ? function (val) { - return this.writeProperty(property, schema.sanitize(val), schema.set); - } : function (val) { - return this.writeProperty(property, val, schema.set); - }, - enumerable: true - }); - - if (typeof obj[property] === 'undefined') { - obj[property] = init(obj, property, schema); - } -}; - -// -// Adds the Factory to the set of known resources -// -resourceful.register = function (name, Factory) { - return this.resources[name] = Factory; -}; - -// -// Removes the name from the set of known resources; -// -resourceful.unregister = function (name) { - delete this.resources[name]; -}; - -resourceful.instantiate = function (obj) { - var instance, Factory, id; - - Factory = resourceful.resources[this.resource]; - - id = obj[this.key]; - - if (id && this.connection.cache.has(id)) { - obj = this.connection.cache.get(id); - } - - if (Factory) { - // Don't instantiate an already instantiated object - if (obj instanceof Factory) { return obj; } - else { - instance = new Factory(obj); - instance.isNewRecord = false; - return instance; - } - } else { - throw new Error("unrecognised resource '" + obj.resource + "'"); - } -}; diff --git a/node_modules/resourceful/lib/resourceful/definers.js b/node_modules/resourceful/lib/resourceful/definers.js deleted file mode 100644 index 60ce162..0000000 --- a/node_modules/resourceful/lib/resourceful/definers.js +++ /dev/null @@ -1,259 +0,0 @@ -var common = require('./common'); - -module.exports = { - all: { - define: function (attr, val /*, condition, options */) { - var args = Array.prototype.slice.call(arguments, 2), - condition, - options; - - this.property[attr] = val; - - if (typeof(args[0]) === "function") { - condition = args[0]; - options = args[1] || {}; - } - else { - options = args[0] || {}; - } - - if (options.message) this.property.messages[attr] = options.message; - if (condition) this.property.conditions[attr] = condition; - - return this; - }, - // TODO implement me - dependencies: function () {}, - // - // Restricted, include property in model.restricted() output - // - restricted: function() { - this.property.restricted = true; - - return this; - }, - // - // JSON Schema 5.1: type - // - type: function (val) { - var valid = [ - 'string', 'number', 'integer', - 'boolean', 'object', 'array', - 'null', 'any' - ]; - - valid = (Array.isArray(val) ? val : [val]).every(function (val) { - return valid.indexOf(val) !== -1; - }); - if (!valid) { - throw new(TypeError)("invalid type."); - } - - this.property.type = val; - return this; - }, - 'default': function (val, condition, options) { - if (this.property.type) { - enforceType(val, this.property.type); - } - return this.define("default", val, condition, options); - }, - // - // JSON Schema 5.7: required - // - required: function (val, condition, options) { - enforceType(val, "boolean"); - return this.define("required", val, condition, options); - }, - unique: function (val, condition, options) { - enforceType(val, "boolean"); - return this.define("unique", val, condition, options); - }, - // - // JSON Schema 5.18: title - // - title: function (val) { - enforceType(val, "string"); - this.property.title = val; - return this; - }, - // - // JSON Schema 5.19: description - // - description: function (val) { - enforceType(val, "string"); - this.property.description = val; - return this; - }, - // - // JSON Schema 5.20: format - // - format: function (val, condition, options) { - var valid = [ - 'date', 'time', 'utc-millisec', - 'regex', 'color', 'style', - 'phone', 'uri', 'email', - 'ip-address', 'ipv6', 'street-adress', - 'country', 'region', 'postal-code', - 'locality', 'date-time' - ]; - if (valid.indexOf(val) === -1) { - throw new(Error)({name:"ArgumentError"}); - } - - return this.define("format", val, condition, options); - }, - storageName: function (val) { - enforceType(val, "string"); - this.property.storageName = val; - - return this; - }, - conform: function (val, condition, options) { - enforceType(val, "function"); - return this.define("conform", val, condition, options); - }, - lazy: function (val, condition, options) { - enforceType(val, "boolean"); - return this.define("lazy", val, condition, options); - } - }, - string: { - // - // JSON Schema 5.14: pattern - // - pattern: function (val, condition, options) { - enforceType(val, "regexp"); - return this.define("pattern", val, condition, options); - }, - // - // JSON Schema 5.16: minLength - // - minLength: function (val, condition, options) { - enforceType(val, "number"); - return this.define("minLength", val, condition, options); - }, - // - // JSON Schema 5.15: maxLength - // - maxLength: function (val, condition, options) { - enforceType(val, "number"); - return this.define("maxLength", val, condition, options); - }, - // - // Addition: Sets minLength and maxLength - // - length: function (val, condition, options) { - enforceType(val, "array"); - return this.define("minLength", val[0], condition, options) - .define("maxLength", val[1], condition, options); - }, - sanitize: sanitize('string', { - upper: function (val) { - return val.toUpperCase(); - }, - lower: function (val) { - return val.toLowerCase(); - }, - capitalize: common.capitalize, - pluralize: common.pluralize, - replace: function (val, regexp, replacement) { - return val.replace(regexp, replacement); - } - }), - prefix: function (prefix) { - var matcher = new RegExp('^' + prefix + '(.*)'); - - return this.sanitize(function (val) { - return !matcher.test(val) - ? prefix + val - : val; - }); - } - }, - number: { - // - // JSON Schema 5.7: minimum - // - minimum: function (val, condition, options) { - enforceType(val, "number"); - return this.define("minimum", val, condition, options); - }, - // - // JSON Schema 5.8: maximum - // - maximum: function (val, condition, options) { - enforceType(val, "number"); - return this.define("maximum", val, condition, options); - }, - // - // Addition: Sets minimum and maximum - // - within: function (val, condition, options) { - enforceType(val, "array"); - return this.define("minimum", val[0], condition, options) - .define("maximum", val[1], condition, options); - }, - sanitize: sanitize('number', { - round: Math.round, - ceil: Math.ceil, - floor: Math.floor, - abs: Math.abs - }) - }, - array: { - sanitize: sanitize('array', { - reverse: function (val) { - return val.slice().reverse(); - } - }) - } -}; - -// -// Sanitize factory -// -function sanitize(type, sanitizers) { - return function (name) { - // this.property(...).sanitize(functon (val) { return val; }) - if (typeof name === 'function') return this.define('sanitize', name); - - // `reset` will remove any existing sanitizers from property; - if (name === 'reset') { - delete this.property['sanitize']; - return this; - } - - if (!sanitizers[name]) throw new Error('Unknown sanitizer: ' + name); - - // this.property(...).sanitize('sanitizer', args...) - var args = Array.prototype.slice.call(arguments, 1), - prop = this.name, - sanitizer = sanitizers[name], - sanitizeFn = this.property['sanitize']; - - if (!sanitizeFn) { - sanitizeFn = function (val) { - if (type === 'array' ? Array.isArray(val) : typeof val === type) { - return sanitizeFn.sanitizers.reduce(function (value, sanitizer) { - return sanitizer.fn.apply(null, [value].concat(sanitizer.args)); - }, val); - } else { - return val; - } - } - sanitizeFn.sanitizers = []; - } - sanitizeFn.sanitizers.push({ fn: sanitizer, args: args }); - - this.property['sanitize'] = sanitizeFn; - - return this; - }; -} - -function enforceType(val, type) { - if (common.typeOf(val) !== type) { - throw new TypeError({ name: "ArgumentError" }); - } -} diff --git a/node_modules/resourceful/lib/resourceful/engines.js b/node_modules/resourceful/lib/resourceful/engines.js deleted file mode 100644 index c35b855..0000000 --- a/node_modules/resourceful/lib/resourceful/engines.js +++ /dev/null @@ -1,34 +0,0 @@ -/* - * engines.js: Set of all engines `resourceful` knows about - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENCE - * - */ - -var fs = require('fs'), - path = require('path'), - common = require('./common'); - -var engines = exports; - -if (fs.readdirSync) { - // Backend - Setup all engines as lazy-loaded getters. - fs.readdirSync(path.join(__dirname, 'engines')).forEach(function (file) { - var engine = file.replace('.js', ''), - name = common.capitalize(engine); - - engines.__defineGetter__(name, function () { - return require('./engines/' + engine)[name]; - }); - }); -} else { - // Frontend support for engines - ['memory'].forEach(function (engine) { - var name = common.capitalize(engine); - - engines.__defineGetter__(name, function () { - return require(path.resolve(__dirname, './engines/', engine))[name]; - }); - }); -} diff --git a/node_modules/resourceful/lib/resourceful/engines/couchdb/index.js b/node_modules/resourceful/lib/resourceful/engines/couchdb/index.js deleted file mode 100644 index 8b5353d..0000000 --- a/node_modules/resourceful/lib/resourceful/engines/couchdb/index.js +++ /dev/null @@ -1,231 +0,0 @@ -/* - * couchdb/index.js: CouchDB engine wrapper - * - * (C) 2011 Nodejitsu Inc. - * MIT LICENCE - * - */ - -var url = require('url'), - cradle = require('cradle'), - resourceful = require('../../../resourceful'), - render = require('./view').render, - filter = require('./view').filter; - -var Couchdb = exports.Couchdb = function Couchdb(config) { - if (config.uri) { - var parsed = url.parse('couchdb://' + config.uri); - config.uri = parsed.hostname; - config.port = parseInt(parsed.port, 10); - config.database = (parsed.pathname || '').replace(/^\//, ''); - } - - this.connection = new(cradle.Connection)({ - host: config.host || config.uri || '127.0.0.1', - port: config.port || 5984, - raw: true, - cache: false, - auth: config && config.auth || null - }).database(config.database || resourceful.env); - - this.cache = new resourceful.Cache(); -}; - -Couchdb.prototype.protocol = 'couchdb'; - -Couchdb.prototype.load = function (data) { - throw new(Error)("Load not valid for couchdb engine."); -}; - -Couchdb.prototype.request = function (method) { - var args = Array.prototype.slice.call(arguments, 1); - return this.connection[method].apply(this.connection, args); -}; - -Couchdb.prototype.head = function (id, callback) { - return this.request('head', id, callback); -}; - -Couchdb.prototype.get = function (id, callback) { - return this.request.call(this, 'get', id, function (e, res) { - if (e) { - e.status = e.headers.status; - return callback(e); - } - - return Array.isArray(id) - ? callback(null, res.rows.map(function (r) { return r.doc; })) - : callback(null, res); - }); -}; - -Couchdb.prototype.put = function (id, doc, callback) { - return this.request('put', id, doc, function (e, res) { - if (e) return callback(e); - - res.status = 201; - callback(null, resourceful.mixin({}, doc, res)); - }); -}; - -Couchdb.prototype.post = Couchdb.prototype.create = function (doc, callback) { - return this.request('post', doc, function (e, res) { - if (e) return callback(e); - - res.status = 201; - callback(null, resourceful.mixin({}, doc, res)); - }); -}; - -Couchdb.prototype.save = function (id, doc, callback) { - var args = Array.prototype.slice.call(arguments, 0), - callback = args.pop(), - doc = args.pop(); - - // if there's an ID left in args after popping off the callback and - // the doc, then we need to PUT, otherwise create a new record thru POST - if (args.length) { - return this.put.apply(this, arguments); - } - - // checks for presence of _id in doc, just in case the caller forgot - // to add an id as first argument - if (doc._id) { - return this.put.apply(doc._id, doc, callback); - } else { - return this.post.call(this, doc, callback); - } -}; -Couchdb.prototype.update = function (id, doc, callback) { - return this.cache.has(id) - ? this.put(id, resourceful.mixin({}, this.cache.get(id).toJSON(), doc), callback) - : this.request('merge', id, doc, callback); -}; - -Couchdb.prototype.destroy = function () { - var that = this, - args = Array.prototype.slice.call(arguments), - id = args[0], - rev; - - if (Array.isArray(id)) { - rev = id[1]; - id = id[0]; - } - - if (rev) { - return this.request.apply(this, ['remove', id, rev, callback]); - } - if (this.cache.has(id)) { - args.splice(1, -1, this.cache.get(id)._rev); - return this.request.apply(this, ['remove'].concat(args)); - } - - this.head(id, function (e, headers, res) { - if (res === 404 || !headers['etag']) { - e = e || { reason: 'not_found' }; - } - - if (headers.etag) { - args.splice(1, -1, headers.etag.slice(1, -1)); - return that.request.apply(that, ['remove'].concat(args)); - } else { args.pop()(e) } - }); -}; - -Couchdb.prototype.view = function (path, opts, callback) { - return this.request.call(this, 'view', path, opts, function (e, res) { - if (e) return callback(e); - - callback(null, res.rows.map(function (r) { - // Check to see if the view returns an object that represents a Resource. - // With `include_docs=true` option set, the 'doc' attribute is used instead - // of 'value', so we must check both - if ((r.doc && typeof r.doc.resource === "undefined") || (r.value && typeof r.value.resource === "undefined")) { - // Since the view doesn't return a resource, we assume the user requires - // both the key and value of the returned rows. - var row = {key: r.key, value: r.value}; - return row; - } - else { - return r.doc || r.value; - } - })); - }); -}; - -Couchdb.prototype.find = function (conditions, callback) { - mapFunction = "function (doc) { var obj = " + JSON.stringify(conditions) + "; if (function () { "; - mapFunction+= "for (var k in obj) { if (obj[k] !== doc[k]) return false; } return true;"; - mapFunction+= "}()) { emit(doc._id, doc); }}"; - this.connection.temporaryView({ - map: mapFunction - }, function (e, res) { - if (e) return callback(e); - callback(null, res.rows.map(function (r) { - // With `include_docs=true`, the 'doc' attribute is set instead of 'value'. - return r.doc || r.value; - })); - }); -}; - -Couchdb.prototype.filter = function (name, data) { - return filter.call(data.resource, name, data.options, data.filter); -}; - -Couchdb.prototype.sync = function (factory, callback) { - var that = this, - id = '_design/' + factory.resource; - - factory._design = factory._design || {}; - factory._design._id = id; - if (factory._design._rev) return callback(null); - - this.connection.head(id, function (e, headers, status) { - if (!e && headers.etag) { - factory._design._rev = headers.etag.slice(1, -1); - } - - that.connection.put(id, factory._design, function (e, res) { - if (e) { - if (e.reason === 'no_db_file') { - that.connection.create(function () { - that.sync(callback); - }); - } - else { - - /* TODO: Catch errors here. Needs a rewrite, because of the race */ - /* condition, when the design doc is trying to be written in parallel */ - callback(e); - } - } - else { - // We might not need to wait for the document to be - // persisted, before returning it. If for whatever reason - // the insert fails, it'll just re-attempt it. For now though, - // to be on the safe side, we wait. - factory._design._rev = res.rev; - callback(null, factory._design); - } - }); - }); -}; - -// -// Relationship hook -// -Couchdb._byParent = function (factory, parent, rfactory) { - factory.filter('by' + parent, { include_docs: true }, resourceful.render({ - map: function (doc) { - if (doc.resource === $resource) { - for (var i = 0; i < doc.$children.length; i++) { - emit(doc._id, { _id: doc.$children[i] }); - } - } - } - }, { - resource: JSON.stringify(parent), - children: (''+factory.resource).toLowerCase() + '_ids' - })); -}; diff --git a/node_modules/resourceful/lib/resourceful/engines/couchdb/view.js b/node_modules/resourceful/lib/resourceful/engines/couchdb/view.js deleted file mode 100644 index 85f38b3..0000000 --- a/node_modules/resourceful/lib/resourceful/engines/couchdb/view.js +++ /dev/null @@ -1,91 +0,0 @@ -var events = require('events'), - resourceful = require('../../../resourceful'), - Resource = resourceful.Resource; - -// -// Define a Resource filter -// -exports.filter = function (name /* [options], filter */) { - var args = Array.prototype.slice.call(arguments), - R = this, - filter = args.pop(), - options = (typeof(args[args.length - 1]) === 'object') && args.pop(); - - if (R._design && R._design._rev) { - throw new(Error)("Cannot call 'filter' after design has been saved to database"); - } - - R._design = R._design || { - views: R.views = R.views || {} - }; - if (typeof(filter) === 'object') { - // In this case, we treat the filter as a raw view object, - // and copy it as-is. - if (filter.map) { - Object.keys(filter).forEach(function (key) { - filter[key] = filter[key].toString().replace(/\n|\r/g, '') - .replace(/\s+/g, ' '); - }); - R.views[name] = filter; - // Here, we treat the filter as a sub-object which must be matched - // in the document to pass through. - } else { - R.views[name] = resourceful.render({ - map: function (doc) { - var object = $object; - if (doc.resource === $resource) { - if (function () { - for (var k in object) { - if (object[k] !== doc[k]) return false; - } - return true; - }()) { emit(doc._id, doc); } - } - } - }, { object: filter, resource: JSON.stringify(R.resource) }); - } - } else if (typeof(filter) === 'function') { - R.views[name] = resourceful.render({ - map: function (doc) { - if (doc.resource === $resource) { - emit($key, doc); - } - } - }, { key: "doc." + Object.keys(filter("$key"))[0], - resource: JSON.stringify(R.resource) }); - } else { throw new TypeError("last argument must be an object or function"); } - - // Here we create the named filter method on the Resource - // - // Sample Usage: - // resource.someFilter('targetKey'); - // resoure.someFilter({ startKey: 0, endKey: 1 }); - // - R[name] = function (/* [param], callback */) { - var that = this, - promise = new events.EventEmitter(), - args = Array.prototype.slice.call(arguments), - callback = args.pop(), - param = args.pop() || {}, - path = [this.resource, name].join('/'); - - var params = (typeof(param) === 'object' && !Array.isArray(param)) ? param : { key: param }; - - if (options) { - Object.keys(options).forEach(function (key) { - params[key] = options[key]; - }); - } - - // Make sure our _design document is synched, - // before we attempt to call it. - if (R._design._rev) { - that.view(path, params, callback); - } else { - R.sync(function (err) { - if (err) return callback(err); - that.view(path, params, callback); - }); - } - }; -}; diff --git a/node_modules/resourceful/lib/resourceful/engines/memory.js b/node_modules/resourceful/lib/resourceful/engines/memory.js deleted file mode 100644 index 8181007..0000000 --- a/node_modules/resourceful/lib/resourceful/engines/memory.js +++ /dev/null @@ -1,129 +0,0 @@ -var resourceful = require('../../resourceful'), - Cache = resourceful.Cache; - -exports.stores = {}; -exports.caches = {}; - - -var Memory = exports.Memory = function (options) { - var counter = 0; - options = options || {}; - this.uri = options.uri; - - this.increment = function () { - return ++counter; - } - - if (typeof(this.uri) === 'string') { - // Application-wide store - if (!exports.stores[this.uri]) { - this.store = exports.stores[this.uri] = {}; - this.cache = exports.caches[this.uri] = new Cache(); - } else { - // Use store that was created before - this.store = exports.stores[this.uri]; - this.cache = exports.caches[this.uri]; - } - } - else { - // Connection-wise store - this.store = {}; - this.cache = new Cache(); - } -}; - -Memory.prototype.protocol = 'memory'; - -Memory.prototype.load = function (data) { - if (data instanceof Array) { - var tmp = {}; - data.forEach(function (e) { - tmp[e._id] = e; - }); - data = tmp; - } - - this.store = data; - - // Update cache - if (this.uri) { - exports.stores[this.uri] = data; - } - - return this; -}; - -Memory.prototype.request = function (fn) { - var self = this; - - process.nextTick(function () { - fn.call(self); - }); -}; - -Memory.prototype.save = function (key, val, callback) { - var args = Array.prototype.slice.call(arguments); - var callback = args.pop(), val = args.pop(); - if (!args.length || !key) { - key = this.increment(); - val._id = key; - } - - this.request(function () { - var update = key in this.store; - this.store[key] = val; - callback(null, resourceful.mixin({ status: update ? 200 : 201 }, val)); - }); -}; - -Memory.prototype.put = function () { - this.save.apply(this, arguments); -}; - -Memory.prototype.update = function (key, obj, callback) { - this.put(key, resourceful.mixin({}, this.store[key], obj), callback); -}; - -Memory.prototype.get = function (key, callback) { - this.request(function () { - key = key.toString(); - return key in this.store ? - callback(null, this.store[key]) - : - callback({ status: 404 }); - }); -}; - -Memory.prototype.destroy = function (key, callback) { - this.request(function () { - delete this.store[key]; - return callback(null, { status: 204 }); - }); -} - -Memory.prototype.find = function (conditions, callback) { - this.filter(function (obj) { - return Object.keys(conditions).every(function (k) { - return conditions[k] === obj[k]; - }); - }, callback); -}; - -Memory.prototype.filter = function (filter, callback) { - this.request(function () { - var result = [], - store = this.store; - - Object.keys(this.store).forEach(function (k) { - if (filter(store[k])) { - result.push(store[k]); - } - }); - - callback(null, result); - }); -}; - -Memory.prototype.sync = function (factory, callback) { - process.nextTick(function () { callback(); }); -}; diff --git a/node_modules/resourceful/lib/resourceful/init.js b/node_modules/resourceful/lib/resourceful/init.js deleted file mode 100644 index e14f97f..0000000 --- a/node_modules/resourceful/lib/resourceful/init.js +++ /dev/null @@ -1,43 +0,0 @@ - -module.exports = function init(obj, property, schema) { - if (obj[property]) { - return obj[property]; - } - - return !!init.type[schema.type] - ? init.type[schema.type](schema) - : null; -}; - -module.exports.type = { - default: function (schema) { - // - // TODO: Consume schema to determine default value - // - return undefined; - }, - object: function (schema) { - // - // TODO: Consume schema to determine default value - // - return {}; - }, - string: function (schema) { - // - // TODO: Consume schema to determine default value - // - return undefined; - }, - number: function (schema) { - // - // TODO: Consume schema to determine default value - // - return undefined; - }, - array: function (schema) { - // - // TODO: Consume schema to determine default value - // - return []; - } -}; \ No newline at end of file diff --git a/node_modules/resourceful/lib/resourceful/resource.js b/node_modules/resourceful/lib/resourceful/resource.js deleted file mode 100644 index 033d3a7..0000000 --- a/node_modules/resourceful/lib/resourceful/resource.js +++ /dev/null @@ -1,687 +0,0 @@ -var util = require('util'), - validator = require('revalidator'), - definers = require('./definers'), - resourceful = require('../resourceful'); - -// -// CRUD -// -var Resource = exports.Resource = function () { - Object.defineProperty(this, 'isNewRecord', { - value: true, - writable: true - }); - - Object.defineProperty(this, 'schema', { - value: this.constructor.schema, - enumerable: false, - configurable: true - }); -}; - -// -// Hooks -// -Resource.after = function (event, callback) { - this.hook(event, 'after', callback); -}; - -Resource.before = function (event, callback) { - this.hook(event, 'before', callback); -}; - -Resource.hook = function (event, timing, callback) { - this.hooks[timing][event] = this.hooks[timing][event] || []; - this.hooks[timing][event].push(callback); -}; - -Resource.runBeforeHooks = function (method, obj, callback, finish) { - if (method in this.hooks.before) { - (function loop(hooks) { - var hook = hooks.shift(); - - if (hook) { - hook(obj, function (e, obj) { - if (e || obj) { - if (callback) { - callback(e, obj); - } - } - else { - loop(hooks); - } - }); - } else { - finish(); - } - })(this.hooks.before[method].slice(0)); - } else { finish(); } -}; - -Resource.runAfterHooks = function (method, e, obj, finish) { - if (method in this.hooks.after) { - (function loop(hooks) { - var hook = hooks.shift(); - - if (hook) { - hook(e, obj, function (e, obj) { - if (e) { finish(e, obj); } - else { loop(hooks); } - }); - } else { - finish(); - } - })(this.hooks.after[method].slice(0)); - } else { finish(); } -}; - -// -// Raises the init event. Called from resourceful.define -// -Resource.init = function () { - this.emit('init', this); -}; - -// -// Registers the current instance's resource with resourceful -// -Resource.register = function () { - return resourceful.register(this.resource, this); -}; - -// -// Unregisters the current instance's resource from resourceful -// -Resource.unregister = function () { - return resourceful.unregister(this.resource); -}; - -Resource._request = function (/* method, [key, obj], callback */) { - var args = Array.prototype.slice.call(arguments), - that = this, - callback = args.pop(), - method = args.shift(), - key = args.shift(), - obj = args.shift(); - - if (key) args.push(key); - if (obj) args.push(obj.properties ? obj.properties : obj); - - this.runBeforeHooks(method, obj, callback, function () { - args.push(function (e, result) { - var Factory; - - if (e) { - if (e.status >= 500) { - throw new(Error)(e); - } else { that.runAfterHooks(method, e, obj, function () { - that.emit("error", e, obj); - if (callback) { - callback(e); - } - }); - } - } else { - if (Array.isArray(result)) { - // Check to see if the array contains Resource objects - if ((typeof result[0].resource === "undefined")) { - // Since this view does not return a resource, do nothing to the result - } else { - // If the view returns a resource, then try to instantiate it - result = result.map(function (r) { - return resourceful.instantiate.call(that, r); - }); - } - } else { - if (method === 'destroy') { - that.connection.cache.clear(key); - } else { - if (result.rev) { - // Set the revision if available, so it can be saved - // to the cache. If we're saving a new object, - // '_rev' won't be a member of 'resource._properties' - // so we need to set it here so resource.toJSON() includes it. - if (obj instanceof resourceful.Resource && !obj._rev) { - resourceful.defineProperty(obj, '_rev'); - } - obj._rev = result.rev; - } - - if (method === 'save') { - obj._id = result._id || result.id; - } - - result = resourceful.instantiate.call(that, ['get', 'update'].indexOf(method) !== -1 ? result : obj); - - if (method === 'update') { - // TODO: Not necessary for identity map - that.connection.cache.update(key, obj); - } else { - // TODO: We only need to do this if the key doesn't exist - that.connection.cache.put(key, result); - } - } - } - that.runAfterHooks(method, null, obj, function (e, res) { - if (e) { that.emit('error', e); } - else { that.emit(method, res || result); } - if (callback) { - callback(e || null, result); - } - }); - } - }); - that.connection[method].apply(that.connection, args); - }); -}; - -Resource.get = function (id, callback) { - if (this.schema.properties._id && this.schema.properties._id.sanitize) { - id = this.schema.properties._id.sanitize(id); - } - - return id - ? this._request('get', id, callback) - : callback && callback(new Error('key is undefined')); -}; - -Resource.new = function (attrs) { - return new(this)(attrs); -}; - -Resource.create = function (attrs, callback) { - if (this._timestamps) { - attrs.ctime = attrs.mtime = Date.now(); - } - - var that = this; - this.runBeforeHooks("create", attrs, callback, function () { - var instance = new(that)(attrs); - - // could happen after validate, but would unnecessarily remove the validation safety net - that.runAfterHooks("create", null, instance, function (e, res) { - if (e) { - return that.emit('error', e); - } - - var validate = that.prototype.validate(instance, that.schema); - - // Why is this here? We are validating in Resource.save - if (!validate.valid) { - that.emit('error', validate.errors); - if (callback) { - callback(validate.errors); - } - return; - } - - instance.save(function (e, res) { - if (res) { - instance._id = instance._id || res.id; - instance._rev = instance._rev || res.rev; - } - - if (callback) { - callback(e, instance); - } - }); - }); - }); -}; - -Resource.save = function (obj, callback) { - var validate = this.prototype.validate(obj, this.schema); - - if (!validate.valid) { - return callback && callback(validate.errors); - } - - if (this._timestamps) { - obj.mtime = Date.now(); - if (obj.isNewRecord) { - obj.ctime = obj.mtime; - } - } - - return this._request("save", obj.key, obj, callback); -}; - -Resource.destroy = function (id, callback) { - if (this.schema.properties._id && this.schema.properties._id.sanitize) { - id = this.schema.properties._id.sanitize(id); - } - - return id - ? this._request('destroy', id, callback) - : callback && callback(new Error('key is undefined')); -}; - -Resource.update = function (id, obj, callback) { - if (this.schema.properties._id && this.schema.properties._id.sanitize) { - id = this.schema.properties._id.sanitize(id); - } - - if (this._timestamps) { - obj.mtime = Date.now(); - } - - return id - ? this._request('update', id, obj, callback) - : callback && callback(new Error('key is undefined')); -}; - -Resource.all = function (callback) { - return this.find({}, callback); -}; - -Resource.view = function (path, params, callback) { - return this._request("view", path, params, callback); -}; - -Resource.filter = function (name, options, filter) { - if (filter === undefined) { - filter = options; - options = {}; - } - - return this._request("filter", name, { - options: options, - filter: filter, - resource: this - }, function () {}); -}; - -Resource.find = function (conditions, callback) { - if (typeof(conditions) !== "object") { - throw new(TypeError)("`find` takes an object as first argument."); - } - conditions['resource'] = this._resource; - return this._request("find", conditions, callback); -}; - -Resource.use = function () { - return resourceful.use.apply(this, arguments); -}; - -Resource.connect = function () { - return resourceful.connect.apply(this, arguments); -}; - -// Define getter / setter for connection property -Resource.__defineGetter__('connection', function () { - return this._connection || resourceful.connection; -}); -Resource.__defineSetter__('connection', function (val) { - return this._connection = val; -}); - -// Define getter / setter for engine property -Resource.__defineGetter__('engine', function () { - return this._engine || resourceful.engine; -}); -Resource.__defineSetter__('engine', function (val) { - return this._engine = val; -}); - -// Define getter / setter for resource property -Resource.__defineGetter__('resource', function () { - return this._resource; -}); -Resource.__defineSetter__('resource', function (name) { - return this._resource = name; -}); - -// Define getter for properties, wraps this resources schema properties -Resource.__defineGetter__('properties', function () { - return this.schema.properties; -}); - -// Define getter / setter for key property. The key property is required by CouchDB -Resource.__defineSetter__('key', function (val) { return this._key = val; }); -Resource.__defineGetter__('key', function () { return this._key; }); - -Resource.__defineGetter__('children', function (name) { - return this._children.map(function (c) { return resourceful.resources[c]; }); -}); -Resource.__defineGetter__('parents', function (name) { - return this._parents.map(function (c) { return resourceful.resources[c]; }); -}); - -// -// many-to-many -// -// user.groups = [1,2,3,4,5] -// -// new(User).groups() // -> bulk GET on user.groups property -// // OR linked documents view -// // OR cache -// // - Define Users.byGroup(group_id) -// -// new(Group).users() // -> Users.byGroup(this._id) // view -// -// group = {}; -// -// User.child('group') -// Group.child('user'); -// - -// -// Factory method for defining basic behaviour -// -function relationship(factory, type, r, options) { - var engine = factory.engine, - rfactory, // Resource factory/constructor - rstring, // Resource string - rstringp, // Resource pluralized string - rstringc; // Resource capitalized string - - if (typeof(r) === 'string') { - rstring = r.toLowerCase(); - rfactory = resourceful.resources[resourceful.capitalize(r)]; - - // We're dealing with .child('name-of-this-resource') - if (!rfactory && rstring === factory.resource.toLowerCase()) { - rfactory = factory; - } - } else if (typeof(r) === 'function') { - rstringc = r.resource; - rstring = rstringc.toLowerCase(); - rfactory = r; - } else { - throw new(TypeError)("argument must be a string or constructor"); - } - rstringp = resourceful.pluralize(rstring); - rstringc = rstringc || resourceful.capitalize(rstring); - - if (factory._children.indexOf(rstringc) !== -1) return; - if (rfactory === undefined) throw new Error("unknown resource " + rstring); - - if (type == 'child') { - factory._children.push(rstringc); - factory.property(rstring + '_ids', Array, { 'default': [], required: true }); - // - // Parent.children(id, callback) - // - if (engine._children) { - engine._children.call(this, factory, rstringp, rfactory); - } else { - factory[rstringp] = function (id, callback) { - return rfactory['by' + factory.resource](id, callback); - }; - } - // - // parent.children(callback) - // - factory.prototype[rstringp] = function (callback) { - return this.constructor[rstringp](this._id, callback); - }; - - // - // Parent.createChild(id, child, callback) - // - factory['create' + rstringc] = function (id, child, callback) { - var key = factory.resource.toLowerCase() + '_id'; - - if (child instanceof rfactory) { - child[key] = id; - child.save(callback); - } else { - var inheritance = {}; - inheritance[key] = id; - child = resourceful.mixin({}, child, inheritance); - rfactory.create(child, callback); - } - }; - - // - // parent.createChild(child, callback) - // - factory.prototype['create' + rstringc] = function (child, callback) { - factory['create' + rstringc](this._id, child, callback); - }; - - // Notify child about new parent - rfactory.parent(factory); - } else { - factory._parents.push(rstringc); - - // - // Child.byParent(id, callback) - // - if (engine._byParent) { - engine._byParent.call(engine, factory, rstringc, rfactory); - } else { - factory['by' + rstringc] = engine._byParent || function (id, callback) { - var filter = {}; - filter[rstring + '_id'] = id; - - factory.find(filter, callback); - }; - } - - // - // child.parent(callback) - // - factory.prototype[rstring] = function (callback) { - return rfactory.get(this[rstring + '_id'], callback); - }; - factory.property(rstring + '_id', [String, null], { - 'default': null, - required: true - }); - - // Notify parent about new child - rfactory.child(factory); - } -}; - -// -// Entity relationships -// -Resource.child = function (resource, options) { - relationship(this, 'child', resource, options); -}; - -Resource.parent = function (resource, options) { - relationship(this, 'parent', resource, options); -}; - -// -// Types of properties -// -Resource.string = function (name, schema) { - return this.property(name, schema); -}; - -Resource.bool = function (name, schema) { - return this.property(name, Boolean, schema); -}; - -Resource.array = function (name, schema) { - return this.property(name, Array, schema); -}; - -Resource.number = function (name, schema) { - return this.property(name, Number, schema); -}; - -Resource.object = function (name, schema) { - return this.property(name, Object, schema); -}; - -Resource.property = function (name, typeOrSchema, schema) { - var definer = {}; - var type = (function () { - switch (Array.isArray(typeOrSchema) ? 'array' : typeof typeOrSchema) { - case "array": - case "string": return typeOrSchema; - case "function": return typeOrSchema.name.toLowerCase(); - case "object": schema = typeOrSchema; - case "undefined": return "string"; - default: throw new(Error)("Argument Error"); - } - })(); - - if (Array.isArray(type)) { - type = type.map(function (type) { - return typeof type === 'function' ? type.name.toLowerCase() : '' + type; - }); - } - - schema = schema || {}; - schema.type = schema.type || type; - - this.schema.properties[name] = definer.property = schema; - this.schema.properties[name].messages = {}; - this.schema.properties[name].conditions = {}; - definer.name = name; - - resourceful.mixin(definer, definers.all, definers[schema.type] || {}); - - return definer; -}; - -Resource.timestamps = function () { - this._timestamps = true; - this.property('ctime', 'number'); - this.property('mtime', 'number'); -}; - -Resource.define = function (schema) { - return resourceful.mixin(this.schema, schema); -}; - -// -// Synchronize a Resource's design document with the database. -// -Resource.sync = function (callback) { - var that = this, - id = ["_design", this.resource].join('/'); - - this.once('sync', function (d) { - callback && callback(null, d); - }); - - if (this._synching) { - return; - } - - this._synching = true; - this.connection.sync(this, function (e, design) { - if (e) { - // XXX how to report errors here? - that.emit('error', e); - } - that._synching = false; - - that.emit('sync', design); - }); -}; - -Resource.prototype.validate = function(instance, schema) { - instance || (instance = this); - schema || (schema = this.schema || {}); - - // Before we create a new resource, perform a validation based on its schema - return validator.validate(instance._properties, { - properties: schema.properties || {} - }); -}; - -// -// Prototype -// -Resource.prototype.save = function (callback) { - var self = this; - var validation = this.validate(); - if (validation.valid) { - this.constructor.save(this, function (err, res) { - if (!err) { - self.isNewRecord = false; - } - - if (callback) { - callback(err, res); - } - }); - } else if (callback) { - callback(validation.errors); - } -}; - -Resource.prototype.update = function (obj, callback) { - return this.constructor.update(this._id, obj, callback); -}; - -Resource.prototype.saveAttachment = function (attachment, callback) { - return this.constructor.saveAttachment({ - id: this._id, - rev: this._rev - }, attachment, callback); -}; - -Resource.prototype.destroy = function (callback) { - return this.constructor.destroy(this._id, callback); -}; - -Resource.prototype.reload = function (callback) { - return this.constructor.get(this._id, callback); -}; - -Resource.prototype.readProperty = function (k, getter) { - return getter ? getter.call(this, this._properties[k]) : this._properties[k]; -}; - -Resource.prototype.writeProperty = function (k, val, setter) { - return this._properties[k] = setter - ? setter.call(this, val) - : val; -}; - - -Resource.prototype.toJSON = function () { - return resourceful.clone(this.properties); -}; - -Resource.prototype.restricted = function () { - var schema = this.constructor.schema; - return resourceful.clone(this.properties, function(key) { - return schema.properties[key] && schema.properties[key].restricted; - }); -}; - -Resource.prototype.inspect = function () { - return util.inspect(this.properties); -}; - -Resource.prototype.toString = function () { - return JSON.stringify(this.properties); -}; - - -Resource.prototype.__defineGetter__('key', function () { - return this[this.constructor.key]; -}); - -Resource.prototype.__defineGetter__('id', function () { - return this.constructor.key === '_id' - ? this._id - : undefined; -}); - -Resource.prototype.__defineGetter__('isValid', function () { - return this.validate().valid; -}); - -Resource.prototype.__defineGetter__('properties', function () { - return this._properties; -}); - -Resource.prototype.__defineSetter__('properties', function (props) { - var self = this; - Object.keys(props).forEach(function (k) { - self[k] = props[k]; - }); - - return props; -}); diff --git a/node_modules/resourceful/node_modules/cradle/.npmignore b/node_modules/resourceful/node_modules/cradle/.npmignore deleted file mode 100644 index 28a59dc..0000000 --- a/node_modules/resourceful/node_modules/cradle/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -npm-debug.log -test/fixtures/README.md -test/fixtures/not-found.txt \ No newline at end of file diff --git a/node_modules/resourceful/node_modules/cradle/LICENSE b/node_modules/resourceful/node_modules/cradle/LICENSE deleted file mode 100644 index a1edd93..0000000 --- a/node_modules/resourceful/node_modules/cradle/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2009 cloudhead - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/resourceful/node_modules/cradle/README.md b/node_modules/resourceful/node_modules/cradle/README.md deleted file mode 100644 index 436e989..0000000 --- a/node_modules/resourceful/node_modules/cradle/README.md +++ /dev/null @@ -1,377 +0,0 @@ -cradle -====== - -A high-level, caching, CouchDB client for Node.js - -introduction ------------- - -Cradle is an asynchronous javascript client for [CouchDB](http://couchdb.apache.org). -It is somewhat higher-level than most other CouchDB clients, requiring a little less knowledge of CouchDB's REST API. -Cradle also has built-in write-through caching, giving you an extra level of speed, and making document _updates_ and _deletion_ easier. -Cradle was built from the love of CouchDB and Node.js, and tries to make the most out of this wonderful marriage of technologies. - -philosophy ----------- - -The key concept here is the common ground shared by CouchDB and Node.js, that is, _javascript_. The other important aspect of this marriage is the asynchronous behaviors of both these technologies. Cradle tries to make use of these symmetries, whenever it can. -Cradle's API, although closely knit with CouchDB's, isn't overly so. Whenever the API can be abstracted in a friendlier, simpler way, that's the route it takes. So even though a large part of the `Cradle <--> CouchDB` mappings are one to one, some Cradle functions, such as `save()`, can perform more than one operation, depending on how they are used. - -synopsis --------- - -``` js - var cradle = require('cradle'); - var db = new(cradle.Connection)().database('starwars'); - - db.get('vader', function (err, doc) { - doc.name; // 'Darth Vader' - assert.equal(doc.force, 'dark'); - }); - - db.save('skywalker', { - force: 'light', - name: 'Luke Skywalker' - }, function (err, res) { - if (err) { - // Handle error - } else { - // Handle success - } - }); -``` - -installation ------------- - -``` bash - $ npm install cradle -``` - -API ---- - -Cradle's API builds right on top of Node's asynch API. Every asynch method takes a callback as its last argument. The return value is an `event.EventEmitter`, so listeners can also be optionally added. - -### Opening a connection ### - -``` js - new(cradle.Connection)('http://living-room.couch', 5984, { - cache: true, - raw: false - }); -``` - -_Defaults to `127.0.0.1:5984`_ - -Note that you can also use `cradle.setup` to set a global configuration: - -``` js - cradle.setup({ - host: 'living-room.couch', - cache: true, - raw: false - }); - - var c = new(cradle.Connection), - cc = new(cradle.Connection)('173.45.66.92'); -``` - -### creating a database ### - -``` js - var db = c.database('starwars'); - db.create(); -``` - -#### checking for database existence #### - -You can check if a database exists with the `exists()` method. - -``` js - db.exists(function (err, exists) { - if (err) { - console.log('error', err); - } else if (exists) { - console.log('the force is with you.'); - } else { - console.log('database does not exists.'); - db.create(); - /* populate design documents */ - } - }); -``` - -### destroy a database ### - -``` js - db.destroy(cb); -``` - -### fetching a document _(GET)_ ### - -``` js - db.get('vader', function (err, doc) { - console.log(doc); - }); -``` - -> If you want to get a specific revision for that document, you can pass it as the 2nd parameter to `get()`. - -Cradle is also able to fetch multiple documents if you have a list of ids, just pass an array to `get`: - -``` js - db.get(['luke', 'vader'], function (err, doc) { ... }); -``` - -### Querying a view ### - -``` js - db.view('characters/all', function (err, res) { - res.forEach(function (row) { - console.log("%s is on the %s side of the force.", row.name, row.force); - }); - }); -``` - -#### Querying a row with a specific key #### -Lets suppose that you have a design document that you've created: - -``` js - db.save('_design/user', { - views: { - byUsername: { - map: 'function (doc) { if (doc.resource === 'User') { emit(doc.username, doc) } }' - } - } - }); -``` - -In CouchDB you could query this view directly by making an HTTP request to: - -``` - /_design/User/_view/byUsername/?key="luke" -``` - -In `cradle` you can make this same query by using the `.view()` database function: - -``` js - db.view('user/byUsername', { key: 'luke' }, function (err, doc) { - console.dir(doc); - }); -``` - -### creating/updating documents ### - -In general, document creation is done with the `save()` method, while updating is done with `merge()`. - -#### creating with an id _(PUT)_ #### - -``` js - db.save('vader', { - name: 'darth', force: 'dark' - }, function (err, res) { - // Handle response - }); -``` - -#### creating without an id _(POST)_ #### - -``` js - db.save({ - force: 'dark', name: 'Darth' - }, function (err, res) { - // Handle response - }); -``` - -#### updating an existing document with the revision #### - -``` js - db.save('luke', '1-94B6F82', { - force: 'dark', name: 'Luke' - }, function (err, res) { - // Handle response - }); -``` - -Note that when saving a document this way, CouchDB overwrites the existing document with the new one. If you want to update only certain fields of the document, you have to fetch it first (with `get`), make your changes, then resave the modified document with the above method. - -If you only want to update one or more attributes, and leave the others untouched, you can use the `merge()` method: - -``` js - db.merge('luke', {jedi: true}, function (err, res) { - // Luke is now a jedi, - // but remains on the dark side of the force. - }); -``` - -Note that we didn't pass a `_rev`, this only works because we previously saved a full version of 'luke', and the `cache` option is enabled. - -#### bulk insertion #### - -If you want to insert more than one document at a time, for performance reasons, you can pass an array to `save()`: - -``` js - db.save([ - { name: 'Yoda' }, - { name: 'Han Solo' }, - { name: 'Leia' } - ], function (err, res) { - // Handle response - }); -``` - -#### creating views #### - -Here we create a design document named 'characters', with two views: 'all' and 'darkside'. - -``` js - db.save('_design/characters', { - all: { - map: function (doc) { - if (doc.name) emit(doc.name, doc); - } - }, - darkside: { - map: function (doc) { - if (doc.name && doc.force == 'dark') { - emit(null, doc); - } - } - } - }); -``` - -These views can later be queried with `db.view('characters/all')`, for example. - -Here we create a temporary view. WARNING: do not use this in production as it is -extremely slow (use it to test views). - -``` js - db.temporaryView({ - map: function (doc) { - if (doc.color) emit(doc._id, doc); - } - }, function (err, res) { - if (err) console.log(err); - console.log(res); - }); -``` - -### creating validation ### - -when saving a design document, cradle guesses you want to create a view, mention views explicitly to work around this. - -``` js - db.save('_design/laws', { - views: {}, - validate_doc_update: - function (newDoc, oldDoc, usrCtx) { - if(! /^(light|dark|neutral)$/(newDoc.force)) - throw { error: "invalid value", reason:"force must be dark, light, or neutral" } - } - } - }); -``` - -### removing documents _(DELETE)_ ### - -To remove a document, you call the `remove()` method, passing the latest document revision. - -``` js - db.remove('luke', '1-94B6F82', function (err, res) { - // Handle response - }); -``` - - -If `remove` is called without a revision, and the document was recently fetched from the database, it will attempt to use the cached document's revision, providing caching is enabled. - -Connecting with authentication and SSL --------------------------------------- - -``` js - var connection = new(cradle.Connection)('https://couch.io', 443, { - auth: { username: 'john', password: 'fha82l' } - }); -``` - -or - -``` js - var connection = new(cradle.Connection)('couch.io', 443, { - secure: true, - auth: { username: 'john', password: 'fha82l' } - }); -``` - -Changes API ------------ - -For a one-time `_changes` query, simply call `db.changes` with a callback: - -``` js - db.changes(function (list) { - list.forEach(function (change) { console.log(change) }); - }); -``` - -Or if you want to see changes since a specific sequence number: - -``` js - db.changes({ since: 42 }, function (list) { - ... - }); -``` - -The callback will receive the list of changes as an *Array*. If you want to include -the affected documents, simply pass `include_docs: true` in the options. - -### Streaming # - -You can also *stream* changes, by calling `db.changes` without the callback. This API uses the **excellent** [follow][0] library from [IrisCouch][1]: - -``` js - var feed = db.changes({ since: 42 }); - - feed.on('change', function (change) { - console.log(change); - }); -``` - -In this case, it returns an instance of `follow.Feed`, which behaves very similarly to node's `EventEmitter` API. For full documentation on the options available to you when monitoring CouchDB with `.changes()` see the [follow documentation][0]. - - -Other API methods ------------------ - -### CouchDB Server level ### - -``` js - new(cradle.Connection)().* -``` - -- `databases()`: Get list of databases -- `config()`: Get server config -- `info()`: Get server information -- `stats()`: Statistics overview -- `activeTasks()`: Get list of currently active tasks -- `uuids(count)`: Get _count_ list of UUIDs -- `replicate(options)`: Replicate a database. - -### database level ### - -``` js - new(cradle.Connection)().database('starwars').* -``` - -- `info()`: Database information -- `all()`: Get all documents -- `allBySeq()`: Get all documents by sequence -- `compact()`: Compact database -- `viewCleanup()`: Cleanup old view data -- `replicate(target, options)`: Replicate this database to `target`. - -[0]: https://github.com/iriscouch/follow -[1]: http://iriscouch.com diff --git a/node_modules/resourceful/node_modules/cradle/lib/cradle.js b/node_modules/resourceful/node_modules/cradle/lib/cradle.js deleted file mode 100644 index 6b28281..0000000 --- a/node_modules/resourceful/node_modules/cradle/lib/cradle.js +++ /dev/null @@ -1,281 +0,0 @@ -var events = require('events'), - fs = require('fs'), - path = require('path'), - url = require('url'), - http = require('http'), - https = require('https'), - querystring = require('querystring'), - request = require('request'); - -var cradle = exports; - -cradle.extend = require('./cradle/response').extend; -cradle.Response = require('./cradle/response').Response; -cradle.Cache = require('./cradle/cache').Cache; -cradle.Database = require('./cradle/database').Database; - -cradle.host = '127.0.0.1'; -cradle.port = 5984; -cradle.auth = null; -cradle.options = { - cache: true, - raw: false, - timeout: 0, - secure: false, - headers: {} -}; - -cradle.setup = function (settings) { - this.host = settings.host; - this.auth = settings.auth; - this.port = parseInt(settings.port, 10); - cradle.merge(this.options, settings); - - return this; -}; - -var protocolPattern = /^(https?):\/\//; - -cradle.Connection = function Connection(/* variable args */) { - var args = Array.prototype.slice.call(arguments), - options = {}, - remote, - match, - host, - port, - auth; - - args.forEach(function (a) { - if (typeof(a) === 'number' || (typeof(a) === 'string' && /^\d{2,5}$/.test(a))) { - port = parseInt(a); - } else if (typeof(a) === 'object') { - options = a; - host = host || options.host; - port = port || options.port; - auth = options.auth; - } else { - host = a; - - if (match = host.match(/^(.+)\:(\d{2,5})$/)) { - host = match[1]; - port = parseInt(match[2]); - } - } - }); - - this.host = host || cradle.host; - this.port = port || cradle.port; - this.auth = auth || cradle.auth; - this.options = cradle.merge({}, cradle.options, options); - - this.options.maxSockets = this.options.maxSockets || 20; - this.options.secure = this.options.secure || this.options.ssl; - - if (protocolPattern.test(this.host)) { - this.protocol = this.host.match(protocolPattern)[1]; - this.host = this.host.replace(protocolPattern, ''); - } - - if (this.protocol === 'https') this.options.secure = true; - - if (this.auth && this.auth.user) { // Deprecation warning - console.log('Warning: "user" & "pass" parameters ignored. Use "username" & "password"'); - } - if (this.options.ssl) { // Deprecation warning - console.log('Warning: "ssl" option is deprecated. Use "secure" instead.'); - } - - this.transport = (this.options.secure) ? https : http; - this.agent = new (this.transport.Agent)({ - host: this.host, - port: this.port - }); - - this.agent.maxSockets = this.options.maxSockets; -}; - -// -// Connection.rawRequest() -// -// This is a base wrapper around connections to CouchDB. Given that it handles -// *all* requests, including those for attachments, it knows nothing about -// JSON serialization and does not presuppose it is sending or receiving JSON -// content -// -// OLDAPI: function (method, path, options, data, headers) -// -cradle.Connection.prototype.rawRequest = function (options, callback) { - var promise = new(events.EventEmitter), - self = this; - - // HTTP Headers - options.headers = options.headers || {}; - - // Set HTTP Basic Auth - if (this.auth) { - options.headers['Authorization'] = "Basic " + new Buffer(this.auth.username + ':' + this.auth.password).toString('base64'); - } - - // Set client-wide headers - Object.keys(this.options.headers).forEach(function (header) { - options.headers[header] = self.options.headers[header]; - }); - - if (options.query && Object.keys(options.query).length) { - for (var k in options.query) { - if (typeof(options.query[k]) === 'boolean') { - options.query[k] = String(options.query[k]); - } - } - options.path += '?' + querystring.stringify(options.query); - } - - options.headers['Connection'] = options.headers['Connection'] || 'keep-alive'; - options.agent = this.agent; - options.uri = this._url(options.path); - delete options.path; - - return request(options, callback || function () { }); -}; - -// -// Connection.close() -// -// Close all underlying sockets associated with the agent for the connection. -// -cradle.Connection.prototype.close = function () { - this.agent.sockets.forEach(function (socket) { - socket.end(); - }); -} - -// -// Connection.request() -// -// This is the entry point for all requests to CouchDB, at this point, -// the database name has been embed in the url, by one of the wrappers. -// -cradle.Connection.prototype.request = function (options, callback) { - var headers = cradle.merge({ host: this.host }, options.headers || {}), - self = this; - - // HTTP Headers - options.headers = options.headers || {}; - - // - // Handle POST/PUT data. We also convert functions to strings, - // so they can be used in _design documents. - // - if (options.body) { - options.body = JSON.stringify(options.body, function (k, val) { - if (typeof(val) === 'function') { - return val.toString(); - } else { return val } - }); - options.headers["Content-Length"] = Buffer.byteLength(options.body); - options.headers["Content-Type"] = "application/json"; - } - - return this.rawRequest(options, function (err, res, body) { - if (err) { - return callback(err); - } - else if (options.method === 'HEAD') { - return callback(null, res.headers, res.statusCode); - } - else if (body && body.error) { - cradle.extend(body, { headers: res.headers }); - body.headers.status = res.statusCode; - return callback(body); - } - - try { body = JSON.parse(body) } - catch (err) { } - - if (body && body.error) { - cradle.extend(body, { headers: res.headers }); - body.headers.status = res.statusCode; - return callback(body); - } - - callback(null, self.options.raw ? body : new cradle.Response(body, res)); - }); -}; - -// -// The database object -// -// We return an object with database functions, -// closing around the `name` argument. -// -cradle.Connection.prototype.database = function (name) { - return new cradle.Database(name, this) -}; - -// -// Wrapper functions for the server API -// -cradle.Connection.prototype.databases = function (callback) { - this.request({ path: '/_all_dbs' }, callback); -}; -cradle.Connection.prototype.config = function (callback) { - this.request({ path: '/_config' }, callback); -}; -cradle.Connection.prototype.info = function (callback) { - this.request({ path: '/' }, callback); -}; -cradle.Connection.prototype.stats = function (callback) { - this.request({ path: '/_stats' }, callback); -}; -cradle.Connection.prototype.activeTasks = function (callback) { - this.request({ path: '/_active_tasks' }, callback); -}; -cradle.Connection.prototype.uuids = function (count, callback) { - if (typeof(count) === 'function') { - callback = count; - count = null; - } - - this.request({ - method: 'GET', - path: '/_uuids', - query: count ? { count: count } : {} - }, callback); -}; -cradle.Connection.prototype.replicate = function (options, callback) { - this.request({ - method: 'POST', - path: '/_replicate', - query: options - }, callback); -}; - -cradle.Connection.prototype._url = function (path) { - var url = (this.protocol || 'http') + '://' + this.host; - - if (this.port !== 443 && this.port !== 80) { - url += ':' + this.port; - } - - url += path[0] === '/' ? path : ('/' + path); - - return url; -} - -cradle.escape = function (id) { - return ['_design', '_changes', '_temp_view'].indexOf(id.split('/')[0]) === -1 - ? querystring.escape(id) - : id; -}; - -cradle.merge = function (target) { - var objs = Array.prototype.slice.call(arguments, 1); - objs.forEach(function (o) { - Object.keys(o).forEach(function (attr) { - if (! o.__lookupGetter__(attr)) { - target[attr] = o[attr]; - } - }); - }); - return target; -}; diff --git a/node_modules/resourceful/node_modules/cradle/lib/cradle/cache.js b/node_modules/resourceful/node_modules/cradle/lib/cradle/cache.js deleted file mode 100644 index 5b60877..0000000 --- a/node_modules/resourceful/node_modules/cradle/lib/cradle/cache.js +++ /dev/null @@ -1,102 +0,0 @@ -var Response = require('./response').Response; -// -// Each database object has its own cache store. -// The cache.* methods are all wrappers around -// `cache.query`, which transparently checks if -// caching is enabled, before performing any action. -// -this.Cache = function (options) { - var that = this; - - this.store = {}; - this.options = options; - this.size = options.cacheSize || 0; - this.keys = 0; -}; - -this.Cache.prototype = { - // API - get: function (id) { return this.query('get', id) }, - save: function (id, doc) { return this.query('save', id, doc) }, - purge: function (id) { return this.query('purge', id) }, - has: function (id) { return this.query('has', id) }, - - _get: function (id) { - var entry; - - if (id in this.store) { - entry = this.store[id]; - entry.atime = Date.now(); - - if (this.options.raw) { - return entry.document; - } else { - // If the document is already wrapped in a `Response`, - // just return it. Else, wrap it first. We clone the documents - // before returning them, to protect them from modification. - if (entry.document.toJSON) { - return clone(entry.document); - } else { - return new(Response)(clone(entry.document)); - } - } - } - }, - _has: function (id) { - return id in this.store; - }, - _save: function (id, doc) { - if (! this._has(id)) { - this.keys ++; - this.prune(); - } - - return this.store[id] = { - atime: Date.now(), - document: doc - }; - }, - _purge: function (id) { - if (id) { - delete(this.store[id]); - this.keys --; - } else { - this.store = {}; - } - }, - query: function (op, id, doc) { - if (this.options.cache) { - return this['_' + op](id, doc); - } else { - return false; - } - }, - prune: function () { - var that = this; - if (this.size && this.keys > this.size) { - process.nextTick(function () { - var store = that.store, - keys = Object.keys(store), - pruned = Math.ceil(that.size / 8); - - keys.sort(function (a, b) { - return store[a].atime > store[b].atime ? 1 : -1; - }); - - for (var i = 0; i < pruned; i++) { - delete(store[keys[i]]); - } - that.keys -= pruned; - }); - } - } -}; - -function clone(obj) { - return Object.keys(obj).reduce(function (clone, k) { - if (! obj.__lookupGetter__(k)) { - clone[k] = obj[k]; - } - return clone; - }, {}); -} diff --git a/node_modules/resourceful/node_modules/cradle/lib/cradle/database/attachments.js b/node_modules/resourceful/node_modules/cradle/lib/cradle/database/attachments.js deleted file mode 100644 index 08fec40..0000000 --- a/node_modules/resourceful/node_modules/cradle/lib/cradle/database/attachments.js +++ /dev/null @@ -1,120 +0,0 @@ -var querystring = require('querystring'), - Args = require('vargs').Constructor, - cradle = require('../../cradle'), - Database = require('./index').Database; - -Database.prototype.getAttachment = function (id, attachmentName, callback) { - // - // TODO: Update cache? - // - - return this.connection.rawRequest({ - method: 'GET', - path: '/' + [this.name, querystring.escape(id), attachmentName].join('/') - }, callback); -}; - -Database.prototype.removeAttachment = function (doc, attachmentName, callback) { - var params, - rev, - id; - - if (typeof doc === 'string') { - id = doc; - } else { - id = doc.id || doc._id; - rev = doc.rev || doc._rev; - } - - if (!id) { - error = new(TypeError)("first argument must be a document id"); - if (!callback) { throw error } - return callback(error); - } - - if (!rev && this.cache.has(id)) { - rev = this.cache.get(id)._rev; - } else if (rev) { - rev = rev.replace(/\"/g, ''); - } - - this.query({ - method: 'DELETE', - path: [querystring.escape(id), attachmentName].join('/'), - query: { rev: rev } - }, callback); -}; - -Database.prototype.saveAttachment = function (doc, attachment, callback) { - var attachmentName, - options = {}, - self = this, - params, - error, - rev, - id; - - if (typeof doc === 'string') { - id = doc; - } else { - id = doc.id || doc._id; - rev = doc.rev || doc._rev; - } - - if (!id) { - error = new(TypeError)("Missing document id."); - if (!callback) { throw error } - return callback(error); - } - - attachmentName = typeof attachment !== 'string' - ? attachment.name - : attachment; - - if (!rev && this.cache.has(id)) { - params = { rev: this.cache.get(id)._rev }; - } else if (rev) { - params = { rev: rev.replace(/\"/g, '') }; - } - - options.method = 'PUT'; - options.path = '/' + [this.name, querystring.escape(id), attachmentName].join('/'); - options.headers = { - 'Content-Type': attachment['content-type'] - || attachment['contentType'] - || attachment['Content-Type'] - || 'text/plain' - }; - - if (attachment.body) { - options.body = attachment.body; - } - - if (params) { - options.path += ('?' + querystring.stringify(params)); - } - - return this.connection.rawRequest(options, function (err, res, body) { - var result = JSON.parse(body); - result.headers = res.headers; - result.headers.status = res.statusCode; - - if (result.headers.status == 201) { - if (self.cache.has(id)) { - cached = self.cache.store[id].document; - cached._rev = result.rev; - cached._attachments = cached._attachments || {}; - cached._attachments[attachmentName] = { stub: true }; - } - - return callback(null, result); - } - - callback(result); - }); -}; - -// -// Alias `saveAttachment` to `addAttachment` -// -Database.prototype.addAttachment = Database.prototype.saveAttachment; diff --git a/node_modules/resourceful/node_modules/cradle/lib/cradle/database/changes.js b/node_modules/resourceful/node_modules/cradle/lib/cradle/database/changes.js deleted file mode 100644 index f2b7bf2..0000000 --- a/node_modules/resourceful/node_modules/cradle/lib/cradle/database/changes.js +++ /dev/null @@ -1,56 +0,0 @@ -var events = require('events'), - querystring = require('querystring'), - Args = require('vargs').Constructor, - follow = require('follow'), - cradle = require('../../cradle'), - Database = require('./index').Database; - -Database.prototype.changes = function (options, callback) { - if (typeof(options) === 'function') { - callback = options; - options = {}; - } - - options = options || {}; - - if (callback) { - return this.query({ - method: 'GET', - path: '_changes', - query: options - }, callback); - } - - var response = new events.EventEmitter(), - responded = false, - auth = '', - feed; - - if (!options.db) { - if (this.connection.auth && this.connection.auth.username - && this.connection.auth.password) { - auth = this.connection.auth.username + ':' + this.connection.auth.password + '@'; - } - - options.db = 'http://' + auth + this.connection.host + ':' + this.connection.port + '/' + this.name; - } - - feed = new follow.Feed(options); - feed.on('change', function () { - // - // Remark: Support the legacy `data` events. - // - if (!responded) { - responded = true; - feed.emit('response', response); - } - - response.emit.apply(response, ['data'].concat(Array.prototype.slice.call(arguments))); - }); - - if (options.follow !== false) { - feed.follow(); - } - - return feed; -}; diff --git a/node_modules/resourceful/node_modules/cradle/lib/cradle/database/documents.js b/node_modules/resourceful/node_modules/cradle/lib/cradle/database/documents.js deleted file mode 100644 index 04e5922..0000000 --- a/node_modules/resourceful/node_modules/cradle/lib/cradle/database/documents.js +++ /dev/null @@ -1,215 +0,0 @@ -var querystring = require('querystring'), - Args = require('vargs').Constructor, - cradle = require('../../cradle'), - Database = require('./index').Database; - -// -// Perform a HEAD request -// -Database.prototype.head = function (id, callback) { - this.query({ - method: 'HEAD', - path: cradle.escape(id) - }, callback); -}; - -// Fetch either a single document from the database, or cache, -// or multiple documents from the database. -// If it's a single doc from the db, attempt to save it to the cache. -Database.prototype.get = function (id, rev) { - var args = new (Args)(arguments), - options = null, - that = this; - - if (Array.isArray(id)) { // Bulk GET - this.query({ - method: 'POST', - path: '/_all_docs', - query: { include_docs: true }, - body: { keys: id }, - }, function (err, res) { - args.callback(err, res) - }); - } else { - if (rev && args.length === 2) { - if (typeof(rev) === 'string') { options = { rev: rev } } - else if (typeof(rev) === 'object') { options = rev } - } else if (this.cache.has(id)) { - return args.callback(null, this.cache.get(id)); - } - this.query({ - path: cradle.escape(id), - query: options - }, function (err, res) { - if (! err) that.cache.save(res.id, res.json); - args.callback(err, res); - }); - } -}; - -// -// PUT a document, and write through cache -// -Database.prototype.put = function (id, doc, callback) { - var cache = this.cache; - if (typeof(id) !== 'string') { throw new(TypeError)("id must be a string") } - this.query({ - method: 'PUT', - path: cradle.escape(id), - body: doc - }, function (e, res) { - if (! e) { cache.save(id, cradle.merge({}, doc, { _id: id, _rev: res.rev })) } - callback && callback(e, res); - }); -}; - -// -// POST a document, and write through cache -// -Database.prototype.post = function (doc, callback) { - var cache = this.cache; - this.query({ - method: 'POST', - path: '/', - body: doc - }, function (e, res) { - if (! e) { cache.save(res.id, cradle.merge({}, doc, { _id: res.id, _rev: res.rev })) } - callback && callback(e, res); - }); -}; - -Database.prototype.save = function (/* [id], [rev], doc | [doc, ...] */) { - var args = new(Args)(arguments), - array = args.all.slice(0), doc, id, rev; - - if (Array.isArray(args.first)) { - doc = args.first; - } else { - doc = array.pop(), - id = array.shift(), - rev = array.shift(); - } - this._save(id, rev, doc, args.callback); -}; - -Database.prototype._save = function (id, rev, doc, callback) { - var options = this.connection.options; - var document = {}, that = this; - - // Bulk Insert - if (Array.isArray(doc)) { - document.docs = doc; - if (options.allOrNothing) { document.all_or_nothing = true } - this.query({ - method: 'POST', - path: '/_bulk_docs', - body: document - }, callback); - } else { - if (!id && doc._id) { - id = doc._id; - } - - // PUT a single document, with an id (Create or Update) - if (id) { - // Design document - if (/^_design\/(\w|%|\-)+$/.test(id) && !('views' in doc)) { - document.language = "javascript"; - document.views = doc; - } else { - document = doc; - } - // Try to set the '_rev' attribute of the document. - // If it wasn't passed, attempt to retrieve it from the cache. - rev && (document._rev = rev); - - if (document._rev) { - this.put(id, document, callback); - } else if (this.cache.has(id)) { - document._rev = this.cache.get(id)._rev; - this.put(id, document, callback); - } else { - // Attempt to create a new document. If it fails, - // because an existing document with that _id exists (409), - // perform a HEAD, to get the _rev, and try to re-save. - this.put(id, document, function (e, res) { - if (e && e.headers && e.headers.status === 409) { // Conflict - that.head(id, function (e, headers, res) { - if (res === 404 || !headers['etag']) { - return callback({ reason: 'not_found' }); - } - - document._rev = headers['etag'].slice(1, -1); - that.put(id, document, callback); - }); - } else { callback(e, res) } - }); - } - // POST a single document, without an id (Create) - } else { - this.post(doc, callback); - } - } -}; - -Database.prototype.merge = function (/* [id], doc */) { - var args = Array.prototype.slice.call(arguments), - callback = args.pop(), - doc = args.pop(), - id = args.pop() || doc._id; - - this._merge(id, doc, callback); -}; - -Database.prototype._merge = function (id, doc, callback) { - var that = this; - this.get(id, function (e, res) { - if (e) { return callback(e) } - doc = cradle.merge({}, res.json || res, doc); - that.save(id, res._rev, doc, callback); - }); -}; - -Database.prototype.insert = function () { - throw new Error("`insert` is deprecated, use `save` instead"); -}; - -Database.prototype.update = function (path, id, options) { - var args = new(Args)(arguments); - path = path.split('/'); - - if (id) { - return this.query({ - method: 'PUT', - path: ['_design', path[0], '_update', path[1], id].map(querystring.escape).join('/'), - query: options - }, args.callback); - } - - return this.query({ - method: 'POST', - path: ['_design', path[0], '_update', path[1]].map(querystring.escape).join('/'), - query: options, - }, args.callback); -}; - -// Delete a document -// if the _rev wasn't supplied, we attempt to retrieve it from the -// cache. If the deletion was successful, we purge the cache. -Database.prototype.remove = function (id, rev) { - var that = this, doc, args = new(Args)(arguments); - - if (typeof(rev) !== 'string') { - if (doc = this.cache.get(id)) { rev = doc._rev } - else { throw new(Error)("rev needs to be supplied") } - } - - this.query({ - method: 'DELETE', - path: cradle.escape(id), - query: { rev: rev } - }, function (err, res) { - if (! err) { that.cache.purge(id) } - args.callback(err, res); - }); -}; \ No newline at end of file diff --git a/node_modules/resourceful/node_modules/cradle/lib/cradle/database/index.js b/node_modules/resourceful/node_modules/cradle/lib/cradle/database/index.js deleted file mode 100644 index 3441cf9..0000000 --- a/node_modules/resourceful/node_modules/cradle/lib/cradle/database/index.js +++ /dev/null @@ -1,65 +0,0 @@ -var querystring = require('querystring'), - Args = require('vargs').Constructor, - cradle = require('../../cradle'); - -var Database = exports.Database = function (name, connection) { - this.connection = connection; - this.name = encodeURIComponent(name); - this.cache = new (cradle.Cache)(connection.options); -}; - -// A wrapper around `Connection.request`, -// which prepends the database name. -Database.prototype.query = function (options, callback) { - options.path = [this.name, options.path].filter(Boolean).join('/'); - this.connection.request(options, callback); -}; - -Database.prototype.exists = function (callback) { - this.query({ method: 'HEAD' }, function (err, res, status) { - if (err) { - callback(err); - } else { - if (status === 404) { - callback(null, false); - } else { - callback(null, true); - } - } - }); -}; - -Database.prototype.replicate = function (target, options, callback) { - if (typeof(options) === 'function') { callback = options, options = {} } - this.connection.replicate(cradle.merge({ source: name, target: target }, options), callback); -}; - -Database.prototype.info = function (callback) { - this.query({ method: 'GET' }, callback); -}; - -Database.prototype.create = function (callback) { - this.query({ method: 'PUT' }, callback); -}; - -// Destroys a database with 'DELETE' -// we raise an exception if arguments were supplied, -// as we don't want users to confuse this function with `remove`. -Database.prototype.destroy = function (callback) { - if (arguments.length > 1) { - throw new(Error)("destroy() doesn't take any additional arguments"); - } - - this.query({ - method: 'DELETE', - path: '/', - }, callback); -}; - -// -// Extend the Database prototype with Couch features -// -require('./attachments'); -require('./changes'); -require('./documents'); -require('./views'); \ No newline at end of file diff --git a/node_modules/resourceful/node_modules/cradle/lib/cradle/database/views.js b/node_modules/resourceful/node_modules/cradle/lib/cradle/database/views.js deleted file mode 100644 index 5790210..0000000 --- a/node_modules/resourceful/node_modules/cradle/lib/cradle/database/views.js +++ /dev/null @@ -1,125 +0,0 @@ -var querystring = require('querystring'), - Args = require('vargs').Constructor, - cradle = require('../../cradle'), - Database = require('./index').Database; - -Database.prototype.all = function (options, callback) { - if (arguments.length === 1) { - callback = options; - options = {}; - } - - return this._getOrPostView('/_all_docs', options, callback); -}; - -// Query a view, passing any options to the query string. -// Some query string parameters' values have to be JSON-encoded. -Database.prototype.view = function (path, options) { - var callback = new(Args)(arguments).callback, - body; - - path = path.split('/'); - path = ['_design', path[0], '_view', path[1]].map(querystring.escape).join('/'); - - return this._getOrPostView(path, options, callback); -}; - -Database.prototype.temporaryView = function (doc, options, callback) { - if (!callback && typeof options === 'function') { - callback = options; - options = null; - } - - if (options && typeof options === 'object') { - ['key', 'keys', 'startkey', 'endkey'].forEach(function (k) { - if (k in options) { options[k] = JSON.stringify(options[k]) } - }); - } - - return this.query({ - method: 'POST', - path: '_temp_view', - query: options, - body: doc - }, callback); -}; - -Database.prototype.viewCleanup = function (callback) { - this.query({ - method: 'POST', - path: '/_view_cleanup', - headers: { - 'Content-Type': 'application/json' - } - }, callback); -}; - -Database.prototype.compact = function (design) { - this.query({ - method: 'POST', - path: '/_compact' + (typeof(design) === 'string' ? '/' + querystring.escape(design) : ''), - headers: { - 'Content-Type': 'application/json' - } - }, Args.last(arguments)); -}; - -// Query a list, passing any options to the query string. -// Some query string parameters' values have to be JSON-encoded. -Database.prototype.list = function (path, options) { - var callback = new(Args)(arguments).callback; - path = path.split('/'); - - this._getOrPostView( - ['_design', path[0], '_list', path[1], path[2]].map(querystring.escape).join('/'), - options, - callback - ); -}; - -// -// Helper function which parses options and makes either a `GET` -// or `POST` request to `path` depending on if `options.keys` or -// `options.body` is present. -// -Database.prototype._getOrPostView = function (path, options, callback) { - options = parseOptions(options); - - if (options && options.body) { - body = options.body; - delete options.body; - - return this.query({ - method: 'POST', - path: path, - query: options, - body: body - }, callback); - } - - return this.query({ - method: 'GET', - path: path, - query: options - }, callback); -} - -// -// Helper function for parsing and stringifying complex options -// to pass to CouchDB. -// -function parseOptions(options) { - if (options && typeof options === 'object') { - ['key', 'startkey', 'endkey'].forEach(function (k) { - if (k in options) { options[k] = JSON.stringify(options[k]) } - }); - } - - if (options && options.keys) { - options.body = options.body || {}; - options.body.keys = options.keys; - delete options.keys; - } - - return options; -} diff --git a/node_modules/resourceful/node_modules/cradle/lib/cradle/response.js b/node_modules/resourceful/node_modules/cradle/lib/cradle/response.js deleted file mode 100644 index 096f08a..0000000 --- a/node_modules/resourceful/node_modules/cradle/lib/cradle/response.js +++ /dev/null @@ -1,127 +0,0 @@ -// -// HTTP response wrapper -// -// It allows us to call array-like methods on documents -// with a 'row' attribute. -// -this.Response = function Response(json, response) { - var obj, headers; - - // If there's rows, this is the result - // of a view function. - // We want to return this as an Array. - if (json.rows) { - obj = json.rows.slice(0); - obj.__proto__ = new(Array); - if (json && typeof json === 'object') { - Object.keys(json).forEach(function (k) { - Object.defineProperty(obj.__proto__, k, { - value: json[k], - enumerable: false - }); - }); - } - } else if (json.results) { - obj = json.results.slice(0); - obj.__proto__ = new(Array); - obj.last_seq = json.last_seq; - } else if (json.uuids) { - obj = json.uuids; - obj.__proto__ = new(Array); - } else if (Array.isArray(json)) { - obj = json.slice(0); - obj.__proto__ = new(Array); - } else { - obj = {}; - obj.__proto__ = new(Object); - if (json && typeof json === 'object') { - Object.keys(json).forEach(function (k) { - obj[k] = json[k]; - }); - } - } - - // If the response was originally a document, - // give access to it via the 'json' getter. - if (!Array.isArray(json) && !obj.json) { - Object.defineProperty(obj, 'json', { - value: json, - enumerable: false - }); - } - - if (response) { - headers = { status: response.statusCode }; - Object.keys(response.headers).forEach(function (k) { - headers[k] = response.headers[k]; - }); - - // Set the 'headers' special field, with the response's status code. - exports.extend(obj, 'headers' in obj ? { _headers: headers } - : { headers: headers }); - } - - // Alias '_rev' and '_id' - if (obj.id && obj.rev) { - exports.extend(obj, { _id: obj.id, _rev: obj.rev }); - } else if (obj._id && obj._rev) { - exports.extend(obj, { id: obj._id, rev: obj._rev }); - } - - if (Array.isArray(obj) && json.rows) { - exports.extend(obj, exports.collectionPrototype); - } - exports.extend(obj, exports.basePrototype); - - // Set the constructor to be this function - Object.defineProperty(obj, 'constructor', { - value: arguments.callee - }); - - return obj; -}; - -this.basePrototype = { - toJSON: function () { - return this; - }, - toString: function () { - return JSON.stringify(this); - } -}; - -this.collectionPrototype = { - forEach: function (f) { - for (var i = 0, value; i < this.length; i++) { - value = this[i].doc || this[i].json || this[i].value || this[i]; - if (f.length === 1) { - f.call(this[i], value); - } else { - f.call(this[i], this[i].key, value, this[i].id); - } - } - }, - map: function (f) { - var ary = []; - if (f.length === 1) { - this.forEach(function (a) { ary.push(f.call(this, a)) }); - } else { - this.forEach(function () { ary.push(f.apply(this, arguments)) }); - } - return ary; - }, - toArray: function () { - return this.map(function (k, v) { return v }); - } -}; - -this.extend = function (obj, properties) { - var descriptor = Object.keys(properties).reduce(function (hash, k) { - hash[k] = { - value: properties[k], - enumerable: false - }; - return hash; - }, {}); - return Object.defineProperties(obj, descriptor); -}; diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/.bin/follow b/node_modules/resourceful/node_modules/cradle/node_modules/.bin/follow deleted file mode 120000 index c7fe0ae..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/.bin/follow +++ /dev/null @@ -1 +0,0 @@ -../follow/cli.js \ No newline at end of file diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/.npmignore b/node_modules/resourceful/node_modules/cradle/node_modules/follow/.npmignore deleted file mode 100644 index 76c509f..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -./.gitignore -./Rakefile -./browser/ diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/LICENSE b/node_modules/resourceful/node_modules/cradle/node_modules/follow/LICENSE deleted file mode 100644 index d645695..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/README.md b/node_modules/resourceful/node_modules/cradle/node_modules/follow/README.md deleted file mode 100644 index 1706ccf..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/README.md +++ /dev/null @@ -1,164 +0,0 @@ -# Follow: CouchDB changes notifier for NodeJS - -Follow (upper-case *F*) comes from an internal Iris Couch project used in production for over a year. It works in the browser (beta) and is available as an NPM module. - - $ npm install follow - -## Example - -This looks much like the [request][req] API. - -```javascript -var follow = require('follow'); -follow("https://example.iriscouch.com/boogie", function(error, change) { - if(!error) - console.log("Got change number " + change.seq + ": " + change.id); -}) -``` - -The *error* parameter to the callback will basically always be `null`. - -## Objective - -The API must be very simple: notify me every time a change happens in the DB. Also, never fail. - -If an error occurs, Follow will internally retry without notifying your code. - -Specifically, this should be possible: - -1. Begin a changes feed. Get a couple of change callbacks -2. Shut down CouchDB -3. Go home. Have a nice weekend. Come back on Monday. -4. Start CouchDB with a different IP address -5. Make a couple of changes -6. Update DNS so the domain points to the new IP -7. Once DNS propagates, get a couple more change callbacks - -## Failure Mode - -If CouchDB permanently crashes, there is an option of failure modes: - -* **Default:** Simply never call back with a change again -* **Optional:** Specify an *inactivity* timeout. If no changes happen by the timeout, Follow will signal an error. - -### Simple API: follow(options, callback) - -The first argument is an options object. The only required option is `db`. Instead of an object, you can use a string to indicate the `db` value. - -```javascript -follow({db:"https://example.iriscouch.com/boogie", include_docs:true}, function(error, change) { - if(!error) { - console.log("Change " + change.seq + " has " + Object.keys(change.doc).length + " fields"); - } -}) -``` - - -All of the CouchDB _changes options are allowed. See http://guide.couchdb.org/draft/notifications.html. - -* `db` | Fully-qualified URL of a couch database. (Basic auth URLs are ok.) -* `since` | The sequence number to start from. Use `"now"` to start from the latest change in the DB. -* `heartbeat` | Milliseconds within which CouchDB must respond (default: **30000** or 30 seconds) -* `feed` | **Optional but only "continuous" is allowed** -* `filter` | - * **Either** a path to design document filter, e.g. `app/important` - * **Or** a Javascript `function(doc, req) { ... }` which should return true or false -* `query_params` | **Optional** for use in with `filter` functions, passed as `req.query` to the filter function - -Besides the CouchDB options, more are available: - -* `headers` | Object with HTTP headers to add to the request -* `inactivity_ms` | Maximum time to wait between **changes**. Omitting this means no maximum. - -## Object API - -The main API is a thin wrapper around the EventEmitter API. - -```javascript -var follow = require('follow'); - -var opts = {}; // Same options paramters as before -var feed = new follow.Feed(opts); - -// You can also set values directly. -feed.db = "http://example.iriscouch.com/boogie"; -feed.since = 3; -feed.heartbeat = 30 * 1000 -feed.inactivity_ms = 86400 * 1000; - -feed.filter = function(doc, req) { - // req.query is the parameters from the _changes request and also feed.query_params. - console.log('Filtering for query: ' + JSON.stringify(req.query)); - - if(doc.stinky || doc.ugly) - return false; - return true; -} - -feed.on('change', function(change) { - console.log('Doc ' + change.id + ' in change ' + change.seq + ' is neither stinky nor ugly.'); -}) - -feed.on('error', function(er) { - console.error('Since Follow always retries on errors, this must be serious'); - throw er; -}) - -feed.follow(); -``` - - -## Events - -The feed object is an EventEmitter. There are a few ways to get a feed object: - -* Use the object API above -* Use the return value of `follow()` -* In the callback to `follow()`, the *this* variable is bound to the feed object. - -Once you've got one, you can subscribe to these events: - -* **start** | Before any i/o occurs -* **confirm_request** | `function(req)` | The database confirmation request is sent; passed the `request` object -* **confirm** | `function(db_obj)` | The database is confirmed; passed the couch database object -* **change** | `function(change)` | A change occured; passed the change object from CouchDB -* **catchup** | `function(seq_id)` | The feed has caught up to the *update_seq* from the confirm step. Assuming no subsequent changes, you have seen all the data. *Always fires before the final **change** event.* -* **wait** | Follow is idle, waiting for the next data chunk from CouchDB -* **timeout** | `function(info)` | Follow did not receive a heartbeat from couch in time. The passed object has `.elapsed_ms` set to the elapsed time -* **retry** | `function(info)` | A retry is scheduled (usually after a timeout or disconnection). The passed object has - * `.since` the current sequence id - * `.after` the milliseconds to wait before the request occurs (on an exponential fallback schedule) - * `.db` the database url (scrubbed of basic auth credentials) -* **stop** | The feed is stopping, because of an error, or because you called `feed.stop()` -* **error** | `function(err)` | An error occurs - -## Error conditions - -Follow is happy to retry over and over, for all eternity. It will only emit an error if it thinks your whole application might be in trouble. - -* *DB confirmation* failed: Follow confirms the DB with a preliminary query, which must reply properly. -* *DB is deleted*: Even if it retried, subsequent sequence numbers would be meaningless to your code. -* *Your inactivity timer* expired: This is a last-ditch way to detect possible errors. What if couch is sending heartbeats just fine, but nothing has changed for 24 hours? You know that for your app, 24 hours with no change is impossible. Maybe your filter has a bug? Maybe you queried the wrong DB? Whatever the reason, Follow will emit an error. -* JSON parse error, which should be impossible from CouchDB -* Invalid change object format, which should be impossible from CouchDB -* Internal error, if the internal state seems wrong, e.g. cancelling a timeout that already expired, etc. Follow tries to fail early. - -## Tests - -Follow uses [node-tap][tap]. If you clone this Git repository, tap is included. - - $ ./node_modules/.bin/tap test - ok test/couch.js ...................................... 10/10 - ok test/follow.js ..................................... 43/43 - ok test/issues.js ..................................... 43/43 - ok test/stream.js ................................... 275/275 - total ............................................... 375/375 - - ok - -## License - -Apache 2.0 - -[req]: https://github.com/mikeal/request -[tap]: https://github.com/isaacs/node-tap diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/Rakefile b/node_modules/resourceful/node_modules/cradle/node_modules/follow/Rakefile deleted file mode 100644 index b912031..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/Rakefile +++ /dev/null @@ -1,54 +0,0 @@ -require 'json' - -LIBRARY = [ "api.js", "feed.js", "lib.js", "cli.js" ] -BROWSER_TOOLS = Dir.glob("browser/*").select{|x| x != "browser/export.js" } - -task :default => :export - -desc 'Export Follow for use in web browsers' -task :export => ([:clean, "cli.js"] + LIBRARY + BROWSER_TOOLS) do |task| - build = "./build" - target = "#{build}/follow" - - sh "mkdir", "-p", target - LIBRARY.each do |js| - sh "node", "browser/export.js", js, "#{target}/#{js}" - end - - BROWSER_TOOLS.each do |file| - sh "cp", file, build - end - - # EventEmitter2 needs wrapping. - sh "node", "browser/export.js", "browser/eventemitter2.js", "#{build}/eventemitter2.js" - - File.open("#{build}/boot.js", 'w') do |boot| - requirejs_paths = { 'request' => 'request.jquery', - 'events' => 'eventemitter2', - # 'foo' => 'bar', etc. - } - - opts = { # 'baseUrl' => "follow", - 'paths' => requirejs_paths, - } - - main_js = "main.js" - - boot.write([ 'require(', - '// Options', - opts.to_json() + ',', - '', - '// Modules', - [main_js].to_json() + ',', - '', - '// Code to run when ready', - 'function(main) { return main(); }', - ');' - ].join("\n")); - end -end - -desc 'Clean up build files' -task :clean do - sh "rm", "-rf", "./build" -end diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/api.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/api.js deleted file mode 100644 index 4b71d78..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/api.js +++ /dev/null @@ -1,35 +0,0 @@ -// The changes_couchdb API -// -// Copyright 2011 Iris Couch -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -var feed = require('./lib/feed') - , stream = require('./lib/stream') - -function follow_feed(opts, cb) { - var ch_feed = new feed.Feed(opts); - ch_feed.on('error' , function(er) { return cb && cb.call(ch_feed, er) }); - ch_feed.on('change', function(ch) { return cb && cb.call(ch_feed, null, ch) }); - - // Give the caller a chance to hook into any events. - process.nextTick(function() { - ch_feed.follow(); - }) - - return ch_feed; -} - -module.exports = follow_feed; -module.exports.Feed = feed.Feed; -module.exports.Changes = stream.Changes diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/eventemitter2.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/eventemitter2.js deleted file mode 100644 index a4da624..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/eventemitter2.js +++ /dev/null @@ -1,453 +0,0 @@ - -;!function(exports, undefined) { - - var isArray = Array.isArray; - var defaultMaxListeners = 10; - - function init() { - this._events = new Object; - } - - function configure(conf) { - - if (conf) { - this.wildcard = conf.wildcard; - this.delimiter = conf.delimiter || '.'; - - if (this.wildcard) { - this.listenerTree = new Object; - } - } - } - - function EventEmitter(conf) { - this._events = new Object; - configure.call(this, conf); - } - - function searchListenerTree(handlers, type, tree, i) { - if (!tree) { - return; - } - - var listeners; - - if (i === type.length && tree._listeners) { - // - // If at the end of the event(s) list and the tree has listeners - // invoke those listeners. - // - if (typeof tree._listeners === 'function') { - handlers && handlers.push(tree._listeners); - return tree; - } else { - for (var leaf = 0, len = tree._listeners.length; leaf < len; leaf++) { - handlers && handlers.push(tree._listeners[leaf]); - } - return tree; - } - } - - if (type[i] === '*' || tree[type[i]]) { - // - // If the event emitted is '*' at this part - // or there is a concrete match at this patch - // - if (type[i] === '*') { - for (var branch in tree) { - if (branch !== '_listeners' && tree.hasOwnProperty(branch)) { - listeners = searchListenerTree(handlers, type, tree[branch], i+1); - } - } - return listeners; - } - - listeners = searchListenerTree(handlers, type, tree[type[i]], i+1); - } - - - if (tree['*']) { - // - // If the listener tree will allow any match for this part, - // then recursively explore all branches of the tree - // - searchListenerTree(handlers, type, tree['*'], i+1); - } - - return listeners; - }; - - function growListenerTree(type, listener) { - - type = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); - - var tree = this.listenerTree; - var name = type.shift(); - - while (name) { - - if (!tree[name]) { - tree[name] = new Object; - } - - tree = tree[name]; - - if (type.length === 0) { - - if (!tree._listeners) { - tree._listeners = listener; - } - else if(typeof tree._listeners === 'function') { - tree._listeners = [tree._listeners, listener]; - } - else if (isArray(tree._listeners)) { - - tree._listeners.push(listener); - - if (!tree._listeners.warned) { - - var m = defaultMaxListeners; - - if (m > 0 && tree._listeners.length > m) { - - tree._listeners.warned = true; - console.error('(node) warning: possible EventEmitter memory ' + - 'leak detected. %d listeners added. ' + - 'Use emitter.setMaxListeners() to increase limit.', - tree._listeners.length); - console.trace(); - } - } - } - return true; - } - name = type.shift(); - } - return true; - }; - - // By default EventEmitters will print a warning if more than - // 10 listeners are added to it. This is a useful default which - // helps finding memory leaks. - // - // Obviously not all Emitters should be limited to 10. This function allows - // that to be increased. Set to zero for unlimited. - - EventEmitter.prototype.setMaxListeners = function(n) { - this._events || init.call(this); - this._events.maxListeners = n; - }; - - EventEmitter.prototype.event = ''; - - EventEmitter.prototype.once = function(event, fn) { - this.many(event, 1, fn); - return this; - }; - - EventEmitter.prototype.many = function(event, ttl, fn) { - var self = this; - - if (typeof fn !== 'function') { - throw new Error('many only accepts instances of Function'); - } - - function listener() { - if (--ttl === 0) { - self.off(event, listener); - } - fn.apply(null, arguments); - }; - - listener._origin = fn; - - this.on(event, listener); - - return self; - }; - - EventEmitter.prototype.emit = function() { - this._events || init.call(this); - - var type = arguments[0]; - - if (type === 'newListener') { - if (!this._events.newListener) { return false; } - } - - // Loop through the *_all* functions and invoke them. - if (this._all) { - var l = arguments.length; - var args = new Array(l - 1); - for (var i = 1; i < l; i++) args[i - 1] = arguments[i]; - for (i = 0, l = this._all.length; i < l; i++) { - this.event = type; - this._all[i].apply(this, args); - } - } - - // If there is no 'error' event listener then throw. - if (type === 'error') { - - if (!this._all && - !this._events.error && - !(this.wildcard && this.listenerTree.error)) { - - if (arguments[1] instanceof Error) { - throw arguments[1]; // Unhandled 'error' event - } else { - throw new Error("Uncaught, unspecified 'error' event."); - } - return false; - } - } - - var handler; - - if(this.wildcard) { - handler = []; - var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); - searchListenerTree.call(this, handler, ns, this.listenerTree, 0); - } - else { - handler = this._events[type]; - } - - if (typeof handler === 'function') { - this.event = type; - if (arguments.length === 1) { - handler.call(this); - } - else if (arguments.length > 1) - switch (arguments.length) { - case 2: - handler.call(this, arguments[1]); - break; - case 3: - handler.call(this, arguments[1], arguments[2]); - break; - // slower - default: - var l = arguments.length; - var args = new Array(l - 1); - for (var i = 1; i < l; i++) args[i - 1] = arguments[i]; - handler.apply(this, args); - } - return true; - } - else if (handler) { - var l = arguments.length; - var args = new Array(l - 1); - for (var i = 1; i < l; i++) args[i - 1] = arguments[i]; - - var listeners = handler.slice(); - for (var i = 0, l = listeners.length; i < l; i++) { - this.event = type; - listeners[i].apply(this, args); - } - return true; - } - - }; - - EventEmitter.prototype.on = function(type, listener) { - this._events || init.call(this); - - // To avoid recursion in the case that type == "newListeners"! Before - // adding it to the listeners, first emit "newListeners". - this.emit('newListener', type, listener); - - if(this.wildcard) { - growListenerTree.call(this, type, listener); - return this; - } - - if (!this._events[type]) { - // Optimize the case of one listener. Don't need the extra array object. - this._events[type] = listener; - } - else if(typeof this._events[type] === 'function') { - // Adding the second element, need to change to array. - this._events[type] = [this._events[type], listener]; - } - else if (isArray(this._events[type])) { - // If we've already got an array, just append. - this._events[type].push(listener); - - // Check for listener leak - if (!this._events[type].warned) { - - var m; - if (this._events.maxListeners !== undefined) { - m = this._events.maxListeners; - } else { - m = defaultMaxListeners; - } - - if (m && m > 0 && this._events[type].length > m) { - - this._events[type].warned = true; - console.error('(node) warning: possible EventEmitter memory ' + - 'leak detected. %d listeners added. ' + - 'Use emitter.setMaxListeners() to increase limit.', - this._events[type].length); - console.trace(); - } - } - } - return this; - }; - - EventEmitter.prototype.onAny = function(fn) { - - if(!this._all) { - this._all = []; - } - - if (typeof fn !== 'function') { - throw new Error('onAny only accepts instances of Function'); - } - - // Add the function to the event listener collection. - this._all.push(fn); - return this; - }; - - EventEmitter.prototype.addListener = EventEmitter.prototype.on; - - EventEmitter.prototype.off = function(type, listener) { - if (typeof listener !== 'function') { - throw new Error('removeListener only takes instances of Function'); - } - - var handlers; - - if(this.wildcard) { - var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); - var leaf = searchListenerTree.call(this, null, ns, this.listenerTree, 0); - - if('undefined' === typeof leaf) { return this; } - handlers = leaf._listeners; - } - else { - // does not use listeners(), so no side effect of creating _events[type] - if (!this._events[type]) return this; - handlers = this._events[type]; - } - - if (isArray(handlers)) { - - var position = -1; - - for (var i = 0, length = handlers.length; i < length; i++) { - if (handlers[i] === listener || - (handlers[i].listener && handlers[i].listener === listener) || - (handlers[i]._origin && handlers[i]._origin === listener)) { - position = i; - break; - } - } - - if (position < 0) { - return this; - } - - if(this.wildcard) { - leaf._listeners.splice(position, 1) - } - else { - this._events[type].splice(position, 1); - } - - if (handlers.length === 0) { - if(this.wildcard) { - delete leaf._listeners; - } - else { - delete this._events[type]; - } - } - } - else if (handlers === listener || - (handlers.listener && handlers.listener === listener) || - (handlers._origin && handlers._origin === listener)) { - if(this.wildcard) { - delete leaf._listeners; - } - else { - delete this._events[type]; - } - } - - return this; - }; - - EventEmitter.prototype.offAny = function(fn) { - var i = 0, l = 0, fns; - if (fn && this._all && this._all.length > 0) { - fns = this._all; - for(i = 0, l = fns.length; i < l; i++) { - if(fn === fns[i]) { - fns.splice(i, 1); - return this; - } - } - } else { - this._all = []; - } - return this; - }; - - EventEmitter.prototype.removeListener = EventEmitter.prototype.off; - - EventEmitter.prototype.removeAllListeners = function(type) { - if (arguments.length === 0) { - !this._events || init.call(this); - return this; - } - - if(this.wildcard) { - var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); - var leaf = searchListenerTree.call(this, null, ns, this.listenerTree, 0); - - if('undefined' === typeof leaf) { return this; } - leaf._listeners = null; - } - else { - if (!this._events[type]) return this; - this._events[type] = null; - } - return this; - }; - - EventEmitter.prototype.listeners = function(type) { - if(this.wildcard) { - var handlers = []; - var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); - searchListenerTree.call(this, handlers, ns, this.listenerTree, 0); - return handlers; - } - - this._events || init.call(this); - - if (!this._events[type]) this._events[type] = []; - if (!isArray(this._events[type])) { - this._events[type] = [this._events[type]]; - } - return this._events[type]; - }; - - EventEmitter.prototype.listenersAny = function() { - - if(this._all) { - return this._all; - } - else { - return []; - } - - }; - - exports.EventEmitter2 = EventEmitter; - -}(typeof exports === 'undefined' ? window : exports); diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/export.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/export.js deleted file mode 100644 index 21a4415..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/export.js +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env node -// Export Follow in browser-friendly format. -// -// Copyright 2011 Iris Couch -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -var fs = require('fs') - , path = require('path') - ; - -if(process.argv[1] === module.filename) { - var source = process.argv[2] - , dest = process.argv[3] - ; - - if(!source || !dest) - throw new Error("usage: browser-export.js "); - - install(source, dest, function(er) { - if(er) throw er; - }); -} - -function install(filename, target, callback) { - //console.log('Exporting: ' + filename); - fs.readFile(filename, null, function(er, content) { - if(er && er.errno) er = new Error(er.stack); // Make a better stack trace. - if(er) return callback(er); - - // Strip the shebang. - content = content.toString('utf8'); - var content_lines = content.split(/\n/); - content_lines[0] = content_lines[0].replace(/^(#!.*)$/, '// $1'); - - // TODO - // content_lines.join('\n'), maybe new Buffer of that - - //Convert the Node module (CommonJS) to RequireJS. - var require_re = /\brequire\(['"]([\w\d\-_\/\.]+?)['"]\)/g; - - // No idea why I'm doing this but it's cool. - var match, dependencies = {}; - while(match = require_re.exec(content)) - dependencies[ match[1] ] = true; - dependencies = Object.keys(dependencies); - dependencies.forEach(function(dep) { - //console.log(' depends: ' + dep); - }) - - // In order to keep the error message line numbers correct, this makes an ugly final file. - content = [ 'require.def(function(require, exports, module) {' - //, 'var module = {};' - //, 'var exports = {};' - //, 'module.exports = exports;' - , '' - , content_lines.join('\n') - , '; return(module.exports);' - , '}); // define' - ].join(''); - //content = new Buffer(content); - - fs.writeFile(target, content, 'utf8', function(er) { - if(er) return callback(er); - return callback(); - }) - }) -} diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/index.html b/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/index.html deleted file mode 100644 index 3b02388..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/index.html +++ /dev/null @@ -1,14 +0,0 @@ - - - - - Follow - - -
        Booting...
        -
        -
        - - - - diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/jquery-1.6.1.min.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/jquery-1.6.1.min.js deleted file mode 100644 index b2ac174..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/jquery-1.6.1.min.js +++ /dev/null @@ -1,18 +0,0 @@ -/*! - * jQuery JavaScript Library v1.6.1 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Thu May 12 15:04:36 2011 -0400 - */ -(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!cj[a]){var b=f("<"+a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d===""){ck||(ck=c.createElement("iframe"),ck.frameBorder=ck.width=ck.height=0),c.body.appendChild(ck);if(!cl||!ck.createElement)cl=(ck.contentWindow||ck.contentDocument).document,cl.write("");b=cl.createElement(a),cl.body.appendChild(b),d=f.css(b,"display"),c.body.removeChild(ck)}cj[a]=d}return cj[a]}function cu(a,b){var c={};f.each(cp.concat.apply([],cp.slice(0,b)),function(){c[this]=a});return c}function ct(){cq=b}function cs(){setTimeout(ct,0);return cq=f.now()}function ci(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ch(){try{return new a.XMLHttpRequest}catch(b){}}function cb(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g=0===c})}function W(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function O(a,b){return(a&&a!=="*"?a+".":"")+b.replace(A,"`").replace(B,"&")}function N(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;ic)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function L(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function F(){return!0}function E(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"$1-$2").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function H(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(H,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=d.userAgent,x,y,z,A=Object.prototype.toString,B=Object.prototype.hasOwnProperty,C=Array.prototype.push,D=Array.prototype.slice,E=String.prototype.trim,F=Array.prototype.indexOf,G={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.1",length:0,size:function(){return this.length},toArray:function(){return D.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?C.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),y.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(D.apply(this,arguments),"slice",D.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:C,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;y.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!y){y=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",z,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",z),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&H()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):G[A.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;if(a.constructor&&!B.call(a,"constructor")&&!B.call(a.constructor.prototype,"isPrototypeOf"))return!1;var c;for(c in a);return c===b||B.call(a,c)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(b,c,d){a.DOMParser?(d=new DOMParser,c=d.parseFromString(b,"text/xml")):(c=new ActiveXObject("Microsoft.XMLDOM"),c.async="false",c.loadXML(b)),d=c.documentElement,(!d||!d.nodeName||d.nodeName==="parsererror")&&e.error("Invalid XML: "+b);return c},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c
        a",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};f=c.createElement("select"),g=f.appendChild(c.createElement("option")),h=a.getElementsByTagName("input")[0],j={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:h.value==="on",optSelected:g.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},h.checked=!0,j.noCloneChecked=h.cloneNode(!0).checked,f.disabled=!0,j.optDisabled=!g.disabled;try{delete a.test}catch(s){j.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function b(){j.noCloneEvent=!1,a.detachEvent("onclick",b)}),a.cloneNode(!0).fireEvent("onclick")),h=c.createElement("input"),h.value="t",h.setAttribute("type","radio"),j.radioValue=h.value==="t",h.setAttribute("checked","checked"),a.appendChild(h),k=c.createDocumentFragment(),k.appendChild(a.firstChild),j.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",l=c.createElement("body"),m={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"};for(q in m)l.style[q]=m[q];l.appendChild(a),b.insertBefore(l,b.firstChild),j.appendChecked=h.checked,j.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,j.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="
        ",j.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="
        t
        ",n=a.getElementsByTagName("td"),r=n[0].offsetHeight===0,n[0].style.display="",n[1].style.display="none",j.reliableHiddenOffsets=r&&n[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(i=c.createElement("div"),i.style.width="0",i.style.marginRight="0",a.appendChild(i),j.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(i,null)||{marginRight:0}).marginRight,10)||0)===0),l.innerHTML="",b.removeChild(l);if(a.attachEvent)for(q in{submit:1,change:1,focusin:1})p="on"+q,r=p in a,r||(a.setAttribute(p,"return;"),r=typeof a[p]=="function"),j[q+"Bubbles"]=r;return j}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([a-z])([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g=f.expando,h=typeof c=="string",i,j=a.nodeType,k=j?f.cache:a,l=j?a[f.expando]:a[f.expando]&&f.expando;if((!l||e&&l&&!k[l][g])&&h&&d===b)return;l||(j?a[f.expando]=l=++f.uuid:l=f.expando),k[l]||(k[l]={},j||(k[l].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?k[l][g]=f.extend(k[l][g],c):k[l]=f.extend(k[l],c);i=k[l],e&&(i[g]||(i[g]={}),i=i[g]),d!==b&&(i[f.camelCase(c)]=d);if(c==="events"&&!i[c])return i[g]&&i[g].events;return h?i[f.camelCase(c)]:i}},removeData:function(b,c,d){if(!!f.acceptData(b)){var e=f.expando,g=b.nodeType,h=g?f.cache:b,i=g?b[f.expando]:f.expando;if(!h[i])return;if(c){var j=d?h[i][e]:h[i];if(j){delete j[c];if(!l(j))return}}if(d){delete h[i][e];if(!l(h[i]))return}var k=h[i][e];f.support.deleteExpando||h!=a?delete h[i]:h[i]=null,k?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=k):g&&(f.support.deleteExpando?delete b[f.expando]:b.removeAttribute?b.removeAttribute(f.expando):b[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;return(e.value||"").replace(p,"")}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);c=j&&f.attrFix[c]||c,i=f.attrHooks[c],i||(!t.test(c)||typeof d!="boolean"&&d!==b&&d.toLowerCase()!==c.toLowerCase()?v&&(f.nodeName(a,"form")||u.test(c))&&(i=v):i=w);if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j)return i.get(a,c);h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.support.getSetAttribute?a.removeAttribute(b):(f.attr(a,b,""),a.removeAttributeNode(a.getAttributeNode(b))),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},tabIndex:{get:function(a){var c=a.getAttributeNode("tabIndex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);c=i&&f.propFix[c]||c,h=f.propHooks[c];return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==b?g:a[c]},propHooks:{}}),w={get:function(a,c){return a[f.propFix[c]||c]?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=b),a.setAttribute(c,c.toLowerCase()));return c}},f.attrHooks.value={get:function(a,b){if(v&&f.nodeName(a,"button"))return v.get(a,b);return a.value},set:function(a,b,c){if(v&&f.nodeName(a,"button"))return v.set(a,b,c);a.value=b}},f.support.getSetAttribute||(f.attrFix=f.propFix,v=f.attrHooks.name=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,c){var d=a.getAttributeNode(c);if(d){d.nodeValue=b;return b}}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex)}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var x=Object.prototype.hasOwnProperty,y=/\.(.*)$/,z=/^(?:textarea|input|select)$/i,A=/\./g,B=/ /g,C=/[^\w\s.|`]/g,D=function(a){return a.replace(C,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=E;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=E);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),D).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem -)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},K=function(c){var d=c.target,e,g;if(!!z.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=J(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:K,beforedeactivate:K,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&K.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&K.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",J(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in I)f.event.add(this,c+".specialChange",I[c]);return z.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return z.test(this.nodeName)}},I=f.event.special.change.filters,I.focus=I.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

        ";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
        ";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g0)for(h=g;h0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=U.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a||typeof a=="string")return f.inArray(this[0],a?f(a):this.parent().children());return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(W(c[0])||W(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=T.call(arguments);P.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!V[a]?f.unique(e):e,(this.length>1||R.test(d))&&Q.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var Y=/ jQuery\d+="(?:\d+|null)"/g,Z=/^\s+/,$=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,_=/<([\w:]+)/,ba=/",""],legend:[1,"
        ","
        "],thead:[1,"","
        "],tr:[2,"","
        "],td:[3,"","
        "],col:[2,"","
        "],area:[1,"",""],_default:[0,"",""]};bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
        ","
        "]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Y,""):null;if(typeof a=="string"&&!bc.test(a)&&(f.support.leadingWhitespace||!Z.test(a))&&!bg[(_.exec(a)||["",""])[1].toLowerCase()]){a=a.replace($,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bj(a,d),e=bk(a),g=bk(d);for(h=0;e[h];++h)bj(e[h],g[h])}if(b){bi(a,d);if(c){e=bk(a),g=bk(d);for(h=0;e[h];++h)bi(e[h],g[h])}}return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument|| -b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!bb.test(k))k=b.createTextNode(k);else{k=k.replace($,"<$1>");var l=(_.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=ba.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&Z.test(k)&&o.insertBefore(b.createTextNode(Z.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bp.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle;c.zoom=1;var e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.filter=bo.test(g)?g.replace(bo,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,c){var d,e,g;c=c.replace(br,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bs.test(d)&&bt.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bE=/%20/g,bF=/\[\]$/,bG=/\r?\n/g,bH=/#.*$/,bI=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bJ=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bK=/^(?:about|app|app\-storage|.+\-extension|file|widget):$/,bL=/^(?:GET|HEAD)$/,bM=/^\/\//,bN=/\?/,bO=/)<[^<]*)*<\/script>/gi,bP=/^(?:select|textarea)/i,bQ=/\s+/,bR=/([?&])_=[^&]*/,bS=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bT=f.fn.load,bU={},bV={},bW,bX;try{bW=e.href}catch(bY){bW=c.createElement("a"),bW.href="",bW=bW.href}bX=bS.exec(bW.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bT)return bT.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
        ").append(c.replace(bO,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bP.test(this.nodeName)||bJ.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bG,"\r\n")}}):{name:b.name,value:c.replace(bG,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?f.extend(!0,a,f.ajaxSettings,b):(b=a,a=f.extend(!0,f.ajaxSettings,b));for(var c in{context:1,url:1})c in b?a[c]=b[c]:c in f.ajaxSettings&&(a[c]=f.ajaxSettings[c]);return a},ajaxSettings:{url:bW,isLocal:bK.test(bX[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":"*/*"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML}},ajaxPrefilter:bZ(bU),ajaxTransport:bZ(bV),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a?4:0;var o,r,u,w=l?ca(d,v,l):b,x,y;if(a>=200&&a<300||a===304){if(d.ifModified){if(x=v.getResponseHeader("Last-Modified"))f.lastModified[k]=x;if(y=v.getResponseHeader("Etag"))f.etag[k]=y}if(a===304)c="notmodified",o=!0;else try{r=cb(d,w),c="success",o=!0}catch(z){c="parsererror",u=z}}else{u=c;if(!c||a)c="error",a<0&&(a=0)}v.status=a,v.statusText=c,o?h.resolveWith(e,[r,c,v]):h.rejectWith(e,[v,c,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,c]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bI.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bH,"").replace(bM,bX[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bQ),d.crossDomain==null&&(r=bS.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bX[1]&&r[2]==bX[2]&&(r[3]||(r[1]==="http:"?80:443))==(bX[3]||(bX[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bU,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bL.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bN.test(d.url)?"&":"?")+d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bR,"$1_="+x);d.url=y+(y===d.url?(bN.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", */*; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bV,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){status<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)b_(g,a[g],c,e);return d.join("&").replace(bE,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cc=f.now(),cd=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cc++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(cd.test(b.url)||e&&cd.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(cd,l),b.url===j&&(e&&(k=k.replace(cd,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var ce=a.ActiveXObject?function(){for(var a in cg)cg[a](0,1)}:!1,cf=0,cg;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ch()||ci()}:ch,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,ce&&delete cg[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cf,ce&&(cg||(cg={},f(a).unload(ce)),cg[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cj={},ck,cl,cm=/^(?:toggle|show|hide)$/,cn=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,co,cp=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cq,cr=a.webkitRequestAnimationFrame||a.mozRequestAnimationFrame||a.oRequestAnimationFrame;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b
        ";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){return this[0]?parseFloat(f.css(this[0],d,"padding")):null},f.fn["outer"+c]=function(a){return this[0]?parseFloat(f.css(this[0],d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c];return e.document.compatMode==="CSS1Compat"&&g||e.document.body["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var h=f.css(e,d),i=parseFloat(h);return f.isNaN(i)?h:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window); \ No newline at end of file diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/log4js.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/log4js.js deleted file mode 100644 index 7684bc4..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/log4js.js +++ /dev/null @@ -1,46 +0,0 @@ -// log4js stub -// - -define(['querystring'], function(querystring) { - function noop() {}; - function trace(str) { return console.trace(str) } - function log(str) { return console.log(str) } - - function is_verbose() { - return !! querystring.parse(window.location.search).verbose; - } - - function con(str) { - var con = jQuery('#con'); - var html = con.html(); - con.html(html + str + "
        "); - } - - function debug(str) { - if(is_verbose()) - con(str); - return console.debug(str); - } - - function out(str) { - con(str); - log(str); - } - - var err = out; - - var noops = { "trace": trace - , "debug": debug - , "info" : out - , "warn" : err - , "error": err - , "fatal": err - - , "setLevel": noop - } - - return function() { - return { 'getLogger': function() { return noops } - } - } -}) diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/main.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/main.js deleted file mode 100644 index c836f79..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/main.js +++ /dev/null @@ -1,92 +0,0 @@ -window.process = { env: {} }; - -if(!Object.keys) - Object.keys = function(o){ - if(typeof o !== 'object') - throw new Error('Object.keys called on non-object: ' + JSON.stringify(o)); - var ret=[], p; - for (p in o) - if(Object.prototype.hasOwnProperty.call(o,p)) - ret.push(p); - return ret; - } - -if(!Array.isArray) - Array.isArray = function(o) { - return Object.prototype.toString.call(o) === '[object Array]'; - } - -if(!Array.prototype.forEach) - Array.prototype.forEach = function(callback) { - var i, len = this.length; - for(var i = 0; i < len; i++) - callback(this[i], i, this); - } - -if(!Array.prototype.reduce) - Array.prototype.reduce = function(callback, state) { - var i, len = this.length; - for(i = 0; i < len; i++) - state = callback(state, this[i]); - return state; - } - -if(!Array.prototype.filter) - Array.prototype.filter = function(pred) { - var i, len = this.length, result = []; - for(i = 0; i < len; i++) - if(!! pred(this[i])) - result.push(this[i]); - return result; - } - -if(!Array.prototype.map) - Array.prototype.map = function(func) { - var i, len = this.length, result = []; - for(i = 0; i < len; i++) - result.push(func(this[i], i, this)); - return result; - } - - -if(!window.console) - window.console = {}; - -; ['trace', 'debug', 'log', 'info', 'warn', 'error', 'fatal'].forEach(function(lev) { - window.console[lev] = window.console[lev] || function() {}; -}) - -define(['events', 'querystring', 'follow/cli'], function(events, querystring, cli) { - var welcome = [ 'Starting Follow.' - , 'Follow Follow' - , 'at GitHub.' - ]; - jQuery('#boot').html('

        ' + welcome.join(' ') + '

        '); - - // Set up some faux Node stuff. - events.EventEmitter = events.EventEmitter2; - var process = window.process = new events.EventEmitter; - - process.env = querystring.parse(window.location.search.slice(1)); - - process.stdout = {}; - process.stdout.write = function(x) { - var con = jQuery('#con'); - con.append(x); - } - - process.exit = function(code) { - if(code === 0) - console.log("'EXIT' " + code); - else - console.error("'EXIT' " + code); - } - - - return function() { // main() - console.log('Main running'); - - try { cli.main() } - catch(er) { console.log("Error starting tests"); console.log(er) } - } -}) diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/querystring.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/querystring.js deleted file mode 100644 index 58b9aa2..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/querystring.js +++ /dev/null @@ -1,28 +0,0 @@ -define([], function() { - var exports = {}; - - exports.parse = function(str) { - var result = {}; - - str = str || ""; - str = str.replace(/^\?/, ""); - if(!str) return result; - - var kvs = str.split('&'); - kvs.forEach(function(pair) { - var both = pair.split('='); - result[both[0]] = both[1]; - }) - - return result; - } - - exports.stringify = function(query) { - var result = []; - for (var k in query) - result.push(k + '=' + encodeURIComponent(query[k])); - return result.join('&'); - } - - return exports; -}) diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/request.jquery.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/request.jquery.js deleted file mode 100644 index c093e08..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/request.jquery.js +++ /dev/null @@ -1,237 +0,0 @@ -(function() { -var define = window.define -if(!define) define = function(deps, definer) { - if(!window.jQuery) - throw new Error("Can't find jQuery"); - return definer(window.jQuery); -} - -define(['jquery'], function(jQuery) { - -// -// request.jquery -// - -var DEFAULT_TIMEOUT = 3 * 60 * 1000; // 3 minutes - -function request(options, callback) { - var options_onResponse = options.onResponse; // Save this for later. - - if(typeof options === 'string') - options = {'uri':options}; - else - options = JSON.parse(JSON.stringify(options)); // Use a duplicate for mutating. - - if(options.url) { - options.uri = options.url; - delete options.url; - } - - if(!options.uri && options.uri !== "") - throw new Error("options.uri is a required argument"); - - if(options.json) { - options.body = JSON.stringify(options.json); - delete options.json; - } - - if(typeof options.uri != "string") - throw new Error("options.uri must be a string"); - - ; ['proxy', '_redirectsFollowed', 'maxRedirects', 'followRedirect'].forEach(function(opt) { - if(options[opt]) - throw new Error("options." + opt + " is not supported"); - }) - - options.method = options.method || 'GET'; - options.headers = options.headers || {}; - - if(options.headers.host) - throw new Error("Options.headers.host is not supported"); - - // onResponse is just like the callback but that is not quite what Node request does. - callback = callback || options_onResponse; - - /* - // Browsers do not like this. - if(options.body) - options.headers['content-length'] = options.body.length; - */ - - var headers = {}; - var beforeSend = function(xhr, settings) { - if(!options.headers.authorization && options.auth) { - debugger - options.headers.authorization = 'Basic ' + b64_enc(options.auth.username + ':' + options.auth.password); - } - - for (var key in options.headers) - xhr.setRequestHeader(key, options.headers[key]); - } - - // Establish a place where the callback arguments will go. - var result = []; - - function fix_xhr(xhr) { - var fixed_xhr = {}; - for (var key in xhr) - fixed_xhr[key] = xhr[key]; - fixed_xhr.statusCode = xhr.status; - return fixed_xhr; - } - - var onSuccess = function(data, reason, xhr) { - result = [null, fix_xhr(xhr), data]; - } - - var onError = function (xhr, reason, er) { - var body = undefined; - - if(reason == 'timeout') { - er = er || new Error("Request timeout"); - } else if(reason == 'error') { - if(xhr.status > 299 && xhr.responseText.length > 0) { - // Looks like HTTP worked, so there is no error as far as request is concerned. Simulate a success scenario. - er = null; - body = xhr.responseText; - } - } else { - er = er || new Error("Unknown error; reason = " + reason); - } - - result = [er, fix_xhr(xhr), body]; - } - - var onComplete = function(xhr, reason) { - if(result.length === 0) - result = [new Error("Result does not exist at completion time")]; - return callback && callback.apply(this, result); - } - - - var cors_creds = !!( options.creds || options.withCredentials ); - - return jQuery.ajax({ 'async' : true - , 'cache' : (options.cache || false) - , 'contentType': (options.headers['content-type'] || 'application/x-www-form-urlencoded') - , 'type' : options.method - , 'url' : options.uri - , 'data' : (options.body || undefined) - , 'timeout' : (options.timeout || request.DEFAULT_TIMEOUT) - , 'dataType' : 'text' - , 'processData': false - , 'beforeSend' : beforeSend - , 'success' : onSuccess - , 'error' : onError - , 'complete' : onComplete - , 'xhrFields' : { 'withCredentials': cors_creds - } - }); - -}; - -request.withCredentials = false; -request.DEFAULT_TIMEOUT = DEFAULT_TIMEOUT; - -var shortcuts = [ 'get', 'put', 'post', 'head' ]; -shortcuts.forEach(function(shortcut) { - var method = shortcut.toUpperCase(); - var func = shortcut.toLowerCase(); - - request[func] = function(opts) { - if(typeof opts === 'string') - opts = {'method':method, 'uri':opts}; - else { - opts = JSON.parse(JSON.stringify(opts)); - opts.method = method; - } - - var args = [opts].concat(Array.prototype.slice.apply(arguments, [1])); - return request.apply(this, args); - } -}) - -request.json = function(options, callback) { - options = JSON.parse(JSON.stringify(options)); - options.headers = options.headers || {}; - options.headers['accept'] = options.headers['accept'] || 'application/json'; - - if(options.method !== 'GET') - options.headers['content-type'] = 'application/json'; - - return request(options, function(er, resp, body) { - if(!er) - body = JSON.parse(body) - return callback && callback(er, resp, body); - }) -} - -request.couch = function(options, callback) { - return request.json(options, function(er, resp, body) { - if(er) - return callback && callback(er, resp, body); - - if((resp.status < 200 || resp.status > 299) && body.error) - // The body is a Couch JSON object indicating the error. - return callback && callback(body, resp); - - return callback && callback(er, resp, body); - }) -} - -jQuery(document).ready(function() { - jQuery.request = request; -}) - -return request; - -}); - -// -// Utility -// - -// MIT License from http://phpjs.org/functions/base64_encode:358 -function b64_enc (data) { - // Encodes string using MIME base64 algorithm - var b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; - var o1, o2, o3, h1, h2, h3, h4, bits, i = 0, ac = 0, enc="", tmp_arr = []; - - if (!data) { - return data; - } - - // assume utf8 data - // data = this.utf8_encode(data+''); - - do { // pack three octets into four hexets - o1 = data.charCodeAt(i++); - o2 = data.charCodeAt(i++); - o3 = data.charCodeAt(i++); - - bits = o1<<16 | o2<<8 | o3; - - h1 = bits>>18 & 0x3f; - h2 = bits>>12 & 0x3f; - h3 = bits>>6 & 0x3f; - h4 = bits & 0x3f; - - // use hexets to index into b64, and append result to encoded string - tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4); - } while (i < data.length); - - enc = tmp_arr.join(''); - - switch (data.length % 3) { - case 1: - enc = enc.slice(0, -2) + '=='; - break; - case 2: - enc = enc.slice(0, -1) + '='; - break; - } - - return enc; -} - -})(); diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/require.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/require.js deleted file mode 100644 index 7ab5bf1..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/require.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - RequireJS 0.26.0 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved. - Available via the MIT or new BSD license. - see: http://github.com/jrburke/requirejs for details -*/ -var requirejs,require,define; -(function(){function M(a){return $.call(a)==="[object Function]"}function E(a){return $.call(a)==="[object Array]"}function V(a,c,g){for(var e in c)if(!(e in J)&&(!(e in a)||g))a[e]=c[e];return d}function R(a,c,d){a=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+a);if(d)a.originalError=d;return a}function aa(a,c,d){var e,x,j;for(e=0;j=c[e];e++){j=typeof j==="string"?{name:j}:j;x=j.location;if(d&&(!x||x.indexOf("/")!==0&&x.indexOf(":")===-1))x=d+"/"+(x||j.name);a[j.name]={name:j.name,location:x|| -j.name,main:(j.main||"main").replace(fa,"").replace(ba,"")}}}function W(a,d){a.holdReady?a.holdReady(d):d?a.readyWait+=1:a.ready(!0)}function ga(a){function c(b,h){var n,o;if(b&&b.charAt(0)==="."&&h){p.pkgs[h]?h=[h]:(h=h.split("/"),h=h.slice(0,h.length-1));n=b=h.concat(b.split("/"));var a;for(o=0;a=n[o];o++)if(a===".")n.splice(o,1),o-=1;else if(a==="..")if(o===1&&(n[2]===".."||n[0]===".."))break;else o>0&&(n.splice(o-1,2),o-=2);o=p.pkgs[n=b[0]];b=b.join("/");o&&b===n+"/"+o.main&&(b=n)}return b}function g(b, -h){var n=b?b.indexOf("!"):-1,o=null,a=h?h.name:null,ha=b,g,l;n!==-1&&(o=b.substring(0,n),b=b.substring(n+1,b.length));o&&(o=c(o,a));b&&(g=o?(n=m[o])?n.normalize?n.normalize(b,function(b){return c(b,a)}):c(b,a):"__$p"+a+"@"+(b||""):c(b,a),l=E[g],l||(l=d.toModuleUrl?d.toModuleUrl(f,g,h):f.nameToUrl(g,null,h),E[g]=l));return{prefix:o,name:g,parentMap:h,url:l,originalName:ha,fullName:o?o+"!"+(g||""):g}}function e(){var b=!0,h=p.priorityWait,n,a;if(h){for(a=0;n=h[a];a++)if(!s[n]){b=!1;break}b&&delete p.priorityWait}return b} -function x(b){return function(h){b.exports=h}}function j(b,h,n){return function(){var a=[].concat(ia.call(arguments,0)),d;if(n&&M(d=a[a.length-1]))d.__requireJsBuild=!0;a.push(h);return b.apply(null,a)}}function q(b,h){var a=j(f.require,b,h);V(a,{nameToUrl:j(f.nameToUrl,b),toUrl:j(f.toUrl,b),defined:j(f.requireDefined,b),specified:j(f.requireSpecified,b),ready:d.ready,isBrowser:d.isBrowser});if(d.paths)a.paths=d.paths;return a}function v(b){var h=b.prefix,a=b.fullName;y[a]||a in m||(h&&!K[h]&&(K[h]= -void 0,(S[h]||(S[h]=[])).push(b),(t[h]||(t[h]=[])).push({onDep:function(b){if(b===h){var a,n,d,c,f,e,j=S[h];if(j)for(d=0;a=j[d];d++)if(b=a.fullName,a=g(a.originalName,a.parentMap),a=a.fullName,n=t[b]||[],c=t[a],a!==b){b in y&&(delete y[b],y[a]=!0);t[a]=c?c.concat(n):n;delete t[b];for(c=0;c0)){if(p.priorityWait)if(e())G();else return;for(k in s)if(!(k in J)&&(c=!0,!s[k]))if(a)b+=k+" ";else{g=!0;break}if(c||f.waitCount){if(a&&b)return k=R("timeout","Load timeout for modules: "+b),k.requireType="timeout",k.requireModules= -b,d.onError(k);if(g||f.scriptCount){if((B||ca)&&!X)X=setTimeout(function(){X=0;A()},50)}else{if(f.waitCount){for(H=0;b=I[H];H++)C(b,{});Y<5&&(Y+=1,A())}Y=0;d.checkReadyState()}}}}function D(b,a){var c=a.name,e=a.fullName,g;if(!(e in m||e in s))K[b]||(K[b]=m[b]),s[e]||(s[e]=!1),g=function(g){if(d.onPluginLoad)d.onPluginLoad(f,b,c,g);w({prefix:a.prefix,name:a.name,fullName:a.fullName,callback:function(){return g}});s[e]=!0},g.fromText=function(b,a){var c=N;f.loaded[b]=!1;f.scriptCount+=1;c&&(N=!1); -d.exec(a);c&&(N=!0);f.completeLoad(b)},K[b].load(c,q(a.parentMap,!0),g,p)}function L(b){b.prefix&&b.name&&b.name.indexOf("__$p")===0&&m[b.prefix]&&(b=g(b.originalName,b.parentMap));var a=b.prefix,c=b.fullName,e=f.urlFetched;!y[c]&&!s[c]&&(y[c]=!0,a?m[a]?D(a,b):(O[a]||(O[a]=[],(t[a]||(t[a]=[])).push({onDep:function(b){if(b===a){for(var c,d=O[a],b=0;b0;m--)if(i=e.slice(0,m).join("/"),g[i]){e.splice(0,m,g[i]);break}else if(i=j[i]){b=b===i.name?i.location+"/"+i.main:i.location;e.splice(0,m,b);break}a=e.join("/")+(a||".js");a=(a.charAt(0)==="/"||a.match(/^\w+:/)?"":l.baseUrl)+a}return l.urlArgs?a+((a.indexOf("?")===-1?"?":"&")+l.urlArgs):a}};f.jQueryCheck=T;f.resume=G;return f}function la(){var a, -c,d;if(C&&C.readyState==="interactive")return C;a=document.getElementsByTagName("script");for(c=a.length-1;c>-1&&(d=a[c]);c--)if(d.readyState==="interactive")return C=d;return null}var ma=/(\/\*([\s\S]*?)\*\/|\/\/(.*)$)/mg,na=/require\(\s*["']([^'"\s]+)["']\s*\)/g,fa=/^\.\//,ba=/\.js$/,$=Object.prototype.toString,q=Array.prototype,ia=q.slice,ka=q.splice,B=!!(typeof window!=="undefined"&&navigator&&document),ca=!B&&typeof importScripts!=="undefined",oa=B&&navigator.platform==="PLAYSTATION 3"?/^complete$/: -/^(complete|loaded)$/,da=typeof opera!=="undefined"&&opera.toString()==="[object Opera]",ja="_r@@",J={},z={},U=[],C=null,Y=0,N=!1,d,q={},I,i,u,L,v,A,D,H,Q,ea,w,T,X;if(typeof define==="undefined"){if(typeof requirejs!=="undefined")if(M(requirejs))return;else q=requirejs,requirejs=void 0;typeof require!=="undefined"&&!M(require)&&(q=require,require=void 0);d=requirejs=function(a,c,d){var e="_",i;!E(a)&&typeof a!=="string"&&(i=a,E(c)?(a=c,c=d):a=[]);if(i&&i.context)e=i.context;d=z[e]||(z[e]=ga(e));i&& -d.configure(i);return d.require(a,c)};d.config=function(a){return d(a)};typeof require==="undefined"&&(require=d);d.toUrl=function(a){return z._.toUrl(a)};d.version="0.26.0";d.isArray=E;d.isFunction=M;d.mixin=V;d.jsExtRegExp=/^\/|:|\?|\.js$/;i=d.s={contexts:z,skipAsync:{},isPageLoaded:!B,readyCalls:[]};if(d.isAsync=d.isBrowser=B)if(u=i.head=document.getElementsByTagName("head")[0],L=document.getElementsByTagName("base")[0])u=i.head=L.parentNode;d.onError=function(a){throw a;};d.load=function(a,c, -g){var e=a.loaded;e[c]||(e[c]=!1);a.scriptCount+=1;d.attach(g,a,c);if(a.jQuery&&!a.jQueryIncremented)W(a.jQuery,!0),a.jQueryIncremented=!0};define=d.def=function(a,c,g){var e,i;typeof a!=="string"&&(g=c,c=a,a=null);d.isArray(c)||(g=c,c=[]);!a&&!c.length&&d.isFunction(g)&&g.length&&(g.toString().replace(ma,"").replace(na,function(a,d){c.push(d)}),c=(g.length===1?["require"]:["require","exports","module"]).concat(c));if(N&&(e=I||la()))a||(a=e.getAttribute("data-requiremodule")),i=z[e.getAttribute("data-requirecontext")]; -(i?i.defQueue:U).push([a,c,g])};define.amd={multiversion:!0,plugins:!0,jQuery:!0};d.exec=function(a){return eval(a)};d.execCb=function(a,c,d,e){return c.apply(e,d)};d.onScriptLoad=function(a){var c=a.currentTarget||a.srcElement,g;if(a.type==="load"||oa.test(c.readyState))C=null,a=c.getAttribute("data-requirecontext"),g=c.getAttribute("data-requiremodule"),z[a].completeLoad(g),c.detachEvent&&!da?c.detachEvent("onreadystatechange",d.onScriptLoad):c.removeEventListener("load",d.onScriptLoad,!1)};d.attach= -function(a,c,g,e,q){var j;if(B)return e=e||d.onScriptLoad,j=c&&c.config&&c.config.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script"),j.type=q||"text/javascript",j.charset="utf-8",j.async=!i.skipAsync[a],c&&j.setAttribute("data-requirecontext",c.contextName),j.setAttribute("data-requiremodule",g),j.attachEvent&&!da?(N=!0,j.attachEvent("onreadystatechange",e)):j.addEventListener("load",e,!1),j.src=a,I=j,L?u.insertBefore(j,L):u.appendChild(j), -I=null,j;else if(ca)e=c.loaded,e[g]=!1,importScripts(a),c.completeLoad(g);return null};if(B){v=document.getElementsByTagName("script");for(H=v.length-1;H>-1&&(A=v[H]);H--){if(!u)u=A.parentNode;if(D=A.getAttribute("data-main")){if(!q.baseUrl)v=D.split("/"),A=v.pop(),v=v.length?v.join("/")+"/":"./",q.baseUrl=v,D=A.replace(ba,"");q.deps=q.deps?q.deps.concat(D):[D];break}}}i.baseUrl=q.baseUrl;d.pageLoaded=function(){if(!i.isPageLoaded){i.isPageLoaded=!0;Q&&clearInterval(Q);if(ea)document.readyState="complete"; -d.callReady()}};d.checkReadyState=function(){var a=i.contexts,c;for(c in a)if(!(c in J)&&a[c].waitCount)return;i.isDone=!0;d.callReady()};d.callReady=function(){var a=i.readyCalls,c,d,e;if(i.isPageLoaded&&i.isDone){if(a.length){i.readyCalls=[];for(c=0;d=a[c];c++)d()}a=i.contexts;for(e in a)if(!(e in J)&&(c=a[e],c.jQueryIncremented))W(c.jQuery,!1),c.jQueryIncremented=!1}};d.ready=function(a){i.isPageLoaded&&i.isDone?a():i.readyCalls.push(a);return d};if(B){if(document.addEventListener){if(document.addEventListener("DOMContentLoaded", -d.pageLoaded,!1),window.addEventListener("load",d.pageLoaded,!1),!document.readyState)ea=!0,document.readyState="loading"}else window.attachEvent&&(window.attachEvent("onload",d.pageLoaded),self===self.top&&(Q=setInterval(function(){try{document.body&&(document.documentElement.doScroll("left"),d.pageLoaded())}catch(a){}},30)));document.readyState==="complete"&&d.pageLoaded()}d(q);if(d.isAsync&&typeof setTimeout!=="undefined")w=i.contexts[q.context||"_"],w.requireWait=!0,setTimeout(function(){w.requireWait= -!1;w.takeGlobalQueue();w.jQueryCheck();w.scriptCount||w.resume();d.checkReadyState()},0)}})(); diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/util.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/util.js deleted file mode 100644 index f4c3d3f..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/browser/util.js +++ /dev/null @@ -1,28 +0,0 @@ -define([], function() { - var exports = {}; - - exports.inspect = JSON.stringify; - - // Copy from Node - /** - * Inherit the prototype methods from one constructor into another. - * - * The Function.prototype.inherits from lang.js rewritten as a standalone - * function (not on Function.prototype). NOTE: If this file is to be loaded - * during bootstrapping this function needs to be revritten using some native - * functions as prototype setup using normal JavaScript does not work as - * expected during bootstrapping (see mirror.js in r114903). - * - * @param {function} ctor Constructor function which needs to inherit the - * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. - */ - exports.inherits = function(ctor, superCtor) { - ctor.super_ = superCtor; - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { value: ctor, enumerable: false } - }); - }; - - return exports; -}) diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/cli.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/cli.js deleted file mode 100755 index cb17d36..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/cli.js +++ /dev/null @@ -1,101 +0,0 @@ -#!/usr/bin/env node -// The follow command-line interface. -// -// Copyright 2011 Iris Couch -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -var lib = require('./lib') - , couch_changes = require('./api') - ; - -function puts(str) { - process.stdout.write(str + "\n"); -} - -function main() { - var db = require.isBrowser ? (process.env.db || '/_users') : process.argv[2]; - puts('Watching: ' + db); - - var feed = new couch_changes.Feed(); - feed.db = db; - feed.since = (process.env.since === 'now') ? 'now' : parseInt(process.env.since || '0'); - - feed.heartbeat = (process.env.heartbeat || '3000').replace(/s$/, '000'); - feed.heartbeat = parseInt(feed.heartbeat); - - if(require.isBrowser) - feed.feed = 'longpoll'; - if(process.env.host) - feed.headers.host = process.env.host; - if(process.env.inactivity) - feed.inactivity_ms = parseInt(process.env.inactivity); - if(process.env.limit) - feed.limit = parseInt(process.env.limit); - - feed.query_params.pid = process.pid; - feed.filter = process.env.filter || example_filter; - function example_filter(doc, req) { - // This is a local filter. It runs on the client side. - var label = 'Filter ' + (req.query.pid || '::'); - - if(process.env.show_doc) - console.log(label + ' doc: ' + JSON.stringify(doc)); - if(process.env.show_req) - console.log(label + ' for ' + doc._id + ' req: ' + JSON.stringify(req)); - return true; - } - - feed.on('confirm', function() { - puts('Database confirmed: ' + db); - }) - - feed.on('change', function(change) { - puts('Change:' + JSON.stringify(change)); - }) - - feed.on('timeout', function(state) { - var seconds = state.elapsed_ms / 1000; - var hb = state.heartbeat / 1000; - puts('Timeout after ' + seconds + 's inactive, heartbeat=' + hb + 's'); - }) - - feed.on('retry', function(state) { - if(require.isBrowser) - puts('Long polling since ' + state.since); - else - puts('Retry since ' + state.since + ' after ' + state.after + 'ms'); - }) - - feed.on('response', function() { - puts('Streaming response:'); - }) - - feed.on('error', function(er) { - //console.error(er); - console.error('Changes error ============\n' + er.stack); - setTimeout(function() { process.exit(0) }, 100); - }) - - process.on('uncaughtException', function(er) { - puts('========= UNCAUGHT EXCEPTION; This is bad'); - puts(er.stack); - setTimeout(function() { process.exit(1) }, 100); - }) - - feed.follow(); -} - -exports.main = main; -if(!require.isBrowser && process.argv[1] == module.filename) - main(); diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/lib/feed.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/lib/feed.js deleted file mode 100644 index 1079979..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/lib/feed.js +++ /dev/null @@ -1,556 +0,0 @@ -// Core routines for event emitters -// -// Copyright 2011 Iris Couch -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -var lib = require('../lib') - , util = require('util') - , events = require('events') - , request = require('request') - , Changes = require('./stream').Changes - , querystring = require('querystring') - -// Use the library timeout functions, primarily so the test suite can catch errors. -var setTimeout = lib.setTimeout - , clearTimeout = lib.clearTimeout - -var DEFAULT_HEARTBEAT = 30000; -var HEARTBEAT_TIMEOUT_COEFFICIENT = 1.25; // E.g. heartbeat 1000ms would trigger a timeout after 1250ms of no heartbeat. -var DEFAULT_MAX_RETRY_SECONDS = 60 * 60; -var INITIAL_RETRY_DELAY = 1000; - -var FEED_PARAMETERS = ['since', 'limit', 'feed', 'heartbeat', 'filter', 'include_docs']; - -var EventEmitter = events.EventEmitter2 || events.EventEmitter; - - -util.inherits(Feed, EventEmitter); -function Feed (opts) { - var self = this; - EventEmitter.call(self); - - self.feed = 'continuous'; - self.heartbeat = DEFAULT_HEARTBEAT; - self.max_retry_seconds = DEFAULT_MAX_RETRY_SECONDS; - self.inactivity_ms = null; - - self.headers = {}; - self.request = {}; // Extra options for potentially future versions of request. The caller can supply them. - - self.since = 0; - self.caught_up = false - self.retry_delay = INITIAL_RETRY_DELAY; // ms - - self.query_params = {}; // Extra `req.query` values for filter functions - - opts = opts || {}; - if(typeof opts === 'string') - opts = {'db': opts}; - Object.keys(opts).forEach(function(key) { - self[key] = opts[key]; - }) - - self.pending = { request : null - , activity_at : null - }; -} // Feed - -Feed.prototype.start = -Feed.prototype.follow = function follow_feed() { - var self = this; - - if(!self.db) - throw new Error('Database URL required'); - - if(self.feed !== 'continuous' && self.feed !== 'longpoll') - throw new Error('The only valid feed options are "continuous" and "longpoll"'); - - if(typeof self.heartbeat !== 'number') - throw new Error('Required "heartbeat" value'); - - self.log = lib.log4js.getLogger(self.db); - self.log.setLevel(process.env.follow_log_level || "info"); - - self.emit('start'); - return self.confirm(); -} - -Feed.prototype.confirm = function confirm_feed() { - var self = this; - - self.db_safe = lib.scrub_creds(self.db); - - self.log.debug('Checking database: ' + self.db_safe); - - var confirm_timeout = self.heartbeat * 3; // Give it time to look up the name, connect, etc. - var timeout_id = setTimeout(function() { - return self.die(new Error('Timeout confirming database: ' + self.db_safe)); - }, confirm_timeout); - - var headers = lib.JP(lib.JS(self.headers)); - headers.accept = 'application/json'; - - var req = request({'uri':self.db, 'headers':headers}, db_response) - self.emit('confirm_request', req) - - function db_response(er, resp, body) { - clearTimeout(timeout_id); - - if(er) - return self.die(er); - - var db; - try { - db = JSON.parse(body) - } catch(json_er) { - return self.emit('error', json_er) - } - - if(!db.db_name || !db.instance_start_time) - return self.emit('error', new Error('Bad DB response: ' + body)); - - self.original_db_seq = db.update_seq - self.log.debug('Confirmed db: ' + self.db_safe); - self.emit('confirm', db); - - if(self.since == 'now') { - self.log.debug('Query since "now" is the same as query since -1') - self.since = -1 - } - - if(self.since < 0) { - self.log.debug('Query since '+self.since+' will start at ' + (db.update_seq + self.since + 1)) - self.since = db.update_seq + self.since + 1 - } - - // If the next change would come after the current update_seq, just fake a catchup event now. - if(self.original_db_seq == self.since) { - self.caught_up = true - self.emit('catchup', db.update_seq) - } - - return self.query(); - } -} - -Feed.prototype.query = function query_feed() { - var self = this; - - var query_params = JSON.parse(JSON.stringify(self.query_params)); - - FEED_PARAMETERS.forEach(function(key) { - if(key in self) - query_params[key] = self[key]; - }) - - if(typeof query_params.filter !== 'string') - delete query_params.filter; - - if(typeof self.filter === 'function' && !query_params.include_docs) { - self.log.debug('Enabling include_docs for client-side filter'); - query_params.include_docs = true; - } - - // Limit the response size for longpoll. - var poll_size = 100; - if(query_params.feed == 'longpoll' && (!query_params.limit || query_params.limit > poll_size)) - query_params.limit = poll_size; - - var feed_url = self.db + '/_changes?' + querystring.stringify(query_params); - - self.headers.accept = self.headers.accept || 'application/json'; - var req = { method : 'GET' - , uri : feed_url - , headers: self.headers - , encoding: 'utf-8' - , onResponse: on_feed_response - } - - req.changes_query = query_params; - Object.keys(self.request).forEach(function(key) { - req[key] = self.request[key]; - }) - - var now = new Date - , feed_ts = lib.JDUP(now) - , feed_id = process.env.follow_debug ? feed_ts.match(/\.(\d\d\d)Z$/)[1] : feed_ts - - self.log.debug('Feed query ' + feed_id + ': ' + lib.scrub_creds(feed_url)) - var feed_request = request(req) - feed_request.on('response', function() { - self.log.debug('Remove feed from agent pool: ' + feed_id) - feed_request.req.socket.emit('agentRemove') - }) - - // The response headers must arrive within one heartbeat. - var response_timer = setTimeout(response_timed_out, self.heartbeat) - , timed_out = false - - return self.emit('query', feed_request) - - function response_timed_out() { - self.log.debug('Feed response timed out: ' + feed_id) - timed_out = true - return self.retry() - } - - function on_feed_response(er, resp, body) { - clearTimeout(response_timer) - - if((resp !== undefined && resp.body) || body) - return self.die(new Error('Cannot handle a body in the feed response: ' + lib.JS(resp.body || body))) - - if(timed_out) { - self.log.debug('Ignoring late response: ' + feed_id); - return destroy_response(resp); - } - - if(er) { - self.log.debug('Request error ' + feed_id + ': ' + er.stack); - destroy_response(resp); - return self.retry(); - } - - if(resp.statusCode !== 200) { - self.log.debug('Bad changes response ' + feed_id + ': ' + resp.statusCode); - destroy_response(resp); - return self.retry(); - } - - self.log.debug('Good response: ' + feed_id); - self.retry_delay = INITIAL_RETRY_DELAY; - - self.emit('response', resp); - - var changes_stream = new Changes - changes_stream.log = lib.log4js.getLogger('stream ' + self.db) - changes_stream.log.setLevel(self.log.level.levelStr) - changes_stream.feed = self.feed - feed_request.pipe(changes_stream) - - changes_stream.created_at = now - changes_stream.id = function() { return feed_id } - return self.prep(changes_stream) - } -} - -Feed.prototype.prep = function prep_request(changes_stream) { - var self = this; - - var now = new Date; - self.pending.request = changes_stream; - self.pending.activity_at = now; - self.pending.wait_timer = null; - - // The inactivity timer is for time between *changes*, or time between the - // initial connection and the first change. Therefore it goes here. - self.change_at = now; - if(self.inactivity_ms) { - clearTimeout(self.inactivity_timer); - self.inactivity_timer = setTimeout(function() { self.on_inactivity() }, self.inactivity_ms); - } - - changes_stream.on('heartbeat', handler_for('heartbeat')) - changes_stream.on('error', handler_for('error')) - changes_stream.on('data', handler_for('data')) - changes_stream.on('end', handler_for('end')) - - return self.wait(); - - function handler_for(ev) { - var name = 'on_couch_' + ev; - var inner_handler = self[name]; - - return handle_confirmed_req_event; - function handle_confirmed_req_event() { - if(self.pending.request === changes_stream) - return inner_handler.apply(self, arguments); - - if(!changes_stream.created_at) - return self.die(new Error("Received data from unknown request")); // Pretty sure this is impossible. - - var s_to_now = (new Date() - changes_stream.created_at) / 1000; - var s_to_req = '[no req]'; - if(self.pending.request) - s_to_req = (self.pending.request.created_at - changes_stream.created_at) / 1000; - - var msg = ': ' + changes_stream.id() + ' to_req=' + s_to_req + 's, to_now=' + s_to_now + 's'; - - if(ev == 'end' || ev == 'data' || ev == 'heartbeat') { - self.log.debug('Old "' + ev + '": ' + changes_stream.id()) - return destroy_req(changes_stream) - } - - self.log.warn('Old "'+ev+'"' + msg); - } - } -} - -Feed.prototype.wait = function wait_for_event() { - var self = this; - self.emit('wait'); - - if(self.pending.wait_timer) - return self.die(new Error('wait() called but there is already a wait_timer: ' + self.pending.wait_timer)); - - var timeout_ms = self.heartbeat * HEARTBEAT_TIMEOUT_COEFFICIENT; - var req_id = self.pending.request && self.pending.request.id() - var msg = 'Req ' + req_id + ' timeout=' + timeout_ms; - if(self.inactivity_ms) - msg += ', inactivity=' + self.inactivity_ms; - msg += ': ' + self.db_safe; - - self.log.debug(msg); - self.pending.wait_timer = setTimeout(function() { self.on_timeout() }, timeout_ms); -} - -Feed.prototype.got_activity = function() { - var self = this - - if(! self.pending.wait_timer) - return self.die(new Error('Cannot find wait timer')) - - clearTimeout(self.pending.wait_timer) - self.pending.wait_timer = null - self.pending.activity_at = new Date -} - -Feed.prototype.on_couch_heartbeat = function on_couch_heartbeat() { - var self = this - - self.got_activity() - if(self.dead) - return self.log.debug('Skip heartbeat processing for dead feed') - - self.emit('heartbeat') - - if(self.dead) - return self.log.debug('No wait: heartbeat listener stopped this feed') - self.wait() -} - -Feed.prototype.on_couch_data = function on_couch_data(change) { - var self = this; - self.log.debug('Data from ' + self.pending.request.id()); - - self.got_activity() - if(self.dead) - return self.log.debug('Skip data processing for dead feed') - - // The changes stream guarantees that this data is valid JSON. - change = JSON.parse(change) - - //self.log.debug('Object:\n' + util.inspect(change)); - if('last_seq' in change) { - self.log.warn('Stopping upon receiving a final message: ' + JSON.stringify(change)) - var del_er = new Error('Database deleted after change: ' + change.last_seq) - del_er.deleted = true - del_er.last_seq = change.last_seq - return self.die(del_er) - } - - if(!change.seq) - return self.die(new Error('Change has no .seq field: ' + JSON.stringify(change))) - - self.on_change(change) - - // on_change() might work its way all the way to a "change" event, and the listener - // might call .stop(), which means among other things that no more events are desired. - // The die() code sets a self.dead flag to indicate this. - if(self.dead) - return self.log.debug('No wait: change listener stopped this feed') - self.wait() -} - -Feed.prototype.on_timeout = function on_timeout() { - var self = this; - self.log.debug('Timeout') - - var now = new Date; - var elapsed_ms = now - self.pending.activity_at; - - self.emit('timeout', {elapsed_ms:elapsed_ms, heartbeat:self.heartbeat, id:self.pending.request.id()}); - - /* - var msg = ' for timeout after ' + elapsed_ms + 'ms; heartbeat=' + self.heartbeat; - if(!self.pending.request.id) - self.log.warn('Closing req (no id) ' + msg + ' req=' + util.inspect(self.pending.request)); - else - self.log.warn('Closing req ' + self.pending.request.id() + msg); - */ - - destroy_req(self.pending.request); - self.retry() -} - -Feed.prototype.retry = function retry() { - var self = this; - - clearTimeout(self.pending.wait_timer); - self.pending.wait_timer = null; - - self.log.debug('Retry since=' + self.since + ' after ' + self.retry_delay + 'ms ') - self.emit('retry', {since:self.since, after:self.retry_delay, db:self.db_safe}); - - self.retry_timer = setTimeout(function() { self.query() }, self.retry_delay); - - var max_retry_ms = self.max_retry_seconds * 1000; - self.retry_delay *= 2; - if(self.retry_delay > max_retry_ms) - self.retry_delay = max_retry_ms; -} - -Feed.prototype.on_couch_end = function on_couch_end() { - var self = this; - - self.log.debug('Changes feed ended ' + self.pending.request.id()); - self.pending.request = null; - return self.retry(); -} - -Feed.prototype.on_couch_error = function on_couch_error(er) { - var self = this; - - self.log.debug('Changes query eror: ' + lib.JS(er.stack)); - return self.retry(); -} - -Feed.prototype.stop = function(val) { - var self = this - self.log.debug('Stop') - - // Die with no errors. - self.die() - self.emit('stop', val); -} - -Feed.prototype.die = function(er) { - var self = this; - - if(er) - self.log.fatal('Fatal error: ' + er.stack); - - // Warn code executing later that death has occured. - self.dead = true - - clearTimeout(self.retry_timer) - clearTimeout(self.inactivity_timer) - clearTimeout(self.pending.wait_timer) - - self.inactivity_timer = null - self.pending.wait_timer = null - - var req = self.pending.request; - self.pending.request = null; - if(req) { - self.log.debug('Destroying req ' + req.id()); - destroy_req(req); - } - - if(er) - self.emit('error', er); -} - -Feed.prototype.on_change = function on_change(change) { - var self = this; - - if(!change.seq) - return self.die(new Error('No seq value in change: ' + lib.JS(change))); - - if(change.seq <= self.since) { - self.log.debug('Bad seq value ' + change.seq + ' since=' + self.since); - return destroy_req(self.pending.request); - } - - if(!self.caught_up && change.seq >= self.original_db_seq) { - self.caught_up = true - self.emit('catchup', change.seq) - } - - if(typeof self.filter !== 'function') - return self.on_good_change(change); - - if(!change.doc) - return self.die(new Error('Internal filter needs .doc in change ' + change.seq)); - - // Don't let the filter mutate the real data. - var doc = lib.JDUP(change.doc); - var req = lib.JDUP({'query': self.pending.request.changes_query}); - - var result = false; - try { - result = self.filter.apply(null, [doc, req]); - } catch (er) { - self.log.debug('Filter error', er); - } - - result = (result && true) || false; - if(result) { - self.log.debug('Builtin filter PASS for change: ' + change.seq); - return self.on_good_change(change); - } else - self.log.debug('Builtin filter FAIL for change: ' + change.seq); -} - -Feed.prototype.on_good_change = function on_good_change(change) { - var self = this; - - if(self.inactivity_ms && !self.inactivity_timer) - return self.die(new Error('Cannot find inactivity timer during change')); - - clearTimeout(self.inactivity_timer); - self.inactivity_timer = null; - if(self.inactivity_ms) - self.inactivity_timer = setTimeout(function() { self.on_inactivity() }, self.inactivity_ms); - - self.change_at = new Date; - self.since = change.seq; - self.emit('change', change); -} - -Feed.prototype.on_inactivity = function on_inactivity() { - var self = this; - var now = new Date; - var elapsed_ms = now - self.change_at; - var elapsed_s = elapsed_ms / 1000; - - return self.die(new Error('Req ' + self.pending.request.id() + ' made no changes for ' + elapsed_s + 's')); -} - -module.exports = { "Feed" : Feed - }; - - -/* - * Utilities - */ - -function destroy_req(req) { - if(req) - destroy_response(req.response) - - if(req && typeof req.destroy == 'function') - req.destroy() -} - -function destroy_response(response) { - if(!response) - return; - - if(typeof response.abort === 'function') - response.abort(); - - if(response.connection) - response.connection.destroy(); -} diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/lib/index.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/lib/index.js deleted file mode 100644 index e0e6235..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/lib/index.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2011 Iris Couch -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -exports.scrub_creds = function scrub_creds(url) { - return url.replace(/^(https?:\/\/)[^:]+:[^@]+@(.*)$/, '$1$2'); // Scrub username and password -} - -exports.JP = JSON.parse; -exports.JS = JSON.stringify; -exports.JDUP = function(obj) { return JSON.parse(JSON.stringify(obj)) }; - -var timeouts = { 'setTimeout': setTimeout - , 'clearTimeout': clearTimeout - } - -exports.setTimeout = function() { return timeouts.setTimeout.apply(this, arguments) } -exports.clearTimeout = function() { return timeouts.clearTimeout.apply(this, arguments) } -exports.timeouts = function(set, clear) { - timeouts.setTimeout = set - timeouts.clearTimeout = clear -} - -// Wrap log4js so it will not be a dependency. -var VERBOSE; -if(require.isBrowser) - VERBOSE = true; -else - VERBOSE = (process.env.verbose === 'true'); - -var noop = function() {} -if(process.env.TAP_DIAG) - noop = console.error - -function noops() { - return { "trace": noop - , "debug": VERBOSE ? console.log : noop - , "info" : VERBOSE ? console.info : noop - , "warn" : VERBOSE ? console.warn : noop - , "error": VERBOSE ? console.error : noop - , "fatal": VERBOSE ? console.error : noop - - , "level": {'level':0, 'levelStr':'noop'} - , "setLevel": noop - } -} - - -try { - if(! process.env.log_plain) - exports.log4js = require('log4js'); -} catch(e) { - exports.log4js = null; -} - -exports.log4js = exports.log4js || { 'getLogger': function() { return noops() } } diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/lib/stream.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/lib/stream.js deleted file mode 100644 index e6d13ae..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/lib/stream.js +++ /dev/null @@ -1,305 +0,0 @@ -// Changes stream -// -// Copyright 2011 Iris Couch -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -var lib = require('../lib') - , util = require('util') - , stream = require('stream') - , request = require('request') - -// Use the library timeout functions, primarily so the test suite can catch errors. -var setTimeout = lib.setTimeout - , clearTimeout = lib.clearTimeout - - -var DEFS = - { 'longpoll_header': '{"results":[' - , 'log_level' : process.env.follow_log_level || 'info' - } - -module.exports = { 'Changes': Changes - } - - -util.inherits(Changes, stream) -function Changes (opts) { - var self = this - stream.call(self) - - self.readable = true - self.writable = true - - self.headers = {} - self.statusCode = null - - opts = opts || {} - self.feed = opts.feed || null // "continuous" or "longpoll" - self.encoding = opts.encoding || 'utf8' - - self.log = opts.log - if(!self.log) { - self.log = lib.log4js.getLogger('change_stream') - self.log.setLevel(DEFS.log_level) - } - - self.is_sending = true - self.is_ending = false - self.is_dead = false - - self.source = null - self.expect = null - self.buf = null - self.changes = [] - - self.on('pipe', function(src) { - if(!self.source) - self.source = src - else { - var er = new Error('Already have a pipe source') - er.source = self.source - self.error(er) - } - }) -} - - -Changes.prototype.setHeader = function(key, val) { - var self = this - self.headers[key] = val -} - -// -// Readable stream API -// - -Changes.prototype.setEncoding = function(encoding) { - var self = this - self.encoding = encoding // TODO -} - - -Changes.prototype.pause = function() { - var self = this - self.is_sending = false - - if(self.source && self.source.pause) - self.source.pause() -} - - -Changes.prototype.resume = function() { - var self = this - self.is_sending = true - if(self.source && self.source.resume) - self.source.resume() - self.emit_changes() -} - -// -// Writable stream API -// - -Changes.prototype.write = function(data, encoding) { - var self = this - - data = self.normalize_data(data, encoding) - if(typeof data != 'string') - return // Looks like normalize_data emitted an error. - - if(self.feed === 'longpoll') - return self.write_longpoll(data) - else if(self.feed === 'continuous') - return self.write_continuous(data) -} - - -Changes.prototype.write_longpoll = function(data) { - var self = this - - if(self.buf === null) - self.buf = [] - - self.buf.push(data) - return true -} - - -Changes.prototype.write_continuous = function(data) { - var self = this - - var offset, json, change - , buf = (self.buf || "") + data - - self.log.debug('write: ' + util.inspect({'data':data, 'buf':buf})) - - // Buf could have 0, 1, or many JSON objects in it. - while((offset = buf.indexOf("\n")) >= 0) { - json = buf.substr(0, offset); - buf = buf.substr(offset + 1); - self.log.debug('JSON: ' + util.inspect(json)) - - // Heartbeats (empty strings) are fine, but otherwise confirm valid JSON. - if(json === "") - ; - - else if(json[0] !== '{') - return self.error(new Error('Non-object JSON data: ' + json)) - - else { - try { change = JSON.parse(json) } - catch (er) { return self.error(er) } - - self.log.debug('Object: ' + util.inspect(change)) - json = JSON.stringify(change) - } - - // Change (or heartbeat) looks good. - self.changes.push(json) - } - - // Remember the unused data and send all known good changes (or heartbeats). - self.buf = buf - self.emit_changes() - - return self.is_sending -} - - -Changes.prototype.end = function(data, encoding) { - var self = this - - self.is_ending = true - self.writable = false - - // Always call write, even with no data, so it can fire the "end" event. - self.write(data, encoding) - - if(self.feed === 'longpoll') { - var changes = [ DEFS.longpoll_header ].concat(self.buf).join('') - try { changes = JSON.parse(changes) || {} } - catch (er) { return self.error(er) } - - if(!Array.isArray(changes.results)) - return self.error(new Error('No "results" field in feed')) - if(self.changes.length !== 0) - return self.error(new Error('Changes are already queued: ' + JSON.stringify(self.changes))) - - self.changes = changes.results.map(function(change) { return JSON.stringify(change) }) - return self.emit_changes() - } - - else if(self.feed === 'continuous') { - if(self.buf !== "") - self.log.debug('Unprocessed data after "end" called: ' + util.inspect(self.buf)) - } -} - - -Changes.prototype.emit_changes = function() { - var self = this - - while(self.is_sending && self.changes.length > 0) { - var change = self.changes.shift() - if(change === "") { - self.log.debug('emit: heartbeat') - self.emit('heartbeat') - } - - else { - self.log.debug('emit: data') - self.emit('data', change) - } - } - - if(self.is_sending && self.is_ending && self.changes.length === 0) { - self.is_ending = false - self.readable = false - self.log.debug('emit: end') - self.emit('end') - } -} - -// -// Readable/writable stream API -// - -Changes.prototype.destroy = function() { - var self = this - self.log.debug('destroy') - - self.is_dead = true - self.is_ending = false - self.is_sending = false - - if(self.source && typeof self.source.destroy === 'function') - self.source.destroy() - - // Often the source is from the request package, so destroy its response object. - if(self.source && self.source.__isRequestRequest && self.source.response - && typeof self.source.response.destroy === 'function') - self.source.response.destroy() -} - - -Changes.prototype.destroySoon = function() { - var self = this - throw new Error('not implemented') - //return self.request.destroySoon() -} - -// -// Internal implementation -// - -Changes.prototype.normalize_data = function(data, encoding) { - var self = this - - if(data instanceof Buffer) - data = data.toString(encoding) - else if(typeof data === 'undefined' && typeof encoding === 'undefined') - data = "" - - if(typeof data != 'string') - return self.error(new Error('Not a string or Buffer: ' + util.inspect(data))) - - if(self.feed !== 'continuous' && self.feed !== 'longpoll') - return self.error(new Error('Must set .feed to "continuous" or "longpoll" before writing data')) - - if(self.expect === null) - self.expect = (self.feed == 'longpoll') - ? DEFS.longpoll_header - : "" - - var prefix = data.substr(0, self.expect.length) - data = data.substr(prefix.length) - - var expected_part = self.expect.substr(0, prefix.length) - , expected_remainder = self.expect.substr(expected_part.length) - - if(prefix !== expected_part) - return self.error(new Error('Prefix not expected '+util.inspect(expected_part)+': ' + util.inspect(prefix))) - - self.expect = expected_remainder - return data -} - - -Changes.prototype.error = function(er) { - var self = this - - self.readable = false - self.writable = false - self.emit('error', er) -} diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/LICENSE b/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/LICENSE deleted file mode 100644 index a4a9aee..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/LICENSE +++ /dev/null @@ -1,55 +0,0 @@ -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of this License; and - -You must cause any modified files to carry prominent notices stating that You changed the files; and - -You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - -If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/README.md b/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/README.md deleted file mode 100644 index c30f1a5..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/README.md +++ /dev/null @@ -1,285 +0,0 @@ -# Request -- Simplified HTTP request method - -## Install - -
        -  npm install request
        -
        - -Or from source: - -
        -  git clone git://github.com/mikeal/request.git 
        -  cd request
        -  npm link
        -
        - -## Super simple to use - -Request is designed to be the simplest way possible to make http calls. It support HTTPS and follows redirects by default. - -```javascript -var request = require('request'); -request('http://www.google.com', function (error, response, body) { - if (!error && response.statusCode == 200) { - console.log(body) // Print the google web page. - } -}) -``` - -## Streaming - -You can stream any response to a file stream. - -```javascript -request('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png')) -``` - -You can also stream a file to a PUT or POST request. This method will also check the file extension against a mapping of file extensions to content-types, in this case `application/json`, and use the proper content-type in the PUT request if one is not already provided in the headers. - -```javascript -fs.readStream('file.json').pipe(request.put('http://mysite.com/obj.json')) -``` - -Request can also pipe to itself. When doing so the content-type and content-length will be preserved in the PUT headers. - -```javascript -request.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img.png')) -``` - -Now let's get fancy. - -```javascript -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - if (req.method === 'PUT') { - req.pipe(request.put('http://mysite.com/doodle.png')) - } else if (req.method === 'GET' || req.method === 'HEAD') { - request.get('http://mysite.com/doodle.png').pipe(resp) - } - } -}) -``` - -You can also pipe() from a http.ServerRequest instance and to a http.ServerResponse instance. The HTTP method and headers will be sent as well as the entity-body data. Which means that, if you don't really care about security, you can do: - -```javascript -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - var x = request('http://mysite.com/doodle.png') - req.pipe(x) - x.pipe(resp) - } -}) -``` - -And since pipe() returns the destination stream in node 0.5.x you can do one line proxying :) - -```javascript -req.pipe(request('http://mysite.com/doodle.png')).pipe(resp) -``` - -Also, none of this new functionality conflicts with requests previous features, it just expands them. - -```javascript -var r = request.defaults({'proxy':'http://localproxy.com'}) - -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - r.get('http://google.com/doodle.png').pipe(resp) - } -}) -``` - -You can still use intermediate proxies, the requests will still follow HTTP forwards, etc. - -## OAuth Signing - -```javascript -// Twitter OAuth -var qs = require('querystring') - , oauth = - { callback: 'http://mysite.com/callback/' - , consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - } - , url = 'https://api.twitter.com/oauth/request_token' - ; -request.post({url:url, oauth:oauth}, function (e, r, body) { - // Assume by some stretch of magic you aquired the verifier - var access_token = qs.parse(body) - , oauth = - { consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - , token: access_token.oauth_token - , verifier: VERIFIER - , token_secret: access_token.oauth_token_secret - } - , url = 'https://api.twitter.com/oauth/access_token' - ; - request.post({url:url, oauth:oauth}, function (e, r, body) { - var perm_token = qs.parse(body) - , oauth = - { consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - , token: perm_token.oauth_token - , token_secret: perm_token.oauth_token_secret - } - , url = 'https://api.twitter.com/1/users/show.json?' - , params = - { screen_name: perm_token.screen_name - , user_id: perm_token.user_id - } - ; - url += qs.stringify(params) - request.get({url:url, oauth:oauth, json:true}, function (e, r, user) { - console.log(user) - }) - }) -}) -``` - - - -### request(options, callback) - -The first argument can be either a url or an options object. The only required option is uri, all others are optional. - -* `uri` || `url` - fully qualified uri or a parsed url object from url.parse() -* `method` - http method, defaults to GET -* `headers` - http headers, defaults to {} -* `body` - entity body for POST and PUT requests. Must be buffer or string. -* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. -* `multipart` - (experimental) array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See example below. -* `followRedirect` - follow HTTP 3xx responses as redirects. defaults to true. -* `maxRedirects` - the maximum number of redirects to follow, defaults to 10. -* `onResponse` - If true the callback will be fired on the "response" event instead of "end". If a function it will be called on "response" and not effect the regular semantics of the main callback on "end". -* `encoding` - Encoding to be used on response.setEncoding when buffering the response data. -* `pool` - A hash object containing the agents for these requests. If omitted this request will use the global pool which is set to node's default maxSockets. -* `pool.maxSockets` - Integer containing the maximum amount of sockets in the pool. -* `timeout` - Integer containing the number of milliseconds to wait for a request to respond before aborting the request -* `proxy` - An HTTP proxy to be used. Support proxy Auth with Basic Auth the same way it's supported with the `url` parameter by embedding the auth info in the uri. -* `oauth` - Options for OAuth HMAC-SHA1 signing, see documentation above. -* `strictSSL` - Set to `true` to require that SSL certificates be valid. Note: to use your own certificate authority, you need to specify an agent that was created with that ca as an option. -* `jar` - Set to `false` if you don't want cookies to be remembered for future use or define your custom cookie jar (see examples section) - - -The callback argument gets 3 arguments. The first is an error when applicable (usually from the http.Client option not the http.ClientRequest object). The second in an http.ClientResponse object. The third is the response body buffer. - -## Convenience methods - -There are also shorthand methods for different HTTP METHODs and some other conveniences. - -### request.defaults(options) - -This method returns a wrapper around the normal request API that defaults to whatever options you pass in to it. - -### request.put - -Same as request() but defaults to `method: "PUT"`. - -```javascript -request.put(url) -``` - -### request.post - -Same as request() but defaults to `method: "POST"`. - -```javascript -request.post(url) -``` - -### request.head - -Same as request() but defaults to `method: "HEAD"`. - -```javascript -request.head(url) -``` - -### request.del - -Same as request() but defaults to `method: "DELETE"`. - -```javascript -request.del(url) -``` - -### request.get - -Alias to normal request method for uniformity. - -```javascript -request.get(url) -``` -### request.cookie - -Function that creates a new cookie. - -```javascript -request.cookie('cookie_string_here') -``` -### request.jar - -Function that creates a new cookie jar. - -```javascript -request.jar() -``` - - -## Examples: - -```javascript - var request = require('request') - , rand = Math.floor(Math.random()*100000000).toString() - ; - request( - { method: 'PUT' - , uri: 'http://mikeal.iriscouch.com/testjs/' + rand - , multipart: - [ { 'content-type': 'application/json' - , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) - } - , { body: 'I am an attachment' } - ] - } - , function (error, response, body) { - if(response.statusCode == 201){ - console.log('document saved as: http://mikeal.iriscouch.com/testjs/'+ rand) - } else { - console.log('error: '+ response.statusCode) - console.log(body) - } - } - ) -``` -Cookies are enabled by default (so they can be used in subsequent requests). To disable cookies set jar to false (either in defaults or in the options sent). - -```javascript -var request = request.defaults({jar: false}) -request('http://www.google.com', function () { - request('http://images.google.com') -}) -``` - -If you to use a custom cookie jar (instead of letting request use its own global cookie jar) you do so by setting the jar default or by specifying it as an option: - -```javascript -var j = request.jar() -var request = request.defaults({jar:j}) -request('http://www.google.com', function () { - request('http://images.google.com') -}) -``` -OR - -```javascript -var j = request.jar() -var cookie = request.cookie('your_cookie_here') -j.add(cookie) -request({url: 'http://www.google.com', jar: j}, function () { - request('http://images.google.com') -}) -``` diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/main.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/main.js deleted file mode 100644 index 7566d1e..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/main.js +++ /dev/null @@ -1,618 +0,0 @@ -// Copyright 2010-2011 Mikeal Rogers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -var http = require('http') - , https = false - , tls = false - , url = require('url') - , util = require('util') - , stream = require('stream') - , qs = require('querystring') - , mimetypes = require('./mimetypes') - , oauth = require('./oauth') - , uuid = require('./uuid') - , Cookie = require('./vendor/cookie') - , CookieJar = require('./vendor/cookie/jar') - , cookieJar = new CookieJar - ; - -try { - https = require('https') -} catch (e) {} - -try { - tls = require('tls') -} catch (e) {} - -function toBase64 (str) { - return (new Buffer(str || "", "ascii")).toString("base64") -} - -// Hacky fix for pre-0.4.4 https -if (https && !https.Agent) { - https.Agent = function (options) { - http.Agent.call(this, options) - } - util.inherits(https.Agent, http.Agent) - https.Agent.prototype._getConnection = function(host, port, cb) { - var s = tls.connect(port, host, this.options, function() { - // do other checks here? - if (cb) cb() - }) - return s - } -} - -function isReadStream (rs) { - if (rs.readable && rs.path && rs.mode) { - return true - } -} - -function copy (obj) { - var o = {} - for (var i in obj) o[i] = obj[i] - return o -} - -var isUrl = /^https?:/ - -var globalPool = {} - -function Request (options) { - stream.Stream.call(this) - this.readable = true - this.writable = true - - if (typeof options === 'string') { - options = {uri:options} - } - - for (var i in options) { - this[i] = options[i] - } - if (!this.pool) this.pool = globalPool - this.dests = [] - this.__isRequestRequest = true -} -util.inherits(Request, stream.Stream) -Request.prototype.getAgent = function (host, port) { - if (!this.pool[host+':'+port]) { - this.pool[host+':'+port] = new this.httpModule.Agent({host:host, port:port}) - } - return this.pool[host+':'+port] -} -Request.prototype.request = function () { - var self = this - - // Protect against double callback - if (!self._callback && self.callback) { - self._callback = self.callback - self.callback = function () { - if (self._callbackCalled) return // Print a warning maybe? - self._callback.apply(self, arguments) - self._callbackCalled = true - } - } - - if (self.url) { - // People use this property instead all the time so why not just support it. - self.uri = self.url - delete self.url - } - - if (!self.uri) { - throw new Error("options.uri is a required argument") - } else { - if (typeof self.uri == "string") self.uri = url.parse(self.uri) - } - if (self.proxy) { - if (typeof self.proxy == 'string') self.proxy = url.parse(self.proxy) - } - - self._redirectsFollowed = self._redirectsFollowed || 0 - self.maxRedirects = (self.maxRedirects !== undefined) ? self.maxRedirects : 10 - self.followRedirect = (self.followRedirect !== undefined) ? self.followRedirect : true - if (self.followRedirect) - self.redirects = self.redirects || [] - - self.headers = self.headers ? copy(self.headers) : {} - - var setHost = false - if (!self.headers.host) { - self.headers.host = self.uri.hostname - if (self.uri.port) { - if ( !(self.uri.port === 80 && self.uri.protocol === 'http:') && - !(self.uri.port === 443 && self.uri.protocol === 'https:') ) - self.headers.host += (':'+self.uri.port) - } - setHost = true - } - - if (self.jar === false) { - // disable cookies - var cookies = false; - self._disableCookies = true; - } else if (self.jar) { - // fetch cookie from the user defined cookie jar - var cookies = self.jar.get({ url: self.uri.href }) - } else { - // fetch cookie from the global cookie jar - var cookies = cookieJar.get({ url: self.uri.href }) - } - if (cookies) { - var cookieString = cookies.map(function (c) { - return c.name + "=" + c.value; - }).join("; "); - - self.headers.Cookie = cookieString; - } - - if (!self.uri.pathname) {self.uri.pathname = '/'} - if (!self.uri.port) { - if (self.uri.protocol == 'http:') {self.uri.port = 80} - else if (self.uri.protocol == 'https:') {self.uri.port = 443} - } - - if (self.proxy) { - self.port = self.proxy.port - self.host = self.proxy.hostname - } else { - self.port = self.uri.port - self.host = self.uri.hostname - } - - if (self.onResponse === true) { - self.onResponse = self.callback - delete self.callback - } - - var clientErrorHandler = function (error) { - if (setHost) delete self.headers.host - if (self.timeout && self.timeoutTimer) clearTimeout(self.timeoutTimer) - self.emit('error', error) - } - if (self.onResponse) self.on('error', function (e) {self.onResponse(e)}) - if (self.callback) self.on('error', function (e) {self.callback(e)}) - - if (self.form) { - self.headers['content-type'] = 'application/x-www-form-urlencoded; charset=utf-8' - self.body = qs.stringify(self.form).toString('utf8') - } - - if (self.oauth) { - var form - if (self.headers['content-type'] && - self.headers['content-type'].slice(0, 'application/x-www-form-urlencoded'.length) === - 'application/x-www-form-urlencoded' - ) { - form = qs.parse(self.body) - } - if (self.uri.query) { - form = qs.parse(self.uri.query) - } - if (!form) form = {} - var oa = {} - for (var i in form) oa[i] = form[i] - for (var i in self.oauth) oa['oauth_'+i] = self.oauth[i] - if (!oa.oauth_version) oa.oauth_version = '1.0' - if (!oa.oauth_timestamp) oa.oauth_timestamp = Math.floor( (new Date()).getTime() / 1000 ).toString() - if (!oa.oauth_nonce) oa.oauth_nonce = uuid().replace(/-/g, '') - - oa.oauth_signature_method = 'HMAC-SHA1' - - var consumer_secret = oa.oauth_consumer_secret - delete oa.oauth_consumer_secret - var token_secret = oa.oauth_token_secret - delete oa.oauth_token_secret - - var baseurl = self.uri.protocol + '//' + self.uri.host + self.uri.pathname - var signature = oauth.hmacsign(self.method, baseurl, oa, consumer_secret, token_secret) - - // oa.oauth_signature = signature - for (var i in form) { - if ( i.slice(0, 'oauth_') in self.oauth) { - // skip - } else { - delete oa['oauth_'+i] - } - } - self.headers.authorization = - 'OAuth '+Object.keys(oa).sort().map(function (i) {return i+'="'+oauth.rfc3986(oa[i])+'"'}).join(',') - self.headers.authorization += ',oauth_signature="'+oauth.rfc3986(signature)+'"' - } - - if (self.uri.auth && !self.headers.authorization) { - self.headers.authorization = "Basic " + toBase64(self.uri.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':')) - } - if (self.proxy && self.proxy.auth && !self.headers['proxy-authorization']) { - self.headers['proxy-authorization'] = "Basic " + toBase64(self.proxy.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':')) - } - - if (self.uri.path) { - self.path = self.uri.path - } else { - self.path = self.uri.pathname + (self.uri.search || "") - } - - if (self.path.length === 0) self.path = '/' - - if (self.proxy) self.path = (self.uri.protocol + '//' + self.uri.host + self.path) - - if (self.json) { - self.headers['content-type'] = 'application/json' - if (typeof self.json === 'boolean') { - if (typeof self.body === 'object') self.body = JSON.stringify(self.body) - } else { - self.body = JSON.stringify(self.json) - } - - } else if (self.multipart) { - self.body = []; - self.headers['content-type'] = 'multipart/related;boundary="frontier"' - if (!self.multipart.forEach) throw new Error('Argument error, options.multipart.') - - self.multipart.forEach(function (part) { - var body = part.body - if(!body) throw Error('Body attribute missing in multipart.') - delete part.body - var preamble = '--frontier\r\n' - Object.keys(part).forEach(function(key){ - preamble += key + ': ' + part[key] + '\r\n' - }) - preamble += '\r\n'; - self.body.push(new Buffer(preamble)); - self.body.push(new Buffer(body)); - self.body.push(new Buffer('\r\n')); - }) - self.body.push(new Buffer('--frontier--')); - } - - if (self.body) { - var length = 0; - if (!Buffer.isBuffer(self.body)) { - if (Array.isArray(self.body)) { - for (var i = 0; i < self.body.length; i++) { - length += self.body[i].length; - } - } else { - self.body = new Buffer(self.body) - length = self.body.length; - } - } else { - length = self.body.length; - } - if (length) { - self.headers['content-length'] = length; - } else { - throw new Error('Argument error, options.body.') - } - } - - self.httpModule = - {"http:":http, "https:":https}[self.proxy ? self.proxy.protocol : self.uri.protocol] - - if (!self.httpModule) throw new Error("Invalid protocol") - - if (self.pool === false) { - self.agent = false - } else { - if (self.maxSockets) { - // Don't use our pooling if node has the refactored client - self.agent = self.httpModule.globalAgent || self.getAgent(self.host, self.port) - self.agent.maxSockets = self.maxSockets - } - if (self.pool.maxSockets) { - // Don't use our pooling if node has the refactored client - self.agent = self.httpModule.globalAgent || self.getAgent(self.host, self.port) - self.agent.maxSockets = self.pool.maxSockets - } - } - - self.start = function () { - self._started = true - self.method = self.method || 'GET' - - self.req = self.httpModule.request(self, function (response) { - self.response = response - response.request = self - - if (self.httpModule === https && - self.strictSSL && - !response.client.authorized) { - var sslErr = response.client.authorizationError - self.emit('error', new Error('SSL Error: '+ sslErr)) - return - } - - if (setHost) delete self.headers.host - if (self.timeout && self.timeoutTimer) clearTimeout(self.timeoutTimer) - - if (response.headers['set-cookie'] && (!self._disableCookies)) { - response.headers['set-cookie'].forEach(function(cookie) { - if (self.jar) { - // custom defined jar - self.jar.add(new Cookie(cookie)); - } - else { - // add to the global cookie jar if user don't define his own - cookieJar.add(new Cookie(cookie)); - } - }); - } - - if (response.statusCode >= 300 && - response.statusCode < 400 && - self.followRedirect && - self.method !== 'PUT' && - self.method !== 'POST' && - response.headers.location) { - if (self._redirectsFollowed >= self.maxRedirects) { - self.emit('error', new Error("Exceeded maxRedirects. Probably stuck in a redirect loop.")) - return - } - self._redirectsFollowed += 1 - - if (!isUrl.test(response.headers.location)) { - response.headers.location = url.resolve(self.uri.href, response.headers.location) - } - self.uri = response.headers.location - self.redirects.push( { statusCode : response.statusCode, - redirectUri: response.headers.location }) - delete self.req - delete self.agent - delete self._started - if (self.headers) { - delete self.headers.host - } - request(self, self.callback) - return // Ignore the rest of the response - } else { - self._redirectsFollowed = self._redirectsFollowed || 0 - // Be a good stream and emit end when the response is finished. - // Hack to emit end on close because of a core bug that never fires end - response.on('close', function () { - if (!self._ended) self.response.emit('end') - }) - - if (self.encoding) { - if (self.dests.length !== 0) { - console.error("Ingoring encoding parameter as this stream is being piped to another stream which makes the encoding option invalid.") - } else { - response.setEncoding(self.encoding) - } - } - - self.pipeDest = function (dest) { - if (dest.headers) { - dest.headers['content-type'] = response.headers['content-type'] - if (response.headers['content-length']) { - dest.headers['content-length'] = response.headers['content-length'] - } - } - if (dest.setHeader) { - for (var i in response.headers) { - dest.setHeader(i, response.headers[i]) - } - dest.statusCode = response.statusCode - } - if (self.pipefilter) self.pipefilter(response, dest) - } - - self.dests.forEach(function (dest) { - self.pipeDest(dest) - }) - - response.on("data", function (chunk) { - self._destdata = true - self.emit("data", chunk) - }) - response.on("end", function (chunk) { - self._ended = true - self.emit("end", chunk) - }) - response.on("close", function () {self.emit("close")}) - - self.emit('response', response) - - if (self.onResponse) { - self.onResponse(null, response) - } - if (self.callback) { - var buffer = [] - var bodyLen = 0 - self.on("data", function (chunk) { - buffer.push(chunk) - bodyLen += chunk.length - }) - self.on("end", function () { - if (buffer.length && Buffer.isBuffer(buffer[0])) { - var body = new Buffer(bodyLen) - var i = 0 - buffer.forEach(function (chunk) { - chunk.copy(body, i, 0, chunk.length) - i += chunk.length - }) - response.body = body.toString() - } else if (buffer.length) { - response.body = buffer.join('') - } - - if (self.json) { - try { - response.body = JSON.parse(response.body) - } catch (e) {} - } - - self.callback(null, response, response.body) - }) - } - } - }) - - if (self.timeout) { - self.timeoutTimer = setTimeout(function() { - self.req.abort() - var e = new Error("ETIMEDOUT") - e.code = "ETIMEDOUT" - self.emit("error", e) - }, self.timeout) - } - - self.req.on('error', clientErrorHandler) - } - - self.once('pipe', function (src) { - if (self.ntick) throw new Error("You cannot pipe to this stream after the first nextTick() after creation of the request stream.") - self.src = src - if (isReadStream(src)) { - if (!self.headers['content-type'] && !self.headers['Content-Type']) - self.headers['content-type'] = mimetypes.lookup(src.path.slice(src.path.lastIndexOf('.')+1)) - } else { - if (src.headers) { - for (var i in src.headers) { - if (!self.headers[i]) { - self.headers[i] = src.headers[i] - } - } - } - if (src.method && !self.method) { - self.method = src.method - } - } - - self.on('pipe', function () { - console.error("You have already piped to this stream. Pipeing twice is likely to break the request.") - }) - }) - - process.nextTick(function () { - if (self.body) { - if (Array.isArray(self.body)) { - self.body.forEach(function(part) { - self.write(part); - }); - } else { - self.write(self.body) - } - self.end() - } else if (self.requestBodyStream) { - console.warn("options.requestBodyStream is deprecated, please pass the request object to stream.pipe.") - self.requestBodyStream.pipe(self) - } else if (!self.src) { - self.headers['content-length'] = 0 - self.end() - } - self.ntick = true - }) -} -Request.prototype.pipe = function (dest) { - if (this.response) { - if (this._destdata) { - throw new Error("You cannot pipe after data has been emitted from the response.") - } else if (this._ended) { - throw new Error("You cannot pipe after the response has been ended.") - } else { - stream.Stream.prototype.pipe.call(this, dest) - this.pipeDest(dest) - return dest - } - } else { - this.dests.push(dest) - stream.Stream.prototype.pipe.call(this, dest) - return dest - } -} -Request.prototype.write = function () { - if (!this._started) this.start() - if (!this.req) throw new Error("This request has been piped before http.request() was called.") - this.req.write.apply(this.req, arguments) -} -Request.prototype.end = function () { - if (!this._started) this.start() - if (!this.req) throw new Error("This request has been piped before http.request() was called.") - this.req.end.apply(this.req, arguments) -} -Request.prototype.pause = function () { - if (!this.response) throw new Error("This request has been piped before http.request() was called.") - this.response.pause.apply(this.response, arguments) -} -Request.prototype.resume = function () { - if (!this.response) throw new Error("This request has been piped before http.request() was called.") - this.response.resume.apply(this.response, arguments) -} - -function request (options, callback) { - if (typeof options === 'string') options = {uri:options} - if (callback) options.callback = callback - var r = new Request(options) - r.request() - return r -} - -module.exports = request - -request.defaults = function (options) { - var def = function (method) { - var d = function (opts, callback) { - if (typeof opts === 'string') opts = {uri:opts} - for (var i in options) { - if (opts[i] === undefined) opts[i] = options[i] - } - return method(opts, callback) - } - return d - } - var de = def(request) - de.get = def(request.get) - de.post = def(request.post) - de.put = def(request.put) - de.head = def(request.head) - de.del = def(request.del) - de.cookie = def(request.cookie) - de.jar = def(request.jar) - return de -} - -request.get = request -request.post = function (options, callback) { - if (typeof options === 'string') options = {uri:options} - options.method = 'POST' - return request(options, callback) -} -request.put = function (options, callback) { - if (typeof options === 'string') options = {uri:options} - options.method = 'PUT' - return request(options, callback) -} -request.head = function (options, callback) { - if (typeof options === 'string') options = {uri:options} - options.method = 'HEAD' - if (options.body || options.requestBodyStream || options.json || options.multipart) { - throw new Error("HTTP HEAD requests MUST NOT include a request body.") - } - return request(options, callback) -} -request.del = function (options, callback) { - if (typeof options === 'string') options = {uri:options} - options.method = 'DELETE' - return request(options, callback) -} -request.jar = function () { - return new CookieJar -} -request.cookie = function (str) { - if (typeof str !== 'string') throw new Error("The cookie function only accepts STRING as param") - return new Cookie(str) -} diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/mimetypes.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/mimetypes.js deleted file mode 100644 index 8691006..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/mimetypes.js +++ /dev/null @@ -1,146 +0,0 @@ -// from http://github.com/felixge/node-paperboy -exports.types = { - "aiff":"audio/x-aiff", - "arj":"application/x-arj-compressed", - "asf":"video/x-ms-asf", - "asx":"video/x-ms-asx", - "au":"audio/ulaw", - "avi":"video/x-msvideo", - "bcpio":"application/x-bcpio", - "ccad":"application/clariscad", - "cod":"application/vnd.rim.cod", - "com":"application/x-msdos-program", - "cpio":"application/x-cpio", - "cpt":"application/mac-compactpro", - "csh":"application/x-csh", - "css":"text/css", - "deb":"application/x-debian-package", - "dl":"video/dl", - "doc":"application/msword", - "drw":"application/drafting", - "dvi":"application/x-dvi", - "dwg":"application/acad", - "dxf":"application/dxf", - "dxr":"application/x-director", - "etx":"text/x-setext", - "ez":"application/andrew-inset", - "fli":"video/x-fli", - "flv":"video/x-flv", - "gif":"image/gif", - "gl":"video/gl", - "gtar":"application/x-gtar", - "gz":"application/x-gzip", - "hdf":"application/x-hdf", - "hqx":"application/mac-binhex40", - "html":"text/html", - "ice":"x-conference/x-cooltalk", - "ico":"image/x-icon", - "ief":"image/ief", - "igs":"model/iges", - "ips":"application/x-ipscript", - "ipx":"application/x-ipix", - "jad":"text/vnd.sun.j2me.app-descriptor", - "jar":"application/java-archive", - "jpeg":"image/jpeg", - "jpg":"image/jpeg", - "js":"text/javascript", - "json":"application/json", - "latex":"application/x-latex", - "lsp":"application/x-lisp", - "lzh":"application/octet-stream", - "m":"text/plain", - "m3u":"audio/x-mpegurl", - "man":"application/x-troff-man", - "me":"application/x-troff-me", - "midi":"audio/midi", - "mif":"application/x-mif", - "mime":"www/mime", - "movie":"video/x-sgi-movie", - "mustache":"text/plain", - "mp4":"video/mp4", - "mpg":"video/mpeg", - "mpga":"audio/mpeg", - "ms":"application/x-troff-ms", - "nc":"application/x-netcdf", - "oda":"application/oda", - "ogm":"application/ogg", - "pbm":"image/x-portable-bitmap", - "pdf":"application/pdf", - "pgm":"image/x-portable-graymap", - "pgn":"application/x-chess-pgn", - "pgp":"application/pgp", - "pm":"application/x-perl", - "png":"image/png", - "pnm":"image/x-portable-anymap", - "ppm":"image/x-portable-pixmap", - "ppz":"application/vnd.ms-powerpoint", - "pre":"application/x-freelance", - "prt":"application/pro_eng", - "ps":"application/postscript", - "qt":"video/quicktime", - "ra":"audio/x-realaudio", - "rar":"application/x-rar-compressed", - "ras":"image/x-cmu-raster", - "rgb":"image/x-rgb", - "rm":"audio/x-pn-realaudio", - "rpm":"audio/x-pn-realaudio-plugin", - "rtf":"text/rtf", - "rtx":"text/richtext", - "scm":"application/x-lotusscreencam", - "set":"application/set", - "sgml":"text/sgml", - "sh":"application/x-sh", - "shar":"application/x-shar", - "silo":"model/mesh", - "sit":"application/x-stuffit", - "skt":"application/x-koan", - "smil":"application/smil", - "snd":"audio/basic", - "sol":"application/solids", - "spl":"application/x-futuresplash", - "src":"application/x-wais-source", - "stl":"application/SLA", - "stp":"application/STEP", - "sv4cpio":"application/x-sv4cpio", - "sv4crc":"application/x-sv4crc", - "svg":"image/svg+xml", - "swf":"application/x-shockwave-flash", - "tar":"application/x-tar", - "tcl":"application/x-tcl", - "tex":"application/x-tex", - "texinfo":"application/x-texinfo", - "tgz":"application/x-tar-gz", - "tiff":"image/tiff", - "tr":"application/x-troff", - "tsi":"audio/TSP-audio", - "tsp":"application/dsptype", - "tsv":"text/tab-separated-values", - "unv":"application/i-deas", - "ustar":"application/x-ustar", - "vcd":"application/x-cdlink", - "vda":"application/vda", - "vivo":"video/vnd.vivo", - "vrm":"x-world/x-vrml", - "wav":"audio/x-wav", - "wax":"audio/x-ms-wax", - "wma":"audio/x-ms-wma", - "wmv":"video/x-ms-wmv", - "wmx":"video/x-ms-wmx", - "wrl":"model/vrml", - "wvx":"video/x-ms-wvx", - "xbm":"image/x-xbitmap", - "xlw":"application/vnd.ms-excel", - "xml":"text/xml", - "xpm":"image/x-xpixmap", - "xwd":"image/x-xwindowdump", - "xyz":"chemical/x-pdb", - "zip":"application/zip", -}; - -exports.lookup = function(ext, defaultType) { - defaultType = defaultType || 'application/octet-stream'; - - return (ext in exports.types) - ? exports.types[ext] - : defaultType; -}; \ No newline at end of file diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/oauth.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/oauth.js deleted file mode 100644 index 25db669..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/oauth.js +++ /dev/null @@ -1,34 +0,0 @@ -var crypto = require('crypto') - , qs = require('querystring') - ; - -function sha1 (key, body) { - return crypto.createHmac('sha1', key).update(body).digest('base64') -} - -function rfc3986 (str) { - return encodeURIComponent(str) - .replace('!','%21') - .replace('*','%2A') - .replace('(','%28') - .replace(')','%29') - .replace("'",'%27') - ; -} - -function hmacsign (httpMethod, base_uri, params, consumer_secret, token_secret, body) { - // adapted from https://dev.twitter.com/docs/auth/oauth - var base = - httpMethod + "&" + - encodeURIComponent( base_uri ) + "&" + - Object.keys(params).sort().map(function (i) { - // big WTF here with the escape + encoding but it's what twitter wants - return escape(rfc3986(i)) + "%3D" + escape(rfc3986(params[i])) - }).join("%26") - var key = consumer_secret + '&' - if (token_secret) key += token_secret - return sha1(key, base) -} - -exports.hmacsign = hmacsign -exports.rfc3986 = rfc3986 \ No newline at end of file diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/package.json b/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/package.json deleted file mode 100644 index 1168883..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "request", - "description": "Simplified HTTP request client.", - "tags": [ - "http", - "simple", - "util", - "utility" - ], - "version": "2.2.9", - "author": { - "name": "Mikeal Rogers", - "email": "mikeal.rogers@gmail.com" - }, - "repository": { - "type": "git", - "url": "git://github.com/mikeal/request.git" - }, - "bugs": { - "url": "http://github.com/mikeal/request/issues" - }, - "engines": [ - "node >= 0.3.6" - ], - "main": "./main", - "scripts": { - "test": "bash tests/run.sh" - }, - "_id": "request@2.2.9", - "dependencies": {}, - "devDependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "request@~2.2.5" -} diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/googledoodle.png b/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/googledoodle.png deleted file mode 100644 index f80c9c5..0000000 Binary files a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/googledoodle.png and /dev/null differ diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/run.sh b/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/run.sh deleted file mode 100755 index 57d0f64..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/run.sh +++ /dev/null @@ -1,6 +0,0 @@ -FAILS=0 -for i in tests/test-*.js; do - echo $i - node $i || let FAILS++ -done -exit $FAILS diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/server.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/server.js deleted file mode 100644 index bad1e50..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/server.js +++ /dev/null @@ -1,57 +0,0 @@ -var http = require('http') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - ; - -exports.createServer = function (port) { - port = port || 6767 - var s = http.createServer(function (req, resp) { - s.emit(req.url, req, resp); - }) - s.port = port - s.url = 'http://localhost:'+port - return s; -} - -exports.createPostStream = function (text) { - var postStream = new stream.Stream(); - postStream.writeable = true; - postStream.readable = true; - setTimeout(function () {postStream.emit('data', new Buffer(text)); postStream.emit('end')}, 0); - return postStream; -} -exports.createPostValidator = function (text) { - var l = function (req, resp) { - var r = ''; - req.on('data', function (chunk) {r += chunk}) - req.on('end', function () { - if (r !== text) console.log(r, text); - assert.equal(r, text) - resp.writeHead(200, {'content-type':'text/plain'}) - resp.write('OK') - resp.end() - }) - } - return l; -} -exports.createGetResponse = function (text, contentType) { - var l = function (req, resp) { - contentType = contentType || 'text/plain' - resp.writeHead(200, {'content-type':contentType}) - resp.write(text) - resp.end() - } - return l; -} -exports.createChunkResponse = function (chunks, contentType) { - var l = function (req, resp) { - contentType = contentType || 'text/plain' - resp.writeHead(200, {'content-type':contentType}) - chunks.forEach(function (chunk) { - resp.write(chunk) - }) - resp.end() - } - return l; -} diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-body.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-body.js deleted file mode 100644 index 18ad5b9..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-body.js +++ /dev/null @@ -1,90 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--frontier\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--frontier\r\n\r\n' + - 'Oh hi.' + - '\r\n--frontier--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - test.uri = s.url + '/' + i - request(test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) - diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-cookie.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-cookie.js deleted file mode 100644 index aeafd10..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-cookie.js +++ /dev/null @@ -1,29 +0,0 @@ -var Cookie = require('../vendor/cookie') - , assert = require('assert'); - -var str = 'sid=s543qactge.wKE61E01Bs%2BKhzmxrwrnug; path=/; httpOnly; expires=Sat, 04 Dec 2010 23:27:28 GMT'; -var cookie = new Cookie(str); - -// test .toString() -assert.equal(cookie.toString(), str); - -// test .path -assert.equal(cookie.path, '/'); - -// test .httpOnly -assert.equal(cookie.httpOnly, true); - -// test .name -assert.equal(cookie.name, 'sid'); - -// test .value -assert.equal(cookie.value, 's543qactge.wKE61E01Bs%2BKhzmxrwrnug'); - -// test .expires -assert.equal(cookie.expires instanceof Date, true); - -// test .path default -var cookie = new Cookie('foo=bar', { url: 'http://foo.com/bar' }); -assert.equal(cookie.path, '/bar'); - -console.log('All tests passed'); diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-cookiejar.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-cookiejar.js deleted file mode 100644 index 76fcd71..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-cookiejar.js +++ /dev/null @@ -1,90 +0,0 @@ -var Cookie = require('../vendor/cookie') - , Jar = require('../vendor/cookie/jar') - , assert = require('assert'); - -function expires(ms) { - return new Date(Date.now() + ms).toUTCString(); -} - -// test .get() expiration -(function() { - var jar = new Jar; - var cookie = new Cookie('sid=1234; path=/; expires=' + expires(1000)); - jar.add(cookie); - setTimeout(function(){ - var cookies = jar.get({ url: 'http://foo.com/foo' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], cookie); - setTimeout(function(){ - var cookies = jar.get({ url: 'http://foo.com/foo' }); - assert.equal(cookies.length, 0); - }, 1000); - }, 5); -})(); - -// test .get() path support -(function() { - var jar = new Jar; - var a = new Cookie('sid=1234; path=/'); - var b = new Cookie('sid=1111; path=/foo/bar'); - var c = new Cookie('sid=2222; path=/'); - jar.add(a); - jar.add(b); - jar.add(c); - - // should remove the duplicates - assert.equal(jar.cookies.length, 2); - - // same name, same path, latter prevails - var cookies = jar.get({ url: 'http://foo.com/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], c); - - // same name, diff path, path specifity prevails, latter prevails - var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], b); - - var jar = new Jar; - var a = new Cookie('sid=1111; path=/foo/bar'); - var b = new Cookie('sid=1234; path=/'); - jar.add(a); - jar.add(b); - - var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], a); - - var cookies = jar.get({ url: 'http://foo.com/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], b); - - var jar = new Jar; - var a = new Cookie('sid=1111; path=/foo/bar'); - var b = new Cookie('sid=3333; path=/foo/bar'); - var c = new Cookie('pid=3333; path=/foo/bar'); - var d = new Cookie('sid=2222; path=/foo/'); - var e = new Cookie('sid=1234; path=/'); - jar.add(a); - jar.add(b); - jar.add(c); - jar.add(d); - jar.add(e); - - var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); - assert.equal(cookies.length, 2); - assert.equal(cookies[0], b); - assert.equal(cookies[1], c); - - var cookies = jar.get({ url: 'http://foo.com/foo/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], d); - - var cookies = jar.get({ url: 'http://foo.com/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], e); -})(); - -setTimeout(function() { - console.log('All tests passed'); -}, 1200); diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-errors.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-errors.js deleted file mode 100644 index a7db1f7..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-errors.js +++ /dev/null @@ -1,30 +0,0 @@ -var server = require('./server') - , events = require('events') - , assert = require('assert') - , request = require('../main.js') - ; - -var local = 'http://localhost:8888/asdf' - -try { - request({uri:local, body:{}}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Argument error, options.body.') -} - -try { - request({uri:local, multipart: 'foo'}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Argument error, options.multipart.') -} - -try { - request({uri:local, multipart: [{}]}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Body attribute missing in multipart.') -} - -console.log("All tests passed.") diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-oauth.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-oauth.js deleted file mode 100644 index 7d969a0..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-oauth.js +++ /dev/null @@ -1,109 +0,0 @@ -var hmacsign = require('../oauth').hmacsign - , assert = require('assert') - , qs = require('querystring') - , request = require('../main') - ; - -function getsignature (r) { - var sign - r.headers.authorization.slice('OAuth '.length).replace(/,\ /g, ',').split(',').forEach(function (v) { - if (v.slice(0, 'oauth_signature="'.length) === 'oauth_signature="') sign = v.slice('oauth_signature="'.length, -1) - }) - return decodeURIComponent(sign) -} - -// Tests from Twitter documentation https://dev.twitter.com/docs/auth/oauth - -var reqsign = hmacsign('POST', 'https://api.twitter.com/oauth/request_token', - { oauth_callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11' - , oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g' - , oauth_nonce: 'QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk' - , oauth_signature_method: 'HMAC-SHA1' - , oauth_timestamp: '1272323042' - , oauth_version: '1.0' - }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98") - -console.log(reqsign) -console.log('8wUi7m5HFQy76nowoCThusfgB+Q=') -assert.equal(reqsign, '8wUi7m5HFQy76nowoCThusfgB+Q=') - -var accsign = hmacsign('POST', 'https://api.twitter.com/oauth/access_token', - { oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g' - , oauth_nonce: '9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8' - , oauth_signature_method: 'HMAC-SHA1' - , oauth_token: '8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc' - , oauth_timestamp: '1272323047' - , oauth_verifier: 'pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY' - , oauth_version: '1.0' - }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "x6qpRnlEmW9JbQn4PQVVeVG8ZLPEx6A0TOebgwcuA") - -console.log(accsign) -console.log('PUw/dHA4fnlJYM6RhXk5IU/0fCc=') -assert.equal(accsign, 'PUw/dHA4fnlJYM6RhXk5IU/0fCc=') - -var upsign = hmacsign('POST', 'http://api.twitter.com/1/statuses/update.json', - { oauth_consumer_key: "GDdmIQH6jhtmLUypg82g" - , oauth_nonce: "oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y" - , oauth_signature_method: "HMAC-SHA1" - , oauth_token: "819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw" - , oauth_timestamp: "1272325550" - , oauth_version: "1.0" - , status: 'setting up my twitter 私のさえずりを設定する' - }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA") - -console.log(upsign) -console.log('yOahq5m0YjDDjfjxHaXEsW9D+X0=') -assert.equal(upsign, 'yOahq5m0YjDDjfjxHaXEsW9D+X0=') - - -var r = request.post( - { url: 'https://api.twitter.com/oauth/request_token' - , oauth: - { callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11' - , consumer_key: 'GDdmIQH6jhtmLUypg82g' - , nonce: 'QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk' - , timestamp: '1272323042' - , version: '1.0' - , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" - } - }) - -console.log(getsignature(r)) -assert.equal(reqsign, getsignature(r)) - -var r = request.post( - { url: 'https://api.twitter.com/oauth/access_token' - , oauth: - { consumer_key: 'GDdmIQH6jhtmLUypg82g' - , nonce: '9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8' - , signature_method: 'HMAC-SHA1' - , token: '8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc' - , timestamp: '1272323047' - , verifier: 'pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY' - , version: '1.0' - , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" - , token_secret: "x6qpRnlEmW9JbQn4PQVVeVG8ZLPEx6A0TOebgwcuA" - } - }) - -console.log(getsignature(r)) -assert.equal(accsign, getsignature(r)) - -var r = request.post( - { url: 'http://api.twitter.com/1/statuses/update.json' - , oauth: - { consumer_key: "GDdmIQH6jhtmLUypg82g" - , nonce: "oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y" - , signature_method: "HMAC-SHA1" - , token: "819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw" - , timestamp: "1272325550" - , version: "1.0" - , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" - , token_secret: "J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA" - } - , form: {status: 'setting up my twitter 私のさえずりを設定する'} - }) - -console.log(getsignature(r)) -assert.equal(upsign, getsignature(r)) - diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-pipes.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-pipes.js deleted file mode 100644 index 0774647..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-pipes.js +++ /dev/null @@ -1,167 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , fs = require('fs') - , request = require('../main.js') - , path = require('path') - , util = require('util') - ; - -var s = server.createServer(3453); - -function ValidationStream(str) { - this.str = str - this.buf = '' - this.on('data', function (data) { - this.buf += data - }) - this.on('end', function () { - assert.equal(this.str, this.buf) - }) - this.writable = true -} -util.inherits(ValidationStream, stream.Stream) -ValidationStream.prototype.write = function (chunk) { - this.emit('data', chunk) -} -ValidationStream.prototype.end = function (chunk) { - if (chunk) emit('data', chunk) - this.emit('end') -} - -s.listen(s.port, function () { - counter = 0; - - var check = function () { - counter = counter - 1 - if (counter === 0) { - console.log('All tests passed.') - setTimeout(function () { - process.exit(); - }, 500) - } - } - - // Test pipeing to a request object - s.once('/push', server.createPostValidator("mydata")); - - var mydata = new stream.Stream(); - mydata.readable = true - - counter++ - var r1 = request.put({url:'http://localhost:3453/push'}, function () { - check(); - }) - mydata.pipe(r1) - - mydata.emit('data', 'mydata'); - mydata.emit('end'); - - - // Test pipeing from a request object. - s.once('/pull', server.createGetResponse("mypulldata")); - - var mypulldata = new stream.Stream(); - mypulldata.writable = true - - counter++ - request({url:'http://localhost:3453/pull'}).pipe(mypulldata) - - var d = ''; - - mypulldata.write = function (chunk) { - d += chunk; - } - mypulldata.end = function () { - assert.equal(d, 'mypulldata'); - check(); - }; - - - s.on('/cat', function (req, resp) { - if (req.method === "GET") { - resp.writeHead(200, {'content-type':'text/plain-test', 'content-length':4}); - resp.end('asdf') - } else if (req.method === "PUT") { - assert.equal(req.headers['content-type'], 'text/plain-test'); - assert.equal(req.headers['content-length'], 4) - var validate = ''; - - req.on('data', function (chunk) {validate += chunk}) - req.on('end', function () { - resp.writeHead(201); - resp.end(); - assert.equal(validate, 'asdf'); - check(); - }) - } - }) - s.on('/pushjs', function (req, resp) { - if (req.method === "PUT") { - assert.equal(req.headers['content-type'], 'text/javascript'); - check(); - } - }) - s.on('/catresp', function (req, resp) { - request.get('http://localhost:3453/cat').pipe(resp) - }) - s.on('/doodle', function (req, resp) { - if (req.headers['x-oneline-proxy']) { - resp.setHeader('x-oneline-proxy', 'yup') - } - resp.writeHead('200', {'content-type':'image/png'}) - fs.createReadStream(path.join(__dirname, 'googledoodle.png')).pipe(resp) - }) - s.on('/onelineproxy', function (req, resp) { - var x = request('http://localhost:3453/doodle') - req.pipe(x) - x.pipe(resp) - }) - - counter++ - fs.createReadStream(__filename).pipe(request.put('http://localhost:3453/pushjs')) - - counter++ - request.get('http://localhost:3453/cat').pipe(request.put('http://localhost:3453/cat')) - - counter++ - request.get('http://localhost:3453/catresp', function (e, resp, body) { - assert.equal(resp.headers['content-type'], 'text/plain-test'); - assert.equal(resp.headers['content-length'], 4) - check(); - }) - - var doodleWrite = fs.createWriteStream(path.join(__dirname, 'test.png')) - - counter++ - request.get('http://localhost:3453/doodle').pipe(doodleWrite) - - doodleWrite.on('close', function () { - assert.deepEqual(fs.readFileSync(path.join(__dirname, 'googledoodle.png')), fs.readFileSync(path.join(__dirname, 'test.png'))) - check() - }) - - process.on('exit', function () { - fs.unlinkSync(path.join(__dirname, 'test.png')) - }) - - counter++ - request.get({uri:'http://localhost:3453/onelineproxy', headers:{'x-oneline-proxy':'nope'}}, function (err, resp, body) { - assert.equal(resp.headers['x-oneline-proxy'], 'yup') - check() - }) - - s.on('/afterresponse', function (req, resp) { - resp.write('d') - resp.end() - }) - - counter++ - var afterresp = request.post('http://localhost:3453/afterresponse').on('response', function () { - var v = new ValidationStream('d') - afterresp.pipe(v) - v.on('end', check) - }) - -}) diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-proxy.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-proxy.js deleted file mode 100644 index 647157c..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-proxy.js +++ /dev/null @@ -1,39 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , fs = require('fs') - , request = require('../main.js') - , path = require('path') - , util = require('util') - ; - -var port = 6768 - , called = false - , proxiedHost = 'google.com' - ; - -var s = server.createServer(port) -s.listen(port, function () { - s.on('http://google.com/', function (req, res) { - called = true - assert.equal(req.headers.host, proxiedHost) - res.writeHeader(200) - res.end() - }) - request ({ - url: 'http://'+proxiedHost, - proxy: 'http://localhost:'+port - /* - //should behave as if these arguments where passed: - url: 'http://localhost:'+port, - headers: {host: proxiedHost} - //*/ - }, function (err, res, body) { - s.close() - }) -}) - -process.on('exit', function () { - assert.ok(called, 'the request must be made to the proxy server') -}) diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-timeout.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-timeout.js deleted file mode 100644 index 673f8ad..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/tests/test-timeout.js +++ /dev/null @@ -1,87 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); -var expectedBody = "waited"; -var remainingTests = 5; - -s.listen(s.port, function () { - // Request that waits for 200ms - s.on('/timeout', function (req, resp) { - setTimeout(function(){ - resp.writeHead(200, {'content-type':'text/plain'}) - resp.write(expectedBody) - resp.end() - }, 200); - }); - - // Scenario that should timeout - var shouldTimeout = { - url: s.url + "/timeout", - timeout:100 - } - - - request(shouldTimeout, function (err, resp, body) { - assert.equal(err.code, "ETIMEDOUT"); - checkDone(); - }) - - - // Scenario that shouldn't timeout - var shouldntTimeout = { - url: s.url + "/timeout", - timeout:300 - } - - request(shouldntTimeout, function (err, resp, body) { - assert.equal(err, null); - assert.equal(expectedBody, body) - checkDone(); - }) - - // Scenario with no timeout set, so shouldn't timeout - var noTimeout = { - url: s.url + "/timeout" - } - - request(noTimeout, function (err, resp, body) { - assert.equal(err); - assert.equal(expectedBody, body) - checkDone(); - }) - - // Scenario with a negative timeout value, should be treated a zero or the minimum delay - var negativeTimeout = { - url: s.url + "/timeout", - timeout:-1000 - } - - request(negativeTimeout, function (err, resp, body) { - assert.equal(err.code, "ETIMEDOUT"); - checkDone(); - }) - - // Scenario with a float timeout value, should be rounded by setTimeout anyway - var floatTimeout = { - url: s.url + "/timeout", - timeout: 100.76 - } - - request(floatTimeout, function (err, resp, body) { - assert.equal(err.code, "ETIMEDOUT"); - checkDone(); - }) - - function checkDone() { - if(--remainingTests == 0) { - s.close(); - console.log("All tests passed."); - } - } -}) - diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/uuid.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/uuid.js deleted file mode 100644 index 1d83bd5..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/uuid.js +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = function () { - var s = [], itoh = '0123456789ABCDEF'; - - // Make array of random hex digits. The UUID only has 32 digits in it, but we - // allocate an extra items to make room for the '-'s we'll be inserting. - for (var i = 0; i <36; i++) s[i] = Math.floor(Math.random()*0x10); - - // Conform to RFC-4122, section 4.4 - s[14] = 4; // Set 4 high bits of time_high field to version - s[19] = (s[19] & 0x3) | 0x8; // Specify 2 high bits of clock sequence - - // Convert to hex chars - for (var i = 0; i <36; i++) s[i] = itoh[s[i]]; - - // Insert '-'s - s[8] = s[13] = s[18] = s[23] = '-'; - - return s.join(''); -} diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/vendor/cookie/index.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/vendor/cookie/index.js deleted file mode 100644 index d8f29b3..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/vendor/cookie/index.js +++ /dev/null @@ -1,55 +0,0 @@ -/*! - * Tobi - Cookie - * Copyright(c) 2010 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var url = require('url'); - -/** - * Initialize a new `Cookie` with the given cookie `str` and `req`. - * - * @param {String} str - * @param {IncomingRequest} req - * @api private - */ - -var Cookie = exports = module.exports = function Cookie(str, req) { - this.str = str; - - // First key is the name - this.name = str.substr(0, str.indexOf('=')); - - // Map the key/val pairs - str.split(/ *; */).reduce(function(obj, pair){ - pair = pair.split(/ *= */); - obj[pair[0].toLowerCase()] = pair[1] || true; - return obj; - }, this); - - // Assign value - this.value = this[this.name]; - - // Expires - this.expires = this.expires - ? new Date(this.expires) - : Infinity; - - // Default or trim path - this.path = this.path || '/'; -}; - -/** - * Return the original cookie string. - * - * @return {String} - * @api public - */ - -Cookie.prototype.toString = function(){ - return this.str; -}; diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/vendor/cookie/jar.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/vendor/cookie/jar.js deleted file mode 100644 index 34920e0..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/node_modules/request/vendor/cookie/jar.js +++ /dev/null @@ -1,72 +0,0 @@ -/*! -* Tobi - CookieJar -* Copyright(c) 2010 LearnBoost -* MIT Licensed -*/ - -/** -* Module dependencies. -*/ - -var url = require('url'); - -/** -* Initialize a new `CookieJar`. -* -* @api private -*/ - -var CookieJar = exports = module.exports = function CookieJar() { - this.cookies = []; -}; - -/** -* Add the given `cookie` to the jar. -* -* @param {Cookie} cookie -* @api private -*/ - -CookieJar.prototype.add = function(cookie){ - this.cookies = this.cookies.filter(function(c){ - // Avoid duplication (same path, same name) - return !(c.name == cookie.name && c.path == cookie.path); - }); - this.cookies.push(cookie); -}; - -/** -* Get cookies for the given `req`. -* -* @param {IncomingRequest} req -* @return {Array} -* @api private -*/ - -CookieJar.prototype.get = function(req){ - var path = url.parse(req.url).pathname - , now = new Date - , specificity = {}; - return this.cookies.filter(function(cookie){ - if (0 == path.indexOf(cookie.path) && now < cookie.expires - && cookie.path.length > (specificity[cookie.name] || 0)) - return specificity[cookie.name] = cookie.path.length; - }); -}; - -/** -* Return Cookie string for the given `req`. -* -* @param {IncomingRequest} req -* @return {String} -* @api private -*/ - -CookieJar.prototype.cookieString = function(req){ - var cookies = this.get(req); - if (cookies.length) { - return cookies.map(function(cookie){ - return cookie.name + '=' + cookie.value; - }).join('; '); - } -}; diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/package.json b/node_modules/resourceful/node_modules/cradle/node_modules/follow/package.json deleted file mode 100644 index f39425c..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "follow", - "version": "0.7.2", - "author": { - "name": "Jason Smith", - "email": "jhs@iriscouch.com" - }, - "description": "Extremely robust, fault-tolerant CouchDB changes follower", - "keywords": [ - "couchdb", - "changes", - "sleep", - "sleepy" - ], - "homepage": "http://github.com/iriscouch/follow", - "repository": { - "type": "git", - "url": "git://github.com/iriscouch/follow.git" - }, - "engines": [ - "node" - ], - "dependencies": { - "request": "~2.2.5" - }, - "devDependencies": { - "tap": "~0.1.3", - "traceback": "~0.3.0" - }, - "main": "./api.js", - "bin": { - "follow": "./cli.js" - }, - "_id": "follow@0.7.2", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "follow@0.7.x" -} diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/test/couch.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/test/couch.js deleted file mode 100644 index 7d4ee45..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/test/couch.js +++ /dev/null @@ -1,153 +0,0 @@ -// CouchDB tests -// -// This module is also a library for other test modules. - -var tap = require('tap') - , util = require('util') - , assert = require('assert') - , request = require('request') - -var follow = require('../api') - , DB = process.env.db || 'http://localhost:5984/follow_test' - , RTT = null - - -module.exports = { 'DB': DB - , 'rtt' : get_rtt - , 'redo': redo_couch - , 'setup': setup_test - , 'make_data': make_data - } - - -function get_rtt() { - if(!RTT) - throw new Error('RTT was not set. Use setup(test) or redo(callback)') - return RTT -} - - -// Basically a redo but testing along the way. -function setup_test(test_func) { - assert.equal(typeof test_func, 'function', 'Please provide tap.test function') - - test_func('Initialize CouchDB', function(t) { - init_db(t, function(er, rtt) { - RTT = rtt - t.end() - }) - }) -} - -function redo_couch(callback) { - function noop() {} - var t = { 'ok':noop, 'false':noop, 'equal':noop, 'end':noop } - init_db(t, function(er, rtt) { - if(rtt) - RTT = rtt - return callback(er) - }) -} - -function init_db(t, callback) { - var create_begin = new Date - - request.del({uri:DB, json:true}, function(er, res) { - t.false(er, 'Clear old test DB: ' + DB) - t.ok(!res.body.error || res.body.error == 'not_found', 'Couch cleared old test DB: ' + DB) - - request.put({uri:DB, json:true}, function(er, res) { - t.false(er, 'Create new test DB: ' + DB) - t.false(res.body.error, 'Couch created new test DB: ' + DB) - - var values = ['first', 'second', 'third'] - , stores = 0 - values.forEach(function(val) { - var doc = { _id:'doc_'+val, value:val } - - request.post({uri:DB, json:doc}, function(er, res) { - t.false(er, 'POST document') - t.equal(res.statusCode, 201, 'Couch stored test document') - - stores += 1 - if(stores == values.length) { - var rtt = (new Date) - create_begin - callback(null, rtt) - //request.post({uri:DB, json:{_id:'_local/rtt', ms:(new Date)-begin}}, function(er, res) { - // t.false(er, 'Store RTT value') - // t.equal(res.statusCode, 201, 'Couch stored RTT value') - // t.end() - //}) - } - }) - }) - }) - }) -} - - -function make_data(minimum_size, callback) { - var payload = {'docs':[]} - , size = 0 - - // TODO: Make document number 20 really large, at least over 9kb. - while(size < minimum_size) { - var doc = {} - , key_count = rndint(0, 25) - - while(key_count-- > 0) - doc[rndstr(8)] = rndstr(20) - - // The 20th document has one really large string value. - if(payload.docs.length == 19) { - var big_str = rndstr(9000, 15000) - doc.big = {'length':big_str.length, 'value':big_str} - } - - size += JSON.stringify(doc).length // This is an underestimate because an _id and _rev will be added. - payload.docs.push(doc) - } - - request.post({'uri':DB+'/_bulk_docs', 'json':payload}, function(er, res) { - if(er) throw er - - if(res.statusCode != 201) - throw new Error('Bad bulk_docs update: ' + util.inspect(res.body)) - - if(res.body.length != payload.docs.length) - throw new Error('Should have results for '+payload.docs.length+' doc insertions') - - if(res.body.length < 1500) - throw new Error('Seems like at least 1,500 docs should have been added: ' + res.body.length) - - res.body.forEach(function(result) { - if(!result || !result.id || !result.rev) - throw new Error('Bad bulk_docs response: ' + util.inspect(result)) - }) - - return callback(payload.docs.length) - }) - - function rndstr(minlen, maxlen) { - if(!maxlen) { - maxlen = minlen - minlen = 1 - } - - var str = "" - , length = rndint(minlen, maxlen) - - while(length-- > 0) - str += String.fromCharCode(rndint(97, 122)) - - return str - } - - function rndint(min, max) { - return min + Math.floor(Math.random() * (max - min + 1)) - } -} - - -if(require.main === module) - setup_test(tap.test) diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/test/follow.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/test/follow.js deleted file mode 100644 index bd0ff61..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/test/follow.js +++ /dev/null @@ -1,136 +0,0 @@ -var tap = require('tap') - , test = tap.test - , util = require('util') - , request = require('request') - -var couch = require('./couch') - , follow = require('../api') - - -couch.setup(test) - -test('Follow API', function(t) { - var i = 0 - , saw = {} - - var feed = follow(couch.DB, function(er, change) { - t.is(this, feed, 'Callback "this" value is the feed object') - - i += 1 - t.false(er, 'No error coming back from follow: ' + i) - t.equal(change.seq, i, 'Change #'+i+' should have seq_id='+i) - saw[change.id] = true - - if(i == 3) { - t.ok(saw.doc_first, 'Got the first document') - t.ok(saw.doc_second, 'Got the second document') - t.ok(saw.doc_third , 'Got the third document') - - t.doesNotThrow(function() { feed.stop() }, 'No problem calling stop()') - - t.end() - } - }) -}) - -test("Confirmation request behavior", function(t) { - var feed = follow(couch.DB, function() {}) - - var confirm_req = null - , follow_req = null - - feed.on('confirm_request', function(req) { confirm_req = req }) - feed.on('query', function(req) { follow_req = req }) - - setTimeout(check_req, couch.rtt() * 2) - function check_req() { - t.ok(confirm_req, 'The confirm_request event should have fired by now') - t.ok(confirm_req.agent, 'The confirm request has an agent') - - t.ok(follow_req, 'The follow_request event should have fired by now') - t.ok(follow_req.agent, 'The follow request has an agent') - - // Confirm that the changes follower is not still in the pool. - var host = 'localhost:5984' - follow_req.req.agent.sockets[host].forEach(function(socket, i) { - t.isNot(socket, follow_req.req.connection, 'The changes follower is not socket '+i+' in the agent pool') - }) - - feed.stop() - t.end() - } -}) - -test('Heartbeats', function(t) { - t.ok(couch.rtt(), 'The couch RTT is known') - var check_time = couch.rtt() * 3.5 // Enough time for 3 heartbeats. - - var beats = 0 - , retries = 0 - - var feed = follow(couch.DB, function() {}) - feed.heartbeat = couch.rtt() - feed.on('response', function() { feed.retry_delay = 1 }) - - feed.on('heartbeat', function() { beats += 1 }) - feed.on('retry', function() { retries += 1 }) - - feed.on('catchup', function() { - t.equal(beats, 0, 'Still 0 heartbeats after receiving changes') - t.equal(retries, 0, 'Still 0 retries after receiving changes') - - //console.error('Waiting ' + couch.rtt() + ' * 3 = ' + check_time + ' to check stuff') - setTimeout(check_counters, check_time) - function check_counters() { - t.equal(beats, 3, 'Three heartbeats ('+couch.rtt()+') fired after '+check_time+' ms') - t.equal(retries, 0, 'No retries after '+check_time+' ms') - - feed.stop() - t.end() - } - }) -}) - -test('Events for DB confirmation and hitting the original seq', function(t) { - var feed = follow(couch.DB, on_change) - - var events = { 'confirm':null, 'catchup':null } - feed.on('confirm', function(db) { events.confirm = db }) - feed.on('catchup', function(seq) { events.catchup = seq }) - - function on_change(er, ch) { - t.false(er, 'No problem with the feed') - if(ch.seq == 3) { - t.ok(events.confirm, 'Confirm event fired') - t.equal(events.confirm && events.confirm.db_name, 'follow_test', 'Confirm event returned the Couch DB object') - t.equal(events.confirm && events.confirm.update_seq, 3, 'Confirm event got the update_seq right') - - t.ok(events.catchup, 'Catchup event fired') - t.equal(events.catchup, 3, 'Catchup event fired on update 3') - - feed.stop() - t.end() - } - } -}) - -test('Handle a deleted database', function(t) { - var feed = follow(couch.DB, function(er, change) { - if(er) - return t.equal(er.last_seq, 3, 'Got an error for the deletion event') - - if(change.seq < 3) - return - - t.equal(change.seq, 3, 'Got change number 3') - - var redo_er - couch.redo(function(er) { redo_er = er }) - - setTimeout(check_results, couch.rtt() * 2) - function check_results() { - t.false(er, 'No problem redoing the couch') - t.end() - } - }) -}) diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/test/issues.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/test/issues.js deleted file mode 100644 index 32b0650..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/test/issues.js +++ /dev/null @@ -1,178 +0,0 @@ -var tap = require('tap') - , test = tap.test - , util = require('util') - , request = require('request') - , traceback = require('traceback') - -var lib = require('../lib') - , couch = require('./couch') - , follow = require('../api') - -couch.setup(test) - -test('Issue #5', function(t) { - var saw = { loops:0, seqs:{} } - - var saw_change = false - // -2 means I want to see the last change. - var feed = follow({'db':couch.DB, since:-2}, function(er, change) { - t.equal(change.seq, 3, 'Got the latest change, 3') - t.false(saw_change, 'Only one callback run for since=-2 (assuming no subsequent change') - saw_change = true - - process.nextTick(function() { feed.stop() }) - feed.on('stop', function() { - // Test using since=-1 (AKA since="now"). - follow({'db':couch.DB, since:'now'}, function(er, change) { - t.equal(change.seq, 4, 'Only get changes made after starting the feed') - t.equal(change.id, "You're in now, now", 'Got the subsequent change') - - this.stop() - t.end() - }) - - // Let that follower settle in, then send it something - setTimeout(function() { - var doc = { _id:"You're in now, now", movie:"Spaceballs" } - request.post({uri:couch.DB, json:doc}, function(er) { - if(er) throw er - }) - }, couch.rtt()) - }) - }) -}) - -couch.setup(test) // Back to the expected documents - -test('Issue #6', function(t) { - // When we see change 1, delete the database. The rest should still come in, then the error indicating deletion. - var saw = { seqs:{}, redid:false, redo_err:null } - - follow(couch.DB, function(er, change) { - if(!er) { - saw.seqs[change.seq] = true - t.notOk(change.last_seq, 'Change '+change.seq+' ha no .last_seq') - if(change.seq == 1) { - couch.redo(function(er) { - saw.redid = true - saw.redo_err = er - }) - } - } - - else setTimeout(function() { - // Give the redo time to finish, then confirm that everything happened as expected. - // Hopefully this error indicates the database was deleted. - t.ok(er.message.match(/deleted .* 3$/), 'Got delete error after change 3') - t.ok(er.deleted, 'Error object indicates database deletion') - t.equal(er.last_seq, 3, 'Error object indicates the last change number') - - t.ok(saw.seqs[1], 'Change 1 was processed') - t.ok(saw.seqs[2], 'Change 2 was processed') - t.ok(saw.seqs[3], 'Change 3 was processed') - t.ok(saw.redid, 'The redo function ran') - t.false(saw.redo_err, 'No problem redoing the database') - - return t.end() - }, couch.rtt() * 2) - }) -}) - -test('Issue #8', function(t) { - var timeouts = timeout_tracker() - - // Detect inappropriate timeouts after the run. - var runs = {'set':false, 'clear':false} - function badSetT() { - runs.set = true - return setTimeout.apply(this, arguments) - } - - function badClearT() { - runs.clear = true - return clearTimeout.apply(this, arguments) - } - - follow(couch.DB, function(er, change) { - t.false(er, 'Got a feed') - t.equal(change.seq, 1, 'Handler only runs for one change') - - this.on('stop', check_timeouts) - this.stop() - - function check_timeouts() { - t.equal(timeouts().length, 0, 'No timeouts by the time stop fires') - - lib.timeouts(badSetT, badClearT) - - // And give it a moment to try something bad. - setTimeout(final_timeout_check, 250) - function final_timeout_check() { - t.equal(timeouts().length, 0, 'No lingering timeouts after teardown: ' + tims(timeouts())) - t.false(runs.set, 'No more setTimeouts ran') - t.false(runs.clear, 'No more clearTimeouts ran') - - t.end() - } - } - }) -}) - -test('Issue #9', function(t) { - var timeouts = timeout_tracker() - - follow({db:couch.DB, inactivity_ms:30000}, function(er, change) { - if(change.seq == 1) - return // Let it run through once, just for fun. - - t.equal(change.seq, 2, 'The second change will be the last') - this.stop() - - setTimeout(check_inactivity_timer, 250) - function check_inactivity_timer() { - t.equal(timeouts().length, 0, 'No lingering timeouts after teardown: ' + tims(timeouts())) - timeouts().forEach(function(id) { clearTimeout(id) }) - t.end() - } - }) -}) - -// -// Utilities -// - -function timeout_tracker() { - // Return an array tracking in-flight timeouts. - var timeouts = [] - var set_num = 0 - - lib.timeouts(set, clear) - return function() { return timeouts } - - function set() { - var result = setTimeout.apply(this, arguments) - - var caller = traceback()[2] - set_num += 1 - result.caller = '('+set_num+') ' + (caller.method || caller.name || '') + ' in ' + caller.file + ':' + caller.line - //console.error('setTimeout: ' + result.caller) - - timeouts.push(result) - //console.error('inflight ('+timeouts.length+'): ' + tims(timeouts)) - return result - } - - function clear(id) { - //var caller = traceback()[2] - //caller = (caller.method || caller.name || '') + ' in ' + caller.file + ':' + caller.line - //console.error('clearTimeout: ' + (id && id.caller) + ' <- ' + caller) - - timeouts = timeouts.filter(function(element) { return element !== id }) - //console.error('inflight ('+timeouts.length+'): ' + tims(timeouts)) - return clearTimeout.apply(this, arguments) - } -} - -function tims(arr) { - return JSON.stringify(arr.map(function(timer) { return timer.caller })) -} diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/test/issues/10.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/test/issues/10.js deleted file mode 100644 index ed59970..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/test/issues/10.js +++ /dev/null @@ -1,24 +0,0 @@ -var tap = require('tap') - , test = tap.test - , util = require('util') - -// Issue #10 is about missing log4js. This file sets the environment variable to disable it. -process.env.log_plain = true - -var lib = require('../../lib') - , couch = require('../couch') - , follow = require('../../api') - -couch.setup(test) - -test('Issue #10', function(t) { - follow({db:couch.DB, inactivity_ms:30000}, function(er, change) { - console.error('Change: ' + JSON.stringify(change)) - if(change.seq == 2) - this.stop() - - this.on('stop', function() { - t.end() - }) - }) -}) diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/follow/test/stream.js b/node_modules/resourceful/node_modules/cradle/node_modules/follow/test/stream.js deleted file mode 100644 index 4eb67d2..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/follow/test/stream.js +++ /dev/null @@ -1,493 +0,0 @@ -var tap = require('tap') - , test = tap.test - , util = require('util') - , request = require('request') - -var couch = require('./couch') - , follow = require('../api') - - -couch.setup(test) - -test('The Changes stream API', function(t) { - var feed = new follow.Changes - - t.type(feed.statusCode, 'null', 'Changes has a .statusCode (initially null)') - t.type(feed.setHeader, 'function', 'Changes has a .setHeader() method') - t.type(feed.headers, 'object', 'Changes has a .headers object') - t.same(feed.headers, {}, 'Changes headers are initially empty') - - t.end() -}) - -test('Readable Stream API', function(t) { - var feed = new follow.Changes - - t.is(feed.readable, true, 'Changes is a readable stream') - - t.type(feed.setEncoding, 'function', 'Changes has .setEncoding() method') - t.type(feed.pause, 'function', 'Changes has .pause() method') - t.type(feed.resume, 'function', 'Changes has .resume() method') - t.type(feed.destroy, 'function', 'Changes has .destroy() method') - t.type(feed.destroySoon, 'function', 'Changes has .destroySoon() method') - t.type(feed.pipe, 'function', 'Changes has .pipe() method') - - t.end() -}) - -test('Writatable Stream API', function(t) { - var feed = new follow.Changes - - t.is(feed.writable, true, 'Changes is a writable stream') - - t.type(feed.write, 'function', 'Changes has .write() method') - t.type(feed.end, 'function', 'Changes has .end() method') - t.type(feed.destroy, 'function', 'Changes has .destroy() method') - t.type(feed.destroySoon, 'function', 'Changes has .destroySoon() method') - - t.end() -}) - -test('Error conditions', function(t) { - var feed = new follow.Changes - t.throws(write, 'Throw if the feed type is not defined') - - feed = new follow.Changes - feed.feed = 'neither longpoll nor continuous' - t.throws(write, 'Throw if the feed type is not longpoll nor continuous') - - feed = new follow.Changes({'feed':'longpoll'}) - t.throws(write('stuff'), 'Throw if the "results" line is not sent first') - - feed = new follow.Changes({'feed':'longpoll'}) - t.doesNotThrow(write('') , 'Empty string is fine waiting for "results"') - t.doesNotThrow(write('{') , 'This could be the "results" line') - t.doesNotThrow(write('"resu', 'Another part of the "results" line')) - t.doesNotThrow(write('') , 'Another empty string is still fine') - t.doesNotThrow(write('lts":', 'Final part of "results" line still good')) - t.throws(write(']'), 'First line was not {"results":[') - - feed = new follow.Changes - feed.feed = 'continuous' - t.doesNotThrow(write(''), 'Empty string is fine for a continuous feed') - t.throws(end('{"results":[\n'), 'Continuous stream does not want a header') - - feed = new follow.Changes({'feed':'continuous'}) - t.throws(write('hi\n'), 'Continuous stream wants objects') - - feed = new follow.Changes({'feed':'continuous'}) - t.throws(end('[]\n'), 'Continuous stream wants "real" objects, not Array') - - feed = new follow.Changes({'feed':'continuous'}) - t.throws(write('{"seq":1,"id":"hi","changes":[{"rev":"1-869df2efe56ff5228e613ceb4d561b35"}]},\n'), - 'Continuous stream does not want a comma') - - var types = ['longpoll', 'continuous'] - types.forEach(function(type) { - var bad_writes = [ {}, null, ['a string (array)'], {'an':'object'}] - bad_writes.forEach(function(obj) { - feed = new follow.Changes - feed.feed = type - - t.throws(write(obj), 'Throw for bad write to '+type+': ' + util.inspect(obj)) - }) - - feed = new follow.Changes - feed.feed = type - - var valid = (type == 'longpoll') - ? '{"results":[\n{}\n],\n"last_seq":1}' - : '{"seq":1,"id":"doc"}' - - t.throws(buf(valid, 'but_invalid_encoding'), 'Throw for buffer with bad encoding') - }) - - t.end() - - function buf(data, encoding) { - return write(new Buffer(data), encoding) - } - - function write(data, encoding) { - if(data === undefined) - return feed.write('blah') - return function() { feed.write(data, encoding) } - } - - function end(data, encoding) { - return function() { feed.end(data, encoding) } - } -}) - -test('Longpoll feed', function(t) { - for(var i = 0; i < 2; i++) { - var feed = new follow.Changes({'feed':'longpoll'}) - - var data = [] - feed.on('data', function(d) { data.push(d) }) - - function encode(data) { return (i == 0) ? data : new Buffer(data) } - function write(data) { return function() { feed.write(encode(data)) } } - function end(data) { return function() { feed.end(encode(data)) } } - - t.doesNotThrow(write('{"results":[') , 'Longpoll header') - t.doesNotThrow(write('{}') , 'Empty object') - t.doesNotThrow(write(',{"foo":"bar"},') , 'Comma prefix and suffix') - t.doesNotThrow(write('{"two":"bar"},') , 'Comma suffix') - t.doesNotThrow(write('{"three":3},{"four":4}'), 'Two objects on one line') - t.doesNotThrow(end('],\n"last_seq":3}\n') , 'Longpoll footer') - - t.equal(data.length, 5, 'Five data events fired') - t.equal(data[0], '{}', 'First object emitted') - t.equal(data[1], '{"foo":"bar"}', 'Second object emitted') - t.equal(data[2], '{"two":"bar"}', 'Third object emitted') - t.equal(data[3], '{"three":3}', 'Fourth object emitted') - t.equal(data[4], '{"four":4}', 'Fifth object emitted') - } - - t.end() -}) - -test('Longpoll pause', function(t) { - var feed = new follow.Changes({'feed':'longpoll'}) - , all = {'results':[{'change':1}, {'second':'change'},{'change':'#3'}], 'last_seq':3} - , start = new Date - - var events = [] - - feed.on('data', function(change) { - change = JSON.parse(change) - change.elapsed = new Date - start - events.push(change) - }) - - feed.once('data', function(data) { - t.equal(data, '{"change":1}', 'First data event was the first change') - feed.pause() - setTimeout(function() { feed.resume() }, 100) - }) - - feed.on('end', function() { - t.equal(feed.readable, false, 'Feed is no longer readable') - events.push('END') - }) - - setTimeout(check_events, 150) - feed.end(JSON.stringify(all)) - - function check_events() { - t.equal(events.length, 3+1, 'Three data events, plus the end event') - - t.ok(events[0].elapsed < 10, 'Immediate emit first data event') - t.ok(events[1].elapsed >= 100 && events[1].elapsed < 125, 'About 100ms delay until the second event') - t.ok(events[2].elapsed - events[1].elapsed < 10, 'Immediate emit of subsequent event after resume') - t.equal(events[3], 'END', 'End event was fired') - - t.end() - } -}) - -test('Continuous feed', function(t) { - for(var i = 0; i < 2; i++) { - var feed = new follow.Changes({'feed':'continuous'}) - - var data = [] - feed.on('data', function(d) { data.push(d) }) - feed.on('end', function() { data.push('END') }) - - var beats = 0 - feed.on('heartbeat', function() { beats += 1 }) - - function encode(data) { return (i == 0) ? data : new Buffer(data) } - function write(data) { return function() { feed.write(encode(data)) } } - function end(data) { return function() { feed.end(encode(data)) } } - - // This also tests whether the feed is compacting or tightening up the JSON. - t.doesNotThrow(write('{ }\n') , 'Empty object') - t.doesNotThrow(write('\n') , 'Heartbeat') - t.doesNotThrow(write('{ "foo" : "bar" }\n') , 'One object') - t.doesNotThrow(write('{"three":3}\n{ "four": 4}\n'), 'Two objects sent in one chunk') - t.doesNotThrow(write('') , 'Empty string') - t.doesNotThrow(write('\n') , 'Another heartbeat') - t.doesNotThrow(write('') , 'Another empty string') - t.doesNotThrow(write('{ "end" ') , 'Partial object 1/4') - t.doesNotThrow(write(':') , 'Partial object 2/4') - t.doesNotThrow(write('tru') , 'Partial object 3/4') - t.doesNotThrow(end('e}\n') , 'Partial object 4/4') - - t.equal(data.length, 6, 'Five objects emitted, plus the end event') - t.equal(beats, 2, 'Two heartbeats emitted') - - t.equal(data[0], '{}', 'First object emitted') - t.equal(data[1], '{"foo":"bar"}', 'Second object emitted') - t.equal(data[2], '{"three":3}', 'Third object emitted') - t.equal(data[3], '{"four":4}', 'Fourth object emitted') - t.equal(data[4], '{"end":true}', 'Fifth object emitted') - t.equal(data[5], 'END', 'End event fired') - } - - t.end() -}) - -test('Continuous pause', function(t) { - var feed = new follow.Changes({'feed':'continuous'}) - , all = [{'change':1}, {'second':'change'},{'#3':'change'}] - , start = new Date - - var events = [] - - feed.on('end', function() { - t.equal(feed.readable, false, 'Feed is not readable after "end" event') - events.push('END') - }) - - feed.on('data', function(change) { - change = JSON.parse(change) - change.elapsed = new Date - start - events.push(change) - }) - - feed.once('data', function(data) { - t.equal(data, '{"change":1}', 'First data event was the first change') - t.equal(feed.readable, true, 'Feed is readable after first data event') - feed.pause() - t.equal(feed.readable, true, 'Feed is readable after pause()') - - setTimeout(unpause, 100) - function unpause() { - t.equal(feed.readable, true, 'Feed is readable just before resume()') - feed.resume() - } - }) - - setTimeout(check_events, 150) - all.forEach(function(obj) { - feed.write(JSON.stringify(obj)) - feed.write("\r\n") - }) - feed.end() - - function check_events() { - t.equal(events.length, 3+1, 'Three data events, plus the end event') - - t.ok(events[0].elapsed < 10, 'Immediate emit first data event') - t.ok(events[1].elapsed >= 100 && events[1].elapsed < 125, 'About 100ms delay until the second event') - t.ok(events[2].elapsed - events[1].elapsed < 10, 'Immediate emit of subsequent event after resume') - t.equal(events[3], 'END', 'End event was fired') - - t.end() - } -}) - -test('Feeds from couch', function(t) { - t.ok(couch.rtt(), 'RTT to couch is known') - - var did = 0 - function done() { - did += 1 - if(did == 2) - t.end() - } - - var types = [ 'longpoll', 'continuous' ] - types.forEach(function(type) { - var feed = new follow.Changes({'feed':type}) - setTimeout(check_changes, couch.rtt() * 2) - - var events = [] - feed.on('data', function(data) { events.push(JSON.parse(data)) }) - feed.on('end', function() { events.push('END') }) - - var uri = couch.DB + '/_changes?feed=' + type - var req = request({'uri':uri, 'onResponse':true}, on_response) - - // Disconnect the continuous feed after a while. - if(type == 'continuous') - setTimeout(function() { feed.destroy() }, couch.rtt() * 1) - - function on_response(er, res, body) { - t.false(er, 'No problem fetching '+type+' feed: ' + uri) - t.type(body, 'undefined', 'No data in '+type+' callback. This is an onResponse callback') - t.type(res.body, 'undefined', 'No response body in '+type+' callback. This is an onResponse callback') - t.ok(req.response, 'The request object has its '+type+' response by now') - - req.pipe(feed) - - t.equal(feed.statusCode, 200, 'Upon piping from request, the statusCode is set') - t.ok('content-type' in feed.headers, 'Upon piping from request, feed has headers set') - } - - function check_changes() { - var expected_count = 3 - if(type == 'longpoll') - expected_count += 1 // For the "end" event - - t.equal(events.length, expected_count, 'Change event count for ' + type) - - t.equal(events[0].seq, 1, 'First '+type+' update sequence id') - t.equal(events[1].seq, 2, 'Second '+type+' update sequence id') - t.equal(events[2].seq, 3, 'Third '+type+' update sequence id') - - t.equal(good_id(events[0]), true, 'First '+type+' update is a good doc id: ' + events[0].id) - t.equal(good_id(events[1]), true, 'Second '+type+' update is a good doc id: ' + events[1].id) - t.equal(good_id(events[2]), true, 'Third '+type+' update is a good doc id: ' + events[2].id) - - if(type == 'longpoll') - t.equal(events[3], 'END', 'End event fired for '+type) - else - t.type(events[3], 'undefined', 'No end event for a destroyed continuous feed') - - done() - } - - var good_ids = {'doc_first':true, 'doc_second':true, 'doc_third':true} - function good_id(event) { - var is_good = good_ids[event.id] - delete good_ids[event.id] - return is_good - } - }) -}) - -test('Pausing and destroying a feed mid-stream', function(t) { - t.ok(couch.rtt(), 'RTT to couch is known') - var IMMEDIATE = 20 - , FIRST_PAUSE = couch.rtt() * 8 - , SECOND_PAUSE = couch.rtt() * 12 - - // To be really, really sure that backpressure goes all the way to couch, create more - // documents than could possibly be buffered. Linux and OSX seem to have a 16k MTU for - // the local interface, so a few hundred kb worth of document data should cover it. - couch.make_data(512 * 1024, check) - - var types = ['longpoll', 'continuous'] - function check(bulk_docs_count) { - var type = types.shift() - if(!type) - return t.end() - - var feed = new follow.Changes - feed.feed = type - - var destroys = 0 - function destroy() { - destroys += 1 - feed.destroy() - - // Give one more RTT time for everything to wind down before checking how it all went. - if(destroys == 1) - setTimeout(check_events, couch.rtt()) - } - - var events = {'feed':[], 'http':[], 'request':[]} - , firsts = {'feed':null, 'http':null, 'request':null} - function ev(type, value) { - var now = new Date - firsts[type] = firsts[type] || now - events[type].push({'elapsed':now - firsts[type], 'at':now, 'val':value, 'before_destroy':(destroys == 0)}) - } - - feed.on('heartbeat', function() { ev('feed', 'heartbeat') }) - feed.on('error', function(er) { ev('feed', er) }) - feed.on('close', function() { ev('feed', 'close') }) - feed.on('data', function(data) { ev('feed', data) }) - feed.on('end', function() { ev('feed', 'end') }) - - var data_count = 0 - feed.on('data', function() { - data_count += 1 - if(data_count == 4) { - feed.pause() - setTimeout(function() { feed.resume() }, FIRST_PAUSE) - } - - if(data_count == 7) { - feed.pause() - setTimeout(function() { feed.resume() }, SECOND_PAUSE - FIRST_PAUSE) - } - - if(data_count >= 10) - destroy() - }) - - var uri = couch.DB + '/_changes?include_docs=true&feed=' + type - if(type == 'continuous') - uri += '&heartbeat=' + Math.floor(couch.rtt()) - - var req = request({'uri':uri, 'onResponse':feed_response}) - req.on('error', function(er) { ev('request', er) }) - req.on('close', function() { ev('request', 'close') }) - req.on('data', function(d) { ev('request', d) }) - req.on('end', function() { ev('request', 'end') }) - req.pipe(feed) - - function feed_response(er, res) { - if(er) throw er - - res.on('error', function(er) { ev('http', er) }) - res.on('close', function() { ev('http', 'close') }) - res.on('data', function(d) { ev('http', d) }) - res.on('end', function() { ev('http', 'end') }) - - t.equal(events.feed.length, 0, 'No feed events yet: ' + type) - t.equal(events.http.length, 0, 'No http events yet: ' + type) - t.equal(events.request.length, 0, 'No request events yet: ' + type) - } - - function check_events() { - t.equal(destroys, 1, 'Only necessary to call destroy once: ' + type) - t.equal(events.feed.length, 10, 'Ten '+type+' data events fired') - if(events.feed.length != 10) - events.feed.forEach(function(e, i) { - console.error((i+1) + ') ' + util.inspect(e)) - }) - - events.feed.forEach(function(event, i) { - var label = type + ' event #' + (i+1) + ' at ' + event.elapsed + ' ms' - - t.type(event.val, 'string', label+' was a data string') - t.equal(event.before_destroy, true, label+' fired before the destroy') - - var change = null - t.doesNotThrow(function() { change = JSON.parse(event.val) }, label+' was JSON: ' + type) - t.ok(change && change.seq > 0 && change.id, label+' was change data: ' + type) - - // The first batch of events should have fired quickly (IMMEDIATE), then silence. Then another batch - // of events at the FIRST_PAUSE mark. Then more silence. Then a final batch at the SECOND_PAUSE mark. - if(i < 4) - t.ok(event.elapsed < IMMEDIATE, label+' was immediate (within '+IMMEDIATE+' ms)') - else if(i < 7) - t.ok(is_almost(event.elapsed, FIRST_PAUSE), label+' was after the first pause (about '+FIRST_PAUSE+' ms)') - else - t.ok(is_almost(event.elapsed, SECOND_PAUSE), label+' was after the second pause (about '+SECOND_PAUSE+' ms)') - }) - - if(type == 'continuous') { - t.ok(events.http.length >= 10, 'Should have at least ten '+type+' HTTP events') - t.ok(events.request.length >= 10, 'Should have at least ten '+type+' request events') - - t.ok(events.http.length < 200, type+' HTTP events ('+events.http.length+') stop before 100') - t.ok(events.request.length < 200, type+' request events ('+events.request.length+') stop before 100') - - var frac = events.http.length / bulk_docs_count - t.ok(frac < 0.10, 'Percent of http events received ('+frac.toFixed(1)+'%) is less than 10% of the data') - - frac = events.request.length / bulk_docs_count - t.ok(frac < 0.10, type+' request events received ('+frac.toFixed(1)+'%) is less than 10% of the data') - } - - return check(bulk_docs_count) - } - } -}) - -// -// Utilities -// - -function is_almost(actual, expected) { - var tolerance = 0.10 // 10% - , diff = Math.abs(actual - expected) - , fraction = diff / expected - return fraction < tolerance -} diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/LICENSE b/node_modules/resourceful/node_modules/cradle/node_modules/request/LICENSE deleted file mode 100644 index a4a9aee..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/LICENSE +++ /dev/null @@ -1,55 +0,0 @@ -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of this License; and - -You must cause any modified files to carry prominent notices stating that You changed the files; and - -You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - -If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/README.md b/node_modules/resourceful/node_modules/cradle/node_modules/request/README.md deleted file mode 100644 index e5839b5..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/README.md +++ /dev/null @@ -1,288 +0,0 @@ -# Request -- Simplified HTTP request method - -## Install - -
        -  npm install request
        -
        - -Or from source: - -
        -  git clone git://github.com/mikeal/request.git 
        -  cd request
        -  npm link
        -
        - -## Super simple to use - -Request is designed to be the simplest way possible to make http calls. It support HTTPS and follows redirects by default. - -```javascript -var request = require('request'); -request('http://www.google.com', function (error, response, body) { - if (!error && response.statusCode == 200) { - console.log(body) // Print the google web page. - } -}) -``` - -## Streaming - -You can stream any response to a file stream. - -```javascript -request('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png')) -``` - -You can also stream a file to a PUT or POST request. This method will also check the file extension against a mapping of file extensions to content-types, in this case `application/json`, and use the proper content-type in the PUT request if one is not already provided in the headers. - -```javascript -fs.createReadStream('file.json').pipe(request.put('http://mysite.com/obj.json')) -``` - -Request can also pipe to itself. When doing so the content-type and content-length will be preserved in the PUT headers. - -```javascript -request.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img.png')) -``` - -Now let's get fancy. - -```javascript -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - if (req.method === 'PUT') { - req.pipe(request.put('http://mysite.com/doodle.png')) - } else if (req.method === 'GET' || req.method === 'HEAD') { - request.get('http://mysite.com/doodle.png').pipe(resp) - } - } -}) -``` - -You can also pipe() from a http.ServerRequest instance and to a http.ServerResponse instance. The HTTP method and headers will be sent as well as the entity-body data. Which means that, if you don't really care about security, you can do: - -```javascript -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - var x = request('http://mysite.com/doodle.png') - req.pipe(x) - x.pipe(resp) - } -}) -``` - -And since pipe() returns the destination stream in node 0.5.x you can do one line proxying :) - -```javascript -req.pipe(request('http://mysite.com/doodle.png')).pipe(resp) -``` - -Also, none of this new functionality conflicts with requests previous features, it just expands them. - -```javascript -var r = request.defaults({'proxy':'http://localproxy.com'}) - -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - r.get('http://google.com/doodle.png').pipe(resp) - } -}) -``` - -You can still use intermediate proxies, the requests will still follow HTTP forwards, etc. - -## OAuth Signing - -```javascript -// Twitter OAuth -var qs = require('querystring') - , oauth = - { callback: 'http://mysite.com/callback/' - , consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - } - , url = 'https://api.twitter.com/oauth/request_token' - ; -request.post({url:url, oauth:oauth}, function (e, r, body) { - // Assume by some stretch of magic you aquired the verifier - var access_token = qs.parse(body) - , oauth = - { consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - , token: access_token.oauth_token - , verifier: VERIFIER - , token_secret: access_token.oauth_token_secret - } - , url = 'https://api.twitter.com/oauth/access_token' - ; - request.post({url:url, oauth:oauth}, function (e, r, body) { - var perm_token = qs.parse(body) - , oauth = - { consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - , token: perm_token.oauth_token - , token_secret: perm_token.oauth_token_secret - } - , url = 'https://api.twitter.com/1/users/show.json?' - , params = - { screen_name: perm_token.screen_name - , user_id: perm_token.user_id - } - ; - url += qs.stringify(params) - request.get({url:url, oauth:oauth, json:true}, function (e, r, user) { - console.log(user) - }) - }) -}) -``` - - - -### request(options, callback) - -The first argument can be either a url or an options object. The only required option is uri, all others are optional. - -* `uri` || `url` - fully qualified uri or a parsed url object from url.parse() -* `qs` - object containing querystring values to be appended to the uri -* `method` - http method, defaults to GET -* `headers` - http headers, defaults to {} -* `body` - entity body for POST and PUT requests. Must be buffer or string. -* `form` - sets `body` but to querystring representation of value and adds `Content-type: application/x-www-form-urlencoded; charset=utf-8` header. -* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. -* `multipart` - (experimental) array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See example below. -* `followRedirect` - follow HTTP 3xx responses as redirects. defaults to true. -* `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects. defaults to false. -* `maxRedirects` - the maximum number of redirects to follow, defaults to 10. -* `onResponse` - If true the callback will be fired on the "response" event instead of "end". If a function it will be called on "response" and not effect the regular semantics of the main callback on "end". -* `encoding` - Encoding to be used on `setEncoding` of response data. If set to `null`, the body is returned as a Buffer. -* `pool` - A hash object containing the agents for these requests. If omitted this request will use the global pool which is set to node's default maxSockets. -* `pool.maxSockets` - Integer containing the maximum amount of sockets in the pool. -* `timeout` - Integer containing the number of milliseconds to wait for a request to respond before aborting the request -* `proxy` - An HTTP proxy to be used. Support proxy Auth with Basic Auth the same way it's supported with the `url` parameter by embedding the auth info in the uri. -* `oauth` - Options for OAuth HMAC-SHA1 signing, see documentation above. -* `strictSSL` - Set to `true` to require that SSL certificates be valid. Note: to use your own certificate authority, you need to specify an agent that was created with that ca as an option. -* `jar` - Set to `false` if you don't want cookies to be remembered for future use or define your custom cookie jar (see examples section) - - -The callback argument gets 3 arguments. The first is an error when applicable (usually from the http.Client option not the http.ClientRequest object). The second in an http.ClientResponse object. The third is the response body String or Buffer. - -## Convenience methods - -There are also shorthand methods for different HTTP METHODs and some other conveniences. - -### request.defaults(options) - -This method returns a wrapper around the normal request API that defaults to whatever options you pass in to it. - -### request.put - -Same as request() but defaults to `method: "PUT"`. - -```javascript -request.put(url) -``` - -### request.post - -Same as request() but defaults to `method: "POST"`. - -```javascript -request.post(url) -``` - -### request.head - -Same as request() but defaults to `method: "HEAD"`. - -```javascript -request.head(url) -``` - -### request.del - -Same as request() but defaults to `method: "DELETE"`. - -```javascript -request.del(url) -``` - -### request.get - -Alias to normal request method for uniformity. - -```javascript -request.get(url) -``` -### request.cookie - -Function that creates a new cookie. - -```javascript -request.cookie('cookie_string_here') -``` -### request.jar - -Function that creates a new cookie jar. - -```javascript -request.jar() -``` - - -## Examples: - -```javascript - var request = require('request') - , rand = Math.floor(Math.random()*100000000).toString() - ; - request( - { method: 'PUT' - , uri: 'http://mikeal.iriscouch.com/testjs/' + rand - , multipart: - [ { 'content-type': 'application/json' - , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) - } - , { body: 'I am an attachment' } - ] - } - , function (error, response, body) { - if(response.statusCode == 201){ - console.log('document saved as: http://mikeal.iriscouch.com/testjs/'+ rand) - } else { - console.log('error: '+ response.statusCode) - console.log(body) - } - } - ) -``` -Cookies are enabled by default (so they can be used in subsequent requests). To disable cookies set jar to false (either in defaults or in the options sent). - -```javascript -var request = request.defaults({jar: false}) -request('http://www.google.com', function () { - request('http://images.google.com') -}) -``` - -If you to use a custom cookie jar (instead of letting request use its own global cookie jar) you do so by setting the jar default or by specifying it as an option: - -```javascript -var j = request.jar() -var request = request.defaults({jar:j}) -request('http://www.google.com', function () { - request('http://images.google.com') -}) -``` -OR - -```javascript -var j = request.jar() -var cookie = request.cookie('your_cookie_here') -j.add(cookie) -request({url: 'http://www.google.com', jar: j}, function () { - request('http://images.google.com') -}) -``` diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/forever.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/forever.js deleted file mode 100644 index ac853c0..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/forever.js +++ /dev/null @@ -1,103 +0,0 @@ -module.exports = ForeverAgent -ForeverAgent.SSL = ForeverAgentSSL - -var util = require('util') - , Agent = require('http').Agent - , net = require('net') - , tls = require('tls') - , AgentSSL = require('https').Agent - -function ForeverAgent(options) { - var self = this - self.options = options || {} - self.requests = {} - self.sockets = {} - self.freeSockets = {} - self.maxSockets = self.options.maxSockets || Agent.defaultMaxSockets - self.minSockets = self.options.minSockets || ForeverAgent.defaultMinSockets - self.on('free', function(socket, host, port) { - var name = host + ':' + port - if (self.requests[name] && self.requests[name].length) { - self.requests[name].shift().onSocket(socket) - } else if (self.sockets[name].length < self.minSockets) { - if (!self.freeSockets[name]) self.freeSockets[name] = [] - self.freeSockets[name].push(socket) - - // if an error happens while we don't use the socket anyway, meh, throw the socket away - function onIdleError() { - socket.destroy() - } - socket._onIdleError = onIdleError - socket.on('error', onIdleError) - } else { - // If there are no pending requests just destroy the - // socket and it will get removed from the pool. This - // gets us out of timeout issues and allows us to - // default to Connection:keep-alive. - socket.destroy(); - } - }) - -} -util.inherits(ForeverAgent, Agent) - -ForeverAgent.defaultMinSockets = 5 - - -ForeverAgent.prototype.createConnection = net.createConnection -ForeverAgent.prototype.addRequestNoreuse = Agent.prototype.addRequest -ForeverAgent.prototype.addRequest = function(req, host, port) { - var name = host + ':' + port - if (this.freeSockets[name] && this.freeSockets[name].length > 0 && !req.useChunkedEncodingByDefault) { - var idleSocket = this.freeSockets[name].pop() - idleSocket.removeListener('error', idleSocket._onIdleError) - delete idleSocket._onIdleError - req._reusedSocket = true - req.onSocket(idleSocket) - } else { - this.addRequestNoreuse(req, host, port) - } -} - -ForeverAgent.prototype.removeSocket = function(s, name, host, port) { - if (this.sockets[name]) { - var index = this.sockets[name].indexOf(s); - if (index !== -1) { - this.sockets[name].splice(index, 1); - } - } else if (this.sockets[name] && this.sockets[name].length === 0) { - // don't leak - delete this.sockets[name]; - delete this.requests[name]; - } - - if (this.freeSockets[name]) { - var index = this.freeSockets[name].indexOf(s) - if (index !== -1) { - this.freeSockets[name].splice(index, 1) - if (this.freeSockets[name].length === 0) { - delete this.freeSockets[name] - } - } - } - - if (this.requests[name] && this.requests[name].length) { - // If we have pending requests and a socket gets closed a new one - // needs to be created to take over in the pool for the one that closed. - this.createSocket(name, host, port).emit('free'); - } -} - -function ForeverAgentSSL (options) { - ForeverAgent.call(this, options) -} -util.inherits(ForeverAgentSSL, ForeverAgent) - -ForeverAgentSSL.prototype.createConnection = createConnectionSSL -ForeverAgentSSL.prototype.addRequestNoreuse = AgentSSL.prototype.addRequest - -function createConnectionSSL (port, host, options) { - options.port = port - options.host = host - return tls.connect(options) -} diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/main.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/main.js deleted file mode 100644 index f651202..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/main.js +++ /dev/null @@ -1,874 +0,0 @@ -// Copyright 2010-2012 Mikeal Rogers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -var http = require('http') - , https = false - , tls = false - , url = require('url') - , util = require('util') - , stream = require('stream') - , qs = require('querystring') - , mimetypes = require('./mimetypes') - , oauth = require('./oauth') - , uuid = require('./uuid') - , ForeverAgent = require('./forever') - , Cookie = require('./vendor/cookie') - , CookieJar = require('./vendor/cookie/jar') - , cookieJar = new CookieJar - , tunnel = require('./tunnel') - ; - -if (process.logging) { - var log = process.logging('request') -} - -try { - https = require('https') -} catch (e) {} - -try { - tls = require('tls') -} catch (e) {} - -function toBase64 (str) { - return (new Buffer(str || "", "ascii")).toString("base64") -} - -// Hacky fix for pre-0.4.4 https -if (https && !https.Agent) { - https.Agent = function (options) { - http.Agent.call(this, options) - } - util.inherits(https.Agent, http.Agent) - https.Agent.prototype._getConnection = function(host, port, cb) { - var s = tls.connect(port, host, this.options, function() { - // do other checks here? - if (cb) cb() - }) - return s - } -} - -function isReadStream (rs) { - if (rs.readable && rs.path && rs.mode) { - return true - } -} - -function copy (obj) { - var o = {} - Object.keys(obj).forEach(function (i) { - o[i] = obj[i] - }) - return o -} - -var isUrl = /^https?:/ - -var globalPool = {} - -function Request (options) { - stream.Stream.call(this) - this.readable = true - this.writable = true - - if (typeof options === 'string') { - options = {uri:options} - } - - var reserved = Object.keys(Request.prototype) - for (var i in options) { - if (reserved.indexOf(i) === -1) { - this[i] = options[i] - } else { - if (typeof options[i] === 'function') { - delete options[i] - } - } - } - options = copy(options) - - this.init(options) -} -util.inherits(Request, stream.Stream) -Request.prototype.init = function (options) { - var self = this - - if (!options) options = {} - - if (!self.pool) self.pool = globalPool - self.dests = [] - self.__isRequestRequest = true - - // Protect against double callback - if (!self._callback && self.callback) { - self._callback = self.callback - self.callback = function () { - if (self._callbackCalled) return // Print a warning maybe? - self._callback.apply(self, arguments) - self._callbackCalled = true - } - } - - if (self.url) { - // People use this property instead all the time so why not just support it. - self.uri = self.url - delete self.url - } - - if (!self.uri) { - throw new Error("options.uri is a required argument") - } else { - if (typeof self.uri == "string") self.uri = url.parse(self.uri) - } - if (self.proxy) { - if (typeof self.proxy == 'string') self.proxy = url.parse(self.proxy) - - // do the HTTP CONNECT dance using koichik/node-tunnel - if (http.globalAgent && self.uri.protocol === "https:") { - self.tunnel = true - var tunnelFn = self.proxy.protocol === "http:" - ? tunnel.httpsOverHttp : tunnel.httpsOverHttps - - var tunnelOptions = { proxy: { host: self.proxy.hostname - , port: +self.proxy.port } - , ca: this.ca } - - self.agent = tunnelFn(tunnelOptions) - self.tunnel = true - } - } - - self._redirectsFollowed = self._redirectsFollowed || 0 - self.maxRedirects = (self.maxRedirects !== undefined) ? self.maxRedirects : 10 - self.followRedirect = (self.followRedirect !== undefined) ? self.followRedirect : true - self.followAllRedirects = (self.followAllRedirects !== undefined) ? self.followAllRedirects : false; - if (self.followRedirect || self.followAllRedirects) - self.redirects = self.redirects || [] - - self.headers = self.headers ? copy(self.headers) : {} - - self.setHost = false - if (!self.headers.host) { - self.headers.host = self.uri.hostname - if (self.uri.port) { - if ( !(self.uri.port === 80 && self.uri.protocol === 'http:') && - !(self.uri.port === 443 && self.uri.protocol === 'https:') ) - self.headers.host += (':'+self.uri.port) - } - self.setHost = true - } - - self.jar(options.jar) - - if (!self.uri.pathname) {self.uri.pathname = '/'} - if (!self.uri.port) { - if (self.uri.protocol == 'http:') {self.uri.port = 80} - else if (self.uri.protocol == 'https:') {self.uri.port = 443} - } - - if (self.proxy && !self.tunnel) { - self.port = self.proxy.port - self.host = self.proxy.hostname - } else { - self.port = self.uri.port - self.host = self.uri.hostname - } - - if (self.onResponse === true) { - self.onResponse = self.callback - delete self.callback - } - - self.clientErrorHandler = function (error) { - if (self._aborted) return - - if (self.setHost) delete self.headers.host - if (self.req._reusedSocket && error.code === 'ECONNRESET' - && self.agent.addRequestNoreuse) { - self.agent = { addRequest: self.agent.addRequestNoreuse.bind(self.agent) } - self.start() - self.req.end() - return - } - if (self.timeout && self.timeoutTimer) { - clearTimeout(self.timeoutTimer); - self.timeoutTimer = null; - } - self.emit('error', error) - } - if (self.onResponse) self.on('error', function (e) {self.onResponse(e)}) - if (self.callback) self.on('error', function (e) {self.callback(e)}) - - if (options.form) { - self.form(options.form) - } - - if (options.oauth) { - self.oauth(options.oauth) - } - - if (self.uri.auth && !self.headers.authorization) { - self.headers.authorization = "Basic " + toBase64(self.uri.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':')) - } - if (self.proxy && self.proxy.auth && !self.headers['proxy-authorization'] && !self.tunnel) { - self.headers['proxy-authorization'] = "Basic " + toBase64(self.proxy.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':')) - } - - if (options.qs) self.qs(options.qs) - - if (self.uri.path) { - self.path = self.uri.path - } else { - self.path = self.uri.pathname + (self.uri.search || "") - } - - if (self.path.length === 0) self.path = '/' - - if (self.proxy && !self.tunnel) self.path = (self.uri.protocol + '//' + self.uri.host + self.path) - - if (options.json) { - self.json(options.json) - } else if (options.multipart) { - self.multipart(options.multipart) - } - - if (self.body) { - var length = 0 - if (!Buffer.isBuffer(self.body)) { - if (Array.isArray(self.body)) { - for (var i = 0; i < self.body.length; i++) { - length += self.body[i].length - } - } else { - self.body = new Buffer(self.body) - length = self.body.length - } - } else { - length = self.body.length - } - if (length) { - self.headers['content-length'] = length - } else { - throw new Error('Argument error, options.body.') - } - } - - var protocol = self.proxy && !self.tunnel ? self.proxy.protocol : self.uri.protocol - , defaultModules = {'http:':http, 'https:':https} - , httpModules = self.httpModules || {} - ; - self.httpModule = httpModules[protocol] || defaultModules[protocol] - - if (!self.httpModule) throw new Error("Invalid protocol") - - if (options.ca) self.ca = options.ca - - if (!self.agent) { - if (options.agentOptions) self.agentOptions = options.agentOptions - - if (options.agentClass) { - self.agentClass = options.agentClass - } else if (options.forever) { - self.agentClass = protocol === 'http:' ? ForeverAgent : ForeverAgent.SSL - } else { - self.agentClass = self.httpModule.Agent - } - } - - if (self.pool === false) { - self.agent = false - } else { - self.agent = self.agent || self.getAgent() - if (self.maxSockets) { - // Don't use our pooling if node has the refactored client - self.agent.maxSockets = self.maxSockets - } - if (self.pool.maxSockets) { - // Don't use our pooling if node has the refactored client - self.agent.maxSockets = self.pool.maxSockets - } - } - - self.once('pipe', function (src) { - if (self.ntick) throw new Error("You cannot pipe to this stream after the first nextTick() after creation of the request stream.") - self.src = src - if (isReadStream(src)) { - if (!self.headers['content-type'] && !self.headers['Content-Type']) - self.headers['content-type'] = mimetypes.lookup(src.path.slice(src.path.lastIndexOf('.')+1)) - } else { - if (src.headers) { - for (var i in src.headers) { - if (!self.headers[i]) { - self.headers[i] = src.headers[i] - } - } - } - if (src.method && !self.method) { - self.method = src.method - } - } - - self.on('pipe', function () { - console.error("You have already piped to this stream. Pipeing twice is likely to break the request.") - }) - }) - - process.nextTick(function () { - if (self._aborted) return - - if (self.body) { - if (Array.isArray(self.body)) { - self.body.forEach(function(part) { - self.write(part) - }) - } else { - self.write(self.body) - } - self.end() - } else if (self.requestBodyStream) { - console.warn("options.requestBodyStream is deprecated, please pass the request object to stream.pipe.") - self.requestBodyStream.pipe(self) - } else if (!self.src) { - self.headers['content-length'] = 0 - self.end() - } - self.ntick = true - }) -} - -Request.prototype.getAgent = function () { - var Agent = this.agentClass - var options = {} - if (this.agentOptions) { - for (var i in this.agentOptions) { - options[i] = this.agentOptions[i] - } - } - if (this.ca) options.ca = this.ca - - var poolKey = '' - - // different types of agents are in different pools - if (Agent !== this.httpModule.Agent) { - poolKey += Agent.name - } - - if (!this.httpModule.globalAgent) { - // node 0.4.x - options.host = this.host - options.port = this.port - if (poolKey) poolKey += ':' - poolKey += this.host + ':' + this.port - } - - if (options.ca) { - if (poolKey) poolKey += ':' - poolKey += options.ca - } - - if (!poolKey && Agent === this.httpModule.Agent && this.httpModule.globalAgent) { - // not doing anything special. Use the globalAgent - return this.httpModule.globalAgent - } - - // already generated an agent for this setting - if (this.pool[poolKey]) return this.pool[poolKey] - - return this.pool[poolKey] = new Agent(options) -} - -Request.prototype.start = function () { - var self = this - - if (self._aborted) return - - self._started = true - self.method = self.method || 'GET' - self.href = self.uri.href - if (log) log('%method %href', self) - self.req = self.httpModule.request(self, function (response) { - if (self._aborted) return - if (self._paused) response.pause() - - self.response = response - response.request = self - - if (self.httpModule === https && - self.strictSSL && - !response.client.authorized) { - var sslErr = response.client.authorizationError - self.emit('error', new Error('SSL Error: '+ sslErr)) - return - } - - if (self.setHost) delete self.headers.host - if (self.timeout && self.timeoutTimer) { - clearTimeout(self.timeoutTimer); - self.timeoutTimer = null; - } - - if (response.headers['set-cookie'] && (!self._disableCookies)) { - response.headers['set-cookie'].forEach(function(cookie) { - if (self._jar) self._jar.add(new Cookie(cookie)) - else cookieJar.add(new Cookie(cookie)) - }) - } - - if (response.statusCode >= 300 && response.statusCode < 400 && - (self.followAllRedirects || - (self.followRedirect && (self.method !== 'PUT' && self.method !== 'POST' && self.method !== 'DELETE'))) && - response.headers.location) { - if (self._redirectsFollowed >= self.maxRedirects) { - self.emit('error', new Error("Exceeded maxRedirects. Probably stuck in a redirect loop.")) - return - } - self._redirectsFollowed += 1 - - if (!isUrl.test(response.headers.location)) { - response.headers.location = url.resolve(self.uri.href, response.headers.location) - } - self.uri = response.headers.location - self.redirects.push( - { statusCode : response.statusCode - , redirectUri: response.headers.location - } - ) - self.method = 'GET'; // Force all redirects to use GET - delete self.req - delete self.agent - delete self._started - if (self.headers) { - delete self.headers.host - } - if (log) log('Redirect to %uri', self) - self.init() - return // Ignore the rest of the response - } else { - self._redirectsFollowed = self._redirectsFollowed || 0 - // Be a good stream and emit end when the response is finished. - // Hack to emit end on close because of a core bug that never fires end - response.on('close', function () { - if (!self._ended) self.response.emit('end') - }) - - if (self.encoding) { - if (self.dests.length !== 0) { - console.error("Ingoring encoding parameter as this stream is being piped to another stream which makes the encoding option invalid.") - } else { - response.setEncoding(self.encoding) - } - } - - self.dests.forEach(function (dest) { - self.pipeDest(dest) - }) - - response.on("data", function (chunk) { - self._destdata = true - self.emit("data", chunk) - }) - response.on("end", function (chunk) { - self._ended = true - self.emit("end", chunk) - }) - response.on("close", function () {self.emit("close")}) - - self.emit('response', response) - - if (self.onResponse) { - self.onResponse(null, response) - } - if (self.callback) { - var buffer = [] - var bodyLen = 0 - self.on("data", function (chunk) { - buffer.push(chunk) - bodyLen += chunk.length - }) - self.on("end", function () { - if (self._aborted) return - - if (buffer.length && Buffer.isBuffer(buffer[0])) { - var body = new Buffer(bodyLen) - var i = 0 - buffer.forEach(function (chunk) { - chunk.copy(body, i, 0, chunk.length) - i += chunk.length - }) - if (self.encoding === null) { - response.body = body - } else { - response.body = body.toString() - } - } else if (buffer.length) { - response.body = buffer.join('') - } - - if (self._json) { - try { - response.body = JSON.parse(response.body) - } catch (e) {} - } - - self.callback(null, response, response.body) - }) - } - } - }) - - if (self.timeout && !self.timeoutTimer) { - self.timeoutTimer = setTimeout(function() { - self.req.abort() - var e = new Error("ETIMEDOUT") - e.code = "ETIMEDOUT" - self.emit("error", e) - }, self.timeout) - - // Set additional timeout on socket - in case if remote - // server freeze after sending headers - if (self.req.setTimeout) { // only works on node 0.6+ - self.req.setTimeout(self.timeout, function(){ - if (self.req) { - self.req.abort() - var e = new Error("ESOCKETTIMEDOUT") - e.code = "ESOCKETTIMEDOUT" - self.emit("error", e) - } - }) - } - } - - self.req.on('error', self.clientErrorHandler) - - self.emit('request', self.req) -} - -Request.prototype.abort = function() { - this._aborted = true; - - if (this.req) { - this.req.abort() - } - else if (this.response) { - this.response.abort() - } - - this.emit("abort") -} - -Request.prototype.pipeDest = function (dest) { - var response = this.response - // Called after the response is received - if (dest.headers) { - dest.headers['content-type'] = response.headers['content-type'] - if (response.headers['content-length']) { - dest.headers['content-length'] = response.headers['content-length'] - } - } - if (dest.setHeader) { - for (var i in response.headers) { - dest.setHeader(i, response.headers[i]) - } - dest.statusCode = response.statusCode - } - if (this.pipefilter) this.pipefilter(response, dest) -} - -// Composable API -Request.prototype.setHeader = function (name, value, clobber) { - if (clobber === undefined) clobber = true - if (clobber || !this.headers.hasOwnProperty(name)) this.headers[name] = value - else this.headers[name] += ',' + value - return this -} -Request.prototype.setHeaders = function (headers) { - for (i in headers) {this.setHeader(i, headers[i])} - return this -} -Request.prototype.qs = function (q, clobber) { - var uri = { - protocol: this.uri.protocol, - host: this.uri.host, - pathname: this.uri.pathname, - query: clobber ? q : qs.parse(this.uri.query), - hash: this.uri.hash - }; - if (!clobber) for (var i in q) uri.query[i] = q[i] - - this.uri= url.parse(url.format(uri)) - - return this -} -Request.prototype.form = function (form) { - this.headers['content-type'] = 'application/x-www-form-urlencoded; charset=utf-8' - this.body = qs.stringify(form).toString('utf8') - return this -} -Request.prototype.multipart = function (multipart) { - var self = this - self.body = [] - - if (!self.headers['content-type']) { - self.headers['content-type'] = 'multipart/related;boundary="frontier"'; - } else { - self.headers['content-type'] = self.headers['content-type'].split(';')[0] + ';boundary="frontier"'; - } - - if (!multipart.forEach) throw new Error('Argument error, options.multipart.') - - multipart.forEach(function (part) { - var body = part.body - if(!body) throw Error('Body attribute missing in multipart.') - delete part.body - var preamble = '--frontier\r\n' - Object.keys(part).forEach(function(key){ - preamble += key + ': ' + part[key] + '\r\n' - }) - preamble += '\r\n' - self.body.push(new Buffer(preamble)) - self.body.push(new Buffer(body)) - self.body.push(new Buffer('\r\n')) - }) - self.body.push(new Buffer('--frontier--')) - return self -} -Request.prototype.json = function (val) { - this.setHeader('content-type', 'application/json') - this.setHeader('accept', 'application/json') - this._json = true - if (typeof val === 'boolean') { - if (typeof this.body === 'object') this.body = JSON.stringify(this.body) - } else { - this.body = JSON.stringify(val) - } - return this -} -Request.prototype.oauth = function (_oauth) { - var form - if (this.headers['content-type'] && - this.headers['content-type'].slice(0, 'application/x-www-form-urlencoded'.length) === - 'application/x-www-form-urlencoded' - ) { - form = qs.parse(this.body) - } - if (this.uri.query) { - form = qs.parse(this.uri.query) - } - if (!form) form = {} - var oa = {} - for (var i in form) oa[i] = form[i] - for (var i in _oauth) oa['oauth_'+i] = _oauth[i] - if (!oa.oauth_version) oa.oauth_version = '1.0' - if (!oa.oauth_timestamp) oa.oauth_timestamp = Math.floor( (new Date()).getTime() / 1000 ).toString() - if (!oa.oauth_nonce) oa.oauth_nonce = uuid().replace(/-/g, '') - - oa.oauth_signature_method = 'HMAC-SHA1' - - var consumer_secret = oa.oauth_consumer_secret - delete oa.oauth_consumer_secret - var token_secret = oa.oauth_token_secret - delete oa.oauth_token_secret - - var baseurl = this.uri.protocol + '//' + this.uri.host + this.uri.pathname - var signature = oauth.hmacsign(this.method, baseurl, oa, consumer_secret, token_secret) - - // oa.oauth_signature = signature - for (var i in form) { - if ( i.slice(0, 'oauth_') in _oauth) { - // skip - } else { - delete oa['oauth_'+i] - } - } - this.headers.authorization = - 'OAuth '+Object.keys(oa).sort().map(function (i) {return i+'="'+oauth.rfc3986(oa[i])+'"'}).join(',') - this.headers.authorization += ',oauth_signature="'+oauth.rfc3986(signature)+'"' - return this -} -Request.prototype.jar = function (jar) { - var cookies - - if (this._redirectsFollowed === 0) { - this.originalCookieHeader = this.headers.cookie - } - - if (jar === false) { - // disable cookies - cookies = false; - this._disableCookies = true; - } else if (jar) { - // fetch cookie from the user defined cookie jar - cookies = jar.get({ url: this.uri.href }) - } else { - // fetch cookie from the global cookie jar - cookies = cookieJar.get({ url: this.uri.href }) - } - - if (cookies && cookies.length) { - var cookieString = cookies.map(function (c) { - return c.name + "=" + c.value - }).join("; ") - - if (this.originalCookieHeader) { - // Don't overwrite existing Cookie header - this.headers.cookie = this.originalCookieHeader + '; ' + cookieString - } else { - this.headers.cookie = cookieString - } - } - this._jar = jar - return this -} - - -// Stream API -Request.prototype.pipe = function (dest, opts) { - if (this.response) { - if (this._destdata) { - throw new Error("You cannot pipe after data has been emitted from the response.") - } else if (this._ended) { - throw new Error("You cannot pipe after the response has been ended.") - } else { - stream.Stream.prototype.pipe.call(this, dest, opts) - this.pipeDest(dest) - return dest - } - } else { - this.dests.push(dest) - stream.Stream.prototype.pipe.call(this, dest, opts) - return dest - } -} -Request.prototype.write = function () { - if (!this._started) this.start() - this.req.write.apply(this.req, arguments) -} -Request.prototype.end = function (chunk) { - if (chunk) this.write(chunk) - if (!this._started) this.start() - this.req.end() -} -Request.prototype.pause = function () { - if (!this.response) this._paused = true - else this.response.pause.apply(this.response, arguments) -} -Request.prototype.resume = function () { - if (!this.response) this._paused = false - else this.response.resume.apply(this.response, arguments) -} -Request.prototype.destroy = function () { - if (!this._ended) this.end() -} - -// organize params for post, put, head, del -function initParams(uri, options, callback) { - if ((typeof options === 'function') && !callback) callback = options; - if (typeof options === 'object') { - options.uri = uri; - } else if (typeof uri === 'string') { - options = {uri:uri}; - } else { - options = uri; - uri = options.uri; - } - return { uri: uri, options: options, callback: callback }; -} - -function request (uri, options, callback) { - if ((typeof options === 'function') && !callback) callback = options; - if (typeof options === 'object') { - options.uri = uri; - } else if (typeof uri === 'string') { - options = {uri:uri}; - } else { - options = uri; - } - - if (callback) options.callback = callback; - var r = new Request(options) - return r -} - -module.exports = request - -request.defaults = function (options) { - var def = function (method) { - var d = function (uri, opts, callback) { - var params = initParams(uri, opts, callback); - for (var i in options) { - if (params.options[i] === undefined) params.options[i] = options[i] - } - return method(params.uri, params.options, params.callback) - } - return d - } - var de = def(request) - de.get = def(request.get) - de.post = def(request.post) - de.put = def(request.put) - de.head = def(request.head) - de.del = def(request.del) - de.cookie = def(request.cookie) - de.jar = def(request.jar) - return de -} - -request.forever = function (agentOptions, optionsArg) { - var options = {} - if (optionsArg) { - for (option in optionsArg) { - options[option] = optionsArg[option] - } - } - if (agentOptions) options.agentOptions = agentOptions - options.forever = true - return request.defaults(options) -} - -request.get = request -request.post = function (uri, options, callback) { - var params = initParams(uri, options, callback); - params.options.method = 'POST'; - return request(params.uri, params.options, params.callback) -} -request.put = function (uri, options, callback) { - var params = initParams(uri, options, callback); - params.options.method = 'PUT' - return request(params.uri, params.options, params.callback) -} -request.head = function (uri, options, callback) { - var params = initParams(uri, options, callback); - params.options.method = 'HEAD' - if (params.options.body || - params.options.requestBodyStream || - (params.options.json && typeof params.options.json !== 'boolean') || - params.options.multipart) { - throw new Error("HTTP HEAD requests MUST NOT include a request body.") - } - return request(params.uri, params.options, params.callback) -} -request.del = function (uri, options, callback) { - var params = initParams(uri, options, callback); - params.options.method = 'DELETE' - return request(params.uri, params.options, params.callback) -} -request.jar = function () { - return new CookieJar -} -request.cookie = function (str) { - if (str && str.uri) str = str.uri - if (typeof str !== 'string') throw new Error("The cookie function only accepts STRING as param") - return new Cookie(str) -} diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/mimetypes.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/mimetypes.js deleted file mode 100644 index 59b21b4..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/mimetypes.js +++ /dev/null @@ -1,152 +0,0 @@ -// from http://github.com/felixge/node-paperboy -exports.types = { - "3gp":"video/3gpp", - "aiff":"audio/x-aiff", - "arj":"application/x-arj-compressed", - "asf":"video/x-ms-asf", - "asx":"video/x-ms-asx", - "au":"audio/ulaw", - "avi":"video/x-msvideo", - "bcpio":"application/x-bcpio", - "ccad":"application/clariscad", - "cod":"application/vnd.rim.cod", - "com":"application/x-msdos-program", - "cpio":"application/x-cpio", - "cpt":"application/mac-compactpro", - "csh":"application/x-csh", - "css":"text/css", - "deb":"application/x-debian-package", - "dl":"video/dl", - "doc":"application/msword", - "drw":"application/drafting", - "dvi":"application/x-dvi", - "dwg":"application/acad", - "dxf":"application/dxf", - "dxr":"application/x-director", - "etx":"text/x-setext", - "ez":"application/andrew-inset", - "fli":"video/x-fli", - "flv":"video/x-flv", - "gif":"image/gif", - "gl":"video/gl", - "gtar":"application/x-gtar", - "gz":"application/x-gzip", - "hdf":"application/x-hdf", - "hqx":"application/mac-binhex40", - "html":"text/html", - "ice":"x-conference/x-cooltalk", - "ico":"image/x-icon", - "ief":"image/ief", - "igs":"model/iges", - "ips":"application/x-ipscript", - "ipx":"application/x-ipix", - "jad":"text/vnd.sun.j2me.app-descriptor", - "jar":"application/java-archive", - "jpeg":"image/jpeg", - "jpg":"image/jpeg", - "js":"text/javascript", - "json":"application/json", - "latex":"application/x-latex", - "lsp":"application/x-lisp", - "lzh":"application/octet-stream", - "m":"text/plain", - "m3u":"audio/x-mpegurl", - "m4v":"video/mp4", - "man":"application/x-troff-man", - "me":"application/x-troff-me", - "midi":"audio/midi", - "mif":"application/x-mif", - "mime":"www/mime", - "mkv":" video/x-matrosk", - "movie":"video/x-sgi-movie", - "mp4":"video/mp4", - "mp41":"video/mp4", - "mp42":"video/mp4", - "mpg":"video/mpeg", - "mpga":"audio/mpeg", - "ms":"application/x-troff-ms", - "mustache":"text/plain", - "nc":"application/x-netcdf", - "oda":"application/oda", - "ogm":"application/ogg", - "pbm":"image/x-portable-bitmap", - "pdf":"application/pdf", - "pgm":"image/x-portable-graymap", - "pgn":"application/x-chess-pgn", - "pgp":"application/pgp", - "pm":"application/x-perl", - "png":"image/png", - "pnm":"image/x-portable-anymap", - "ppm":"image/x-portable-pixmap", - "ppz":"application/vnd.ms-powerpoint", - "pre":"application/x-freelance", - "prt":"application/pro_eng", - "ps":"application/postscript", - "qt":"video/quicktime", - "ra":"audio/x-realaudio", - "rar":"application/x-rar-compressed", - "ras":"image/x-cmu-raster", - "rgb":"image/x-rgb", - "rm":"audio/x-pn-realaudio", - "rpm":"audio/x-pn-realaudio-plugin", - "rtf":"text/rtf", - "rtx":"text/richtext", - "scm":"application/x-lotusscreencam", - "set":"application/set", - "sgml":"text/sgml", - "sh":"application/x-sh", - "shar":"application/x-shar", - "silo":"model/mesh", - "sit":"application/x-stuffit", - "skt":"application/x-koan", - "smil":"application/smil", - "snd":"audio/basic", - "sol":"application/solids", - "spl":"application/x-futuresplash", - "src":"application/x-wais-source", - "stl":"application/SLA", - "stp":"application/STEP", - "sv4cpio":"application/x-sv4cpio", - "sv4crc":"application/x-sv4crc", - "svg":"image/svg+xml", - "swf":"application/x-shockwave-flash", - "tar":"application/x-tar", - "tcl":"application/x-tcl", - "tex":"application/x-tex", - "texinfo":"application/x-texinfo", - "tgz":"application/x-tar-gz", - "tiff":"image/tiff", - "tr":"application/x-troff", - "tsi":"audio/TSP-audio", - "tsp":"application/dsptype", - "tsv":"text/tab-separated-values", - "unv":"application/i-deas", - "ustar":"application/x-ustar", - "vcd":"application/x-cdlink", - "vda":"application/vda", - "vivo":"video/vnd.vivo", - "vrm":"x-world/x-vrml", - "wav":"audio/x-wav", - "wax":"audio/x-ms-wax", - "webm":"video/webm", - "wma":"audio/x-ms-wma", - "wmv":"video/x-ms-wmv", - "wmx":"video/x-ms-wmx", - "wrl":"model/vrml", - "wvx":"video/x-ms-wvx", - "xbm":"image/x-xbitmap", - "xlw":"application/vnd.ms-excel", - "xml":"text/xml", - "xpm":"image/x-xpixmap", - "xwd":"image/x-xwindowdump", - "xyz":"chemical/x-pdb", - "zip":"application/zip" -}; - -exports.lookup = function(ext, defaultType) { - defaultType = defaultType || 'application/octet-stream'; - - return (ext in exports.types) - ? exports.types[ext] - : defaultType; -}; \ No newline at end of file diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/oauth.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/oauth.js deleted file mode 100644 index 31b9dc6..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/oauth.js +++ /dev/null @@ -1,34 +0,0 @@ -var crypto = require('crypto') - , qs = require('querystring') - ; - -function sha1 (key, body) { - return crypto.createHmac('sha1', key).update(body).digest('base64') -} - -function rfc3986 (str) { - return encodeURIComponent(str) - .replace('!','%21') - .replace('*','%2A') - .replace('(','%28') - .replace(')','%29') - .replace("'",'%27') - ; -} - -function hmacsign (httpMethod, base_uri, params, consumer_secret, token_secret, body) { - // adapted from https://dev.twitter.com/docs/auth/oauth - var base = - (httpMethod || 'GET') + "&" + - encodeURIComponent( base_uri ) + "&" + - Object.keys(params).sort().map(function (i) { - // big WTF here with the escape + encoding but it's what twitter wants - return escape(rfc3986(i)) + "%3D" + escape(rfc3986(params[i])) - }).join("%26") - var key = consumer_secret + '&' - if (token_secret) key += token_secret - return sha1(key, base) -} - -exports.hmacsign = hmacsign -exports.rfc3986 = rfc3986 \ No newline at end of file diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/package.json b/node_modules/resourceful/node_modules/cradle/node_modules/request/package.json deleted file mode 100644 index 55cf32c..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "request", - "description": "Simplified HTTP request client.", - "tags": [ - "http", - "simple", - "util", - "utility" - ], - "version": "2.9.153", - "author": { - "name": "Mikeal Rogers", - "email": "mikeal.rogers@gmail.com" - }, - "repository": { - "type": "git", - "url": "git://github.com/mikeal/request.git" - }, - "bugs": { - "url": "http://github.com/mikeal/request/issues" - }, - "engines": [ - "node >= 0.3.6" - ], - "main": "./main", - "scripts": { - "test": "node tests/run.js" - }, - "_id": "request@2.9.153", - "dependencies": {}, - "devDependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "request@2.x.x" -} diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/googledoodle.png b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/googledoodle.png deleted file mode 100644 index f80c9c5..0000000 Binary files a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/googledoodle.png and /dev/null differ diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/run.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/run.js deleted file mode 100644 index 6011846..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/run.js +++ /dev/null @@ -1,37 +0,0 @@ -var spawn = require('child_process').spawn - , exitCode = 0 - ; - -var tests = [ - 'test-body.js' - , 'test-cookie.js' - , 'test-cookiejar.js' - , 'test-defaults.js' - , 'test-errors.js' - , 'test-headers.js' - , 'test-httpModule.js' - , 'test-https.js' - , 'test-https-strict.js' - , 'test-oauth.js' - , 'test-pipes.js' - , 'test-proxy.js' - , 'test-qs.js' - , 'test-redirect.js' - , 'test-timeout.js' - , 'test-tunnel.js' -] - -var next = function () { - if (tests.length === 0) process.exit(exitCode); - - var file = tests.shift() - console.log(file) - var proc = spawn('node', [ 'tests/' + file ]) - proc.stdout.pipe(process.stdout) - proc.stderr.pipe(process.stderr) - proc.on('exit', function (code) { - exitCode += code || 0 - next() - }) -} -next() diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/server.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/server.js deleted file mode 100644 index 921f512..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/server.js +++ /dev/null @@ -1,82 +0,0 @@ -var fs = require('fs') - , http = require('http') - , path = require('path') - , https = require('https') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - ; - -exports.createServer = function (port) { - port = port || 6767 - var s = http.createServer(function (req, resp) { - s.emit(req.url, req, resp); - }) - s.port = port - s.url = 'http://localhost:'+port - return s; -} - -exports.createSSLServer = function(port, opts) { - port = port || 16767 - - var options = { 'key' : path.join(__dirname, 'ssl', 'test.key') - , 'cert': path.join(__dirname, 'ssl', 'test.crt') - } - if (opts) { - for (var i in opts) options[i] = opts[i] - } - - for (var i in options) { - options[i] = fs.readFileSync(options[i]) - } - - var s = https.createServer(options, function (req, resp) { - s.emit(req.url, req, resp); - }) - s.port = port - s.url = 'https://localhost:'+port - return s; -} - -exports.createPostStream = function (text) { - var postStream = new stream.Stream(); - postStream.writeable = true; - postStream.readable = true; - setTimeout(function () {postStream.emit('data', new Buffer(text)); postStream.emit('end')}, 0); - return postStream; -} -exports.createPostValidator = function (text) { - var l = function (req, resp) { - var r = ''; - req.on('data', function (chunk) {r += chunk}) - req.on('end', function () { - if (r !== text) console.log(r, text); - assert.equal(r, text) - resp.writeHead(200, {'content-type':'text/plain'}) - resp.write('OK') - resp.end() - }) - } - return l; -} -exports.createGetResponse = function (text, contentType) { - var l = function (req, resp) { - contentType = contentType || 'text/plain' - resp.writeHead(200, {'content-type':contentType}) - resp.write(text) - resp.end() - } - return l; -} -exports.createChunkResponse = function (chunks, contentType) { - var l = function (req, resp) { - contentType = contentType || 'text/plain' - resp.writeHead(200, {'content-type':contentType}) - chunks.forEach(function (chunk) { - resp.write(chunk) - }) - resp.end() - } - return l; -} diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/squid.conf b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/squid.conf deleted file mode 100644 index 0d4a3b6..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/squid.conf +++ /dev/null @@ -1,77 +0,0 @@ -# -# Recommended minimum configuration: -# -acl manager proto cache_object -acl localhost src 127.0.0.1/32 ::1 -acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1 - -# Example rule allowing access from your local networks. -# Adapt to list your (internal) IP networks from where browsing -# should be allowed -acl localnet src 10.0.0.0/8 # RFC1918 possible internal network -acl localnet src 172.16.0.0/12 # RFC1918 possible internal network -acl localnet src 192.168.0.0/16 # RFC1918 possible internal network -acl localnet src fc00::/7 # RFC 4193 local private network range -acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines - -acl SSL_ports port 443 -acl Safe_ports port 80 # http -acl Safe_ports port 21 # ftp -acl Safe_ports port 443 # https -acl Safe_ports port 70 # gopher -acl Safe_ports port 210 # wais -acl Safe_ports port 1025-65535 # unregistered ports -acl Safe_ports port 280 # http-mgmt -acl Safe_ports port 488 # gss-http -acl Safe_ports port 591 # filemaker -acl Safe_ports port 777 # multiling http -acl CONNECT method CONNECT - -# -# Recommended minimum Access Permission configuration: -# -# Only allow cachemgr access from localhost -http_access allow manager localhost -http_access deny manager - -# Deny requests to certain unsafe ports -http_access deny !Safe_ports - -# Deny CONNECT to other than secure SSL ports -#http_access deny CONNECT !SSL_ports - -# We strongly recommend the following be uncommented to protect innocent -# web applications running on the proxy server who think the only -# one who can access services on "localhost" is a local user -#http_access deny to_localhost - -# -# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS -# - -# Example rule allowing access from your local networks. -# Adapt localnet in the ACL section to list your (internal) IP networks -# from where browsing should be allowed -http_access allow localnet -http_access allow localhost - -# And finally deny all other access to this proxy -http_access deny all - -# Squid normally listens to port 3128 -http_port 3128 - -# We recommend you to use at least the following line. -hierarchy_stoplist cgi-bin ? - -# Uncomment and adjust the following to add a disk cache directory. -#cache_dir ufs /usr/local/var/cache 100 16 256 - -# Leave coredumps in the first cache dir -coredump_dir /usr/local/var/cache - -# Add any of your own refresh_pattern entries above these. -refresh_pattern ^ftp: 1440 20% 10080 -refresh_pattern ^gopher: 1440 0% 1440 -refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 -refresh_pattern . 0 20% 4320 diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.cnf b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.cnf deleted file mode 100644 index 425a889..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.cnf +++ /dev/null @@ -1,20 +0,0 @@ -[ req ] -default_bits = 1024 -days = 3650 -distinguished_name = req_distinguished_name -attributes = req_attributes -prompt = no -output_password = password - -[ req_distinguished_name ] -C = US -ST = CA -L = Oakland -O = request -OU = request Certificate Authority -CN = requestCA -emailAddress = mikeal@mikealrogers.com - -[ req_attributes ] -challengePassword = password challenge - diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.crl b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.crl deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.crt b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.crt deleted file mode 100644 index b4524e4..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.crt +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICvTCCAiYCCQDn+P/MSbDsWjANBgkqhkiG9w0BAQUFADCBojELMAkGA1UEBhMC -VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMRAwDgYDVQQKEwdyZXF1 -ZXN0MSYwJAYDVQQLEx1yZXF1ZXN0IENlcnRpZmljYXRlIEF1dGhvcml0eTESMBAG -A1UEAxMJcmVxdWVzdENBMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlrZWFscm9n -ZXJzLmNvbTAeFw0xMjAzMDEyMjUwNTZaFw0yMjAyMjcyMjUwNTZaMIGiMQswCQYD -VQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNVBAcTB09ha2xhbmQxEDAOBgNVBAoT -B3JlcXVlc3QxJjAkBgNVBAsTHXJlcXVlc3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5 -MRIwEAYDVQQDEwlyZXF1ZXN0Q0ExJjAkBgkqhkiG9w0BCQEWF21pa2VhbEBtaWtl -YWxyb2dlcnMuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC7t9pQUAK4 -5XJYTI6NrF0n3G2HZsfN+rPYSVzzL8SuVyb1tHXos+vbPm3NKI4E8X1yVAXU8CjJ -5SqXnp4DAypAhaseho81cbhk7LXUhFz78OvAa+OD+xTAEAnNQ8tGUr4VGyplEjfD -xsBVuqV2j8GPNTftr+drOCFlqfAgMrBn4wIDAQABMA0GCSqGSIb3DQEBBQUAA4GB -ADVdTlVAL45R+PACNS7Gs4o81CwSclukBu4FJbxrkd4xGQmurgfRrYYKjtqiopQm -D7ysRamS3HMN9/VKq2T7r3z1PMHPAy7zM4uoXbbaTKwlnX4j/8pGPn8Ca3qHXYlo -88L/OOPc6Di7i7qckS3HFbXQCTiULtxWmy97oEuTwrAj ------END CERTIFICATE----- diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.csr b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.csr deleted file mode 100644 index e48c56e..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.csr +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIICBjCCAW8CAQAwgaIxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEQMA4GA1UE -BxMHT2FrbGFuZDEQMA4GA1UEChMHcmVxdWVzdDEmMCQGA1UECxMdcmVxdWVzdCBD -ZXJ0aWZpY2F0ZSBBdXRob3JpdHkxEjAQBgNVBAMTCXJlcXVlc3RDQTEmMCQGCSqG -SIb3DQEJARYXbWlrZWFsQG1pa2VhbHJvZ2Vycy5jb20wgZ8wDQYJKoZIhvcNAQEB -BQADgY0AMIGJAoGBALu32lBQArjlclhMjo2sXSfcbYdmx836s9hJXPMvxK5XJvW0 -deiz69s+bc0ojgTxfXJUBdTwKMnlKpeengMDKkCFqx6GjzVxuGTstdSEXPvw68Br -44P7FMAQCc1Dy0ZSvhUbKmUSN8PGwFW6pXaPwY81N+2v52s4IWWp8CAysGfjAgMB -AAGgIzAhBgkqhkiG9w0BCQcxFBMScGFzc3dvcmQgY2hhbGxlbmdlMA0GCSqGSIb3 -DQEBBQUAA4GBAGJO7grHeVHXetjHEK8urIxdnvfB2qeZeObz4GPKIkqUurjr0rfj -bA3EK1kDMR5aeQWR8RunixdM16Q6Ry0lEdLVWkdSwRN9dmirIHT9cypqnD/FYOia -SdezZ0lUzXgmJIwRYRwB1KSMMocIf52ll/xC2bEGg7/ZAEuAyAgcZV3X ------END CERTIFICATE REQUEST----- diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.key b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.key deleted file mode 100644 index a53e7f7..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.key +++ /dev/null @@ -1,18 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,C8B5887048377F02 - -nyD5ZH0Wup2uWsDvurq5mKDaDrf8lvNn9w0SH/ZkVnfR1/bkwqrFriqJWvZNUG+q -nS0iBYczsWLJnbub9a1zLOTENWUKVD5uqbC3aGHhnoUTNSa27DONgP8gHOn6JgR+ -GAKo01HCSTiVT4LjkwN337QKHnMP2fTzg+IoC/CigvMcq09hRLwU1/guq0GJKGwH -gTxYNuYmQC4Tjh8vdS4liF+Ve/P3qPR2CehZrIOkDT8PHJBGQJRo4xGUIB7Tpk38 -VCk+UZ0JCS2coY8VkY/9tqFJp/ZnnQQVmaNbdRqg7ECKL+bXnNo7yjzmazPZmPe3 -/ShbE0+CTt7LrjCaQAxWbeDzqfo1lQfgN1LulTm8MCXpQaJpv7v1VhIhQ7afjMYb -4thW/ypHPiYS2YJCAkAVlua9Oxzzh1qJoh8Df19iHtpd79Q77X/qf+1JvITlMu0U -gi7yEatmQcmYNws1mtTC1q2DXrO90c+NZ0LK/Alse6NRL/xiUdjug2iHeTf/idOR -Gg/5dSZbnnlj1E5zjSMDkzg6EHAFmHV4jYGSAFLEQgp4V3ZhMVoWZrvvSHgKV/Qh -FqrAK4INr1G2+/QTd09AIRzfy3/j6yD4A9iNaOsEf9Ua7Qh6RcALRCAZTWR5QtEf -dX+iSNJ4E85qXs0PqwkMDkoaxIJ+tmIRJY7y8oeylV8cfGAi8Soubt/i3SlR8IHC -uDMas/2OnwafK3N7ODeE1i7r7wkzQkSHaEz0TrF8XRnP25jAICCSLiMdAAjKfxVb -EvzsFSuAy3Jt6bU3hSLY9o4YVYKE+68ITMv9yNjvTsEiW+T+IbN34w== ------END RSA PRIVATE KEY----- diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.srl b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.srl deleted file mode 100644 index 17128db..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/ca.srl +++ /dev/null @@ -1 +0,0 @@ -ADF62016AA40C9C3 diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/server.cnf b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/server.cnf deleted file mode 100644 index cd1fd1e..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/server.cnf +++ /dev/null @@ -1,19 +0,0 @@ -[ req ] -default_bits = 1024 -days = 3650 -distinguished_name = req_distinguished_name -attributes = req_attributes -prompt = no - -[ req_distinguished_name ] -C = US -ST = CA -L = Oakland -O = request -OU = testing -CN = testing.request.mikealrogers.com -emailAddress = mikeal@mikealrogers.com - -[ req_attributes ] -challengePassword = password challenge - diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/server.crt b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/server.crt deleted file mode 100644 index efe96ce..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/server.crt +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICejCCAeMCCQCt9iAWqkDJwzANBgkqhkiG9w0BAQUFADCBojELMAkGA1UEBhMC -VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMRAwDgYDVQQKEwdyZXF1 -ZXN0MSYwJAYDVQQLEx1yZXF1ZXN0IENlcnRpZmljYXRlIEF1dGhvcml0eTESMBAG -A1UEAxMJcmVxdWVzdENBMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlrZWFscm9n -ZXJzLmNvbTAeFw0xMjAzMDEyMjUwNTZaFw0yMjAyMjcyMjUwNTZaMIGjMQswCQYD -VQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNVBAcTB09ha2xhbmQxEDAOBgNVBAoT -B3JlcXVlc3QxEDAOBgNVBAsTB3Rlc3RpbmcxKTAnBgNVBAMTIHRlc3RpbmcucmVx -dWVzdC5taWtlYWxyb2dlcnMuY29tMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlr -ZWFscm9nZXJzLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDgVl0jMumvOpmM -20W5v9yhGgZj8hPhEQF/N7yCBVBn/rWGYm70IHC8T/pR5c0LkWc5gdnCJEvKWQjh -DBKxZD8FAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEABShRkNgFbgs4vUWW9R9deNJj -7HJoiTmvkmoOC7QzcYkjdgHbOxsSq3rBnwxsVjY9PAtPwBn0GRspOeG7KzKRgySB -kb22LyrCFKbEOfKO/+CJc80ioK9zEPVjGsFMyAB+ftYRqM+s/4cQlTg/m89l01wC -yapjN3RxZbInGhWR+jA= ------END CERTIFICATE----- diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/server.csr b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/server.csr deleted file mode 100644 index a8e7595..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/server.csr +++ /dev/null @@ -1,11 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIBgjCCASwCAQAwgaMxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEQMA4GA1UE -BxMHT2FrbGFuZDEQMA4GA1UEChMHcmVxdWVzdDEQMA4GA1UECxMHdGVzdGluZzEp -MCcGA1UEAxMgdGVzdGluZy5yZXF1ZXN0Lm1pa2VhbHJvZ2Vycy5jb20xJjAkBgkq -hkiG9w0BCQEWF21pa2VhbEBtaWtlYWxyb2dlcnMuY29tMFwwDQYJKoZIhvcNAQEB -BQADSwAwSAJBAOBWXSMy6a86mYzbRbm/3KEaBmPyE+ERAX83vIIFUGf+tYZibvQg -cLxP+lHlzQuRZzmB2cIkS8pZCOEMErFkPwUCAwEAAaAjMCEGCSqGSIb3DQEJBzEU -ExJwYXNzd29yZCBjaGFsbGVuZ2UwDQYJKoZIhvcNAQEFBQADQQBD3E5WekQzCEJw -7yOcqvtPYIxGaX8gRKkYfLPoj3pm3GF5SGqtJKhylKfi89szHXgktnQgzff9FN+A -HidVJ/3u ------END CERTIFICATE REQUEST----- diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/server.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/server.js deleted file mode 100644 index 05e21c1..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/server.js +++ /dev/null @@ -1,28 +0,0 @@ -var fs = require("fs") -var https = require("https") -var options = { key: fs.readFileSync("./server.key") - , cert: fs.readFileSync("./server.crt") } - -var server = https.createServer(options, function (req, res) { - res.writeHead(200) - res.end() - server.close() -}) -server.listen(1337) - -var ca = fs.readFileSync("./ca.crt") -var agent = new https.Agent({ host: "localhost", port: 1337, ca: ca }) - -https.request({ host: "localhost" - , method: "HEAD" - , port: 1337 - , headers: { host: "testing.request.mikealrogers.com" } - , agent: agent - , ca: [ ca ] - , path: "/" }, function (res) { - if (res.client.authorized) { - console.log("node test: OK") - } else { - throw new Error(res.client.authorizationError) - } -}).end() diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/server.key b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/server.key deleted file mode 100644 index 72d8698..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/ca/server.key +++ /dev/null @@ -1,9 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIBOwIBAAJBAOBWXSMy6a86mYzbRbm/3KEaBmPyE+ERAX83vIIFUGf+tYZibvQg -cLxP+lHlzQuRZzmB2cIkS8pZCOEMErFkPwUCAwEAAQJAK+r8ZM2sze8s7FRo/ApB -iRBtO9fCaIdJwbwJnXKo4RKwZDt1l2mm+fzZ+/QaQNjY1oTROkIIXmnwRvZWfYlW -gQIhAPKYsG+YSBN9o8Sdp1DMyZ/rUifKX3OE6q9tINkgajDVAiEA7Ltqh01+cnt0 -JEnud/8HHcuehUBLMofeg0G+gCnSbXECIQCqDvkXsWNNLnS/3lgsnvH0Baz4sbeJ -rjIpuVEeg8eM5QIgbu0+9JmOV6ybdmmiMV4yAncoF35R/iKGVHDZCAsQzDECIQDZ -0jGz22tlo5YMcYSqrdD3U4sds1pwiAaWFRbCunoUJw== ------END RSA PRIVATE KEY----- diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/npm-ca.crt b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/npm-ca.crt deleted file mode 100644 index fde2fe9..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/npm-ca.crt +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIChzCCAfACCQDauvz/KHp8ejANBgkqhkiG9w0BAQUFADCBhzELMAkGA1UEBhMC -VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMQwwCgYDVQQKEwNucG0x -IjAgBgNVBAsTGW5wbSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxDjAMBgNVBAMTBW5w -bUNBMRcwFQYJKoZIhvcNAQkBFghpQGl6cy5tZTAeFw0xMTA5MDUwMTQ3MTdaFw0y -MTA5MDIwMTQ3MTdaMIGHMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNV -BAcTB09ha2xhbmQxDDAKBgNVBAoTA25wbTEiMCAGA1UECxMZbnBtIENlcnRpZmlj -YXRlIEF1dGhvcml0eTEOMAwGA1UEAxMFbnBtQ0ExFzAVBgkqhkiG9w0BCQEWCGlA -aXpzLm1lMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLI4tIqPpRW+ACw9GE -OgBlJZwK5f8nnKCLK629Pv5yJpQKs3DENExAyOgDcyaF0HD0zk8zTp+ZsLaNdKOz -Gn2U181KGprGKAXP6DU6ByOJDWmTlY6+Ad1laYT0m64fERSpHw/hjD3D+iX4aMOl -y0HdbT5m1ZGh6SJz3ZqxavhHLQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAC4ySDbC -l7W1WpLmtLGEQ/yuMLUf6Jy/vr+CRp4h+UzL+IQpCv8FfxsYE7dhf/bmWTEupBkv -yNL18lipt2jSvR3v6oAHAReotvdjqhxddpe5Holns6EQd1/xEZ7sB1YhQKJtvUrl -ZNufy1Jf1r0ldEGeA+0ISck7s+xSh9rQD2Op ------END CERTIFICATE----- diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/test.crt b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/test.crt deleted file mode 100644 index b357f86..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/test.crt +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICQzCCAawCCQCO/XWtRFck1jANBgkqhkiG9w0BAQUFADBmMQswCQYDVQQGEwJU -SDEQMA4GA1UECBMHQmFuZ2tvazEOMAwGA1UEBxMFU2lsb20xGzAZBgNVBAoTElRo -ZSBSZXF1ZXN0IE1vZHVsZTEYMBYGA1UEAxMPcmVxdWVzdC5leGFtcGxlMB4XDTEx -MTIwMzAyMjkyM1oXDTIxMTEzMDAyMjkyM1owZjELMAkGA1UEBhMCVEgxEDAOBgNV -BAgTB0Jhbmdrb2sxDjAMBgNVBAcTBVNpbG9tMRswGQYDVQQKExJUaGUgUmVxdWVz -dCBNb2R1bGUxGDAWBgNVBAMTD3JlcXVlc3QuZXhhbXBsZTCBnzANBgkqhkiG9w0B -AQEFAAOBjQAwgYkCgYEAwmctddZqlA48+NXs0yOy92DijcQV1jf87zMiYAIlNUto -wghVbTWgJU5r0pdKrD16AptnWJTzKanhItEX8XCCPgsNkq1afgTtJP7rNkwu3xcj -eIMkhJg/ay4ZnkbnhYdsii5VTU5prix6AqWRAhbkBgoA+iVyHyof8wvZyKBoFTMC -AwEAATANBgkqhkiG9w0BAQUFAAOBgQB6BybMJbpeiABgihDfEVBcAjDoQ8gUMgwV -l4NulugfKTDmArqnR9aPd4ET5jX5dkMP4bwCHYsvrcYDeWEQy7x5WWuylOdKhua4 -L4cEi2uDCjqEErIG3cc1MCOk6Cl6Ld6tkIzQSf953qfdEACRytOeUqLNQcrXrqeE -c7U8F6MWLQ== ------END CERTIFICATE----- diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/test.key b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/test.key deleted file mode 100644 index b85810d..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/ssl/test.key +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXgIBAAKBgQDCZy111mqUDjz41ezTI7L3YOKNxBXWN/zvMyJgAiU1S2jCCFVt -NaAlTmvSl0qsPXoCm2dYlPMpqeEi0RfxcII+Cw2SrVp+BO0k/us2TC7fFyN4gySE -mD9rLhmeRueFh2yKLlVNTmmuLHoCpZECFuQGCgD6JXIfKh/zC9nIoGgVMwIDAQAB -AoGBALXFwfUf8vHTSmGlrdZS2AGFPvEtuvldyoxi9K5u8xmdFCvxnOcLsF2RsTHt -Mu5QYWhUpNJoG+IGLTPf7RJdj/kNtEs7xXqWy4jR36kt5z5MJzqiK+QIgiO9UFWZ -fjUb6oeDnTIJA9YFBdYi97MDuL89iU/UK3LkJN3hd4rciSbpAkEA+MCkowF5kSFb -rkOTBYBXZfiAG78itDXN6DXmqb9XYY+YBh3BiQM28oxCeQYyFy6pk/nstnd4TXk6 -V/ryA2g5NwJBAMgRKTY9KvxJWbESeMEFe2iBIV0c26/72Amgi7ZKUCLukLfD4tLF -+WSZdmTbbqI1079YtwaiOVfiLm45Q/3B0eUCQAaQ/0eWSGE+Yi8tdXoVszjr4GXb -G81qBi91DMu6U1It+jNfIba+MPsiHLcZJMVb4/oWBNukN7bD1nhwFWdlnu0CQQCf -Is9WHkdvz2RxbZDxb8verz/7kXXJQJhx5+rZf7jIYFxqX3yvTNv3wf2jcctJaWlZ -fVZwB193YSivcgt778xlAkEAprYUz3jczjF5r2hrgbizPzPDR94tM5BTO3ki2v3w -kbf+j2g7FNAx6kZiVN8XwfLc8xEeUGiPKwtq3ddPDFh17w== ------END RSA PRIVATE KEY----- diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-body.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-body.js deleted file mode 100644 index 9d2e188..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-body.js +++ /dev/null @@ -1,95 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetBuffer : - { resp : server.createGetResponse(new Buffer("TESTING!")) - , encoding: null - , expectBody: new Buffer("TESTING!") - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--frontier\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--frontier\r\n\r\n' + - 'Oh hi.' + - '\r\n--frontier--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - test.uri = s.url + '/' + i - request(test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) - diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-cookie.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-cookie.js deleted file mode 100644 index f17cfb3..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-cookie.js +++ /dev/null @@ -1,29 +0,0 @@ -var Cookie = require('../vendor/cookie') - , assert = require('assert'); - -var str = 'sid="s543qactge.wKE61E01Bs%2BKhzmxrwrnug="; path=/; httpOnly; expires=Sat, 04 Dec 2010 23:27:28 GMT'; -var cookie = new Cookie(str); - -// test .toString() -assert.equal(cookie.toString(), str); - -// test .path -assert.equal(cookie.path, '/'); - -// test .httpOnly -assert.equal(cookie.httpOnly, true); - -// test .name -assert.equal(cookie.name, 'sid'); - -// test .value -assert.equal(cookie.value, '"s543qactge.wKE61E01Bs%2BKhzmxrwrnug="'); - -// test .expires -assert.equal(cookie.expires instanceof Date, true); - -// test .path default -var cookie = new Cookie('foo=bar', { url: 'http://foo.com/bar' }); -assert.equal(cookie.path, '/bar'); - -console.log('All tests passed'); diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-cookiejar.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-cookiejar.js deleted file mode 100644 index 76fcd71..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-cookiejar.js +++ /dev/null @@ -1,90 +0,0 @@ -var Cookie = require('../vendor/cookie') - , Jar = require('../vendor/cookie/jar') - , assert = require('assert'); - -function expires(ms) { - return new Date(Date.now() + ms).toUTCString(); -} - -// test .get() expiration -(function() { - var jar = new Jar; - var cookie = new Cookie('sid=1234; path=/; expires=' + expires(1000)); - jar.add(cookie); - setTimeout(function(){ - var cookies = jar.get({ url: 'http://foo.com/foo' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], cookie); - setTimeout(function(){ - var cookies = jar.get({ url: 'http://foo.com/foo' }); - assert.equal(cookies.length, 0); - }, 1000); - }, 5); -})(); - -// test .get() path support -(function() { - var jar = new Jar; - var a = new Cookie('sid=1234; path=/'); - var b = new Cookie('sid=1111; path=/foo/bar'); - var c = new Cookie('sid=2222; path=/'); - jar.add(a); - jar.add(b); - jar.add(c); - - // should remove the duplicates - assert.equal(jar.cookies.length, 2); - - // same name, same path, latter prevails - var cookies = jar.get({ url: 'http://foo.com/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], c); - - // same name, diff path, path specifity prevails, latter prevails - var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], b); - - var jar = new Jar; - var a = new Cookie('sid=1111; path=/foo/bar'); - var b = new Cookie('sid=1234; path=/'); - jar.add(a); - jar.add(b); - - var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], a); - - var cookies = jar.get({ url: 'http://foo.com/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], b); - - var jar = new Jar; - var a = new Cookie('sid=1111; path=/foo/bar'); - var b = new Cookie('sid=3333; path=/foo/bar'); - var c = new Cookie('pid=3333; path=/foo/bar'); - var d = new Cookie('sid=2222; path=/foo/'); - var e = new Cookie('sid=1234; path=/'); - jar.add(a); - jar.add(b); - jar.add(c); - jar.add(d); - jar.add(e); - - var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); - assert.equal(cookies.length, 2); - assert.equal(cookies[0], b); - assert.equal(cookies[1], c); - - var cookies = jar.get({ url: 'http://foo.com/foo/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], d); - - var cookies = jar.get({ url: 'http://foo.com/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], e); -})(); - -setTimeout(function() { - console.log('All tests passed'); -}, 1200); diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-defaults.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-defaults.js deleted file mode 100644 index 6c8b58f..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-defaults.js +++ /dev/null @@ -1,68 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); - -s.listen(s.port, function () { - var counter = 0; - s.on('/get', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.method, 'GET') - resp.writeHead(200, {'Content-Type': 'text/plain'}); - resp.end('TESTING!'); - }); - - // test get(string, function) - request.defaults({headers:{foo:"bar"}})(s.url + '/get', function (e, r, b){ - if (e) throw e; - assert.deepEqual("TESTING!", b); - counter += 1; - }); - - s.on('/post', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.headers['content-type'], 'application/json'); - assert.equal(req.method, 'POST') - resp.writeHead(200, {'Content-Type': 'application/json'}); - resp.end(JSON.stringify({foo:'bar'})); - }); - - // test post(string, object, function) - request.defaults({headers:{foo:"bar"}}).post(s.url + '/post', {json: true}, function (e, r, b){ - if (e) throw e; - assert.deepEqual('bar', b.foo); - counter += 1; - }); - - s.on('/del', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.method, 'DELETE') - resp.writeHead(200, {'Content-Type': 'application/json'}); - resp.end(JSON.stringify({foo:'bar'})); - }); - - // test .del(string, function) - request.defaults({headers:{foo:"bar"}, json:true}).del(s.url + '/del', function (e, r, b){ - if (e) throw e; - assert.deepEqual('bar', b.foo); - counter += 1; - }); - - s.on('/head', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.method, 'HEAD') - resp.writeHead(200, {'Content-Type': 'text/plain'}); - resp.end(); - }); - - // test head.(object, function) - request.defaults({headers:{foo:"bar"}}).head({uri: s.url + '/head'}, function (e, r, b){ - if (e) throw e; - counter += 1; - console.log(counter.toString() + " tests passed.") - s.close() - }); - -}) diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-errors.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-errors.js deleted file mode 100644 index 1986a59..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-errors.js +++ /dev/null @@ -1,37 +0,0 @@ -var server = require('./server') - , events = require('events') - , assert = require('assert') - , request = require('../main.js') - ; - -var local = 'http://localhost:8888/asdf' - -try { - request({uri:local, body:{}}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Argument error, options.body.') -} - -try { - request({uri:local, multipart: 'foo'}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Argument error, options.multipart.') -} - -try { - request({uri:local, multipart: [{}]}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Body attribute missing in multipart.') -} - -try { - request(local, {multipart: [{}]}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Body attribute missing in multipart.') -} - -console.log("All tests passed.") diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-headers.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-headers.js deleted file mode 100644 index 31fe3f4..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-headers.js +++ /dev/null @@ -1,52 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , Cookie = require('../vendor/cookie') - , Jar = require('../vendor/cookie/jar') - , s = server.createServer() - -s.listen(s.port, function () { - var serverUri = 'http://localhost:' + s.port - , numTests = 0 - , numOutstandingTests = 0 - - function createTest(requestObj, serverAssertFn) { - var testNumber = numTests; - numTests += 1; - numOutstandingTests += 1; - s.on('/' + testNumber, function (req, res) { - serverAssertFn(req, res); - res.writeHead(200); - res.end(); - }); - requestObj.url = serverUri + '/' + testNumber - request(requestObj, function (err, res, body) { - assert.ok(!err) - assert.equal(res.statusCode, 200) - numOutstandingTests -= 1 - if (numOutstandingTests === 0) { - console.log(numTests + ' tests passed.') - s.close() - } - }) - } - - // Issue #125: headers.cookie shouldn't be replaced when a cookie jar isn't specified - createTest({headers: {cookie: 'foo=bar'}}, function (req, res) { - assert.ok(req.headers.cookie) - assert.equal(req.headers.cookie, 'foo=bar') - }) - - // Issue #125: headers.cookie + cookie jar - var jar = new Jar() - jar.add(new Cookie('quux=baz')); - createTest({jar: jar, headers: {cookie: 'foo=bar'}}, function (req, res) { - assert.ok(req.headers.cookie) - assert.equal(req.headers.cookie, 'foo=bar; quux=baz') - }) - - // There should be no cookie header when neither headers.cookie nor a cookie jar is specified - createTest({}, function (req, res) { - assert.ok(!req.headers.cookie) - }) -}) diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-httpModule.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-httpModule.js deleted file mode 100644 index 1866de2..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-httpModule.js +++ /dev/null @@ -1,94 +0,0 @@ -var http = require('http') - , https = require('https') - , server = require('./server') - , assert = require('assert') - , request = require('../main.js') - - -var faux_requests_made = {'http':0, 'https':0} -function wrap_request(name, module) { - // Just like the http or https module, but note when a request is made. - var wrapped = {} - Object.keys(module).forEach(function(key) { - var value = module[key]; - - if(key != 'request') - wrapped[key] = value; - else - wrapped[key] = function(options, callback) { - faux_requests_made[name] += 1 - return value.apply(this, arguments) - } - }) - - return wrapped; -} - - -var faux_http = wrap_request('http', http) - , faux_https = wrap_request('https', https) - , plain_server = server.createServer() - , https_server = server.createSSLServer() - - -plain_server.listen(plain_server.port, function() { - plain_server.on('/plain', function (req, res) { - res.writeHead(200) - res.end('plain') - }) - plain_server.on('/to_https', function (req, res) { - res.writeHead(301, {'location':'https://localhost:'+https_server.port + '/https'}) - res.end() - }) - - https_server.listen(https_server.port, function() { - https_server.on('/https', function (req, res) { - res.writeHead(200) - res.end('https') - }) - https_server.on('/to_plain', function (req, res) { - res.writeHead(302, {'location':'http://localhost:'+plain_server.port + '/plain'}) - res.end() - }) - - run_tests() - run_tests({}) - run_tests({'http:':faux_http}) - run_tests({'https:':faux_https}) - run_tests({'http:':faux_http, 'https:':faux_https}) - }) -}) - -function run_tests(httpModules) { - var to_https = 'http://localhost:'+plain_server.port+'/to_https' - var to_plain = 'https://localhost:'+https_server.port+'/to_plain' - - request(to_https, {'httpModules':httpModules}, function (er, res, body) { - assert.ok(!er, 'Bounce to SSL worked') - assert.equal(body, 'https', 'Received HTTPS server body') - done() - }) - - request(to_plain, {'httpModules':httpModules}, function (er, res, body) { - assert.ok(!er, 'Bounce to plaintext server worked') - assert.equal(body, 'plain', 'Received HTTPS server body') - done() - }) -} - - -var passed = 0; -function done() { - passed += 1 - var expected = 10 - - if(passed == expected) { - plain_server.close() - https_server.close() - - assert.equal(faux_requests_made.http, 4, 'Wrapped http module called appropriately') - assert.equal(faux_requests_made.https, 4, 'Wrapped https module called appropriately') - - console.log((expected+2) + ' tests passed.') - } -} diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-https-strict.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-https-strict.js deleted file mode 100644 index f53fc14..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-https-strict.js +++ /dev/null @@ -1,97 +0,0 @@ -// a test where we validate the siguature of the keys -// otherwise exactly the same as the ssl test - -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , fs = require('fs') - , path = require('path') - , opts = { key: path.resolve(__dirname, 'ssl/ca/server.key') - , cert: path.resolve(__dirname, 'ssl/ca/server.crt') } - , s = server.createSSLServer(null, opts) - , caFile = path.resolve(__dirname, 'ssl/ca/ca.crt') - , ca = fs.readFileSync(caFile) - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--frontier\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--frontier\r\n\r\n' + - 'Oh hi.' + - '\r\n--frontier--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - test.uri = s.url + '/' + i - test.strictSSL = true - test.ca = ca - test.headers = { host: 'testing.request.mikealrogers.com' } - request(test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-https.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-https.js deleted file mode 100644 index df7330b..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-https.js +++ /dev/null @@ -1,86 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - -var s = server.createSSLServer(); - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--frontier\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--frontier\r\n\r\n' + - 'Oh hi.' + - '\r\n--frontier--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - test.uri = s.url + '/' + i - request(test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-oauth.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-oauth.js deleted file mode 100644 index e9d3290..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-oauth.js +++ /dev/null @@ -1,117 +0,0 @@ -var hmacsign = require('../oauth').hmacsign - , assert = require('assert') - , qs = require('querystring') - , request = require('../main') - ; - -function getsignature (r) { - var sign - r.headers.authorization.slice('OAuth '.length).replace(/,\ /g, ',').split(',').forEach(function (v) { - if (v.slice(0, 'oauth_signature="'.length) === 'oauth_signature="') sign = v.slice('oauth_signature="'.length, -1) - }) - return decodeURIComponent(sign) -} - -// Tests from Twitter documentation https://dev.twitter.com/docs/auth/oauth - -var reqsign = hmacsign('POST', 'https://api.twitter.com/oauth/request_token', - { oauth_callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11' - , oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g' - , oauth_nonce: 'QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk' - , oauth_signature_method: 'HMAC-SHA1' - , oauth_timestamp: '1272323042' - , oauth_version: '1.0' - }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98") - -console.log(reqsign) -console.log('8wUi7m5HFQy76nowoCThusfgB+Q=') -assert.equal(reqsign, '8wUi7m5HFQy76nowoCThusfgB+Q=') - -var accsign = hmacsign('POST', 'https://api.twitter.com/oauth/access_token', - { oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g' - , oauth_nonce: '9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8' - , oauth_signature_method: 'HMAC-SHA1' - , oauth_token: '8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc' - , oauth_timestamp: '1272323047' - , oauth_verifier: 'pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY' - , oauth_version: '1.0' - }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "x6qpRnlEmW9JbQn4PQVVeVG8ZLPEx6A0TOebgwcuA") - -console.log(accsign) -console.log('PUw/dHA4fnlJYM6RhXk5IU/0fCc=') -assert.equal(accsign, 'PUw/dHA4fnlJYM6RhXk5IU/0fCc=') - -var upsign = hmacsign('POST', 'http://api.twitter.com/1/statuses/update.json', - { oauth_consumer_key: "GDdmIQH6jhtmLUypg82g" - , oauth_nonce: "oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y" - , oauth_signature_method: "HMAC-SHA1" - , oauth_token: "819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw" - , oauth_timestamp: "1272325550" - , oauth_version: "1.0" - , status: 'setting up my twitter 私のさえずりを設定する' - }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA") - -console.log(upsign) -console.log('yOahq5m0YjDDjfjxHaXEsW9D+X0=') -assert.equal(upsign, 'yOahq5m0YjDDjfjxHaXEsW9D+X0=') - - -var rsign = request.post( - { url: 'https://api.twitter.com/oauth/request_token' - , oauth: - { callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11' - , consumer_key: 'GDdmIQH6jhtmLUypg82g' - , nonce: 'QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk' - , timestamp: '1272323042' - , version: '1.0' - , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" - } - }) - -setTimeout(function () { - console.log(getsignature(rsign)) - assert.equal(reqsign, getsignature(rsign)) -}) - -var raccsign = request.post( - { url: 'https://api.twitter.com/oauth/access_token' - , oauth: - { consumer_key: 'GDdmIQH6jhtmLUypg82g' - , nonce: '9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8' - , signature_method: 'HMAC-SHA1' - , token: '8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc' - , timestamp: '1272323047' - , verifier: 'pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY' - , version: '1.0' - , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" - , token_secret: "x6qpRnlEmW9JbQn4PQVVeVG8ZLPEx6A0TOebgwcuA" - } - }) - -setTimeout(function () { - console.log(getsignature(raccsign)) - assert.equal(accsign, getsignature(raccsign)) -}, 1) - -var rupsign = request.post( - { url: 'http://api.twitter.com/1/statuses/update.json' - , oauth: - { consumer_key: "GDdmIQH6jhtmLUypg82g" - , nonce: "oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y" - , signature_method: "HMAC-SHA1" - , token: "819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw" - , timestamp: "1272325550" - , version: "1.0" - , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" - , token_secret: "J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA" - } - , form: {status: 'setting up my twitter 私のさえずりを設定する'} - }) -setTimeout(function () { - console.log(getsignature(rupsign)) - assert.equal(upsign, getsignature(rupsign)) -}, 1) - - - - diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-params.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-params.js deleted file mode 100644 index 8354f6d..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-params.js +++ /dev/null @@ -1,92 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetBuffer : - { resp : server.createGetResponse(new Buffer("TESTING!")) - , encoding: null - , expectBody: new Buffer("TESTING!") - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--frontier\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--frontier\r\n\r\n' + - 'Oh hi.' + - '\r\n--frontier--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - //test.uri = s.url + '/' + i - request(s.url + '/' + i, test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-pipes.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-pipes.js deleted file mode 100644 index 1869874..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-pipes.js +++ /dev/null @@ -1,202 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , fs = require('fs') - , request = require('../main.js') - , path = require('path') - , util = require('util') - ; - -var s = server.createServer(3453); - -function ValidationStream(str) { - this.str = str - this.buf = '' - this.on('data', function (data) { - this.buf += data - }) - this.on('end', function () { - assert.equal(this.str, this.buf) - }) - this.writable = true -} -util.inherits(ValidationStream, stream.Stream) -ValidationStream.prototype.write = function (chunk) { - this.emit('data', chunk) -} -ValidationStream.prototype.end = function (chunk) { - if (chunk) emit('data', chunk) - this.emit('end') -} - -s.listen(s.port, function () { - counter = 0; - - var check = function () { - counter = counter - 1 - if (counter === 0) { - console.log('All tests passed.') - setTimeout(function () { - process.exit(); - }, 500) - } - } - - // Test pipeing to a request object - s.once('/push', server.createPostValidator("mydata")); - - var mydata = new stream.Stream(); - mydata.readable = true - - counter++ - var r1 = request.put({url:'http://localhost:3453/push'}, function () { - check(); - }) - mydata.pipe(r1) - - mydata.emit('data', 'mydata'); - mydata.emit('end'); - - - // Test pipeing from a request object. - s.once('/pull', server.createGetResponse("mypulldata")); - - var mypulldata = new stream.Stream(); - mypulldata.writable = true - - counter++ - request({url:'http://localhost:3453/pull'}).pipe(mypulldata) - - var d = ''; - - mypulldata.write = function (chunk) { - d += chunk; - } - mypulldata.end = function () { - assert.equal(d, 'mypulldata'); - check(); - }; - - - s.on('/cat', function (req, resp) { - if (req.method === "GET") { - resp.writeHead(200, {'content-type':'text/plain-test', 'content-length':4}); - resp.end('asdf') - } else if (req.method === "PUT") { - assert.equal(req.headers['content-type'], 'text/plain-test'); - assert.equal(req.headers['content-length'], 4) - var validate = ''; - - req.on('data', function (chunk) {validate += chunk}) - req.on('end', function () { - resp.writeHead(201); - resp.end(); - assert.equal(validate, 'asdf'); - check(); - }) - } - }) - s.on('/pushjs', function (req, resp) { - if (req.method === "PUT") { - assert.equal(req.headers['content-type'], 'text/javascript'); - check(); - } - }) - s.on('/catresp', function (req, resp) { - request.get('http://localhost:3453/cat').pipe(resp) - }) - s.on('/doodle', function (req, resp) { - if (req.headers['x-oneline-proxy']) { - resp.setHeader('x-oneline-proxy', 'yup') - } - resp.writeHead('200', {'content-type':'image/png'}) - fs.createReadStream(path.join(__dirname, 'googledoodle.png')).pipe(resp) - }) - s.on('/onelineproxy', function (req, resp) { - var x = request('http://localhost:3453/doodle') - req.pipe(x) - x.pipe(resp) - }) - - counter++ - fs.createReadStream(__filename).pipe(request.put('http://localhost:3453/pushjs')) - - counter++ - request.get('http://localhost:3453/cat').pipe(request.put('http://localhost:3453/cat')) - - counter++ - request.get('http://localhost:3453/catresp', function (e, resp, body) { - assert.equal(resp.headers['content-type'], 'text/plain-test'); - assert.equal(resp.headers['content-length'], 4) - check(); - }) - - var doodleWrite = fs.createWriteStream(path.join(__dirname, 'test.png')) - - counter++ - request.get('http://localhost:3453/doodle').pipe(doodleWrite) - - doodleWrite.on('close', function () { - assert.deepEqual(fs.readFileSync(path.join(__dirname, 'googledoodle.png')), fs.readFileSync(path.join(__dirname, 'test.png'))) - check() - }) - - process.on('exit', function () { - fs.unlinkSync(path.join(__dirname, 'test.png')) - }) - - counter++ - request.get({uri:'http://localhost:3453/onelineproxy', headers:{'x-oneline-proxy':'nope'}}, function (err, resp, body) { - assert.equal(resp.headers['x-oneline-proxy'], 'yup') - check() - }) - - s.on('/afterresponse', function (req, resp) { - resp.write('d') - resp.end() - }) - - counter++ - var afterresp = request.post('http://localhost:3453/afterresponse').on('response', function () { - var v = new ValidationStream('d') - afterresp.pipe(v) - v.on('end', check) - }) - - s.on('/forward1', function (req, resp) { - resp.writeHead(302, {location:'/forward2'}) - resp.end() - }) - s.on('/forward2', function (req, resp) { - resp.writeHead('200', {'content-type':'image/png'}) - resp.write('d') - resp.end() - }) - - counter++ - var validateForward = new ValidationStream('d') - validateForward.on('end', check) - request.get('http://localhost:3453/forward1').pipe(validateForward) - - // Test pipe options - s.once('/opts', server.createGetResponse('opts response')); - - var optsStream = new stream.Stream(); - optsStream.writable = true - - var optsData = ''; - optsStream.write = function (buf) { - optsData += buf; - if (optsData === 'opts response') { - setTimeout(check, 10); - } - } - - optsStream.end = function () { - assert.fail('end called') - }; - - counter++ - request({url:'http://localhost:3453/opts'}).pipe(optsStream, { end : false }) -}) diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-proxy.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-proxy.js deleted file mode 100644 index 647157c..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-proxy.js +++ /dev/null @@ -1,39 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , fs = require('fs') - , request = require('../main.js') - , path = require('path') - , util = require('util') - ; - -var port = 6768 - , called = false - , proxiedHost = 'google.com' - ; - -var s = server.createServer(port) -s.listen(port, function () { - s.on('http://google.com/', function (req, res) { - called = true - assert.equal(req.headers.host, proxiedHost) - res.writeHeader(200) - res.end() - }) - request ({ - url: 'http://'+proxiedHost, - proxy: 'http://localhost:'+port - /* - //should behave as if these arguments where passed: - url: 'http://localhost:'+port, - headers: {host: proxiedHost} - //*/ - }, function (err, res, body) { - s.close() - }) -}) - -process.on('exit', function () { - assert.ok(called, 'the request must be made to the proxy server') -}) diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-qs.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-qs.js deleted file mode 100644 index 1aac22b..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-qs.js +++ /dev/null @@ -1,28 +0,0 @@ -var request = request = require('../main.js') - , assert = require('assert') - ; - - -// Test adding a querystring -var req1 = request.get({ uri: 'http://www.google.com', qs: { q : 'search' }}) -setTimeout(function() { - assert.equal('/?q=search', req1.path) -}, 1) - -// Test replacing a querystring value -var req2 = request.get({ uri: 'http://www.google.com?q=abc', qs: { q : 'search' }}) -setTimeout(function() { - assert.equal('/?q=search', req2.path) -}, 1) - -// Test appending a querystring value to the ones present in the uri -var req3 = request.get({ uri: 'http://www.google.com?x=y', qs: { q : 'search' }}) -setTimeout(function() { - assert.equal('/?x=y&q=search', req3.path) -}, 1) - -// Test leaving a querystring alone -var req4 = request.get({ uri: 'http://www.google.com?x=y'}) -setTimeout(function() { - assert.equal('/?x=y', req4.path) -}, 1) diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-redirect.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-redirect.js deleted file mode 100644 index 54fc19b..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-redirect.js +++ /dev/null @@ -1,159 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , Cookie = require('../vendor/cookie') - , Jar = require('../vendor/cookie/jar') - -var s = server.createServer() - -s.listen(s.port, function () { - var server = 'http://localhost:' + s.port; - var hits = {} - var passed = 0; - - bouncer(301, 'temp') - bouncer(302, 'perm') - bouncer(302, 'nope') - - function bouncer(code, label) { - var landing = label+'_landing'; - - s.on('/'+label, function (req, res) { - hits[label] = true; - res.writeHead(code, {'location':server + '/'+landing}) - res.end() - }) - - s.on('/'+landing, function (req, res) { - if (req.method !== 'GET') { // We should only accept GET redirects - console.error("Got a non-GET request to the redirect destination URL"); - resp.writeHead(400); - resp.end(); - return; - } - // Make sure the cookie doesn't get included twice, see #139: - assert.equal(req.headers.cookie, 'foo=bar; quux=baz'); - hits[landing] = true; - res.writeHead(200) - res.end(landing) - }) - } - - // Permanent bounce - var jar = new Jar() - jar.add(new Cookie('quux=baz')) - request({uri: server+'/perm', jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.perm, 'Original request is to /perm') - assert.ok(hits.perm_landing, 'Forward to permanent landing URL') - assert.equal(body, 'perm_landing', 'Got permanent landing content') - passed += 1 - } finally { - done() - } - }) - - // Temporary bounce - request({uri: server+'/temp', jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(hits.temp_landing, 'Forward to temporary landing URL') - assert.equal(body, 'temp_landing', 'Got temporary landing content') - passed += 1 - } finally { - done() - } - }) - - // Prevent bouncing. - request({uri:server+'/nope', jar: jar, headers: {cookie: 'foo=bar'}, followRedirect:false}, function (er, res, body) { - try { - assert.ok(hits.nope, 'Original request to /nope') - assert.ok(!hits.nope_landing, 'No chasing the redirect') - assert.equal(res.statusCode, 302, 'Response is the bounce itself') - passed += 1 - } finally { - done() - } - }) - - // Should not follow post redirects by default - request.post(server+'/temp', { jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect when post') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - } finally { - done() - } - }) - - // Should follow post redirects when followAllRedirects true - request.post({uri:server+'/temp', followAllRedirects:true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(hits.temp_landing, 'Forward to temporary landing URL') - assert.equal(body, 'temp_landing', 'Got temporary landing content') - passed += 1 - } finally { - done() - } - }) - - request.post({uri:server+'/temp', followAllRedirects:false, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - } finally { - done() - } - }) - - // Should not follow delete redirects by default - request.del(server+'/temp', { jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect when delete') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - } finally { - done() - } - }) - - // Should not follow delete redirects even if followRedirect is set to true - request.del(server+'/temp', { followRedirect: true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect when delete') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - } finally { - done() - } - }) - - // Should follow delete redirects when followAllRedirects true - request.del(server+'/temp', {followAllRedirects:true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - try { - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(hits.temp_landing, 'Forward to temporary landing URL') - assert.equal(body, 'temp_landing', 'Got temporary landing content') - passed += 1 - } finally { - done() - } - }) - - var reqs_done = 0; - function done() { - reqs_done += 1; - if(reqs_done == 9) { - console.log(passed + ' tests passed.') - s.close() - } - } -}) diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-timeout.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-timeout.js deleted file mode 100644 index 673f8ad..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-timeout.js +++ /dev/null @@ -1,87 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); -var expectedBody = "waited"; -var remainingTests = 5; - -s.listen(s.port, function () { - // Request that waits for 200ms - s.on('/timeout', function (req, resp) { - setTimeout(function(){ - resp.writeHead(200, {'content-type':'text/plain'}) - resp.write(expectedBody) - resp.end() - }, 200); - }); - - // Scenario that should timeout - var shouldTimeout = { - url: s.url + "/timeout", - timeout:100 - } - - - request(shouldTimeout, function (err, resp, body) { - assert.equal(err.code, "ETIMEDOUT"); - checkDone(); - }) - - - // Scenario that shouldn't timeout - var shouldntTimeout = { - url: s.url + "/timeout", - timeout:300 - } - - request(shouldntTimeout, function (err, resp, body) { - assert.equal(err, null); - assert.equal(expectedBody, body) - checkDone(); - }) - - // Scenario with no timeout set, so shouldn't timeout - var noTimeout = { - url: s.url + "/timeout" - } - - request(noTimeout, function (err, resp, body) { - assert.equal(err); - assert.equal(expectedBody, body) - checkDone(); - }) - - // Scenario with a negative timeout value, should be treated a zero or the minimum delay - var negativeTimeout = { - url: s.url + "/timeout", - timeout:-1000 - } - - request(negativeTimeout, function (err, resp, body) { - assert.equal(err.code, "ETIMEDOUT"); - checkDone(); - }) - - // Scenario with a float timeout value, should be rounded by setTimeout anyway - var floatTimeout = { - url: s.url + "/timeout", - timeout: 100.76 - } - - request(floatTimeout, function (err, resp, body) { - assert.equal(err.code, "ETIMEDOUT"); - checkDone(); - }) - - function checkDone() { - if(--remainingTests == 0) { - s.close(); - console.log("All tests passed."); - } - } -}) - diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-tunnel.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-tunnel.js deleted file mode 100644 index 58131b9..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tests/test-tunnel.js +++ /dev/null @@ -1,61 +0,0 @@ -// test that we can tunnel a https request over an http proxy -// keeping all the CA and whatnot intact. -// -// Note: this requires that squid is installed. -// If the proxy fails to start, we'll just log a warning and assume success. - -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , fs = require('fs') - , path = require('path') - , caFile = path.resolve(__dirname, 'ssl/npm-ca.crt') - , ca = fs.readFileSync(caFile) - , child_process = require('child_process') - , sqConf = path.resolve(__dirname, 'squid.conf') - , sqArgs = ['-f', sqConf, '-N', '-d', '5'] - , proxy = 'http://localhost:3128' - , hadError = null - -var squid = child_process.spawn('squid', sqArgs); -var ready = false - -squid.stderr.on('data', function (c) { - console.error('SQUIDERR ' + c.toString().trim().split('\n') - .join('\nSQUIDERR ')) - ready = c.toString().match(/ready to serve requests/i) -}) - -squid.stdout.on('data', function (c) { - console.error('SQUIDOUT ' + c.toString().trim().split('\n') - .join('\nSQUIDOUT ')) -}) - -squid.on('exit', function (c) { - console.error('exit '+c) - if (c && !ready) { - console.error('squid must be installed to run this test.') - c = null - hadError = null - process.exit(0) - return - } - - if (c) { - hadError = hadError || new Error('Squid exited with '+c) - } - if (hadError) throw hadError -}) - -setTimeout(function F () { - if (!ready) return setTimeout(F, 100) - request({ uri: 'https://registry.npmjs.org/request/' - , proxy: 'http://localhost:3128' - , ca: ca - , json: true }, function (er, body) { - hadError = er - console.log(er || typeof body) - if (!er) console.log("ok") - squid.kill('SIGKILL') - }) -}, 100) diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/tunnel.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/tunnel.js deleted file mode 100644 index 453786c..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/tunnel.js +++ /dev/null @@ -1,229 +0,0 @@ -'use strict'; - -var net = require('net'); -var tls = require('tls'); -var http = require('http'); -var https = require('https'); -var events = require('events'); -var assert = require('assert'); -var util = require('util'); - - -exports.httpOverHttp = httpOverHttp; -exports.httpsOverHttp = httpsOverHttp; -exports.httpOverHttps = httpOverHttps; -exports.httpsOverHttps = httpsOverHttps; - - -function httpOverHttp(options) { - var agent = new TunnelingAgent(options); - agent.request = http.request; - return agent; -} - -function httpsOverHttp(options) { - var agent = new TunnelingAgent(options); - agent.request = http.request; - agent.createSocket = createSecureSocket; - return agent; -} - -function httpOverHttps(options) { - var agent = new TunnelingAgent(options); - agent.request = https.request; - return agent; -} - -function httpsOverHttps(options) { - var agent = new TunnelingAgent(options); - agent.request = https.request; - agent.createSocket = createSecureSocket; - return agent; -} - - -function TunnelingAgent(options) { - var self = this; - self.options = options || {}; - self.proxyOptions = self.options.proxy || {}; - self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; - self.requests = []; - self.sockets = []; - - self.on('free', function onFree(socket, host, port) { - for (var i = 0, len = self.requests.length; i < len; ++i) { - var pending = self.requests[i]; - if (pending.host === host && pending.port === port) { - // Detect the request to connect same origin server, - // reuse the connection. - self.requests.splice(i, 1); - pending.request.onSocket(socket); - return; - } - } - socket.destroy(); - self.removeSocket(socket); - }); -} -util.inherits(TunnelingAgent, events.EventEmitter); - -TunnelingAgent.prototype.addRequest = function addRequest(req, host, port) { - var self = this; - - if (self.sockets.length >= this.maxSockets) { - // We are over limit so we'll add it to the queue. - self.requests.push({host: host, port: port, request: req}); - return; - } - - // If we are under maxSockets create a new one. - self.createSocket({host: host, port: port, request: req}, function(socket) { - socket.on('free', onFree); - socket.on('close', onCloseOrRemove); - socket.on('agentRemove', onCloseOrRemove); - req.onSocket(socket); - - function onFree() { - self.emit('free', socket, host, port); - } - - function onCloseOrRemove(err) { - self.removeSocket(); - socket.removeListener('free', onFree); - socket.removeListener('close', onCloseOrRemove); - socket.removeListener('agentRemove', onCloseOrRemove); - } - }); -}; - -TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { - var self = this; - var placeholder = {}; - self.sockets.push(placeholder); - - var connectOptions = mergeOptions({}, self.proxyOptions, { - method: 'CONNECT', - path: options.host + ':' + options.port, - agent: false - }); - if (connectOptions.proxyAuth) { - connectOptions.headers = connectOptions.headers || {}; - connectOptions.headers['Proxy-Authorization'] = 'Basic ' + - new Buffer(connectOptions.proxyAuth).toString('base64'); - } - - debug('making CONNECT request'); - var connectReq = self.request(connectOptions); - connectReq.useChunkedEncodingByDefault = false; // for v0.6 - connectReq.once('response', onResponse); // for v0.6 - connectReq.once('upgrade', onUpgrade); // for v0.6 - connectReq.once('connect', onConnect); // for v0.7 or later - connectReq.once('error', onError); - connectReq.end(); - - function onResponse(res) { - // Very hacky. This is necessary to avoid http-parser leaks. - res.upgrade = true; - } - - function onUpgrade(res, socket, head) { - // Hacky. - process.nextTick(function() { - onConnect(res, socket, head); - }); - } - - function onConnect(res, socket, head) { - connectReq.removeAllListeners(); - socket.removeAllListeners(); - - if (res.statusCode === 200) { - assert.equal(head.length, 0); - debug('tunneling connection has established'); - self.sockets[self.sockets.indexOf(placeholder)] = socket; - cb(socket); - } else { - debug('tunneling socket could not be established, statusCode=%d', - res.statusCode); - var error = new Error('tunneling socket could not be established, ' + - 'sutatusCode=' + res.statusCode); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - } - } - - function onError(cause) { - connectReq.removeAllListeners(); - - debug('tunneling socket could not be established, cause=%s\n', - cause.message, cause.stack); - var error = new Error('tunneling socket could not be established, ' + - 'cause=' + cause.message); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - } -}; - -TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { - var pos = this.sockets.indexOf(socket) - if (pos === -1) { - return; - } - this.sockets.splice(pos, 1); - - var pending = this.requests.shift(); - if (pending) { - // If we have pending requests and a socket gets closed a new one - // needs to be created to take over in the pool for the one that closed. - this.createSocket(pending, function(socket) { - pending.request.onSocket(socket); - }); - } -}; - -function createSecureSocket(options, cb) { - var self = this; - TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { - // 0 is dummy port for v0.6 - var secureSocket = tls.connect(0, mergeOptions({}, self.options, { - socket: socket - })); - cb(secureSocket); - }); -} - - -function mergeOptions(target) { - for (var i = 1, len = arguments.length; i < len; ++i) { - var overrides = arguments[i]; - if (typeof overrides === 'object') { - var keys = Object.keys(overrides); - for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { - var k = keys[j]; - if (overrides[k] !== undefined) { - target[k] = overrides[k]; - } - } - } - } - return target; -} - - -var debug; -if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { - debug = function() { - var args = Array.prototype.slice.call(arguments); - if (typeof args[0] === 'string') { - args[0] = 'TUNNEL: ' + args[0]; - } else { - args.unshift('TUNNEL:'); - } - console.error.apply(console, args); - } -} else { - debug = function() {}; -} -exports.debug = debug; // for test diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/uuid.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/uuid.js deleted file mode 100644 index 1d83bd5..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/uuid.js +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = function () { - var s = [], itoh = '0123456789ABCDEF'; - - // Make array of random hex digits. The UUID only has 32 digits in it, but we - // allocate an extra items to make room for the '-'s we'll be inserting. - for (var i = 0; i <36; i++) s[i] = Math.floor(Math.random()*0x10); - - // Conform to RFC-4122, section 4.4 - s[14] = 4; // Set 4 high bits of time_high field to version - s[19] = (s[19] & 0x3) | 0x8; // Specify 2 high bits of clock sequence - - // Convert to hex chars - for (var i = 0; i <36; i++) s[i] = itoh[s[i]]; - - // Insert '-'s - s[8] = s[13] = s[18] = s[23] = '-'; - - return s.join(''); -} diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/vendor/cookie/index.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/vendor/cookie/index.js deleted file mode 100644 index 1eb2eaa..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/vendor/cookie/index.js +++ /dev/null @@ -1,60 +0,0 @@ -/*! - * Tobi - Cookie - * Copyright(c) 2010 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var url = require('url'); - -/** - * Initialize a new `Cookie` with the given cookie `str` and `req`. - * - * @param {String} str - * @param {IncomingRequest} req - * @api private - */ - -var Cookie = exports = module.exports = function Cookie(str, req) { - this.str = str; - - // First key is the name - this.name = str.substr(0, str.indexOf('=')).trim(); - - // Map the key/val pairs - str.split(/ *; */).reduce(function(obj, pair){ - var p = pair.indexOf('='); - if(p > 0) - obj[pair.substring(0, p).trim()] = pair.substring(p + 1).trim(); - else - obj[pair.trim()] = true; - return obj; - }, this); - - // Assign value - this.value = this[this.name]; - - // Expires - this.expires = this.expires - ? new Date(this.expires) - : Infinity; - - // Default or trim path - this.path = this.path - ? this.path.trim(): req - ? url.parse(req.url).pathname: '/'; -}; - -/** - * Return the original cookie string. - * - * @return {String} - * @api public - */ - -Cookie.prototype.toString = function(){ - return this.str; -}; diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/request/vendor/cookie/jar.js b/node_modules/resourceful/node_modules/cradle/node_modules/request/vendor/cookie/jar.js deleted file mode 100644 index 34920e0..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/request/vendor/cookie/jar.js +++ /dev/null @@ -1,72 +0,0 @@ -/*! -* Tobi - CookieJar -* Copyright(c) 2010 LearnBoost -* MIT Licensed -*/ - -/** -* Module dependencies. -*/ - -var url = require('url'); - -/** -* Initialize a new `CookieJar`. -* -* @api private -*/ - -var CookieJar = exports = module.exports = function CookieJar() { - this.cookies = []; -}; - -/** -* Add the given `cookie` to the jar. -* -* @param {Cookie} cookie -* @api private -*/ - -CookieJar.prototype.add = function(cookie){ - this.cookies = this.cookies.filter(function(c){ - // Avoid duplication (same path, same name) - return !(c.name == cookie.name && c.path == cookie.path); - }); - this.cookies.push(cookie); -}; - -/** -* Get cookies for the given `req`. -* -* @param {IncomingRequest} req -* @return {Array} -* @api private -*/ - -CookieJar.prototype.get = function(req){ - var path = url.parse(req.url).pathname - , now = new Date - , specificity = {}; - return this.cookies.filter(function(cookie){ - if (0 == path.indexOf(cookie.path) && now < cookie.expires - && cookie.path.length > (specificity[cookie.name] || 0)) - return specificity[cookie.name] = cookie.path.length; - }); -}; - -/** -* Return Cookie string for the given `req`. -* -* @param {IncomingRequest} req -* @return {String} -* @api private -*/ - -CookieJar.prototype.cookieString = function(req){ - var cookies = this.get(req); - if (cookies.length) { - return cookies.map(function(cookie){ - return cookie.name + '=' + cookie.value; - }).join('; '); - } -}; diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/vargs/LICENSE b/node_modules/resourceful/node_modules/cradle/node_modules/vargs/LICENSE deleted file mode 100644 index eac7375..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/vargs/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2009-2010 Alexis Sellier - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/vargs/README.md b/node_modules/resourceful/node_modules/cradle/node_modules/vargs/README.md deleted file mode 100644 index 8431589..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/vargs/README.md +++ /dev/null @@ -1,34 +0,0 @@ - -vargs -===== - -> variable argument handling for functions taking a callback - -rationale ----------- - -JavaScript has very poor argument handling. *vargs* tries to make it simpler. - -synopsis --------- - - var Args = require("vargs").Constructor; - - function (/* [arg1, arg2, ...][,callback] */) { - var args = new(Args)(arguments); - - args.first; // first argument - args.last; // last argument before callback - args.callback; // callback argument, or an empty function - args.all; // all arguments except callback - args.length; // number of arguments, not including callback - - args.callbackGiven(); // returns true or false - args.at(-1); // last argument, including callback - args.array; // all arguments, including callback - } - -example -------- - -For a real-world example of *vargs*, check diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/vargs/lib/vargs.js b/node_modules/resourceful/node_modules/cradle/node_modules/vargs/lib/vargs.js deleted file mode 100644 index ae801bd..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/vargs/lib/vargs.js +++ /dev/null @@ -1,70 +0,0 @@ -// -// vargs.js -// -// variable argument handling for functions taking a callback -// -// usage: -// -// var Args = new("vargs").Constructor; -// -// function (/* [arg1, arg2, ...][,callback] */) { -// var args = new(Args)(arguments); -// -// args.first; // first argument -// args.last; // last argument before callback -// args.callback; // callback argument, or an empty function -// args.all; // all arguments except callback -// args.length; // number of arguments, not including callback -// -// args.callbackGiven() // returns true or false -// args.at(-1) // last argument, including callback -// args.array // all arguments, including callback -// } -// -exports.Constructor = function Vargs(arguments) { - this.array = Array.prototype.slice.call(arguments); - this.__defineGetter__('length', function () { - if (this.callbackGiven()) { - return this.array.length - 1; - } else { - return this.array.length; - } - }); - this.__defineGetter__('all', function () { - if (this.callbackGiven()) { - return this.array.slice(0, -1); - } else { - return this.array; - } - }); - this.__defineGetter__('last', function () { - if (typeof(this.at(-1)) === 'function') { - return this.at(-2); - } else { - return this.at(-1); - } - }); - this.__defineGetter__('first', function () { - return this.array[0]; - }); - this.callback = this.callbackGiven() ? this.at(-1) - : function () {}; -}; - -exports.Constructor.prototype = { - callbackGiven: function () { - return typeof(this.at(-1)) === 'function'; - }, - at: function (n) { - if (n < 0) { - return this.array[this.array.length + n]; - } else { - return this.array[n]; - } - } -}; - -exports.Constructor.last = function (args) { - return args[args.length - 1]; -}; - diff --git a/node_modules/resourceful/node_modules/cradle/node_modules/vargs/package.json b/node_modules/resourceful/node_modules/cradle/node_modules/vargs/package.json deleted file mode 100644 index c93d60d..0000000 --- a/node_modules/resourceful/node_modules/cradle/node_modules/vargs/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "name": "vargs", - "description": "practical variable argument handling", - "url": "http://github.com/cloudhead/vargs", - "keywords": [ - "argument", - "arguments" - ], - "author": { - "name": "Alexis Sellier", - "email": "self@cloudhead.net" - }, - "contributors": [], - "version": "0.1.0", - "main": "./lib/vargs", - "directories": { - "lib": "./lib" - }, - "engines": { - "node": ">=0.1.93" - }, - "_id": "vargs@0.1.0", - "dependencies": {}, - "devDependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "dist": { - "shasum": "7e1ba57b2a7515a0d65dfb2d5fccf96c322aaad0" - }, - "_from": "vargs@0.1.0" -} diff --git a/node_modules/resourceful/node_modules/cradle/package.json b/node_modules/resourceful/node_modules/cradle/package.json deleted file mode 100644 index 12791ad..0000000 --- a/node_modules/resourceful/node_modules/cradle/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "cradle", - "version": "0.6.3", - "description": "the high-level, caching, CouchDB library", - "url": "http://cloudhead.io/cradle", - "keywords": [ - "couchdb", - "database", - "couch" - ], - "author": { - "name": "Alexis Sellier", - "email": "self@cloudhead.net" - }, - "contributors": [ - { - "name": "Charlie Robbins", - "email": "charlie@nodejitsu.com" - }, - { - "name": "Maciej Malecki", - "email": "maciej@nodejitsu.com" - } - ], - "main": "./lib/cradle", - "dependencies": { - "follow": "0.7.x", - "request": "2.x.x", - "vargs": "0.1.0" - }, - "devDependencies": { - "async": "~0.1.x", - "vows": "0.6.x" - }, - "scripts": { - "test": "node test/helpers/seed.js && vows --spec" - }, - "engines": { - "node": ">=0.6.0" - }, - "_id": "cradle@0.6.3", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "cradle@0.6.x" -} diff --git a/node_modules/resourceful/node_modules/cradle/test/cache-test.js b/node_modules/resourceful/node_modules/cradle/test/cache-test.js deleted file mode 100644 index d092520..0000000 --- a/node_modules/resourceful/node_modules/cradle/test/cache-test.js +++ /dev/null @@ -1,98 +0,0 @@ -var path = require('path'), - assert = require('assert'), - events = require('events'), - vows = require('vows'); - -var cradle = require('../lib/cradle'); - -vows.describe('cradle/cache').addBatch({ - 'A cradle.Connection instance with a *cacheSize* specified': { - topic: new(cradle.Connection)({ cache: true, cacheSize: 16 }), - 'should set the database cache size appropriately': function (topic) { - assert.equal (topic.database('random').cache.size, 16); - } - }, - 'A cradle.Cache instance with a *cacheSize* of `8`': { - topic: new(cradle.Cache)({ cache: true, cacheSize: 8 }), - 'should be able to store 8 keys': function (topic) { - for (var i = 0; i < 8; i++) { topic.save(i.toString(), {}) } - assert.lengthOf (Object.keys(topic.store), 8); - }, - 'if more than 8 keys are set': { - topic: function (cache) { - var that = this; - cache.save('17af', {}); - process.nextTick(function () { - that.callback(null, cache); - }); - }, - 'there should still be 8 keys in the store': function (cache) { - assert.lengthOf (Object.keys(cache.store), 8); - } - }, - 'if an extra 8 keys are set': { - topic: function (cache) { - var that = this; - setTimeout(function () { - for (var i = 1; i <= 8; i++) { cache.save((i * 10).toString(), 'extra') } - process.nextTick(function () { - that.callback(null, cache); - }); - }, 30); - }, - 'it should purge the initial 8 keys, and keep the new ones': function (cache) { - Object.keys(cache.store).forEach(function (k) { - assert.equal (cache.store[k].document, 'extra'); - }); - } - }, - }, - 'Another cradle.Cache instance': { - topic: new(cradle.Cache)({ cache: true, cacheSize: 8 }), - 'after setting 8 keys on it, accessing 3 of them, and adding 5 more': { - topic: function (cache) { - var that = this; - for (var i = 0; i < 8; i++) { cache.save(i.toString(), { id: i.toString() }) } - setTimeout(function () { - cache.get('2'); - cache.get('5'); - cache.get('1'); - for (var i = 8; i < 13; i++) { cache.save(i.toString(), { id: i.toString() }) } - process.nextTick(function () { - that.callback(null, cache); - }); - }, 10); - }, - 'it should have the 3 accessed ones, with the 5 new ones': function (cache) { - assert.lengthOf (Object.keys(cache.store), 8); - assert.isTrue (cache.has('2')); - assert.isTrue (cache.has('5')); - assert.isTrue (cache.has('1')); - for (var i = 8; i < 13; i++) { cache.has(i.toString()) } - } - } - }, - 'A cradle.Cache instance with a *cacheSize* of *1024*': { - topic: new(cradle.Cache)({ cache: true, cacheSize: 1024 }), - 'setting 4096 keys': { - topic: function (cache) { - var that = this; - var keys = 0; - var timer = setInterval(function () { - if (keys >= 4096) { - clearInterval(timer); - process.nextTick(function () { that.callback(null, cache) }) - } - cache.save(keys.toString(), {}) - keys++; - }, 1); - }, - 'should result in 1025 keys': function (cache) { - assert.equal (Object.keys(cache.store).length, 1025); - assert.equal (cache.keys, 1025); - } - } - - } -}).export(module); - diff --git a/node_modules/resourceful/node_modules/cradle/test/connection-test.js b/node_modules/resourceful/node_modules/cradle/test/connection-test.js deleted file mode 100644 index ddd3756..0000000 --- a/node_modules/resourceful/node_modules/cradle/test/connection-test.js +++ /dev/null @@ -1,179 +0,0 @@ -var path = require('path'), - assert = require('assert'), - events = require('events'), - http = require('http'), - fs = require('fs'), - vows = require('vows'); - -function status(code) { - return function (e, res) { - assert.ok(res || e); - assert.equal((res || e).headers.status || (res || e).status, code); - }; -} - -var cradle = require('../lib/cradle'); - -vows.describe('cradle/connection').addBatch({ - "Default connection settings": { - topic: function () { - cradle.setup({ - host: "http://cloudhead.io", - port: 4242, - milk: 'white' - }); - return new(cradle.Connection); - }, - "should be carried on to new Connections": function (c) { - assert.equal(c.host, "cloudhead.io"); - assert.equal(c.protocol, "http"); - assert.equal(c.port, 4242); - assert.equal(c.options.milk, 'white'); - assert.equal(c.options.cache, true); - }, - "with just a {} passed to a new Connection object": { - topic: function () { return new(cradle.Connection)({milk: 'green'}) }, - "should override the defaults": function (c) { - assert.equal(c.options.milk, 'green'); - assert.equal(c.port, 4242); - } - }, - "with a host and port passed to Connection": { - topic: function () { return new(cradle.Connection)("255.255.0.0", 9696) }, - "should override the defaults": function (c) { - assert.equal(c.host, '255.255.0.0'); - assert.equal(c.port, 9696); - } - }, - "with a host, port and options passed to Connection": { - topic: function () { return new(cradle.Connection)("4.4.4.4", 911, {raw: true}) }, - "should override the defaults": function (c) { - assert.equal(c.host, '4.4.4.4'); - assert.equal(c.port, 911); - assert.equal(c.options.raw, true); - } - }, - "with a host and port and protocol passed to Connection": { - topic: function () { return new(cradle.Connection)("http://4.4.4.4", 911, {raw: true, secure: true}) }, - "should override the defaults": function (c) { - assert.equal(c.host, '4.4.4.4'); - assert.equal(c.port, 911); - assert.equal(c.options.raw, true); - assert.equal(c.options.secure, true); - } - }, - "with a host and port passed as an object to Connection": { - topic: function () { return new(cradle.Connection)({ host: "https://4.4.4.4", port: 911, raw: true }) }, - "should override the defaults": function (c) { - assert.equal(c.options.secure, true); - assert.equal(c.host, '4.4.4.4'); - assert.equal(c.port, 911); - assert.equal(c.options.raw, true); - } - }, - "with a the 'https' protocol": { - topic: function () { return new(cradle.Connection)("https://couch.io", 5984) }, - "should set 'secure' to `true`": function (c) { - assert.equal(c.protocol, 'https'); - assert.equal(c.options.secure, true); - assert.equal(c.host, 'couch.io'); - assert.equal(c.port, 5984); - } - }, - "with the port as part of the URL": { - topic: function () { return new(cradle.Connection)("https://couch.io:418") }, - "should read the port from the URL": function (c) { - assert.equal(c.protocol, 'https'); - assert.equal(c.options.secure, true); - assert.equal(c.host, 'couch.io'); - assert.equal(c.port, 418); - } - } - } -}).addBatch({ - "Connection": { - topic: function () { - return new(cradle.Connection)('127.0.0.1', 5984, {cache: false}); - }, - "getting server info": { - topic: function (c) { c.info(this.callback) }, - - "returns a 200": status(200), - "returns the version number": function (info) { - assert.ok(info); - assert.match(info.version, /\d+\.\d+\.\d+/); - } - }, - "uuids()": { - "with count": { - topic: function (c) { c.uuids(42, this.callback) }, - - "returns a 200": status(200), - "returns an array of UUIDs": function (uuids) { - assert.isArray(uuids); - assert.lengthOf(uuids, 42); - } - }, - "without count": { - topic: function (c) { c.uuids(this.callback) }, - - "returns a 200": status(200), - "returns an array of UUIDs": function (uuids) { - assert.isArray(uuids); - assert.lengthOf(uuids, 1); - } - } - }, - "getting the list of databases": { - topic: function (c) { - c.databases(this.callback); - }, - "should contain the 'rabbits' and 'pigs' databases": function (dbs) { - assert.isArray(dbs); - assert.include(dbs, 'rabbits'); - assert.include(dbs, 'pigs'); - } - }, - } -}).addBatch({ - "Connection": { - topic: function () { - return new(cradle.Connection)('127.0.0.1', 5984, {cache: false}); - }, - "create()": { - "with no / in the name": { - topic: function (c) { - c.database('badgers').create(this.callback); - }, - "returns a 201": status(201), - "creates a database": { - topic: function (res, c) { c.database('badgers').exists(this.callback) }, - "it exists": function (res) { assert.ok(res) } - } - }, - "with a / in the name": { - topic: function (c) { - c.database('madeup/ewoks').create(this.callback); - }, - "returns a 201": status(201), - "creates a database": { - topic: function (res, c) { c.database('madeup/ewoks').exists(this.callback) }, - "it exists": function (res) { assert.ok(res) } - } - - } - }, - "destroy()": { - topic: function (c) { - c.database('rabbits').destroy(this.callback); - }, - "returns a 200": status(200), - "destroys a database": { - topic: function (res, c) { - c.database('rabbits').exists(this.callback); - }, - "it doesn't exist anymore": function (res) { assert.ok(! res) } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/resourceful/node_modules/cradle/test/database-attachment-test.js b/node_modules/resourceful/node_modules/cradle/test/database-attachment-test.js deleted file mode 100644 index 12d7aa2..0000000 --- a/node_modules/resourceful/node_modules/cradle/test/database-attachment-test.js +++ /dev/null @@ -1,344 +0,0 @@ -var path = require('path'), - assert = require('assert'), - events = require('events'), - http = require('http'), - fs = require('fs'), - vows = require('vows'); - -function status(code) { - return function (e, res, body) { - assert.ok(res || e); - assert.equal((res || e).headers.status || (res || e).statusCode, code); - }; -} - -function mixin(target) { - var objs = Array.prototype.slice.call(arguments, 1); - objs.forEach(function (o) { - for (var attr in o) { target[attr] = o[attr] } - }); - return target; -} - -var cradle = require('../lib/cradle'); - -vows.describe('cradle/database/attachments').addBatch({ - "Database with cache": { - topic: function () { - return new(cradle.Connection)('127.0.0.1', 5984, { cache: true }).database('pigs'); - }, - "saveAttachment()": { - "updates the cache": { - topic: function (db) { - var that = this; - db.save({ _id: 'attachment-cacher' }, function (e, res) { - db.saveAttachment({ - id: res.id, - rev: res.rev - }, { - name: 'cached/foo.txt', - 'Content-Type': 'text/plain', - body: 'Foo!' - }, function () { - that.callback(null, db.cache.get(res.id)); - }); - }); - }, - "with the revision": function (cached) { - assert.match(cached._rev, /^2-/); - }, - "with the _attachments": function (cached) { - assert.ok(cached._attachments); - assert.ok(cached._attachments['cached/foo.txt']); - assert.equal(cached._attachments['cached/foo.txt'].stub, true); - }, - "and is valid enough to re-save": { - topic: function (cached, db) { - var that = this - db.save(mixin({ foo: 'bar' }, cached), function (e,res) { - db.cache.purge(cached._id); - db.get(cached._id, that.callback); - }); - }, - "has the attachment": function (res) { - var att = res._attachments['cached/foo.txt']; - assert.equal(att.stub, true); - assert.equal(att.content_type, 'text/plain'); - assert.equal(att.length, 4); - assert.equal(att.revpos, 2); - }, - "and actually updated the rev": function (res) { - assert.match(res._rev, /^3-/); - } - } - }, - "pulls the revision from the cache if not given": { - topic: function (db) { - var callback = this.callback; - db.save({ _id: 'attachment-saving-pulls-rev-from-cache' }, function (e, res) { - db.saveAttachment(res.id, { - name: 'foo.txt', - contentType: 'text/plain', - body: 'Foo!' - }, callback); - }); - }, - "and saves successfully": status(201) - } - } - } -}).addBatch({ - "Database with no cache": { - topic: function () { - return new(cradle.Connection)('127.0.0.1', 5984, {cache: false}).database('pigs'); - }, - "putting an attachment": { - "to an existing document": { - "with given data": { - topic: function (db) { - var that = this; - db.save({_id: 'complete-attachment'}, function (e, res) { - db.saveAttachment({ - id: res.id, - rev: res.rev - }, { - name: 'foo.txt', - 'content-type': 'text/plain', - body: 'Foo!' - }, that.callback); - }); - }, - "returns a 201": status(201), - "returns the revision": function (res) { - assert.ok(res.rev); - assert.match(res.rev, /^2/); - }, - }, - "when piping": { - topic: function (db) { - var callback = this.callback, filestream; - db.save({ _id: 'piped-attachment' }, function (e, res) { - var stream = db.saveAttachment({ - id: res.id, - rev: res.rev - }, { - name: 'foo.txt', - contentType: 'text/plain' - }, callback); - - fs.createReadStream(__dirname + "/../README.md").pipe(stream); - }); - }, - "returns a 201": status(201), - "returns the revision": function (res) { - assert.ok(res.rev); - assert.match(res.rev, /^2/); - } - }, - "with incorrect revision": { - topic: function (db) { - var callback = this.callback, oldRev; - db.save({ _id: 'attachment-incorrect-revision' }, function (e, res) { - oldRev = res.rev; - db.save({_id: 'attachment-incorrect-revision', _rev:res.rev}, function (e, res) { - db.saveAttachment({ - id: res.id, - rev: oldRev - }, { - name: 'foo.txt', - contentType: 'text/plain', - body: 'Foo!' - }, callback); - }); - }); - }, - "returns a 409": status(409) - } - }, - "to a non-existing document": { - topic: function (db) { - db.saveAttachment('standalone-attachment', { - name: 'foo.txt', - contentType: 'text/plain', - body: 'Foo!' - }, this.callback); - }, - "returns a 201": status(201), - "returns the revision": function (res) { - assert.ok(res.rev); - assert.match(res.rev, /^1-/); - } - } - }, - "getting an attachment": { - "when it exists": { - topic: function (db) { - var that = this, doc = { - _id: 'attachment-getter', - _attachments: { - "foo.txt": { - content_type: "text/plain", - data: "aGVsbG8gd29ybGQ=" - } - } - }; - - db.save(doc, function (e, res) { - db.getAttachment('attachment-getter', 'foo.txt', that.callback); - }); - }, - "returns a 200": status(200), - "returns the right mime-type in the header": function (err, res, body) { - assert.equal(res.headers['content-type'], 'text/plain'); - }, - "returns the attachment in the body": function (err, res, body) { - assert.equal(body, "hello world"); - } - }, - "when not found": { - topic: function (db) { - var that = this; - db.save({ _id: 'attachment-not-found' }, function (e, res) { - db.getAttachment('attachment-not-found', 'foo.txt', that.callback); - }); - }, - "returns a 404": status(404) - } - } - } -}).addBatch({ - "Database with no cache": { - topic: function () { - return new(cradle.Connection)('127.0.0.1', 5984, {cache: false}).database('pigs'); - }, - "saving an attachment with ETag": { - topic: function (db) { - var id = 'attachment-incorrect-revision', - that = this; - - db.head('attachment-incorrect-revision', function (err, _doc) { - db.saveAttachment({ - id: id, - rev: _doc.etag, - }, { - name: 'etag-foo.txt', - contentType: 'text/plain', - body: 'FOOO!!' - }, that.callback); - }); - }, - "returns a 201": status(201), - "returns the revision": function (res) { - assert.ok(res.rev); - assert.match(res.rev, /^3/); - } - } - } -}).addBatch({ - "Database with no cache": { - topic: function () { - return new(cradle.Connection)('127.0.0.1', 5984, {cache: false}).database('pigs'); - }, - "getting an attachment with .pipe()": { - "when it exists": { - topic: function (db) { - var stream = db.getAttachment('piped-attachment', 'foo.txt', this.callback); - stream.pipe(fs.createWriteStream(path.join(__dirname, 'fixtures', 'README.md'))); - }, - "returns a 200": status(200), - "returns the right mime-type in the header": function (err, res, body) { - assert.equal(res.headers['content-type'], 'text/plain'); - }, - "should write the correct attachment to disk": function (err, res, body) { - assert.isNull(err); - - assert.equal( - fs.readFileSync(path.join(__dirname, '..', 'README.md'), 'utf8'), - fs.readFileSync(path.join(__dirname, 'fixtures', 'README.md'), 'utf8') - ); - } - }, - "when not found": { - topic: function (db) { - var stream = db.getAttachment('attachment-not-found', 'foo.txt'); - stream.pipe(fs.createWriteStream(path.join(__dirname, 'fixtures', 'not-found.txt'))); - - stream.on('end', this.callback); - }, - "should write the error to disk": function () { - var result = JSON.parse( - fs.readFileSync(path.join(__dirname, 'fixtures', 'not-found.txt'), 'utf8') - ); - - assert.equal(result.reason, 'Document is missing attachment'); - } - } - } - } -}).addBatch({ - "Database with no cache": { - topic: function () { - return new(cradle.Connection)('127.0.0.1', 5984, { cache: false }).database('pigs'); - }, - "removeAttachment()": { - "when it exists": { - topic: function (db) { - var that = this; - db.get('attachment-getter', function (err, doc) { - db.removeAttachment(doc, 'foo.txt', that.callback); - }); - }, - "should remove the attachment": function (err, res) { - assert.isNull(err); - assert.ok(res.ok); - } - }, - "when the document doesnt exist": { - topic: function (db) { - db.removeAttachment({ - id: 'YUNOEXIST', - rev: '2-6bb732ce2ecc7ac85567b444b10590b4' - }, 'foo.txt', this.callback.bind(this, null)); - }, - "should respond with the correct error": function (_, err) { - assert.isObject(err); - assert.equal(err.headers.status, 500); - assert.equal(err.error, '{not_found,missing}'); - } - } - } - } -}).addBatch({ - "Database with cache": { - topic: function () { - return new(cradle.Connection)('127.0.0.1', 5984, { cache: true }).database('pigs'); - }, - "removeAttachment()": { - "when it exists": { - topic: function (db) { - var that = this; - db.get('attachment-cacher', function (err, doc) { - db.removeAttachment(doc._id, 'cached/foo.txt', that.callback); - }); - }, - "should remove the attachment": function (err, res) { - assert.isNull(err); - assert.ok(res.ok); - } - }, - "when the document doesnt exist": { - topic: function (db) { - db.removeAttachment({ - id: 'YUNOEXIST', - rev: '2-6bb732ce2ecc7ac85567b444b10590b4' - }, 'foo.txt', this.callback.bind(this, null)); - }, - "should respond with the correct error": function (_, err) { - assert.isObject(err); - assert.equal(err.headers.status, 500); - assert.equal(err.error, '{not_found,missing}'); - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/resourceful/node_modules/cradle/test/database-cache-test.js b/node_modules/resourceful/node_modules/cradle/test/database-cache-test.js deleted file mode 100644 index f150f6c..0000000 --- a/node_modules/resourceful/node_modules/cradle/test/database-cache-test.js +++ /dev/null @@ -1,132 +0,0 @@ -var path = require('path'), - assert = require('assert'), - events = require('events'), - http = require('http'), - fs = require('fs'), - vows = require('vows'); - -function status(code) { - return function (e, res) { - assert.ok(res || e); - assert.equal((res || e).headers.status || (res || e).status, code); - }; -} - -var cradle = require('../lib/cradle'); - -vows.describe('cradle/database/cache').addBatch({ - "A Cradle connection (cache)": { - topic: function () { - return new(cradle.Connection)('127.0.0.1', 5984, { cache: true }).database('pigs'); - }, - "save()": { - topic: function (db) { - var promise = new(events.EventEmitter); - db.save('bob', {ears: true}, function (e, res) { - promise.emit("success", db); - }); - return promise; - }, - "should write through the cache": function (db) { - assert.ok(db.cache.has('bob')); - assert.ok(db.cache.get('bob')._rev); - }, - "when fetching the cached document": { - topic: function (db) { - db.get('bob', this.callback) - }, - "document contains _id": function (e, doc) { - assert.equal(doc._id, 'bob'); - } - }, - "and": { - topic: function (db) { - var promise = new(events.EventEmitter); - db.save('bob', {size: 12}, function (e, res) { - promise.emit('success', res, db.cache.get('bob')); - }); - return promise; - }, - "return a 201": status(201), - "allow an overwrite": function (res) { - assert.match(res.rev, /^2/); - }, - "caches the updated document": function (e, res, doc) { - assert.ok(doc); - assert.equal(doc.size, 12); - assert.isUndefined(doc.ears); - } - } - }, - "save() with / in id": { - topic: function (db) { - var promise = new(events.EventEmitter); - db.save('bob/someotherdoc', {size: 12}, function (e, res) { - promise.emit('success', res, db.cache.get('bob/someotherdoc')); - }); - return promise; - }, - "return a 201": status(201), - "allow an overwrite": function (res) { - assert.match(res.rev, /^1/); - }, - "caches the updated document": function (e, res, doc) { - assert.ok(doc); - assert.equal(doc.size, 12); - } - }, - "merge()": { - topic: function (db) { - var promise = new(events.EventEmitter); - db.save('billy', {ears: true}, function (e, res) { - promise.emit("success", db); - }); - return promise; - }, - "should write through the cache": function (db) { - assert.ok(db.cache.has('billy')); - assert.ok(db.cache.get('billy')._rev); - }, - "and": { - topic: function (db) { - var promise = new(events.EventEmitter); - db.merge('billy', {size: 12}, function (e, res) { - promise.emit('success', res, db.cache.get('billy')); - }); - return promise; - }, - "return a 201": status(201), - "allow an overwrite": function (res) { - assert.match(res.rev, /^2/); - }, - "caches the updated document": function (e, res, doc) { - assert.ok(doc); - assert.equal(doc.size, 12); - assert.equal(doc.ears, true); - } - } - }, - "remove()": { - topic: function (db) { - var promise = new(events.EventEmitter); - db.save('bruno', {}, function (e, res) { - promise.emit("success", db); - }); - return promise; - }, - "shouldn't ask for a revision": { - topic: function (db) { - var promise = new(events.EventEmitter); - db.remove('bruno', function () { promise.emit('success', db) }); - return promise; - }, - "and should purge the cache": function (db) { - assert.equal(db.cache.has('bruno'), false); - }, - "and raise an exception if you use remove() without a rev": function (db) { - //assert.throws(db.remove('bruno'), Error); - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/resourceful/node_modules/cradle/test/database-test.js b/node_modules/resourceful/node_modules/cradle/test/database-test.js deleted file mode 100644 index fe48786..0000000 --- a/node_modules/resourceful/node_modules/cradle/test/database-test.js +++ /dev/null @@ -1,219 +0,0 @@ -var path = require('path'), - assert = require('assert'), - events = require('events'), - http = require('http'), - fs = require('fs'), - vows = require('vows'); - -function status(code) { - return function (e, res) { - assert.ok(res || e); - assert.equal((res || e).headers.status || (res || e).status, code); - }; -} - -function shouldQueryCouch(name) { - return { - topic: function (c) { return c.database(name) }, - - "info()": { - topic: function (db) { - db.info(this.callback); - }, - "returns a 200": status(200), - "returns database info": function (info) { - assert.equal(info['db_name'], name); - } - }, - "fetching a document by id (GET)": { - topic: function (db) { db.get('mike', this.callback) }, - "returns a 200": status(200), - "returns the document": function (res) { - assert.equal(res.id, 'mike'); - }, - "when not found": { - topic: function (_, db) { db.get('tyler', this.callback) }, - "returns a 404": status(404), - "returns the error": function (err, res) { - assert.isObject(err); - assert.isObject(err.headers); - assert.isUndefined(res); - }, - } - }, - "head()": { - topic: function (db) { db.head('mike', this.callback) }, - "returns the headers": function (res) { - assert.match(res.etag, /^"\d-[a-z0-9]+"$/); - } - }, - "save()": { - "with an id & doc": { - topic: function (db) { - db.save('joe', {gender: 'male'}, this.callback); - }, - "creates a new document (201)": status(201), - "returns the revision": function (res) { - assert.ok(res.rev); - } - }, - "with a doc containing non-ASCII characters": { - topic: function (db) { - db.save('john', {umlauts: 'äöü'}, this.callback); - }, - "creates a new document (201)": status(201) - }, - "with a large doc": { - topic: function (db) { - var text = (function (s) { - for (var i = 0; i < 18; i++) { s += s } - return s; - })('blah'); - - db.save('large-bob', { - gender: 'male', - speech: text - }, this.callback); - }, - "creates a new document (201)": status(201) - }, - "with a '_design' id": { - topic: function (db) { - db.save('_design/horses', { - all: { - map: function (doc) { - if (doc.speed == 72) emit(null, doc); - } - } - }, this.callback); - }, - "creates a doc (201)": status(201), - "returns the revision": function (res) { - assert.ok(res.rev); - }, - "creates a design doc": { - topic: function (res, db) { - db.view('horses/all', this.callback); - }, - "which can be queried": status(200) - } - }, - "without an id (POST)": {}, - }, - "calling save() with an array": { - topic: function (db) { - db.save([{_id: 'tom'}, {_id: 'flint'}], this.callback); - }, - "returns an array of document ids and revs": function (res) { - assert.equal(res[0].id, 'tom'); - assert.equal(res[1].id, 'flint'); - }, - "should bulk insert the documents": { - topic: function (res, db) { - var promise = new(events.EventEmitter); - db.get('tom', function (e, tom) { - db.get('flint', function (e, flint) { - promise.emit('success', tom, flint); - }); - }); - return promise; - }, - "which can then be retrieved": function (e, tom, flint) { - assert.ok(tom._id); - assert.ok(flint._id); - } - } - }, - "getting all documents": { - "with no options": { - topic: function (db) { - db.all(this.callback); - }, - "returns a 200": status(200), - "returns a list of all docs": function (res) { - assert.isArray(res); - assert.isNumber(res.total_rows); - assert.isNumber(res.offset); - assert.isArray(res.rows); - }, - "which can be iterated upon": function (res) { - assert.isFunction(res.forEach); - } - }, - "with { limit: 1 }": { - topic: function (db) { - db.all({ limit: 1 }, this.callback); - }, - "returns a 200": status(200), - "returns a list of all docs": function (res) { - assert.isArray(res); - assert.isNumber(res.total_rows); - assert.isNumber(res.offset); - assert.isArray(res.rows); - assert.lengthOf(res.rows, 1); - }, - "which can be iterated upon": function (res) { - assert.isFunction(res.forEach); - } - }, - "with { keys: ['mike'] }": { - topic: function (db) { - db.all({ keys: ['mike'] }, this.callback); - }, - "returns a 200": status(200), - "returns a list of all docs": function (res) { - assert.isArray(res); - assert.isNumber(res.total_rows); - assert.isNumber(res.offset); - assert.isArray(res.rows); - assert.lengthOf(res.rows, 1); - }, - "which can be iterated upon": function (res) { - assert.isFunction(res.forEach); - } - } - }, - "updating a document (PUT)": { - topic: function (db) { - var promise = new(events.EventEmitter); - db.get('mike', function (err, doc) { - db.save('mike', doc.rev, - {color: doc.color, age: 13}, function (err, res) { - if (! err) promise.emit('success', res, db); - else promise.emit('error', res); - }); - }); - return promise; - }, - "returns a 201": status(201), - "returns the revision": function (res) { - assert.ok(res.rev); - assert.match(res.rev, /^2/); - }, - }, - "deleting a document (DELETE)": { - topic: function (db) { - var promise = new(events.EventEmitter); - db.get('deleteme', function (e, res) { - db.remove('deleteme', res.rev, function (e, res) { - promise.emit('success', res); - }); - }); - return promise; - }, - "returns a 200": status(200) - } - } -} - -var cradle = require('../lib/cradle'); - -vows.describe('cradle/database').addBatch({ - "Connection": { - topic: function () { - return new(cradle.Connection)('127.0.0.1', 5984, {cache: false}); - }, - "database() with no /": shouldQueryCouch('pigs'), - "database() with /": shouldQueryCouch('animals/snorlax') - } -}).export(module); diff --git a/node_modules/resourceful/node_modules/cradle/test/database-view-test.js b/node_modules/resourceful/node_modules/cradle/test/database-view-test.js deleted file mode 100644 index 7dfcd1d..0000000 --- a/node_modules/resourceful/node_modules/cradle/test/database-view-test.js +++ /dev/null @@ -1,141 +0,0 @@ -var path = require('path'), - assert = require('assert'), - events = require('events'), - http = require('http'), - fs = require('fs'), - vows = require('vows'); - -function status(code) { - return function (e, res) { - assert.ok(res || e); - assert.equal((res || e).headers.status || (res || e).status, code); - }; -} - -function shouldQueryView(topic, rows, total) { - return { - topic: topic, - "returns a 200": status(200), - "returns view results": function (res) { - assert.isArray(res.rows); - assert.equal(res.rows.length, rows.length); - assert.equal(res.total_rows, total || rows.length); - }, - "returns an iterable object with key/val pairs": function (res) { - assert.isArray(res); - assert.lengthOf(res, rows.length); - res.forEach(function (k, v) { - assert.isObject(v); - assert.isString(k); - assert.notEqual(rows.indexOf(k), -1); - }); - }, - } -} - -var cradle = require('../lib/cradle'); - -vows.describe('cradle/database/view').addBatch({ - "Database": { - topic: function () { - return new(cradle.Connection)('127.0.0.1', 5984, {cache: false}).database('pigs'); - }, - "querying a view": { - "with no options": shouldQueryView( - function (db) { - db.view('pigs/all', this.callback); - }, - ['bill', 'mike', 'alex'] - ), - "with a single key": shouldQueryView( - function (db) { - db.view('pigs/all', { key: 'bill' }, this.callback); - }, - ['bill'], - 3 - ), - "with a startKey and endKey": shouldQueryView( - function (db) { - db.view('pigs/all', { startkey: 'b', endkey: 'r' }, this.callback); - }, - ['bill', 'mike'], - 3 - ), - "with keys": shouldQueryView( - function (db) { - db.view('pigs/all', { keys: ['mike', 'bill'] }, this.callback); - }, - ['mike', 'bill'], - 3 - ), - "with a `keys` body": shouldQueryView( - function (db) { - db.view('pigs/all', { body: { keys: ['mike', 'bill'] } }, this.callback); - }, - ['mike', 'bill'], - 3 - ) - }, - // same as the above test, but with a temporary view - "querying a temporary view": { - "with no options": shouldQueryView( - function (db) { - db.temporaryView({ - map: function (doc) { - if (doc.color) emit(doc._id, doc); - } - }, this.callback); - }, - ['mike', 'bill', 'alex'] - ) - }, - "cleaning up a view with viewCleanup()": { - topic: function (db) { - db.viewCleanup(this.callback); - }, - "returns a 202": status(202), - "no error is thrown and we get ok response": function (e, res) { - assert.ok(!e); - assert.ok(res && res.ok && res.ok === true); - } - } - } -}).addBatch({ - "Database": { - topic: function () { - return new(cradle.Connection)('127.0.0.1', 5984, {cache: false}).database('pigs'); - }, - "querying a temporary view": { - "with a single key": shouldQueryView( - function (db) { - db.temporaryView({ - map: function (doc) { - if (doc.color) emit(doc._id, doc); - } - }, { key: 'mike' }, this.callback); - }, - ['mike'], - 3 - ) - } - } -}).addBatch({ - "Database": { - topic: function () { - return new(cradle.Connection)('127.0.0.1', 5984, {cache: false}).database('pigs'); - }, - "querying a temporary view": { - "with a startKey and endKey": shouldQueryView( - function (db) { - db.temporaryView({ - map: function (doc) { - if (doc.color) emit(doc._id, doc); - } - }, { startkey: 'b', endkey: 'zzzz' }, this.callback); - }, - ['mike', 'bill'], - 3 - ) - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/resourceful/node_modules/cradle/test/fixtures/databases.json b/node_modules/resourceful/node_modules/cradle/test/fixtures/databases.json deleted file mode 100644 index c855ddb..0000000 --- a/node_modules/resourceful/node_modules/cradle/test/fixtures/databases.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "rabbits": [ - { - "_id": "alex", - "color": "blue" - } - ], - "pigs": [ - { - "_id": "_design/pigs", - "views": { - "all": { "map": "function (doc) { if (doc.color) emit(doc._id, doc) }" } - } - }, - { - "_id": "mike", - "color": "pink" - }, - { - "_id": "bill", - "color": "blue" - }, - { - "_id": "alex", - "color": "red" - }, - { - "_id": "deleteme" - } - ], - "animals/snorlax": [ - { - "_id": "_design/pigs", - "views": { - "all": { "map": "function (doc) { if (doc.color) emit(doc._id, doc) }" } - } - }, - { - "_id": "mike", - "color": "pink" - }, - { - "_id": "bill", - "color": "blue" - }, - { - "_id": "deleteme" - } - ], - "badgers": null, - "madeup/ewoks": null -} \ No newline at end of file diff --git a/node_modules/resourceful/node_modules/cradle/test/helpers/seed.js b/node_modules/resourceful/node_modules/cradle/test/helpers/seed.js deleted file mode 100644 index be6fa63..0000000 --- a/node_modules/resourceful/node_modules/cradle/test/helpers/seed.js +++ /dev/null @@ -1,65 +0,0 @@ -var assert = require('assert'), - fs = require('fs'), - path = require('path'), - async = require('async'), - request = require('request'); - -var databases = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'fixtures', 'databases.json'), 'utf8')); - -var seed = exports; - -seed.createDatabase = function (name, callback) { - request({ - method: 'PUT', - url: 'http://127.0.0.1:5984/' + encodeURIComponent(name) - }, callback); -}; - -seed.deleteDatabase = function (name, callback) { - request({ - method: 'DELETE', - url: 'http://127.0.0.1:5984/' + encodeURIComponent(name) - }, callback); -}; - -seed.seedDatabase = function (name, callback) { - console.log('Seeding ' + name); - seed.deleteDatabase(name, function (err, res, body) { - if (!databases[name]) { - return callback(err); - } - - function putDoc (doc, next) { - request({ - method: 'PUT', - url: 'http://127.0.0.1:5984/' + encodeURIComponent(name) + '/' + doc._id, - body: JSON.stringify(doc) - }, next); - } - - seed.createDatabase(name, function () { - async.forEach(databases[name], putDoc, callback); - }); - }); -}; - -seed.requireSeed = function () { - return { - "Tests require database seeding": { - topic: function () { - async.forEach(Object.keys(databases), seed.seedDatabase, this.callback) - }, - "should respond with no errors": function (err) { - assert.isTrue(!err); - } - } - } -}; - -if (!module.parent) { - async.forEachSeries(Object.keys(databases), seed.seedDatabase, function (err) { - return err - ? console.log('Error seeding database: ' + err.message) - : console.log('Database seed completed.'); - }); -} \ No newline at end of file diff --git a/node_modules/resourceful/node_modules/cradle/test/response-test.js b/node_modules/resourceful/node_modules/cradle/test/response-test.js deleted file mode 100644 index 751c043..0000000 --- a/node_modules/resourceful/node_modules/cradle/test/response-test.js +++ /dev/null @@ -1,72 +0,0 @@ -var path = require('path'), - assert = require('assert'), - events = require('events'), - http = require('http'), - fs = require('fs'), - vows = require('vows'); - -var cradle = require('../lib/cradle'); -var document = { _rev: '2-76be', _id: 'f6av8', name: 'buzz', age: 99 }; - -vows.describe('cradle/response').addBatch({ - 'A cradle.Response instance': { - 'from a document': { - topic: new(cradle.Response)(document), - - 'should only have the original keys': function (topic) { - assert.lengthOf (Object.keys(topic), 4); - assert.equal (topic.name, 'buzz'); - assert.equal (topic.age, 99); - assert.deepEqual (document, topic); - }, - 'should own the keys': function (topic) { - assert.include (topic, 'name'); - assert.include (topic, 'age'); - }, - 'should return the original document, when `json` is called': function (topic) { - assert.isObject (topic.json); - assert.deepEqual (topic.json, document); - assert.isUndefined (topic.json.json); - assert.isUndefined (topic.headers); - assert.lengthOf (Object.keys(topic.json), 4); - }, - 'when using a `for .. in` loop, should only return the original keys': function (topic) { - var keys = []; - for (var k in topic) { keys.push(k) } - - assert.lengthOf (keys, 4); - assert.include (keys, 'name'); - assert.include (keys, 'age'); - }, - 'should stringify': function (topic) { - var expected = JSON.stringify(document); - assert.equal (topic.toString(), expected); - assert.equal (JSON.stringify(topic), expected); - }, - 'should respond to both `id` and `_id`': function (topic) { - assert.equal (topic.id, 'f6av8'); - assert.equal (topic._id, 'f6av8'); - }, - 'should respond to both `rev` and `_rev`': function (topic) { - assert.equal (topic.rev, '2-76be'); - assert.equal (topic._rev, '2-76be'); - }, - 'should have Response as its constructor': function (topic) { - assert.equal (topic.constructor, cradle.Response); - }, - 'when modifying & adding keys': { - topic: function (response) { - response.hair = 'blue'; - response.age = 88; - return response; - }, - 'should return the modified document with toJSON': function (response) { - var json = JSON.parse(JSON.stringify(response)); - assert.equal(json.age, 88); - assert.equal(json.hair, 'blue'); - } - } - } - } -}).export(module); - diff --git a/node_modules/resourceful/node_modules/revalidator/.npmignore b/node_modules/resourceful/node_modules/revalidator/.npmignore deleted file mode 100644 index 5171c54..0000000 --- a/node_modules/resourceful/node_modules/revalidator/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules -npm-debug.log \ No newline at end of file diff --git a/node_modules/resourceful/node_modules/revalidator/LICENSE b/node_modules/resourceful/node_modules/revalidator/LICENSE deleted file mode 100644 index a83d179..0000000 --- a/node_modules/resourceful/node_modules/revalidator/LICENSE +++ /dev/null @@ -1,179 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS - -Copyright (c) 2009-2010 Alexis Sellier, Charlie Robbins, Nodejitsu Inc. diff --git a/node_modules/resourceful/node_modules/revalidator/README.md b/node_modules/resourceful/node_modules/revalidator/README.md deleted file mode 100644 index cc9160d..0000000 --- a/node_modules/resourceful/node_modules/revalidator/README.md +++ /dev/null @@ -1,68 +0,0 @@ -# revalidator - -A cross-browser / node.js validator used by resourceful and flatiron. - -## Example -The core of `revalidator` is simple and succinct: `revalidator.validate(obj, schema)`: - -``` js - var revalidator = require('revalidator'); - - console.dir(revalidator.validate(someObject, { - properties: { - url: { - description: 'the url the object should be stored at', - type: 'string', - pattern: '^/[^#%&*{}\\:<>?\/+]+$', - required: true - }, - challenge: { - description: 'a means of protecting data (insufficient for production, used as example)', - type: 'string', - minLength: 5 - }, - body: { - description: 'what to store at the url', - type: 'any', - default: null - } - } - }); -``` - -This will return with a value indicating if the `obj` conforms to the `schema`. If it does not, a descriptive object will be returned containing the errors encountered with validation. - -``` js - { - valid: true // or false - errors: [/* Array of errors if valid is false */] - } -``` - -In the browser, the validation function is exposed on `window.validate` by simply including `revalidator.js`. - -## Installation - -### Installing npm (node package manager) -``` bash - $ curl http://npmjs.org/install.sh | sh -``` - -### Installing revalidator -``` bash - $ [sudo] npm install revalidator -``` - -## Tests -All tests are written with [vows][0] and should be run with [npm][1]: - -``` bash - $ npm test -``` - -#### Author: [Charlie Robbins](http://nodejitsu.com), [Alexis Sellier](http://cloudhead.io) -#### Contributors: [Fedor Indutny](http://github.com/indutny), [Bradley Meck](http://github.com/bmeck), [Laurie Harper](http://laurie.holoweb.net/) -#### License: Apache 2.0 - -[0]: http://vowsjs.org -[1]: http://npmjs.org \ No newline at end of file diff --git a/node_modules/resourceful/node_modules/revalidator/example/webservice.js b/node_modules/resourceful/node_modules/revalidator/example/webservice.js deleted file mode 100644 index 7c534ed..0000000 --- a/node_modules/resourceful/node_modules/revalidator/example/webservice.js +++ /dev/null @@ -1,204 +0,0 @@ -// -// (C) 2011, Nodejitsu Inc. -// MIT License -// -// A simple web service for storing JSON data via REST -// -// GET - View Object -// POST - Create Object -// PUT - Update Object -// DELETE - Delete Object -// - -var revalidator = require('../'), - http = require('http'), -// -// Keep our objects in a simple memory store -// - memoryStore = {}, -// -// Set up our request schema -// - schema = { - properties: { - url: { - description: 'the url the object should be stored at', - type: 'string', - pattern: '^/[^#%&*{}\\:<>?\/+]+$', - required: true - }, - challenge: { - description: 'a means of protecting data (insufficient for production, used as example)', - type: 'string', - minLength: 5 - }, - body: { - description: 'what to store at the url', - type: 'any', - default: null - } - } - } - -var server = http.createServer(function validateRestRequest (req, res) { - req.method = req.method.toUpperCase(); - - // - // Log the requests - // - console.log(req.method, req.url); - - // - // Buffer the request so it can be parsed as JSON - // - var requestBody = []; - req.on('data', function addDataToBody (data) { - requestBody.push(data); - }); - - // - // Once the request has ended work with the body - // - req.on('end', function dealWithRest () { - - // - // Parse the JSON - // - requestBody = requestBody.join(''); - if ({POST: 1, PUT: 1}[req.method]) { - try { - requestBody = JSON.parse(requestBody); - } - catch (e) { - res.writeHead(400); - res.end(e); - return; - } - } - else { - requestBody = {}; - } - - // - // If this was sent to a url but the body url was not declared - // Make sure the body get the requested url so that our schema - // validates before we work on it - // - if (!requestBody.url) { - requestBody.url = req.url; - } - - // - // Don't let users override the main API endpoint - // - if (requestBody.url === '/') { - res.writeHead(400); - res.end('Cannot override the API endpoint "/"'); - return; - } - - // - // See if our request and target are out of sync - // This lets us double check the url we are about to take up - // if we choose to send the request to the url directly - // - if (req.url !== '/' && requestBody.url !== req.url) { - res.writeHead(400); - res.end('Requested url and actual url do not match'); - return; - } - - // - // Validate the schema - // - var validation = revalidator.validate(requestBody, schema); - if (!validation.valid) { - res.writeHead(400); - res.end(validation.errors.join('\n')); - return; - } - - // - // Grab the current value from storage and - // check if it is a valid state for REST - // - var storedValue = memoryStore[requestBody.url]; - if (req.method === 'POST') { - if (storedValue) { - res.writeHead(400); - res.end('ALREADY EXISTS'); - return; - } - } - else if (!storedValue) { - res.writeHead(404); - res.end('DOES NOT EXIST'); - return; - } - - // - // Check our challenge - // - if (storedValue && requestBody.challenge != storedValue.challenge) { - res.writeHead(403); - res.end('NOT AUTHORIZED'); - return; - } - - // - // Since revalidator only checks and does not manipulate - // our object we need to set up the defaults our selves - // For an easier solution to this please look at Flatiron's - // `Resourceful` project - // - if (requestBody.body === undefined) { - requestBody.body = schema.properties.body.default; - } - - // - // Use REST to determine how to manipulate the stored - // values - // - switch (req.method) { - - case "GET": - res.writeHead(200); - var result = storedValue.body; - res.end(JSON.stringify(result)); - return; - - case "POST": - res.writeHead(201); - res.end(); - memoryStore[requestBody.url] = requestBody; - return; - - case "DELETE": - delete memoryStore[requestBody.url]; - res.writeHead(200); - res.end(); - return; - - case "PUT": - memoryStore[requestBody.url] = requestBody; - res.writeHead(200); - res.end(); - return; - - default: - res.writeHead(400); - res.end('Invalid Http Verb'); - return; - } - }); -}) -// -// Listen to various ports depending on environment we are being run on -// -server.listen(process.env.PORT || process.env.C9_PORT || 1337, function reportListening () { - - console.log('JSON REST Service listening on port', this.address().port); - console.log('Requests can be sent via REST to "/" if they conform to the following schema:'); - console.log(JSON.stringify(schema, null, ' ')); - -}); \ No newline at end of file diff --git a/node_modules/resourceful/node_modules/revalidator/lib/revalidator.js b/node_modules/resourceful/node_modules/revalidator/lib/revalidator.js deleted file mode 100644 index cefff02..0000000 --- a/node_modules/resourceful/node_modules/revalidator/lib/revalidator.js +++ /dev/null @@ -1,350 +0,0 @@ -(function (exports) { - exports.validate = validate; - exports.mixin = mixin; - - // - // ### function validate (object, schema, options) - // #### {Object} object the object to validate. - // #### {Object} schema (optional) the JSON Schema to validate against. - // #### {Object} options (optional) options controlling the validation - // process. See {@link #validate.defaults) for details. - // Validate object against a JSON Schema. - // If object is self-describing (i.e. has a - // $schema property), it will also be validated - // against the referenced schema. [TODO]: This behaviour bay be - // suppressed by setting the {@link #validate.options.???} - // option to ???.[/TODO] - // - // If schema is not specified, and object - // is not self-describing, validation always passes. - // - // Note: in order to pass options but no schema, - // schema must be specified in the call to - // validate(); otherwise, options will - // be interpreted as the schema. schema may be passed - // as null, undefinded, or the empty object - // ({}) in this case. - // - function validate(object, schema, options) { - options = mixin({}, options, validate.defaults); - var errors = []; - - validateObject(object, schema, options, errors); - - // - // TODO: self-described validation - // if (! options.selfDescribing) { ... } - // - - return { - valid: !(errors.length), - errors: errors - }; - }; - - /** - * Default validation options. Defaults can be overridden by - * passing an 'options' hash to {@link #validate}. They can - * also be set globally be changing the values in - * validate.defaults directly. - */ - validate.defaults = { - /** - *

        - * Enforce 'format' constraints. - *

        - * Default: true - *

        - */ - validateFormats: true, - /** - *

        - * When {@link #validateFormats} is true, - * treat unrecognized formats as validation errors. - *

        - * Default: false - *

        - * - * @see validation.formats for default supported formats. - */ - validateFormatsStrict: false, - /** - *

        - * When {@link #validateFormats} is true, - * also validate formats defined in {@link #validate.formatExtensions}. - *

        - * Default: true - *

        - */ - validateFormatExtensions: true - }; - - /** - * Default messages to include with validation errors. - */ - validate.messages = { - required: "", - pattern: "", - maximum: "", - minimum: "", - maxLength: "", - minLength: "", - dependencies: "", - unique: "" - }; - - /** - * - */ - validate.formats = { - 'email': /^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i, - 'ip-address': /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/i, - 'ipv6': /^([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4}$/, - 'date-time': /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/, - 'date': /^\d{4}-\d{2}-\d{2}$/, - 'time': /^\d{2}:\d{2}:\d{2}$/, - 'color': /^#[a-z0-9]{6}|#[a-z0-9]{3}|(?:rgb\(\s*(?:[+-]?\d+%?)\s*,\s*(?:[+-]?\d+%?)\s*,\s*(?:[+-]?\d+%?)\s*\))aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|and yellow$/i, - //'style': (not supported) - //'phone': (not supported) - //'uri': (not supported) - //'host-name': (not supported) - 'utc-millisec': { - test: function (value) { - return typeof(value) === 'number' && value >= 0; - } - }, - 'regex': { - test: function (value) { - try { new RegExp(value) } - catch (e) { return false } - - return true; - } - } - }; - - /** - * - */ - validate.formatExtensions = { - 'url': /^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i - }; - - function mixin(obj) { - var sources = Array.prototype.slice.call(arguments, 1); - while (sources.length) { - var source = sources.shift(); - if (!source) { continue } - - if (typeof(source) !== 'object') { - throw new TypeError('mixin non-object'); - } - - for (var p in source) { - if (source.hasOwnProperty(p)) { - obj[p] = source[p]; - } - } - } - - return obj; - }; - - function validateObject(object, schema, options, errors) { - var props; - - // see 5.2 - if (schema.properties) { - props = schema.properties; - for (var p in props) { - if (props.hasOwnProperty(p)) { - validateProperty(object, object[p], p, props[p], options, errors); - } - } - } - - // see 5.3 - if (schema.patternProperties) { - props = schema.patternProperties; - for (var p in props) { - if (props.hasOwnProperty(p)) { - var re = new RegExp(p); - - // Find all object properties that are matching `re` - for (var k in object) { - if (object.hasOwnProperty(k) && re.exec(k) !== null) { - validateProperty(object, object[k], p, props[p], options, errors); - } - } - } - } - } - - }; - - function validateProperty(object, value, property, schema, options, errors) { - var format, - valid, - spec, - type; - - function constrain(name, value, assert) { - if (schema[name] !== undefined && !assert(value, schema[name])) { - error(name, property, value, schema, errors); - } - } - - if (value === undefined) { - if (schema.required && schema.type !== 'any') { - return error('required', property, undefined, schema, errors); - } else { - return; - } - } - - if (schema.format && options.validateFormats) { - format = schema.format; - - if (options.formatExtensions) { spec = validate.formatExtensions[format] } - if (!spec) { - spec = validate.formats[format]; - if (options.validateFormatsStrict) { - return error('format', property, value, schema, errors); - } - - } - else { - if (!spec.test(value)) { - return error('format', property, value, schema, errors); - } - } - } - - if (schema.enum && schema.enum.indexOf(value) === -1) { - error('enum', property, value, schema, errors); - } - - // Dependencies (see 5.8) - if (typeof schema.dependencies === 'string' && - object[schema.dependencies] === undefined) { - error('dependencies', property, null, schema, errors); - } - - if (isArray(schema.dependencies)) { - for (var i = 0, l = schema.dependencies.length; i < l; i++) { - if (object[schema.dependencies[i]] === undefined) { - error('dependencies', property, null, schema, errors); - } - } - } - - if (typeof schema.dependencies === 'object') { - validateObject(object, schema.dependencies, options, errors); - } - - checkType(value, schema.type, function(err, type) { - if (err) return error('type', property, typeof value, schema, errors); - - switch (type || (isArray(value) ? 'array' : typeof value)) { - case 'string': - constrain('minLength', value.length, function (a, e) { return a >= e }); - constrain('maxLength', value.length, function (a, e) { return a <= e }); - constrain('pattern', value, function (a, e) { - e = typeof e === 'string' - ? e = new RegExp(e) - : e; - return e.test(a) - }); - break; - case 'number': - constrain('minimum', value, function (a, e) { return a >= e }); - constrain('maximum', value, function (a, e) { return a <= e }); - constrain('exclusiveMinimum', value, function (a, e) { return a > e }); - constrain('exclusiveMaximum', value, function (a, e) { return a < e }); - constrain('divisibleBy', value, function (a, e) { return a % e === 0 }); - break; - case 'array': - constrain('items', value, function (a, e) { - for (var i = 0, l = a.length; i < l; i++) { - validateProperty(object, a[i], property, e, options, errors); - } - return true; - }); - constrain('minItems', value, function (a, e) { return a.length >= e }); - constrain('maxItems', value, function (a, e) { return a.length <= e }); - constrain('uniqueItems', value, function (a) { - var h = {}; - - for (var i = 0, l = a.length; i < l; i++) { - var key = JSON.stringify(a[i]); - if (h[key]) return false; - h[key] = true; - } - - return true; - }); - break; - case 'object': - // Recursive validation - if (schema.properties || schema.patternProperties) { - validateObject(value, schema, options, errors); - } - break; - } - }); - }; - - function checkType(val, type, callback) { - var result = false, - types = isArray(type) ? type : [type]; - - // No type - no check - if (type === undefined) return callback(null, type); - - // Go through available types - // And fine first matching - for (var i = 0, l = types.length; i < l; i++) { - type = types[i]; - if (type === 'string' ? typeof val === 'string' : - type === 'array' ? isArray(val) : - type === 'object' ? val && typeof val === 'object' && - !isArray(val) : - type === 'number' ? typeof val === 'number' : - type === 'integer' ? typeof val === 'number' && ~~val === val : - type === 'null' ? val === null : - type === 'boolean'? typeof val === 'boolean' : - type === 'any' ? typeof val !== 'undefined' : false) { - return callback(null, type); - } - }; - - callback(true); - }; - - function error(attribute, property, actual, schema, errors) { - var message = validate.messages && validate.messages[property] || "no default message"; - errors.push({ - attribute: attribute, - property: property, - expected: schema[attribute], - actual: actual, - message: message - }); - }; - - function isArray(value) { - var s = typeof value; - if (s === 'object') { - if (value) { - if (typeof value.length === 'number' && - !(value.propertyIsEnumerable('length')) && - typeof value.splice === 'function') { - return true; - } - } - } - return false; - } - - -})(typeof(window) === 'undefined' ? module.exports : (window.json = window.json || {})); diff --git a/node_modules/resourceful/node_modules/revalidator/package.json b/node_modules/resourceful/node_modules/revalidator/package.json deleted file mode 100644 index b51641d..0000000 --- a/node_modules/resourceful/node_modules/revalidator/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "name": "revalidator", - "version": "0.1.0", - "description": "A cross-browser / node.js validator used by resourceful", - "author": { - "name": "Charlie Robbins", - "email": "charlie.robbins@gmail.com" - }, - "contributors": [ - { - "name": "Alexis Sellier", - "email": "alexis@cloudhead.io" - }, - { - "name": "Laurie Harper", - "email": "laurie@holoweb.net" - }, - { - "name": "Fedor Indutny", - "email": "fedor@indutny.net" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/flatiron/revalidator.git" - }, - "devDependencies": { - "vows": "0.5.x >=0.5.11" - }, - "main": "./lib/revalidator", - "scripts": { - "test": "vows test/*-test.js --spec" - }, - "engines": { - "node": ">= 0.4.0" - }, - "_id": "revalidator@0.1.0", - "dependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "revalidator@0.1.x" -} diff --git a/node_modules/resourceful/node_modules/revalidator/test/validator-test.js b/node_modules/resourceful/node_modules/revalidator/test/validator-test.js deleted file mode 100644 index 113ace4..0000000 --- a/node_modules/resourceful/node_modules/revalidator/test/validator-test.js +++ /dev/null @@ -1,284 +0,0 @@ -var path = require('path'), - sys = require('sys'), - assert = require('assert'), - events = require('events'), - http = require('http'), - fs = require('fs'), - vows = require('vows'), - revalidator = require('../lib/revalidator'); - -function clone(object) { - return Object.keys(object).reduce(function (obj, k) { - obj[k] = object[k]; - return obj; - }, {}); -}; - - -function assertInvalid(res) { - assert.isObject(res); - assert.strictEqual(res.valid, false); -} - -function assertValid(res) { - assert.isObject(res); - assert.strictEqual(res.valid, true); -} - -function assertHasError(attr, field) { - return function (res) { - assert.notEqual(res.errors.length, 0); - assert.ok(res.errors.some(function (e) { - return e.attribute === attr && (field ? e.property === field : true); - })); - }; -} - -function assertValidates(passingValue, failingValue, attributes) { - var schema = { - name: 'Resource', - properties: { field: {} } - }; - - var failing; - - if (!attributes) { - attributes = failingValue; - failing = false; - } else { - failing = true; - } - - var attr = Object.keys(attributes)[0]; - revalidator.mixin(schema.properties.field, attributes); - - var result = { - "when the object conforms": { - topic: function () { - return revalidator.validate({ field: passingValue }, schema); - }, - "return an object with `valid` set to true": assertValid - } - }; - - if (failing) { - result["when the object does not conform"] ={ - topic: function () { - return revalidator.validate({ field: failingValue }, schema); - }, - "return an object with `valid` set to false": assertInvalid, - "and an error concerning the attribute": assertHasError(Object.keys(attributes)[0], 'field') - }; - }; - - return result; -} - -vows.describe('revalidator', { - "Validating": { - "with :'string'": assertValidates ('hello', 42, { type: "string" }), - "with :'number'": assertValidates (42, 'hello', { type: "number" }), - "with :'integer'": assertValidates (42, 42.5, { type: "integer" }), - "with :'array'": assertValidates ([4, 2], 'hi', { type: "array" }), - "with :'object'": assertValidates ({}, [], { type: "object" }), - "with :'boolean'": assertValidates (false, 42, { type: "boolean" }), - "with :bool,num": assertValidates (false, 'hello', { type: ["boolean", "number"] }), - "with :bool,num": assertValidates (544, null, { type: ["boolean", "number"] }), - "with :'null'": assertValidates (null, false, { type: "null" }), - "with :'any'": assertValidates (9, { type: "any" }), - "with ": assertValidates ("kaboom", "42", { pattern: /^[a-z]+$/ }), - "with ": assertValidates ("boom", "kaboom", { maxLength: 4 }), - "with ": assertValidates ("kaboom", "boom", { minLength: 6 }), - "with ": assertValidates ( 512, 43, { minimum: 473 }), - "with ": assertValidates ( 512, 1949, { maximum: 678 }), - "with ": assertValidates ( 512, 1949, { maximum: 678 }), - "with ": assertValidates ( 10, 9, { divisibleBy: 5 }), - "with ": assertValidates ("orange", "cigar", { enum: ["orange", "apple", "pear"] }), - "with ": { - topic: { - properties: { - town: { dependencies: "country" }, - country: { } - } - }, - "when the object conforms": { - topic: function (schema) { - return revalidator.validate({ town: "luna", country: "moon" }, schema); - }, - "return an object with `valid` set to true": assertValid - }, - "when the object does not conform": { - topic: function (schema) { - return revalidator.validate({ town: "luna" }, schema); - }, - "return an object with `valid` set to false": assertInvalid, - "and an error concerning the attribute": assertHasError('dependencies') - } - }, - "with as array": { - topic: { - properties: { - town: { dependencies: ["country", "planet"] }, - country: { }, - planet: { } - } - }, - "when the object conforms": { - topic: function (schema) { - return revalidator.validate({ town: "luna", country: "moon", planet: "mars" }, schema); - }, - "return an object with `valid` set to true": assertValid - }, - "when the object does not conform": { - topic: function (schema) { - return revalidator.validate({ town: "luna", planet: "mars" }, schema); - }, - "return an object with `valid` set to false": assertInvalid, - "and an error concerning the attribute": assertHasError('dependencies') - } - }, - "with as schema": { - topic: { - properties: { - town: { - type: 'string', - dependencies: { - properties: { x: { type: "number" } } - } - }, - country: { } - } - }, - "when the object conforms": { - topic: function (schema) { - return revalidator.validate({ town: "luna", x: 1 }, schema); - }, - "return an object with `valid` set to true": assertValid, - }, - "when the object does not conform": { - topic: function (schema) { - return revalidator.validate({ town: "luna", x: 'no' }, schema); - }, - "return an object with `valid` set to false": assertInvalid - } - } - } -}).addBatch({ - "A schema": { - topic: { - name: 'Article', - properties: { - title: { - type: 'string', - maxLength: 140, - conditions: { - optional: function () { - return !this.published; - } - } - }, - date: { type: 'string', format: 'date' }, - body: { type: 'string' }, - tags: { - type: 'array', - uniqueItems: true, - minItems: 2, - items: { - type: 'string', - pattern: /[a-z ]+/ - } - }, - author: { type: 'string', pattern: /^[\w ]+$/i, required: true}, - published: { type: 'boolean', 'default': false }, - category: { type: 'string' } - }, - patternProperties: { - '^_': { - type: 'boolean', default: false - } - } - }, - "and an object": { - topic: { - title: 'Gimme some Gurus', - date: new(Date)().toUTCString(), - body: "And I will pwn your codex.", - tags: ['energy drinks', 'code'], - author: 'cloudhead', - published: true, - category: 'misc', - _flag: true - }, - "can be validated with `revalidator.validate`": { - "and if it conforms": { - topic: function (object, schema) { - return revalidator.validate(object, schema); - }, - "return an object with the `valid` property set to true": assertValid, - "return an object with the `errors` property as an empty array": function (res) { - assert.isArray(res.errors); - assert.isEmpty(res.errors); - } - }, - "and if it has a missing required property": { - topic: function (object, schema) { - object = clone(object); - delete object.author; - return revalidator.validate(object, schema); - }, - "return an object with `valid` set to false": assertInvalid, - "and an error concerning the 'required' attribute": assertHasError('required') - }, - "and if it has a missing non-required property": { - topic: function (object, schema) { - object = clone(object); - delete object.category; - return revalidator.validate(object, schema); - }, - "return an object with `valid` set to false": assertValid - }, - "and if it has a incorrect pattern property": { - topic: function (object, schema) { - object = clone(object); - object._additionalFlag = 'text'; - return revalidator.validate(object, schema); - }, - "return an object with `valid` set to false": assertInvalid - }, - "and if it has a incorrect unique array property": { - topic: function (object, schema) { - object = clone(object); - object.tags = ['a', 'a']; - return revalidator.validate(object, schema); - }, - "return an object with `valid` set to false": assertInvalid - }, - "and if it has a incorrect array property (wrong values)": { - topic: function (object, schema) { - object = clone(object); - object.tags = ['a', '____']; - return revalidator.validate(object, schema); - }, - "return an object with `valid` set to false": assertInvalid - }, - "and if it has a incorrect array property (< minItems)": { - topic: function (object, schema) { - object = clone(object); - object.tags = ['x']; - return revalidator.validate(object, schema); - }, - "return an object with `valid` set to false": assertInvalid - }, - "and if it didn't validate a pattern": { - topic: function (object, schema) { - object = clone(object); - object.author = 'email@address.com'; - return revalidator.validate(object, schema); - }, - "return an object with `valid` set to false": assertInvalid, - "and an error concerning the 'pattern' attribute": assertHasError('pattern') - }, - } - } - } -}).export(module); diff --git a/node_modules/resourceful/package.json b/node_modules/resourceful/package.json deleted file mode 100644 index 1d33e44..0000000 --- a/node_modules/resourceful/package.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "name": "resourceful", - "description": "A storage agnostic resource-oriented ODM for building prototypical models with validation and sanitization.", - "version": "0.1.10", - "url": "http://github.com/flatiron/resourceful", - "keywords": [ - "ODM", - "database", - "couchdb", - "model", - "resource" - ], - "author": { - "name": "Charlie Robbins", - "email": "charlie@nodejitsu.com" - }, - "contributors": [ - { - "name": "Alexis Sellier", - "email": "self@cloudhead.io" - }, - { - "name": "Fedor Indutny", - "email": "fedor@indutny.com" - }, - { - "name": "Robert Sköld", - "email": "robert@publicclass.se" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/flatiron/resourceful.git" - }, - "dependencies": { - "cradle": "0.6.x", - "revalidator": "0.1.x" - }, - "devDependencies": { - "vows": "~0.6.0" - }, - "main": "./lib/resourceful", - "engines": { - "node": ">= 0.6.0" - }, - "scripts": { - "browserify": "browserify lib/browser.js -o build/resourceful.js", - "test": "vows --spec -i" - }, - "_id": "resourceful@0.1.10", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "resourceful" -} diff --git a/node_modules/resourceful/resourceful.png b/node_modules/resourceful/resourceful.png deleted file mode 100644 index a0162ee..0000000 Binary files a/node_modules/resourceful/resourceful.png and /dev/null differ diff --git a/node_modules/resourceful/test/cache-test.js b/node_modules/resourceful/test/cache-test.js deleted file mode 100644 index 3eb29e9..0000000 --- a/node_modules/resourceful/test/cache-test.js +++ /dev/null @@ -1,49 +0,0 @@ -var assert = require('assert'), - vows = require('vows'), - resourceful = require('../lib/resourceful'); - -var Article = resourceful.define('Article', function () { - this.property('title'); - this.property('published', Boolean); -}).connect('memory://cache-test'); - -vows.describe('resourceful/resource/cache', { - "When creating an instance, and saving it": { - topic: function () { - this.article = new(Article)({ _id: '43', title: "The Last Article", published: true }); - this.article.save(this.callback); - }, - "and then loading it back up with `get()`": { - topic: function () { - Article.get('43', this.callback); - }, - "it should return the previous instance": function (res) { - assert.strictEqual(res._properties, this.article._properties); - } - }, - "and then loading it back up with `find()`": { - topic: function () { - Article.find({ title: "The Last Article" }, this.callback); - }, - "it should return the previous instance": function (res) { - assert.strictEqual(res[0]._properties, this.article._properties); - } - } - } -}).addBatch({ - "When creating an instance, and saving it": { - topic: function () { - this.article = new(Article)({ _id: '43', title: "The Last Article", published: true }); - this.article.save(this.callback); - }, - "and then clearing the cache and loading it back up with `get()`": { - topic: function () { - resourceful.caches.clear(); - Article.get('43', this.callback); - }, - "it should return a new instance": function (res) { - assert.notStrictEqual(res, this.article); - } - } - } -}).export(module); diff --git a/node_modules/resourceful/test/couchdb/couchdb-filter-test.js b/node_modules/resourceful/test/couchdb/couchdb-filter-test.js deleted file mode 100644 index 51ea4c3..0000000 --- a/node_modules/resourceful/test/couchdb/couchdb-filter-test.js +++ /dev/null @@ -1,131 +0,0 @@ -var assert = require('assert'), - events = require('events'), - cradle = require('cradle'), - vows = require('vows'), - resourceful = require('../../lib/resourceful'); - -var Article; - -resourceful.env = 'test'; - -vows.describe('resourceful/resource/view').addVows({ - "A database containing articles and other resources": { - topic: function () { - resourceful.use('couchdb', 'couchdb://127.0.0.1:5984/test'); - var promise = new(events.EventEmitter); - var db = new(cradle.Connection)().database('test'); - db.destroy(function () { - db.create(function () { - db.save([ - { resource: 'Article', title: 'The Great Gatsby', published: true, author: 'fitzgerald', tags: ['classic'] }, - { resource: 'Article', title: 'Finding vim', published: false, author: 'cloudhead', tags: ['hacking', 'vi'] }, - { resource: 'Article', title: 'On Writing', published: true, author: 'cloudhead', tags: ['writing'] }, - { resource: 'Article', title: 'vi Zen', published: false, author: 'cloudhead', tags: ['vi', 'zen'] }, - { resource: 'Article', title: 'Channeling force', published: true, author: 'yoda', tags: ['force', 'zen'] }, - { resource: 'Body', name: 'fitzgerald' } - ], function () { - promise.emit('success'); - }); - }); - }) - return promise; - }, - "is created": function () {} - } -}).addVows({ - "A Resource definition with filters": { - topic: function () { - Article = resourceful.define('Article', function () { - this.use('couchdb', 'couchdb://127.0.0.1:5984/test'); - this.property('author'); - this.property('title'); - this.property('published', Boolean); - - this.filter('all', {}); - this.filter('published', { published: true }); - this.filter('by', function (author) { return { author: author } }); - }) - - Article.register(); - return Article; - }, - "should respond to the filters": function (R) { - assert.isFunction(R.published); - assert.isFunction(R.all); - assert.isFunction(R.by); - }, - "can be used to query the database:": { - "": { - topic: function (Article) { - this.Article = Article; - Article.published(this.callback); - }, - "should return an array of all published Articles": function (e, res) { - var that = this; - assert.isArray(res); - assert.equal(res.length,3); - res.forEach(function (d) { - assert.isObject(d); - assert.instanceOf(d,that.Article); - assert.equal(d.constructor,that.Article); - assert.equal(d.resource,'Article'); - assert.ok(d.published); - }); - } - }, - "": { - topic: function (Article) { - Article.all(this.callback); - }, - "should return an array of all Article records": function (e, res) { - assert.isArray(res); - assert.equal(res.length,5); - } - }, - " 'cloudhead'": { - topic: function (Article) { - Article.by('cloudhead', this.callback); - }, - "should return an array of Article records by 'cloudhead'": function (e, res) { - assert.isArray(res); - assert.equal(res.length,3); - res.forEach(function (d) { - assert.isObject(d); - assert.equal(d.resource,'Article'); - assert.equal(d.author,'cloudhead'); - }); - } - }, - " 'yoda'": { - topic: function (Article) { - Article.by('yoda', this.callback); - }, - "should return an array of Article records by 'yoda'": function (e, res) { - assert.isArray(res); - assert.equal(res.length,1); - assert.equal(res[0].author,'yoda'); - } - } - } - } -}).addBatch({ - "A second Resource definition with filters": { - topic: function () { - return resourceful.define('Person', function () { - this.use('couchdb', 'couchdb://127.0.0.1:5984/test'); - this.property('name'); - this.property('position'); - this.property('age', Number); - - this.filter('all', {}); - this.filter('at', function (position) { return { position: position } }); - this.filter('age', function (age) { return { age: age } }); - }).register(); - }, - "should have no side effects on the first resource views": function () { - var views = Object.keys(Article.views); - assert.isTrue(views.indexOf('at')===-1); - assert.isTrue(views.indexOf('age')===-1); - } - } -}).export(module); diff --git a/node_modules/resourceful/test/couchdb/couchdb-relationship-test.js b/node_modules/resourceful/test/couchdb/couchdb-relationship-test.js deleted file mode 100644 index 084dcc6..0000000 --- a/node_modules/resourceful/test/couchdb/couchdb-relationship-test.js +++ /dev/null @@ -1,106 +0,0 @@ -var assert = require('assert'), - cradle = require('cradle'), - vows = require('vows'), - resourceful = require('../../lib/resourceful'); - -var numberOfArticles = 5; - -resourceful.env = 'test'; - -vows.describe('resourceful/resource/relationship').addBatch({ - "One-To-Many:": { - "An empty database": { - topic: function () { - resourceful.use('couchdb', 'couchdb://127.0.0.1:5984/test'); - var db = new(cradle.Connection)().database('test'), callback = this.callback; - db.destroy(function () { - db.create(function () { - callback(); - }); - }) - }, - "and a Resource definition for Author and Article": { - topic: function () { - var Article = this.Article = resourceful.define('article', function () {}); - this.Author = resourceful.define('author', function () { this.child('article') }); - this.Article.parent('author'); - - var callback = this.callback, - pending = numberOfArticles, - done = function(){--pending || callback()}; - - this.Author.create({_id:'yoda'},function(err,author){ - author.createArticle({ _id: 'a-1', title: 'Channeling force', tags: ['force', 'zen'] },done) - }); - Article.create({ _id: 'a-2', title: 'The Great Gatsby', author: 'fitzgerald', tags: ['classic'] },done); - Article.create({ _id: 'a-3', title: 'Finding vim', author: 'cloudhead', tags: ['hacking', 'vi'] },done); - Article.create({ _id: 'a-4', title: 'On Writing', author: 'cloudhead', tags: ['writing'] },done); - Article.create({ _id: 'a-5', title: 'vi Zen', author: 'cloudhead', tags: ['vi', 'zen'] },done); - }, - "Author should have a method": function () { - assert.isFunction(this.Author.articles); -// }, -// "Author should have a method": { -// topic: function () { -// this.Author.articles('yoda', this.callback); -// }, -// "which will return all author's articles": function (articles) { -// assert.equal(articles.length, 1); -// assert.instanceOf(articles[0], this.Article); -// } - }, - "Author should have a property which is empty": function () { - assert.isArray(this.Author.parents); - assert.isEmpty(this.Author.parents); - }, - "Author should have a property": function (Author, Article) { - assert.isArray(this.Author.children); - assert.include(this.Author.children,this.Article); - }, - "Article should have a property which includes Author": function (Author, Article) { - assert.isArray(this.Article.parents); - assert.include(this.Article.parents,this.Author); - }, - "Article should have a property which is empty": function (Author, Article) { - assert.isArray(this.Article.children); - assert.isEmpty(this.Article.children); - }, - "Article should have a filter": function (Author, Article) { - assert.isFunction(this.Article.byAuthor); - assert.isObject(this.Article.views.byAuthor); - }, - "when instantiated": { - topic: function () { - this.author = new(this.Author); - this.article = new(this.Article); - return null; - }, - "author should have a method": function () { - assert.isFunction(this.author.articles); - }, - "author should have a property": function (_, Author, Article) { - assert.isArray(this.author.article_ids); - }, - "article should have a property": function (Author, Article) { - assert.include(this.article,'author_id'); - assert.isNull(this.article.author_id); - }, - "article should have a method": function (Author, Article) { - assert.isFunction(this.article.author); - } -// }, -// "Article should have a method":{ -// topic: function () { -// this.Article.byAuthor('yoda',this.callback); -// }, -// "which will return all articles by that author": function (articles) { -// assert.isArray(articles); -// assert.equal(articles.length, 1); -// assert.equal(articles[0].author_id,'yoda'); -// assert.equal(articles[0].id,'a-1'); -// } - } - } - } - } -}).export(module); diff --git a/node_modules/resourceful/test/engines-test.js b/node_modules/resourceful/test/engines-test.js deleted file mode 100644 index 418372e..0000000 --- a/node_modules/resourceful/test/engines-test.js +++ /dev/null @@ -1,542 +0,0 @@ -var path = require('path') - , assert = require('assert') - , fs = require('fs') - , vows = require('vows') - , resourceful = require('../lib/resourceful'); - -var engines = fs.readdirSync(path.join(__dirname, 'engines')).map(function (e) { return require('./engines/' + e.slice(0,-3)); }); - -var resources = {}; - -engines.forEach(function (e) { - resources[e] = {}; - vows.describe('resourceful/engines/' + e.name) - .addBatch({ - 'In database "test"': { - topic: function () { - e.load(resourceful, [ - { _id: 'bob', age: 35, hair: 'black', resource: 'Author'}, - { _id: 'tim', age: 16, hair: 'brown', resource: 'Author'}, - { _id: 'mat', age: 29, hair: 'black', resource: 'Author'}, - { _id: 'bob/1', title: 'Nodejs sucks!', year: 2003, fiction: true, resource: 'Book'}, - { _id: 'tim/1', title: 'Nodejitsu rocks!', year: 2008, fiction: false, resource: 'Book'}, - { _id: 'bob/2', title: 'Loling at you', year: 2011, fiction: true, resource: 'Book'}, - { _id: 'dummy/1', hair: 'black', resource: 'Dummy'}, - { _id: 'dummy/2', hair: 'blue', resource: 'Dummy'} - ], this.callback); - }, - 'Defining resource "book"': { - topic: function () { - return resources[e].Book = resourceful.define('book', function () { - this.use(e.name, e.options); - - this.string('title'); - this.number('year'); - this.bool('fiction'); - }); - }, - 'will be successful': function (book) { - assert.equal(Object.keys(book.properties).length, 4); - } - }, - 'Defining resource "author"': { - topic: function () { - return resources[e].Author = resourceful.define('author', function () { - this.use(e.name, e.options); - - this.number('age'); - this.string('hair').sanitize('lower'); - }); - }, - 'will be successful': function (author) { - assert.equal(Object.keys(author.properties).length, 3); - } - } - } - }).addBatch({ - 'In database "test"': { - topic: function () { - return null; - }, - "an Resource.all() request": { - topic: function () { - resources[e].Author.all(this.callback); - }, - "should respond with an array of all records": function (err, obj) { - assert.isNull(err); - assert.isArray(obj); - assert.equal(obj.length, 3); - } - } - } - }).addBatch({ - 'In database "test"': { - topic: function () { - return null; - }, - "a Resource.get() request": { - "when successful": { - topic: function () { - resources[e].Author.get("bob", this.callback); - }, - "should respond with a Resource instance": function (err, obj) { - assert.isNull(err); - assert.isObject(obj); - assert.instanceOf(obj, resourceful.Resource); - assert.equal(obj.constructor, resources[e].Author); - }, - "should respond with the right object": function (err, obj) { - assert.isNull(err); - assert.equal(obj._id, 'bob'); - assert.equal(obj.age, 35); - assert.equal(obj.hair, 'black'); - assert.equal(obj.resource, 'Author'); - }, - "should not be a new record": function (err, obj) { - assert.isNull(err); - assert.isFalse(obj.isNewRecord); - } - }, - "when unsuccessful": { - topic: function () { - resources[e].Author.get("david", this.callback); - }, - "should respond with an error": function (err, obj) { - assert.equal(err.status, 404); - assert.isUndefined(obj); - } - } - } - } - }).addBatch({ - 'In database "test"': { - topic: function () { - return null; - }, - "a Resource.create() request": { - topic: function () { - resources[e].Author.create({ _id: 'han', age: 30, hair: 'red'}, this.callback); - }, - "should return the newly created object": function (err, obj) { - assert.isNull(err); - assert.strictEqual(obj.constructor, resources[e].Author); - assert.instanceOf(obj, resources[e].Author); - assert.equal(obj._id, 'han'); - assert.equal(obj.age, 30); - assert.equal(obj.hair, 'red'); - assert.equal(obj.resource, 'Author'); - }, - "should not be a new record": function (err, obj) { - assert.isNull(err); - assert.isFalse(obj.isNewRecord); - }, - "should create the record in the db": { - topic: function () { - resources[e].Author.get('han', this.callback); - }, - "should respond with a Resource instance": function (err, obj) { - assert.isNull(err); - assert.isObject(obj); - assert.instanceOf(obj, resourceful.Resource); - assert.equal(obj.constructor, resources[e].Author); - }, - "should respond with the right object": function (err, obj) { - assert.isNull(err); - assert.equal(obj._id, 'han'); - assert.equal(obj.age, 30); - assert.equal(obj.hair, 'red'); - assert.equal(obj.resource, 'Author'); - }, - "should not be a new record": function (err, obj) { - assert.isNull(err); - assert.isFalse(obj.isNewRecord); - } - } - } - } - }).addBatch({ - "Instantiating a new instance": { - topic: function () { - return resources[e].Author.new({_id: 'kim', age: 32, hair: 'gold'}); - }, - "should be a new record": function (obj) { - assert.isTrue(obj.isNewRecord); - }, - "should not be in the db": { - topic: function () { - resources[e].Author.get('kim', this.callback); - }, - "should respond with an error": function (err, obj) { - assert.equal(err.status, 404); - assert.isUndefined(obj); - } - } - } - }).addBatch({ - 'In database "test"': { - topic: function () { - return null; - }, - "and a Resource.destroy() request": { - topic: function () { - resources[e].Author.destroy('han', this.callback); - }, - "should be successful": function (err, obj) { - assert.isNull(err); - } - } - } - }).addBatch({ - 'In database "test"': { - topic: function () { - return null; - }, - "a Resource.find() request": { - "when successful": { - topic: function () { - resources[e].Author.find({ hair: "black" }, this.callback); - }, - "should respond with an array of length 2": function (err, obj) { - assert.isNull(err); - assert.equal(obj.length, 2); - }, - "should respond with an array of Resource instances": function (err, obj) { - assert.isNull(err); - assert.isArray(obj); - assert.instanceOf(obj[0], resourceful.Resource); - assert.instanceOf(obj[1], resourceful.Resource); - assert.equal(obj[0]._id, 'bob'); - assert.equal(obj[0].age, 35); - assert.equal(obj[0].hair, 'black'); - assert.equal(obj[0].resource, 'Author'); - }, - "should not be a new record": function (err, obj) { - assert.isNull(err); - assert.isFalse(obj[0].isNewRecord); - assert.isFalse(obj[1].isNewRecord); - } - }, - "when unsuccessful": { - topic: function () { - resources[e].Author.find({ hair: "blue" }, this.callback); - }, - "should respond with an empty array": function (err, obj) { - assert.isNull(err); - assert.isArray(obj); - assert.equal(obj.length, 0); - } - } - } - } - }).addBatch({ - 'In database "test"': { - topic: function () { - resources[e].Author.get('bob', this.callback); - }, - "it should have 'bob' object": function (err, obj) { - assert.isNull(err); - assert.equal(obj._id, 'bob'); - assert.equal(obj.age, 35); - assert.equal(obj.hair, 'black'); - assert.equal(obj.resource, 'Author'); - }, - "should not be a new record": function (err, obj) { - assert.isNull(err); - assert.isFalse(obj.isNewRecord); - }, - "a Resource.update() request when successful": { - topic: function () { - resources[e].Author.update('bob', { age: 31 }, this.callback); - }, - "should respond with a Resource instance": function (err, obj) { - assert.isNull(err); - assert.isObject(obj); - assert.instanceOf(obj, resourceful.Resource); - assert.equal(obj.constructor, resources[e].Author); - }, - "should respond with the right object": function (err, obj) { - assert.isNull(err); - assert.equal(obj._id, 'bob'); - assert.equal(obj.age, 31); - assert.equal(obj.hair, 'black'); - assert.equal(obj.resource, 'Author'); - }, - "should not be a new record": function (err, obj) { - assert.isNull(err); - assert.isFalse(obj.isNewRecord); - }, - "should update the object in db": { - topic: function () { - resources[e].Author.get('bob', this.callback); - }, - "should respond with a Resource instance": function (err, obj) { - assert.isNull(err); - assert.isObject(obj); - assert.instanceOf(obj, resourceful.Resource); - assert.equal(obj.constructor, resources[e].Author); - }, - "should respond with the right object": function (err, obj) { - assert.isNull(err); - assert.equal(obj._id, 'bob'); - assert.equal(obj.age, 31); - assert.equal(obj.hair, 'black'); - assert.equal(obj.resource, 'Author'); - }, - "should not be a new record": function (err, obj) { - assert.isNull(err); - assert.isFalse(obj.isNewRecord); - } - } - } - } - }).addBatch({ - 'In database "test"': { - topic: function () { - resources[e].Author.get('bob', this.callback); - }, - "it should have 'bob' object": function (err, obj) { - assert.isNull(err); - assert.equal(obj._id, 'bob'); - assert.equal(obj.age, 31); - assert.equal(obj.hair, 'black'); - assert.equal(obj.resource, 'Author'); - }, - "should not be a new record": function (err, obj) { - assert.isNull(err); - assert.isFalse(obj.isNewRecord); - }, - "a Resource.save() request when successful": { - topic: function (obj) { - obj.age = 35; - resources[e].Author.save(obj, this.callback); - }, - "should respond with a Resource instance": function (err, obj) { - assert.isNull(err); - assert.isObject(obj); - assert.instanceOf(obj, resourceful.Resource); - assert.equal(obj.constructor, resources[e].Author); - }, - "should respond with the right object": function (err, obj) { - assert.isNull(err); - assert.equal(obj._id, 'bob'); - assert.equal(obj.age, 35); - assert.equal(obj.hair, 'black'); - assert.equal(obj.resource, 'Author'); - }, - "should not be a new record": function (err, obj) { - assert.isNull(err); - assert.isFalse(obj.isNewRecord); - }, - "should update the object in db": { - topic: function () { - resources[e].Author.get('bob', this.callback); - }, - "should respond with a Resource instance": function (err, obj) { - assert.isNull(err); - assert.isObject(obj); - assert.instanceOf(obj, resourceful.Resource); - assert.equal(obj.constructor, resources[e].Author); - }, - "should respond with the right object": function (err, obj) { - assert.isNull(err); - assert.equal(obj._id, 'bob'); - assert.equal(obj.age, 35); - assert.equal(obj.hair, 'black'); - assert.equal(obj.resource, 'Author'); - }, - "should not be a new record": function (err, obj) { - assert.isNull(err); - assert.isFalse(obj.isNewRecord); - } - } - } - } - }).addBatch({ - 'In database "test"': { - topic: function () { - resources[e].Author.get('bob', this.callback); - }, - "it should have 'bob' object": function (err, obj) { - assert.isNull(err); - assert.equal(obj._id, 'bob'); - assert.equal(obj.age, 35); - assert.equal(obj.hair, 'black'); - assert.equal(obj.resource, 'Author'); - }, - "should not be a new record": function (err, obj) { - assert.isNull(err); - assert.isFalse(obj.isNewRecord); - }, - "a Resource.prototype.save() request": { - topic: function (obj) { - obj.age = 31; - obj.hair = 'red'; - obj.save(this.callback); - }, - "should respond with a Resource instance": function (err, obj) { - assert.isNull(err); - assert.isObject(obj); - assert.instanceOf(obj, resourceful.Resource); - assert.equal(obj.constructor, resources[e].Author); - }, - "should respond with the right object": function (err, obj) { - assert.isNull(err); - assert.equal(obj._id, 'bob'); - assert.equal(obj.age, 31); - assert.equal(obj.hair, 'red'); - assert.equal(obj.resource, 'Author'); - }, - "should not be a new record": function (err, obj) { - assert.isNull(err); - assert.isFalse(obj.isNewRecord); - }, - "should save the object in db": { - topic: function () { - resources[e].Author.get('bob', this.callback); - }, - "should respond with a Resource instance": function (err, obj) { - assert.isNull(err); - assert.isObject(obj); - assert.instanceOf(obj, resourceful.Resource); - assert.equal(obj.constructor, resources[e].Author); - }, - "should respond with the right object": function (err, obj) { - assert.isNull(err); - assert.equal(obj._id, 'bob'); - assert.equal(obj.age, 31); - assert.equal(obj.hair, 'red'); - assert.equal(obj.resource, 'Author'); - }, - "should not be a new record": function (err, obj) { - assert.isNull(err); - assert.isFalse(obj.isNewRecord); - } - } - } - } - }).addBatch({ - 'In database "test"': { - topic: function () { - resources[e].Author.get('bob', this.callback); - }, - "it should have 'bob' object": function (err, obj) { - assert.isNull(err); - assert.equal(obj._id, 'bob'); - assert.equal(obj.age, 31); - assert.equal(obj.hair, 'red'); - assert.equal(obj.resource, 'Author'); - }, - "should not be a new record": function (err, obj) { - assert.isNull(err); - assert.isFalse(obj.isNewRecord); - }, - "a Resource.prototype.update() request": { - topic: function (obj) { - obj.update({ age: 35, hair: 'black' }, this.callback); - }, - "should respond with a Resource instance": function (err, obj) { - assert.isNull(err); - assert.isObject(obj); - assert.instanceOf(obj, resourceful.Resource); - assert.equal(obj.constructor, resources[e].Author); - }, - "should respond with the right object": function (err, obj) { - assert.isNull(err); - assert.equal(obj._id, 'bob'); - assert.equal(obj.age, 35); - assert.equal(obj.hair, 'black'); - assert.equal(obj.resource, 'Author'); - }, - "should not be a new record": function (err, obj) { - assert.isNull(err); - assert.isFalse(obj.isNewRecord); - }, - "should update the object in db": { - topic: function () { - resources[e].Author.get('bob', this.callback); - }, - "should respond with a Resource instance": function (err, obj) { - assert.isNull(err); - assert.isObject(obj); - assert.instanceOf(obj, resourceful.Resource); - assert.equal(obj.constructor, resources[e].Author); - }, - "should respond with the right object": function (err, obj) { - assert.isNull(err); - assert.equal(obj._id, 'bob'); - assert.equal(obj.age, 35); - assert.equal(obj.hair, 'black'); - assert.equal(obj.resource, 'Author'); - }, - "should not be a new record": function (err, obj) { - assert.isNull(err); - assert.isFalse(obj.isNewRecord); - } - } - } - } - }).addBatch({ - 'In database "test"': { - topic: function () { - resources[e].Author.create({ _id: 'han', age: 30, hair: 'red'}, this.callback); - }, - "a Resource.prototype.destroy() request": { - topic: function (obj) { - obj.destroy(this.callback); - }, - "should be successful": function (err, obj) { - assert.isNull(err); - }, - "should delete the object in db": { - topic: function (obj) { - resources[e].Author.get('han', this.callback); - }, - "should be missing": function (err, obj) { - assert.equal(err.status, 404); - } - } - } - } - }).addBatch({ - 'In database "test"': { - topic: function () { - resources[e].Author.get('bob', this.callback); - }, - "a Resource.prototype.reload() request": { - topic: function (obj) { - obj.reload(this.callback); - }, - "should respond with a Resource instance": function (err, obj) { - assert.isNull(err); - assert.isObject(obj); - assert.instanceOf(obj, resourceful.Resource); - assert.equal(obj.constructor, resources[e].Author); - }, - "should respond with the right object": function (err, obj) { - assert.isNull(err); - assert.equal(obj._id, 'bob'); - assert.equal(obj.age, 35); - assert.equal(obj.hair, 'black'); - assert.equal(obj.resource, 'Author'); - }, - "should not be a new record": function (err, obj) { - assert.isNull(err); - assert.isFalse(obj.isNewRecord); - } - } - } - }).addBatch({ - "Creating object without 'id'": { - topic: function () { - resources[e].Author.create({ age: 51, hair: 'white' }, this.callback); - }, - "should be successful": function (err, obj) { - assert.isNull(err); - assert.notEqual(obj._id, undefined); - assert.equal(obj.age, 51); - assert.equal(obj.hair, 'white'); - assert.equal(obj.resource, 'Author'); - } - } - }).export(module) -}); diff --git a/node_modules/resourceful/test/engines/couchdb.js b/node_modules/resourceful/test/engines/couchdb.js deleted file mode 100644 index 247445c..0000000 --- a/node_modules/resourceful/test/engines/couchdb.js +++ /dev/null @@ -1,17 +0,0 @@ -var cradle = require('cradle'); - -var engine = exports; - -engine.name = 'couchdb'; -engine.options = { database: 'test' }; - -engine.load = function (resourceful, data, callback) { - var db = new(cradle.Connection)(engine.options).database(engine.options.database); - db.destroy(function () { - db.create(function () { - db.save(data, function (e, res) { - callback(); - }); - }); - }); -}; diff --git a/node_modules/resourceful/test/engines/memory.js b/node_modules/resourceful/test/engines/memory.js deleted file mode 100644 index 8be6b43..0000000 --- a/node_modules/resourceful/test/engines/memory.js +++ /dev/null @@ -1,10 +0,0 @@ -var engine = exports; - -engine.name = 'memory'; -engine.options = { uri: 'test' }; - -engine.load = function (resourceful, data, callback) { - new(resourceful.engines.Memory)(engine.options).load(data); - callback(); -} -; diff --git a/node_modules/resourceful/test/events-test.js b/node_modules/resourceful/test/events-test.js deleted file mode 100644 index 07e38cd..0000000 --- a/node_modules/resourceful/test/events-test.js +++ /dev/null @@ -1,38 +0,0 @@ -var assert = require('assert'), - vows = require('vows'), - resourceful = require('../lib/resourceful'); - -vows.describe('resourceful/events').addBatch({ - "an Article": { - topic: function () { - return resourceful.define("article", function () { - this.property('title'); - }); - }, - "with a 'success' listener on `save`": { - topic: function (A) { - var that = this; - this.func = function (obj) { - that.obj = obj; - }; - A.on('save', this.func); - return A; - }, - "should add the bound method to factory's `listeners` array": function (A) { - assert.isArray(A.listeners('save')); - assert.equal(A.listeners('save')[0], this.func); - }, - "when calling save() on an instance of Article": { - topic: function (A) { - new(A)({ _id: '66', title: 'an Article' }).save(this.callback); - }, - "should trigger the bound function": function (e, res) { - assert.isNull(e); - assert.isObject(this.obj); - assert.equal(this.obj, res); - } - } - } - } -}).export(module); - diff --git a/node_modules/resourceful/test/hooks-test.js b/node_modules/resourceful/test/hooks-test.js deleted file mode 100644 index eb6c02d..0000000 --- a/node_modules/resourceful/test/hooks-test.js +++ /dev/null @@ -1,143 +0,0 @@ -var assert = require('assert'), - vows = require('vows'), - resourceful = require('../lib/resourceful'); - -vows.describe('resourceful/hooks').addBatch({ - "save-able Resource": { - topic: function () { - return resourceful.define('resource', function () { - this.property('title'); - }); - }, - "with 'before' hooks on `save`": { - topic: function (A) { - var that = this; - this.hooked_save = 0; - A.before('save', function (obj, next) { - that.hooked_save += 1; next(null); - }); - A.before('save', function (obj, next) { - that.hooked_save *= 2; next(null); - }); - return A; - }, - "when calling save() on an instance of Article": { - topic: function (A) { - new(A)({ _id: '128', counter: 0, title: 'foobar' }).save(this.callback); - }, - "should trigger both hooks in the right order": function (e, res) { - assert.isNull(e); - assert.equal(this.hooked_save, 2); - } - } - } - }, - "another save-able Resource": { - topic: function () { - return resourceful.define('resource2', function () { - this.property('title'); - }); - }, - "with 'after' hooks on `save`": { - topic: function (A) { - var that = this; - this.hooked = 0; - A.after('save', function (e, obj, next) { - that.hooked += 1; next(null); - // TODO: test other stuff - }); - A.after('save', function (e, obj, next) { - that.hooked *= 2; next(null); - }); - return A; - }, - "should just have the two 'after' hooks registered": function (A) { - assert.equal(A.hooks.after.save.length, 2); - assert.equal(A.hooks.before.save.length, 0); - }, - "when calling save() on an instance of Article": { - topic: function (A) { - new(A)({ _id: '65', counter: 0, title: 'hookbar' }).save(this.callback); - }, - "should trigger both hooks in the right order": function (e, res) { - assert.isNull(e); - assert.equal(this.hooked, 2); - } - } - } - }, - "create-able Resource": { - topic: function () { - return resourceful.define('resourceCreate', function () { - this.property('title'); - }); - }, - "with 'before' hooks on `create`": { - topic: function (A) { - var that = this; - this.hooked_create = 0; - A.before('create', function (obj, next) { - that.hooked_create += 1; next(null); - }); - A.before('create', function (obj, next) { - that.hooked_create *= 2; next(null); - }); - return A; - }, - "when calling create() on an instance of Article": { - topic: function (A) { - A.create({ _id: '69', counter: 0, title: 'foobar' }, this.callback); - }, - "should trigger both hooks in the right order": function (e, res) { - assert.isNull(e); - assert.equal(this.hooked_create, 2); - } - } - }, - }, - "another create-able Resource": { - topic: function () { - return resourceful.define('resourceAfterCreate', function () { - this.property('title'); - }); - }, - "with 'after' hooks on `create`": { - topic: function (A) { - var that = this; - this.hooked = 0; - A.after('save', function (e, obj, next) { - that.hooked += 1; next(null); - // TODO: test other stuff - }); - A.after('save', function (e, obj, next) { - that.hooked *= 2; next(null); - }); - this.hooked_create = 0; - A.after('create', function (e, obj, next) { - // after.create preceeds after.save - assert.equal(that.hooked, 0); - that.hooked_create += 1; next(null); - // TODO: test other stuff - }); - A.after('create', function (e, obj, next) { - that.hooked_create *= 2; next(null); - }); - return A; - }, - "should just have the two 'after' hooks registered": function (A) { - assert.equal(A.hooks.after.create.length, 2); - assert.equal(A.hooks.before.create.length, 0); - }, - "when calling create() on an instance of Article": { - topic: function (A) { - A.create({ _id: '67', counter: 0, title: 'hookbar' }, this.callback); - }, - "should trigger both hooks in the right order": function (e, res) { - assert.isNull(e); - assert.equal(this.hooked, 2); - assert.equal(this.hooked_create, 2); - } - } - } - } -}).export(module); diff --git a/node_modules/resourceful/test/relationship-test.js b/node_modules/resourceful/test/relationship-test.js deleted file mode 100644 index 446a89d..0000000 --- a/node_modules/resourceful/test/relationship-test.js +++ /dev/null @@ -1,220 +0,0 @@ -var vows = require('vows'), - assert = require('assert'); - -var resourceful = require('../lib/resourceful'); - -function authorAndArticles(name) { - return { - topic: function () { - this.Author.create({ - _id: 'author-' + name, - name: name - }, this.callback); - }, - 'should exist': function (err, author) { - assert.isNull(err); - }, - 'with': { - 'article #1': { - topic: function (author) { - author.createArticle({ - _id: author._id + '-article-1', - title: name + '\'s article #1' - }, this.callback); - }, - 'should exist': function () {} - }, - 'article #2': { - topic: function (author) { - author.createArticle({ - _id: author._id + '-article-2', - title: name + '\'s article #2' - }, this.callback); - }, - 'should exist': function () {} - } - } - }; -} - -function category(parentName, childName){ - return { - topic: function () { - this.Category.create({ - _id: 'category-' + parentName, - name: parentName - }, this.callback) - }, - 'should not fail': function (err, parent) { - assert.isNull(err); - assert.equal(parent.name, parentName) - }, - 'with parent Category': { - topic: function(parent){ - parent.createCategory({ - _id: 'category-' + childName, - name: childName - }, this.callback) - }, - 'should not fail': function(err, child){ - assert.isNull(err); - assert.equal(child.name, childName) - } - } - } -} - -function categoryParentTest(name) { - var parent_id = 'category-' + name; - return { - topic: function(){ - // FIXME category pluralized should be categories (maybe use https://github.com/MSNexploder/inflect?) - this.Category.categorys(parent_id, this.callback); - }, - 'should return the children': function(err, children){ - assert.isNull(err); - assert.ok(Array.isArray(children)); - assert.ok(children.every(function (category) { - return category.category_id === parent_id; - })); - }, - 'and .category() of the first child': { - topic: function(children){ - children[0].category(this.callback) - }, - 'should return the parent': function(err, parent){ - assert.isNull(err); - assert.equal(parent_id, parent.id); - } - } - } -} - -function categoryChildTest(name) { - var child_id = 'category-' + name; - - return { - topic: function(){ - this.Category.get(child_id, this.callback); - }, - 'should return the child': function(err, child){ - assert.isNull(err); - assert.equal(child.name, name); - }, - 'and child.category()': { - topic: function(child){ - child.category(this.callback) - }, - 'should return the parent': function(err, parent){ - assert.isNull(err); - assert.notEqual(parent.name, name); - } - } - } -} - -function authorTest(name) { - var author_id = 'author-' + name; - - return { - topic: function () { - this.Author.articles(author_id, this.callback); - }, - 'should return only his articles': function (err, articles) { - assert.isNull(err); - assert.ok(Array.isArray(articles)); - assert.ok(articles.every(function (article) { - return article.author_id === author_id; - })); - } - }; -} - -function articleTest(name) { - var author_id = 'author-' + name; - - return { - topic: function () { - this.Article.byAuthor(author_id, this.callback); - }, - 'should return only his articles': function (err, articles) { - assert.isNull(err); - assert.ok(Array.isArray(articles)); - assert.ok(articles.every(function (article) { - return article.author_id === author_id; - })); - }, - 'and .author() call for first article': { - topic: function (articles) { - if (!articles[0]) return {}; - articles[0].author(this.callback); - }, - 'should return himself': function (err, author) { - assert.isNull(err); - assert.instanceOf(author, this.Author); - assert.equal(author._id, author_id); - } - }, - 'and .author() call for second article': { - topic: function (articles) { - if (!articles[1]) return {}; - articles[1].author(this.callback); - }, - 'should return himself': function (err, author) { - assert.isNull(err); - assert.instanceOf(author, this.Author); - assert.equal(author._id, author_id); - } - } - }; -} - -vows.describe('resourceful/memory/relationship').addBatch({ - 'Initializing': { - 'A memory store': { - topic: function () { - resourceful.use('memory', 'memory://relationship-test'); - return null; - }, - 'with': { - 'author, category and article models': { - topic: function () { - this.Author = resourceful.define('author', function () { - this.property('name', String); - }); - this.Article = resourceful.define('article', function () { - this.property('title', String); - this.parent('Author'); - }); - this.Category = resourceful.define('category', function () { - this.property('name', String); - // FIXME Allow this.parent('category') by resourceful.register() earlier in resourceful.define() - }); - this.Category.parent('category'); - return null; - }, - 'with': { - 'Author #1': authorAndArticles('paul'), - 'Author #2': authorAndArticles('bob'), - 'Category #1 & #2': category('alice', 'bob') - } - } - } - } - } -}).addBatch({ - 'One-To-Many': { - topic: function () { - this.Author = resourceful.resources['Author']; - this.Article = resourceful.resources['Article']; - this.Category = resourceful.resources['Category']; - return null; - }, - 'paul.articles': authorTest('paul'), - 'bob.articles': authorTest('bob'), - 'Article.byAuthor(\'paul\')': articleTest('paul'), - 'Article.byAuthor(\'bob\')': articleTest('bob'), - 'Category.categories()': categoryParentTest('alice'), - 'Category.category()': categoryChildTest('bob') - } -}).export(module); diff --git a/node_modules/resourceful/test/resourceful-test.js b/node_modules/resourceful/test/resourceful-test.js deleted file mode 100644 index f839779..0000000 --- a/node_modules/resourceful/test/resourceful-test.js +++ /dev/null @@ -1,492 +0,0 @@ -var assert = require('assert'), - vows = require('vows'), - resourceful = require('../lib/resourceful'); - -vows.describe('resourceful').addVows({ - "Resource()": { - topic: function () { - return resourceful.define(); - }, - "returns a Resource factory": { - "which is a function": function (Factory) { - assert.isFunction(Factory); - }, - "and has the create/get/all/find methods": function (Factory) { - assert.isFunction(Factory.create); - assert.isFunction(Factory.new); - assert.isFunction(Factory.destroy); - assert.isFunction(Factory.get); - assert.isFunction(Factory.all); - assert.isFunction(Factory.find); - assert.isFunction(Factory.save); - assert.isFunction(Factory.update); - }, - "which can be called": { - topic: function (Factory) { - return new(Factory)(); - }, - "to return Resource instances which have prototype methods": function (resource) { - assert.isFunction(resource.save); - assert.isFunction(resource.update); - assert.isFunction(resource.destroy); - assert.isFunction(resource.reload); - } - } - } - }, - "Resource('article') with a function": { - topic: function () { - return resourceful.define('article', function () { - this.data = 42; - }); - }, - "returns an Article factory": { - "with the resource name set": function (Article) { - assert.equal(Article.resource, 'Article'); - }, - "and access to the `data` attribute": function (Article) { - assert.equal(Article.data, 42); - }, - "which can be called": { - topic: function (Article) { - this.constructor = Article; - Article.prototype.data = 41; - return new(Article)(); - }, - "returning Article instances": function (article) { - assert.isObject(article); - assert.equal(article.constructor, this.constructor); - assert.equal(article.data, 41); - }, - "returning an object which inherits from Resource's prototype": function (article) { - assert.isFunction(article.save); - assert.isFunction(article.update); - assert.isFunction(article.destroy); - assert.isFunction(article.reload); - }, - "and doesn't have a value for `id` and `key`": function (article) { - assert.isUndefined(article.id); - assert.isUndefined(article.key); - } - } - } - } -}).addVows({ // API - "Default Resource instances": { - topic: function () { - return resourceful.define(); - }, - "have the `resource`, `define` and `property` methods": function (r) { - assert.isString(r.resource); - assert.isFunction(r.define); - assert.isFunction(r.property); - assert.isFunction(r.string); - assert.isFunction(r.bool); - assert.isFunction(r.array); - assert.isFunction(r.number); - assert.isFunction(r.object); - }, - "resource should be set to 'Resource'": function (r) { - assert.match(r.resource, /^Resource\d+/); - }, - "the `properties` accessor returns an object with only the '_id' property": function (r) { - assert.isObject(r.properties); - assert.equal(Object.keys(r.properties).length, 1); - assert.include(r.properties, '_id'); - }, - // Should it be a pointer to the 'id' property instead? - "the `key` accessor is set to '_id' by default": function (r) { - assert.equal(r.key, '_id'); - } - } -}).addVows({ // property - "A Resource with a couple of properties": { - topic: function () { - var r = resourceful.define('book'); - r.property('title').restricted(); - r.property('kind'); - return r; - }, - "adds them to `Resource.properties`": function (r) { - assert.equal(Object.keys(r.properties).length,3); - assert.include(r.properties, 'title'); - assert.include(r.properties, 'kind'); - }, - "When instantiated": { - topic: function (R) { - return new(R)({ title: 'The Great Gatsby' }); - }, - "should respond to toString()": function (r) { - assert.equal(r.toString(), '{"title":"The Great Gatsby","resource":"Book"}'); - }, - "should respond to toJSON()": function (r) { - assert.isObject(r.toJSON()); - }, - "should respond to restricted() with filtered properties": function (r) { - var restricted = r.restricted(); - assert.isObject(restricted); - - assert.ok(restricted.title); - assert.ok(!restricted.kind); - }, - "should return the attributes, when `Object.keys` is called": function (r) { - var keys = Object.keys(r); - assert.include(keys, '_id'); - assert.include(keys, 'title'); - assert.include(keys, 'kind'); - assert.include(keys, 'resource'); - assert.equal(keys.length, 4); - }, - "should set the unspecified values to `undefined`": function (r) { - assert.include(r, 'kind'); - assert.isUndefined(r.kind); - } - } - }, - "A Resource with duplicate properties": { - topic: function () { - var r = resourceful.define(); - r.property('dup'); - r.property('dup'); - return r; - }, - "only keeps the last copy": function (r) { - assert.equal(Object.keys(r.properties).length, 2); // 'dup' & 'id' - } - }, - "A Resource with sanitized _id": { - topic: function () { - var r = this.r = resourceful.define(); - r.use('memory', 'memory://testx'); - r.property('_id', 'string').sanitize('lower'); - - new r({ _id: 'AbC'}).save(this.callback); - }, - "should be saved": { - topic: function() { - this.r.get('aBc', this.callback); - }, - "and be found by non-sanitized_id": function (r) { - assert.equal(r.toString(), '{"_id":"abc","resource":"Resource3"}'); - } - } - }, - "The `property()` method": { - topic: function () { - this.Resource = resourceful.define(); - return this.Resource.property('kind'); - }, - "returns an object which implements": { - "requires": function (p) {}, - "type": function (p) { - p.type('integer'); - assert.equal(p.property.type, "integer"); - assert.throws(function () { p.type('unknwon'); }, TypeError); - }, - "required": function (p) { - p.required(true); - assert.equal(p.property.required, true); - assert.throws(function () { p.required(1); }, TypeError); - }, - "unique": function (p) { - p.unique(true); - assert.equal(p.property.unique, true); - assert.throws(function () { p.unique(1); }, TypeError); - }, - "title": function (p) { - p.title("the title"); - assert.equal(p.property.title, "the title"); - assert.throws(function () { p.title(false); }, TypeError); - }, - "description": function (p) { - p.description("the description"); - assert.equal(p.property.description, "the description"); - assert.throws(function () { p.title(false); }, TypeError); - }, - "format": function (p) { - p.format("email"); - assert.equal(p.property.format, "email"); - assert.throws(function () { p.format("unknown"); }, Error); - }, - "storageName": function (p) { - p.storageName("_kind"); - assert.equal(p.property.storageName, "_kind"); - assert.throws(function () { p.storageName(21); }, TypeError); - }, - "conform": function (p) { - p.conform(function (kind) { return kind !== "banana"; }); - assert.isFunction(p.property.conform); - assert.throws(function () { p.conform("banana"); }, TypeError); - }, - "lazy": function (p) { - p.lazy(true); - assert.equal(p.property.lazy, true); - assert.throws(function () { p.lazy(1); }, TypeError); - } - }, - "with a 'string' type": { - topic: function () { - this.Resource = resourceful.define(); - return this.Resource.property('kind', String); - }, - "returns an object which implements": { - "pattern": function (p) {}, - "minLength": function (p) {}, - "maxLength": function (p) {}, - "length": function (p) {}, - "sanitize('upper')": { - topic: function (p) { - p.sanitize('reset').sanitize('upper'); - return new this.Resource({kind: 'test'}); - }, - "and pass check": function (instance) { - assert.equal(instance.kind, 'TEST'); - } - }, - "sanitize('lower')": { - topic: function (p) { - p.sanitize('reset').sanitize('lower'); - return new this.Resource({kind: 'TEST'}); - }, - "and pass check": function (instance) { - assert.equal(instance.kind, 'test'); - } - }, - "sanitize('capitalize')": { - topic: function (p) { - p.sanitize('reset').sanitize('capitalize'); - return new this.Resource({kind: 'mexico'}); - }, - "and pass check": function (instance) { - assert.equal(instance.kind, 'Mexico'); - } - }, - "sanitize('pluralize')": { - topic: function (p) { - p.sanitize('reset').sanitize('pluralize'); - return new this.Resource({kind: 'test'}); - }, - "and pass check": function (instance) { - assert.equal(instance.kind, 'tests'); - } - }, - "sanitize('upper').sanitize('replace')": { - topic: function (p) { - p.sanitize('reset') - .sanitize('upper') - .sanitize('replace', /[^a-z]+/ig, '-'); - return new this.Resource({kind: 'hello world'}); - }, - "and pass check": function (instance) { - assert.equal(instance.kind, 'HELLO-WORLD'); - } - }, - "sanitize('replace')": { - topic: function (p) { - p.sanitize('reset').sanitize('replace', /[^a-z]+/g, '-'); - return new this.Resource({kind: 'hello world'}); - }, - "and pass check": function (instance) { - assert.equal(instance.kind, 'hello-world'); - } - } - } - }, - "with a 'number' type": { - topic: function () { - this.Resource = resourceful.define(); - return this.Resource.property('size', Number); - }, - "returns an object which implements": { - "minimum": function (p) {}, - "maximum": function (p) {}, - "within": function (p) {}, - "sanitize('round')": { - topic: function (p) { - p.sanitize('reset').sanitize('round'); - return new this.Resource({size: 10.5}); - }, - "and pass check": function (instance) { - assert.equal(instance.size, 11); - } - }, - "sanitize(function () {...})": { - topic: function (p) { - p.sanitize('reset').sanitize(function (x) { return x * x; }); - return new this.Resource({size: 3}); - }, - "and pass check": function (instance) { - assert.equal(instance.size, 9); - }, - "with changing property\'s value": { - topic: function(instance) { - instance.size = 30; - return instance.size; - }, - "and pass check": function (size) { - assert.equal(size, 900); - } - } - } - }, - "return an object which doesn't implement String 'definers'": function (p) { - assert.isUndefined(p.pattern); - assert.isUndefined(p.minLength); - } - } - } -}).addVows({ - "Defining a Resource schema": { - "with `property()`": { - topic: function () { - var r = resourceful.define(); - r.property('title', String, { maxLength: 16 }); - r.property('description', { maxLength: 32 }); - return r; - }, - "should add an entry to `properties`": function (r) { - assert.equal(r.properties.title.maxLength, 16); - assert.equal(r.properties.description.maxLength, 32); - }, - "should default to type:'string'": function (r) { - assert.equal(r.properties.title.type, "string"); - assert.equal(r.properties.description.type, "string"); - } - }, - "with `object()`": { - topic: function () { - var r = resourceful.define(); - r.object('title'); - return r; - }, - "should be type:'object'": function (r) { - assert.equal(r.properties.title.type, "object"); - } - }, - "with `string()`": { - topic: function () { - var r = resourceful.define(); - r.string('title', { maxLength: 16 }); - return r; - }, - "should add an entry to `properties`": function (r) { - assert.equal(r.properties.title.maxLength, 16); - }, - "should be type:'string'": function (r) { - assert.equal(r.properties.title.type, "string"); - } - }, - "with `number()`": { - topic: function () { - var r = resourceful.define(); - r.number('rank', { minimum: 1 }); - return r; - }, - "should add an entry to `properties`": function (r) { - assert.equal(r.properties.rank.minimum, 1); - }, - "should be type:'number'": function (r) { - assert.equal(r.properties.rank.type, "number"); - } - }, - "with `bool()`": { - topic: function () { - var r = resourceful.define(); - r.bool('active', {default: true}); - return r; - }, - "should add an entry to `properties`": function (r) { - assert.equal(r.properties.active.default, true); - }, - "should be type:'boolean'": function (r) { - assert.equal(r.properties.active.type, "boolean"); - } - }, - "with `array()`": { - topic: function () { - var r = resourceful.define(); - r.array('emails', {minimum: 1}); - return r; - }, - "should add an entry to `properties`": function (r) { - assert.equal(r.properties.emails.minimum, 1); - }, - "should be type:'array'": function (r) { - assert.equal(r.properties.emails.type, "array"); - } - }, - "with constructor's call": { - topic: function () { - var r = resourceful.define({ - properties: { - title: { - type: "string", - maxLength: 16 - }, - description: { - type: "string", - maxLength: 32 - } - } - }); - return r; - }, - "should add entries to `properties`": function (r) { - assert.equal(r.properties.title.maxLength, 16); - assert.equal(r.properties.description.maxLength, 32); - } - }, - "with `define()`": { - topic: function () { - var r = resourceful.define(); - r.define({ - properties: { - title: { - type: "string", - maxLength: 16 - }, - description: { - type: "string", - maxLength: 32 - } - } - }); - return r; - }, - "should add entries to `properties`": function (r) { - assert.equal(r.properties.title.maxLength, 16); - assert.equal(r.properties.description.maxLength, 32); - } - }, - "by chaining attribute setters": { - topic: function () { - var r = resourceful.define(); - r.property('title').type('string') - .maxLength(16) - .minLength(0); - return r; - }, - "should work just the same": function (r) { - assert.equal(r.properties.title.type, "string"); - assert.equal(r.properties.title.maxLength, 16); - assert.equal(r.properties.title.minLength, 0); - } - }, - "by chaining attribute setters with `string()`": { - topic: function () { - var r = resourceful.define(); - r.string('title') - .maxLength(16) - .minLength(0); - return r; - }, - "should work just the same": function (r) { - assert.equal(r.properties.title.type, "string"); - assert.equal(r.properties.title.maxLength, 16); - assert.equal(r.properties.title.minLength, 0); - } - } - } -}).export(module); - - diff --git a/node_modules/union/.npmignore b/node_modules/union/.npmignore deleted file mode 100644 index cb6fcfe..0000000 --- a/node_modules/union/.npmignore +++ /dev/null @@ -1,7 +0,0 @@ -node_modules -npm-debug.log -test/fixtures/*-test.txt -examples/*.txt -examples/simple/*.txt -.DS_Store - diff --git a/node_modules/union/.travis.yml b/node_modules/union/.travis.yml deleted file mode 100644 index c958222..0000000 --- a/node_modules/union/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 - - 0.7 - -notifications: - email: - - travis@nodejitsu.com - irc: "irc.freenode.org#nodejitsu" - diff --git a/node_modules/union/LICENSE b/node_modules/union/LICENSE deleted file mode 100644 index 1f01e2b..0000000 --- a/node_modules/union/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011 Nodejitsu Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/union/README.md b/node_modules/union/README.md deleted file mode 100644 index 6bd9354..0000000 --- a/node_modules/union/README.md +++ /dev/null @@ -1,321 +0,0 @@ - - - -# Synopsis -A hybrid streaming middleware kernel backwards compatible with connect. - -# Motivation -The advantage to streaming middlewares is that they do not require buffering the entire stream in order to execute their function. - -# Status - -[![Build Status](https://secure.travis-ci.org/flatiron/union.png)](http://travis-ci.org/flatiron/union) - -# Installation -There are a few ways to use `union`. Install the library using npm. You can add it to your `package.json` file as a dependancy - -```bash - $ [sudo] npm install union -``` - -## Usage -Union's request handling is [connect](https://github.com/senchalabs/connect)-compatible, meaning that all existing connect middlewares should work out-of-the-box with union. - -(Union 0.3.0 is compatible with connect > 2.0.3. [Extensively Tested](https://github.com/pksunkara/connect-union)) - -In addition, the response object passed to middlewares listens for a "next" event, which is equivalent to calling `next()`. Flatiron middlewares are written in this manner, meaning they are not reverse-compatible with connect. - -### A simple case - -``` js -var fs = require('fs'), - union = require('../lib'), - director = require('director'), - favicon = require('./middleware/favicon'); - -var router = new director.http.Router(); - -var server = union.createServer({ - before: [ - favicon('./favicon.png'), - function (req, res) { - var found = router.dispatch(req, res); - if (!found) { - res.emit('next'); - } - } - ] -}); - -router.get(/foo/, function () { - this.res.writeHead(200, { 'Content-Type': 'text/plain' }) - this.res.end('hello world\n'); -}); - -router.post(/foo/, { stream: true }, function () { - var req = this.req, - res = this.res, - writeStream; - - writeStream = fs.createWriteStream(Date.now() + '-foo.txt'); - req.pipe(writeStream); - - writeStream.on('close', function () { - res.writeHead(200, { 'Content-Type': 'text/plain' }); - res.end('wrote to a stream!'); - }); -}); - -server.listen(9090); -console.log('union with director running on 9090'); -``` - -To demonstrate the code, we use [director](https://github.com/flatiron/director). A light-weight, Client AND Server side URL-Router for Node.js and Single Page Apps! - -### A case with connect - -Code based on connect - -```js -var connect = require('connect') - , http = require('http'); - -var app = connect() - .use(connect.favicon()) - .use(connect.logger('dev')) - .use(connect.static('public')) - .use(connect.directory('public')) - .use(connect.cookieParser('my secret here')) - .use(connect.session()) - .use(function(req, res){ - res.end('Hello from Connect!\n'); - }); - -http.createServer(app).listen(3000); -``` - -Code based on union - -```js -var connect = require('connect') - , union = require('union'); - -var server = union.createServer({ - before: [ - connect.favicon(), - connect.logger('dev'), - connect.static('public'), - connect.directory('public'), - connect.cookieParser('my secret here'), - connect.session(), - function(req, res) { - res.end('Hello from Connect!\n'); - }, - ] -}).listen(3000); -``` - -# API - -## union Static Members - -### createServer(options) -The `options` object is required. Options include: - -Specification - -``` - function createServer(options) - - @param options {Object} - An object literal that represents the configuration for the server. - - @option before {Array} - The `before` value is an array of middlewares, which are used to route and serve incoming - requests. For instance, in the example, `favicon` is a middleware which handles requests - for `/favicon.ico`. - - @option after {Array} - The `after` value is an array of functions that return stream filters, - which are applied after the request handlers in `options.before`. - Stream filters inherit from `union.ResponseStream`, which implements the - Node.js core streams api with a bunch of other goodies. - - @option limit {Object} - (optional) A value, passed to internal instantiations of `union.BufferedStream`. - - @option https {Object} - (optional) A value that specifies the certificate and key necessary to create an instance of - `https.Server`. - - @option headers {Object} - (optional) An object representing a set of headers to set in every outgoing response -``` - -Example - -```js -var server = union.createServer({ - before: [ - favicon('./favicon.png'), - function (req, res) { - var found = router.dispatch(req, res); - if (!found) { - res.emit('next'); - } - } - ] -}); -``` - -An example of the `https` option. - -``` js -{ - https: { - cert: 'path/to/cert.pem', - key: 'path/to/key.pem', - ca: 'path/to/ca.pem' - } -} -``` - -An example of the `headers` option. - -``` js -{ - 'x-powered-by': 'your-sweet-application v10.9.8' -} -``` - -## Error Handling -Error handler is similiar to middlware but takes an extra argument for error at the beginning. - -```js -var handle = function (err, req, res) { - res.statusCode = err.status; - res.end(req.headers); -}; - -var server = union.createServer({ - onError: handle, - before: [ - favicon('./favicon.png'), - function (req, res) { - var found = router.dispatch(req, res); - if (!found) { - res.emit('next'); - } - } - ] -}); -``` - -## BufferedStream Constructor -This constructor inherits from `Stream` and can buffer data up to `limit` bytes. It also implements `pause` and `resume` methods. - -Specification - -``` - function BufferedStream(limit) - - @param limit {Number} - the limit for which the stream can be buffered -``` - -Example - -```js -var bs = union.BufferedStream(n); -``` - -## HttpStream Constructor -This constructor inherits from `union.BufferedStream` and returns a stream with these extra properties: - -Specification - -``` - function HttpStream() -``` - -Example - -```js -var hs = union.HttpStream(); -``` - -## HttpStream Instance Memebers - -### url -The url from the request. - -Example - -```js -httpStream.url = ''; -``` - -### headers -The HTTP headers associated with the stream. - -Example - -```js -httpStream.headers = ''; -``` - -### method -The HTTP method ("GET", "POST", etc). - -Example - -```js -httpStream.method = 'POST'; -``` - -### query -The querystring associated with the stream (if applicable). - -Example - -```js -httpStream.query = ''; -``` - -## ResponseStream Constructor -This constructor inherits from `union.HttpStream`, and is additionally writeable. Union supplies this constructor as a basic response stream middleware from which to inherit. - -Specification - -``` - function ResponseStream() -``` - -Example - -```js -var rs = union.ResponseStream(); -``` - -# Tests - -All tests are written with [vows][0] and should be run with [npm][1]: - -``` bash - $ npm test -``` - -# Licence - -(The MIT License) - -Copyright (c) 2010 Nodejitsu Inc. - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -[0]: http://vowsjs.org -[1]: http://npmjs.org diff --git a/node_modules/union/examples/after/index.js b/node_modules/union/examples/after/index.js deleted file mode 100644 index 23119e6..0000000 --- a/node_modules/union/examples/after/index.js +++ /dev/null @@ -1,26 +0,0 @@ -var fs = require('fs'), - path = require('path'), - union = require('../../lib'); - -var server = union.createServer({ - before: [ function (req,res) { - if(req.url === "/foo") { - res.text(201, "foo"); - } - } ], - after: [ - function LoggerStream() { - var stream = new union.ResponseStream(); - - stream.once("pipe", function (req) { - console.log({res: this.res.statusCode, method: this.req.method}); - }); - - return stream; - } - ] -}); - -server.listen(9080); -console.log('union running on 9080'); - diff --git a/node_modules/union/examples/simple/favicon.png b/node_modules/union/examples/simple/favicon.png deleted file mode 100644 index bf002b1..0000000 Binary files a/node_modules/union/examples/simple/favicon.png and /dev/null differ diff --git a/node_modules/union/examples/simple/middleware/favicon.js b/node_modules/union/examples/simple/middleware/favicon.js deleted file mode 100644 index 6ca34dc..0000000 --- a/node_modules/union/examples/simple/middleware/favicon.js +++ /dev/null @@ -1,96 +0,0 @@ - -/*! - * Connect - favicon - * Copyright(c) 2010 Sencha Inc. - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var crypto = require('crypto') - , fs = require('fs'); - -/** - * Favicon cache. - */ - -var icon; - -/** - * Return md5 hash of the given string and optional encoding, - * defaulting to hex. - * - * utils.md5('wahoo'); - * // => "e493298061761236c96b02ea6aa8a2ad" - * - * @param {String} str - * @param {String} encoding - * @return {String} - * @api public - */ - -exports.md5 = function(str, encoding){ - return crypto - .createHash('md5') - .update(str) - .digest(encoding || 'hex'); -}; - -/** - * By default serves the connect favicon, or the favicon - * located by the given `path`. - * - * Options: - * - * - `maxAge` cache-control max-age directive, defaulting to 1 day - * - * Examples: - * - * connect.createServer( - * connect.favicon() - * ); - * - * connect.createServer( - * connect.favicon(__dirname + '/public/favicon.ico') - * ); - * - * @param {String} path - * @param {Object} options - * @return {Function} - * @api public - */ - -module.exports = function favicon(path, options){ - var options = options || {} - , path = path || __dirname + '/../public/favicon.ico' - , maxAge = options.maxAge || 86400000; - - return function favicon(req, res, next){ - if ('/favicon.ico' == req.url) { - if (icon) { - res.writeHead(200, icon.headers); - res.end(icon.body); - } else { - fs.readFile(path, function(err, buf){ - if (err) return next(err); - icon = { - headers: { - 'Content-Type': 'image/x-icon' - , 'Content-Length': buf.length - , 'ETag': '"' + exports.md5(buf) + '"' - , 'Cache-Control': 'public, max-age=' + (maxAge / 1000) - }, - body: buf - }; - res.writeHead(200, icon.headers); - res.end(icon.body); - }); - } - } else { - next(); - } - }; -}; \ No newline at end of file diff --git a/node_modules/union/examples/simple/middleware/gzip-decode.js b/node_modules/union/examples/simple/middleware/gzip-decode.js deleted file mode 100644 index c003e26..0000000 --- a/node_modules/union/examples/simple/middleware/gzip-decode.js +++ /dev/null @@ -1,26 +0,0 @@ -var spawn = require('child_process').spawn, - util = require('util'), - RequestStream = require('../../lib').RequestStream; - -var GzipDecode = module.exports = function GzipDecoder(options) { - RequestStream.call(this, options); - - this.on('pipe', this.decode); -} - -util.inherits(GzipDecode, RequestStream); - -GzipDecode.prototype.decode = function (source) { - this.decoder = spawn('gunzip'); - this.decoder.stdout.on('data', this._onGunzipData.bind(this)); - this.decoder.stdout.on('end', this._onGunzipEnd.bind(this)); - source.pipe(this.decoder); -} - -GzipDecoderStack.prototype._onGunzipData = function(chunk) { - this.emit('data', chunk); -} - -GzipDecoderStack.prototype._onGunzipEnd = function() { - this.emit('end'); -} \ No newline at end of file diff --git a/node_modules/union/examples/simple/middleware/gzip-encode.js b/node_modules/union/examples/simple/middleware/gzip-encode.js deleted file mode 100644 index 647148c..0000000 --- a/node_modules/union/examples/simple/middleware/gzip-encode.js +++ /dev/null @@ -1,40 +0,0 @@ -var spawn = require('child_process').spawn, - util = require('util'), - ResponseStream = require('../../lib').ResponseStream; - -/** - * Accepts a writable stream, i.e. fs.WriteStream, and returns a StreamStack - * whose 'write()' calls are transparently sent to a 'gzip' process before - * being written to the target stream. - */ -var GzipEncode = module.exports = function GzipEncode(options) { - ResponseStream.call(this, options); - - if (compression) { - process.assert(compression >= 1 && compression <= 9); - this.compression = compression; - } - - this.on('pipe', this.encode); -} - -util.inherits(GzipEncode, ResponseStream); - -GzipEncode.prototype.encode = function (source) { - this.source = source; -}; - -GzipEncode.prototype.pipe = function (dest) { - if (!this.source) { - throw new Error('GzipEncode is only pipeable once it has been piped to'); - } - - this.encoder = spawn('gzip', ['-'+this.compression]); - this.encoder.stdout.pipe(dest); - this.encoder.stdin.pipe(this.source); -}; - -inherits(GzipEncoderStack, StreamStack); -exports.GzipEncoderStack = GzipEncoderStack; - -GzipEncoderStack.prototype.compression = 6; \ No newline at end of file diff --git a/node_modules/union/examples/simple/simple.js b/node_modules/union/examples/simple/simple.js deleted file mode 100644 index 3f94a64..0000000 --- a/node_modules/union/examples/simple/simple.js +++ /dev/null @@ -1,42 +0,0 @@ -var fs = require('fs'), - path = require('path'), - union = require('../../lib'), - director = require('director'), - favicon = require('./middleware/favicon'); - -var router = new director.http.Router(); - -var server = union.createServer({ - before: [ - favicon(path.join(__dirname, 'favicon.png')), - function (req, res) { - var found = router.dispatch(req, res); - if (!found) { - res.emit('next'); - } - } - ] -}); - -router.get('/foo', function () { - this.res.writeHead(200, { 'Content-Type': 'text/plain' }) - this.res.end('hello world\n'); -}); - -router.post('/foo', { stream: true }, function () { - var req = this.req, - res = this.res, - writeStream; - - writeStream = fs.createWriteStream(__dirname + '/' + Date.now() + '-foo.txt'); - req.pipe(writeStream); - - writeStream.on('close', function () { - res.writeHead(200, { 'Content-Type': 'text/plain' }); - res.end('wrote to a stream!'); - }); -}); - -server.listen(9090); -console.log('union with director running on 9090'); - diff --git a/node_modules/union/examples/socketio/README b/node_modules/union/examples/socketio/README deleted file mode 100644 index 9788811..0000000 --- a/node_modules/union/examples/socketio/README +++ /dev/null @@ -1,13 +0,0 @@ -This folder contains an example of how to use Union with Socket.io. - -First, you'll want to install both Union and Socket.io. Run this -command in the folder you placed these two files: - -npm install union socket.io - -You can run the server like so: - -node server.js - -Now open up your web browser to http://localhost and see the results -in the console! diff --git a/node_modules/union/examples/socketio/index.html b/node_modules/union/examples/socketio/index.html deleted file mode 100644 index fd8dc8c..0000000 --- a/node_modules/union/examples/socketio/index.html +++ /dev/null @@ -1,8 +0,0 @@ - - \ No newline at end of file diff --git a/node_modules/union/examples/socketio/server.js b/node_modules/union/examples/socketio/server.js deleted file mode 100644 index dcaae83..0000000 --- a/node_modules/union/examples/socketio/server.js +++ /dev/null @@ -1,30 +0,0 @@ -var fs = require('fs'), - union = require('union'); - -var server = union.createServer({ - before: [ - function (req, res) { - fs.readFile(__dirname + '/index.html', - function (err, data) { - if (err) { - res.writeHead(500); - return res.end('Error loading index.html'); - } - - res.writeHead(200); - res.end(data); - }); - } - ] -}); - -server.listen(9090); - -var io = require('socket.io').listen(server); - -io.sockets.on('connection', function(socket) { - socket.emit('news', {hello: 'world'}); - socket.on('my other event', function(data) { - console.log(data); - }); -}); \ No newline at end of file diff --git a/node_modules/union/lib/buffered-stream.js b/node_modules/union/lib/buffered-stream.js deleted file mode 100644 index 77fa1d0..0000000 --- a/node_modules/union/lib/buffered-stream.js +++ /dev/null @@ -1,113 +0,0 @@ -/* - * buffered-stream.js: A simple(r) Stream which is partially buffered into memory. - * - * (C) 2010, Mikeal Rogers - * - * Adapted for Flatiron - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var events = require('events'), - fs = require('fs'), - stream = require('stream'), - util = require('util'); - -// -// ### function BufferedStream (limit) -// #### @limit {number} **Optional** Size of the buffer to limit -// Constructor function for the BufferedStream object responsible for -// maintaining a stream interface which can also persist to memory -// temporarily. -// - -var BufferedStream = module.exports = function (limit) { - events.EventEmitter.call(this); - - if (typeof limit === 'undefined') { - limit = Infinity; - } - - this.limit = limit; - this.size = 0; - this.chunks = []; - this.writable = true; - this.readable = true; -}; - -util.inherits(BufferedStream, stream.Stream); - -BufferedStream.prototype.pipe = function () { - var self = this; - if (self.resume) { - self.resume(); - } - - var dest = stream.Stream.prototype.pipe.apply(self, arguments); - - // - // just incase you are piping to two streams, do not emit data twice. - // note: you can pipe twice, but you need to pipe both streams in the same tick. - // (this is normal for streams) - // - if (this.piped) { - return dest; - } - - process.nextTick(function () { - self.chunks.forEach(function (c) { self.emit('data', c) }) - self.size = 0; - delete self.chunks; - - if (!self.readable) { - if (self.ended) { - self.emit('end'); - } - else if (self.closed) { - self.emit('close'); - } - } - }); - - this.piped = true; - - return dest; -}; - -BufferedStream.prototype.write = function (chunk) { - if (!this.chunks) { - this.emit('data', chunk); - return; - } - - this.chunks.push(chunk); - this.size += chunk.length; - if (this.limit < this.size) { - this.pause(); - } -}; - -BufferedStream.prototype.end = function () { - this.readable = false; - this.ended = true; - this.emit('end'); -}; - -BufferedStream.prototype.close = function () { - this.readable = false; - this.closed = true; -}; - -if (!stream.Stream.prototype.pause) { - BufferedStream.prototype.pause = function() { - this.emit('pause'); - }; -} - -if (!stream.Stream.prototype.resume) { - BufferedStream.prototype.resume = function() { - this.emit('resume'); - }; -} - diff --git a/node_modules/union/lib/core.js b/node_modules/union/lib/core.js deleted file mode 100644 index 82dfbba..0000000 --- a/node_modules/union/lib/core.js +++ /dev/null @@ -1,77 +0,0 @@ -/* - * core.js: Core functionality for the Flatiron HTTP plugin. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var http = require('http'), - https = require('https'), - fs = require('fs'), - stream = require('stream'), - HttpStream = require('./http-stream'), - RoutingStream = require('./routing-stream'); - -var core = exports; - -core.createServer = function (options) { - var isArray = Array.isArray(options.after); - - if (!options) { - throw new Error('options is required to create a server'); - } - - function requestHandler(req, res) { - var routingStream = new RoutingStream({ - before: options.before, - // without new after is a huge memory leak that pipes to every - // single open connection - after: isArray && - options.after.map(function (a) { - return new a; - }), - response: res, - limit: options.limit, - headers: options.headers - }); - - routingStream.on('error', function (err) { - var fn = options.onError || core.errorHandler; - fn(err, routingStream, routingStream.target, function () { - routingStream.target.emit('next'); - }); - }); - req.pipe(routingStream); - } - - if (options.https) { - if (!options.https.key || !options.https.cert) { - throw new Error('Both `options.https.key` and `options.https.cert` are required.'); - } - - var credentials = { - key: fs.readFileSync(options.https.key), - cert: fs.readFileSync(options.https.cert) - }; - - if (options.https.ca) { - credentials.ca = fs.readFileSync(options.https.ca); - } - - return https.createServer(credentials, requestHandler); - } - - return http.createServer(requestHandler); -}; - -core.errorHandler = function error(err, req, res) { - if (err) { - (this.res || res).writeHead(err.status || 500, err.headers || { "Content-Type": "text/plain" }); - (this.res || res).end(err.stack + "\n"); - return; - } - - (this.res || res).writeHead(404, {"Content-Type": "text/plain"}); - (this.res || res).end("Not Found\n"); -}; diff --git a/node_modules/union/lib/http-stream.js b/node_modules/union/lib/http-stream.js deleted file mode 100644 index be0d895..0000000 --- a/node_modules/union/lib/http-stream.js +++ /dev/null @@ -1,48 +0,0 @@ -/* - * http-stream.js: Idomatic buffered stream which pipes additional HTTP information. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var url = require('url'), - util = require('util'), - qs = require('qs'), - BufferedStream = require('./buffered-stream'); - -var HttpStream = module.exports = function (options) { - options = options || {}; - BufferedStream.call(this, options.limit); - - this.on('pipe', this.pipeState); -}; - -util.inherits(HttpStream, BufferedStream); - -// -// ### function pipeState (source) -// #### @source {ServerRequest|HttpStream} Source stream piping to this instance -// Pipes additional HTTP metadata from the `source` HTTP stream (either concrete or -// abstract) to this instance. e.g. url, headers, query, etc. -// -// Remark: Is there anything else we wish to pipe? -// -HttpStream.prototype.pipeState = function (source) { - this.headers = source.headers; - this.trailers = source.trailers; - this.method = source.method; - - if (source.url) { - this.url = source.url; - } - - if (source.query) { - this.query = source.query; - } - else if (source.url) { - this.query = ~source.url.indexOf('?') - ? qs.parse(url.parse(source.url).query) - : {}; - } -}; diff --git a/node_modules/union/lib/index.js b/node_modules/union/lib/index.js deleted file mode 100644 index 9a2d74d..0000000 --- a/node_modules/union/lib/index.js +++ /dev/null @@ -1,24 +0,0 @@ -/* - * index.js: Top-level plugin exposing HTTP features in flatiron - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var union = exports; - -// -// Expose version information through `pkginfo` -// -require('pkginfo')(module, 'version') - -// -// Expose core union components -// -union.BufferedStream = require('./buffered-stream'); -union.HttpStream = require('./http-stream'); -union.ResponseStream = require('./response-stream'); -union.RoutingStream = require('./routing-stream'); -union.createServer = require('./core').createServer; -union.errorHandler = require('./core').errorHandler; \ No newline at end of file diff --git a/node_modules/union/lib/request-stream.js b/node_modules/union/lib/request-stream.js deleted file mode 100644 index 8f2041a..0000000 --- a/node_modules/union/lib/request-stream.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * http-stream.js: Idomatic buffered stream which pipes additional HTTP information. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var url = require('url'), - util = require('util'), - qs = require('qs'), - HttpStream = require('./http-stream'); - -var RequestStream = module.exports = function (options) { - options = options || {}; - HttpStream.call(this, options); - - this.on('pipe', this.pipeRequest); -}; - -util.inherits(RequestStream, HttpStream); - -// -// ### function pipeRequest (source) -// #### @source {ServerRequest|HttpStream} Source stream piping to this instance -// Pipes additional HTTP request metadata from the `source` HTTP stream (either concrete or -// abstract) to this instance. e.g. url, headers, query, etc. -// -// Remark: Is there anything else we wish to pipe? -// -RequestStream.prototype.pipeRequest = function (source) { - this.url = source.url; - this.method = source.method; - this.httpVersion = source.httpVersion; - this.setEncoding = source.setEncoding; - this.connection = source.connection; - - if (source.query) { - this.query = source.query; - } - else { - this.query = ~source.url.indexOf('?') - ? qs.parse(url.parse(source.url).query) - : {}; - } -}; diff --git a/node_modules/union/lib/response-stream.js b/node_modules/union/lib/response-stream.js deleted file mode 100644 index 677f2ec..0000000 --- a/node_modules/union/lib/response-stream.js +++ /dev/null @@ -1,160 +0,0 @@ -/* - * response-stream.js: A Stream focused on writing any relevant information to - * a raw http.ServerResponse object. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var util = require('util'), - HttpStream = require('./http-stream'); - -// -// ### function RequestStream (options) -// -// -var ResponseStream = module.exports = function (options) { - var self = this; - - options = options || {}; - HttpStream.call(this, options); - - this.writeable = true; - this.response = options.response; - - if (options.headers) { - for (var key in options.headers) { - this.response.setHeader(key, options.headers[key]); - } - } - - // - // Proxy `statusCode` changes to the actual `response.statusCode`. - // - Object.defineProperty(this, 'statusCode', { - get: function () { - return self.response.statusCode; - }, - set: function (value) { - self.response.statusCode = value; - }, - enumerable: true, - configurable: true - }); - - if (this.response) { - this._headers = this.response._headers = this.response._headers || {}; - - // Patch to node core - this.response._headerNames = this.response._headerNames || {}; - - // - // Proxy to emit "header" event - // - this._renderHeaders = this.response._renderHeaders; - this.response._renderHeaders = function () { - if (!self._emittedHeader) { - self._emittedHeader = true; - self.emit('header'); - } - return self._renderHeaders.call(self.response); - } - } -}; - -util.inherits(ResponseStream, HttpStream); - -ResponseStream.prototype.writeHead = function (statusCode, headers) { - if (headers) { - for (var key in headers) { - this.response.setHeader(key, headers[key]); - } - } - - this.response.statusCode = statusCode; -}; - -// -// Create pass-thru for the necessary -// `http.ServerResponse` methods. -// -['setHeader', 'getHeader', 'removeHeader', '_implicitHeader', 'addTrailers'].forEach(function (method) { - ResponseStream.prototype[method] = function () { - return this.response[method].apply(this.response, arguments); - }; -}); - -ResponseStream.prototype.json = function (obj) { - if (!this.response.writable) { - return; - } - - if (typeof obj === 'number') { - this.response.statusCode = obj; - obj = arguments[1]; - } - - this.modified = true; - - if (!this.response._header && this.response.getHeader('content-type') !== 'application/json') { - this.response.setHeader('content-type', 'application/json'); - } - - this.end(obj ? JSON.stringify(obj) : ''); -}; - -ResponseStream.prototype.html = function (str) { - if (!this.response.writable) { - return; - } - - if (typeof str === 'number') { - this.response.statusCode = str; - str = arguments[1]; - } - - this.modified = true; - - if (!this.response._header && this.response.getHeader('content-type') !== 'text/html') { - this.response.setHeader('content-type', 'text/html'); - } - - this.end(str ? str: ''); -}; - -ResponseStream.prototype.text = function (str) { - if (!this.response.writable) { - return; - } - - if (typeof str === 'number') { - this.response.statusCode = str; - str = arguments[1]; - } - - this.modified = true; - - if (!this.response._header && this.response.getHeader('content-type') !== 'text/plain') { - this.response.setHeader('content-type', 'text/plain'); - } - - this.end(str ? str: ''); -}; - -ResponseStream.prototype.end = function (data) { - if (data && this.writable) { - this.emit('data', data); - } - - this.modified = true; - this.emit('end'); -}; - -ResponseStream.prototype.write = function (data) { - this.modified = true; - - if (this.writable) { - this.emit('data', data); - } -}; diff --git a/node_modules/union/lib/routing-stream.js b/node_modules/union/lib/routing-stream.js deleted file mode 100644 index 022dd71..0000000 --- a/node_modules/union/lib/routing-stream.js +++ /dev/null @@ -1,192 +0,0 @@ -/* - * routing-stream.js: A Stream focused on connecting an arbitrary RequestStream and - * ResponseStream through a given Router. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var util = require('util'), - union = require('./index'), - RequestStream = require('./request-stream'), - ResponseStream = require('./response-stream'); - -// -// ### function RequestStream (options) -// -// -var RoutingStream = module.exports = function (options) { - options = options || {}; - RequestStream.call(this, options); - - this.before = options.before || []; - this.after = options.after || []; - this.response = options.response || options.res; - this.headers = options.headers || { - 'x-powered-by': 'union ' + union.version - }; - - this.target = new ResponseStream({ - response: this.response, - headers: this.headers - }); - - this.once('pipe', this.route); -}; - -util.inherits(RoutingStream, RequestStream); - -// -// Called when this instance is piped to **by another stream** -// -RoutingStream.prototype.route = function (req) { - - // - // When a `RoutingStream` is piped to: - // - // 1. Setup the pipe-chain between the `after` middleware, the abstract response - // and the concrete response. - // 2. Attempt to dispatch to the `before` middleware, which represent things such as - // favicon, static files, application routing. - // 3. If no match is found then pipe to the 404Stream - // - var self = this, - after, - error, - i; - - // make sure data from req is piped on the `once` first call - req.on('data', function () { - self.emit.apply(self, ["data"].concat([].slice.call(arguments,0))); - }); - - // - // Don't allow `this.target` to be writable on HEAD requests - // - this.target.writable = req.method !== 'HEAD'; - - // - // 1. Setup the pipe-chain between the `after` middleware, the abstract response - // and the concrete response. - // - after = [this.target].concat(this.after, this.response); - for (i = 0; i < after.length - 1; i++) { - // attach req to all streams - after[i].req = req; - after[i+1].req = req; - after[i].res = this.response; - after[i+1].res = this.response; - after[i].pipe(after[i + 1]); - // prevent multiple responses and memory leaks - after[i].on('error', this.onError); - } - - // - // Helper function for dispatching to the 404 stream. - // - function notFound() { - error = new Error('Not found'); - error.status = 404; - self.onError(error); - } - - // - // 2. Attempt to dispatch to the `before` middleware, which represent things such as - // favicon, static files, application routing. - // - (function dispatch(i) { - if (self.target.modified) { - return; - } - else if (++i === self.before.length) { - // - // 3. If no match is found then pipe to the 404Stream - // - return notFound(); - } - - self.target.once('next', dispatch.bind(null, i)); - if (self.before[i].length === 3) { - self.before[i](self, self.target, function (err) { - if (err) { - self.onError(err); - } else { - self.target.emit('next'); - } - }); - } - else { - self.before[i](self, self.target); - } - })(-1); -}; - -RoutingStream.prototype.onError = function (err) { - this.emit('error', err); -}; - -RoutingStream.prototype.login = -RoutingStream.prototype.logIn = function(user, options, done) { - if (!this._passport) throw new Error('passport.initialize() middleware not in use'); - - if (!done && typeof options === 'function') { - done = options; - options = {}; - } - options = options || {}; - var property = this._passport.instance._userProperty || 'user'; - var session = (options.session === undefined) ? true : options.session; - - this[property] = user; - if (session) { - var self = this; - this._passport.instance.serializeUser(user, function(err, obj) { - if (err) { self[property] = null; return done(err); } - self._passport.session.user = obj; - done(); - }); - } else { - done && done(); - } -}; - -/** - * Terminate an existing login session. - * - * @api public - */ -RoutingStream.prototype.logout = -RoutingStream.prototype.logOut = function() { - if (!this._passport) throw new Error('passport.initialize() middleware not in use'); - - var property = this._passport.instance._userProperty || 'user'; - - this[property] = null; - delete this._passport.session.user; -}; - -/** - * Test if request is authenticated. - * - * @return {Boolean} - * @api public - */ -RoutingStream.prototype.isAuthenticated = function() { - var property = 'user'; - if (this._passport && this._passport.instance._userProperty) { - property = this._passport.instance._userProperty; - } - - return (this[property]) ? true : false; -}; - -/** - * Test if request is unauthenticated. - * - * @return {Boolean} - * @api public - */ -RoutingStream.prototype.isUnauthenticated = function() { - return !this.isAuthenticated(); -}; diff --git a/node_modules/union/node_modules/pkginfo/.npmignore b/node_modules/union/node_modules/pkginfo/.npmignore deleted file mode 100644 index 9303c34..0000000 --- a/node_modules/union/node_modules/pkginfo/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -npm-debug.log \ No newline at end of file diff --git a/node_modules/union/node_modules/pkginfo/README.md b/node_modules/union/node_modules/pkginfo/README.md deleted file mode 100644 index 07ba942..0000000 --- a/node_modules/union/node_modules/pkginfo/README.md +++ /dev/null @@ -1,85 +0,0 @@ -# node-pkginfo - -An easy way to expose properties on a module from a package.json - -## Installation - -### Installing npm (node package manager) -``` - curl http://npmjs.org/install.sh | sh -``` - -### Installing pkginfo -``` - [sudo] npm install pkginfo -``` - -## Motivation -How often when writing node.js modules have you written the following line(s) of code? - -* Hard code your version string into your code - -``` js - exports.version = '0.1.0'; -``` - -* Programmatically expose the version from the package.json - -``` js - exports.version = JSON.parse(fs.readFileSync('/path/to/package.json', 'utf8')).version; -``` - -In other words, how often have you wanted to expose basic information from your package.json onto your module programmatically? **WELL NOW YOU CAN!** - -## Usage - -Using `pkginfo` is idiot-proof, just require and invoke it. - -``` js - var pkginfo = require('pkginfo')(module); - - console.dir(module.exports); -``` - -By invoking the `pkginfo` module all of the properties in your `package.json` file will be automatically exposed on the callee module (i.e. the parent module of `pkginfo`). - -Here's a sample of the output: - -``` - { name: 'simple-app', - description: 'A test fixture for pkginfo', - version: '0.1.0', - author: 'Charlie Robbins ', - keywords: [ 'test', 'fixture' ], - main: './index.js', - scripts: { test: 'vows test/*-test.js --spec' }, - engines: { node: '>= 0.4.0' } } -``` - -### Expose specific properties -If you don't want to expose **all** properties on from your `package.json` on your module then simple pass those properties to the `pkginfo` function: - -``` js - var pkginfo = require('pkginfo')(module, 'version', 'author'); - - console.dir(module.exports); -``` - -``` - { version: '0.1.0', - author: 'Charlie Robbins ' } -``` - -If you're looking for further usage see the [examples][0] included in this repository. - -## Run Tests -Tests are written in [vows][1] and give complete coverage of all APIs. - -``` - vows test/*-test.js --spec -``` - -[0]: https://github.com/indexzero/node-pkginfo/tree/master/examples -[1]: http://vowsjs.org - -#### Author: [Charlie Robbins](http://nodejitsu.com) \ No newline at end of file diff --git a/node_modules/union/node_modules/pkginfo/docs/docco.css b/node_modules/union/node_modules/pkginfo/docs/docco.css deleted file mode 100644 index bd54134..0000000 --- a/node_modules/union/node_modules/pkginfo/docs/docco.css +++ /dev/null @@ -1,194 +0,0 @@ -/*--------------------- Layout and Typography ----------------------------*/ -body { - font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; - font-size: 15px; - line-height: 22px; - color: #252519; - margin: 0; padding: 0; -} -a { - color: #261a3b; -} - a:visited { - color: #261a3b; - } -p { - margin: 0 0 15px 0; -} -h4, h5, h6 { - color: #333; - margin: 6px 0 6px 0; - font-size: 13px; -} - h2, h3 { - margin-bottom: 0; - color: #000; - } - h1 { - margin-top: 40px; - margin-bottom: 15px; - color: #000; - } -#container { - position: relative; -} -#background { - position: fixed; - top: 0; left: 525px; right: 0; bottom: 0; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - z-index: -1; -} -#jump_to, #jump_page { - background: white; - -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; - -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; - font: 10px Arial; - text-transform: uppercase; - cursor: pointer; - text-align: right; -} -#jump_to, #jump_wrapper { - position: fixed; - right: 0; top: 0; - padding: 5px 10px; -} - #jump_wrapper { - padding: 0; - display: none; - } - #jump_to:hover #jump_wrapper { - display: block; - } - #jump_page { - padding: 5px 0 3px; - margin: 0 0 25px 25px; - } - #jump_page .source { - display: block; - padding: 5px 10px; - text-decoration: none; - border-top: 1px solid #eee; - } - #jump_page .source:hover { - background: #f5f5ff; - } - #jump_page .source:first-child { - } -table td { - border: 0; - outline: 0; -} - td.docs, th.docs { - max-width: 450px; - min-width: 450px; - min-height: 5px; - padding: 10px 25px 1px 50px; - overflow-x: hidden; - vertical-align: top; - text-align: left; - } - .docs pre { - margin: 15px 0 15px; - padding-left: 15px; - } - .docs p tt, .docs p code { - background: #f8f8ff; - border: 1px solid #dedede; - font-size: 12px; - padding: 0 0.2em; - } - .pilwrap { - position: relative; - } - .pilcrow { - font: 12px Arial; - text-decoration: none; - color: #454545; - position: absolute; - top: 3px; left: -20px; - padding: 1px 2px; - opacity: 0; - -webkit-transition: opacity 0.2s linear; - } - td.docs:hover .pilcrow { - opacity: 1; - } - td.code, th.code { - padding: 14px 15px 16px 25px; - width: 100%; - vertical-align: top; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - } - pre, tt, code { - font-size: 12px; line-height: 18px; - font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; - margin: 0; padding: 0; - } - - -/*---------------------- Syntax Highlighting -----------------------------*/ -td.linenos { background-color: #f0f0f0; padding-right: 10px; } -span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } -body .hll { background-color: #ffffcc } -body .c { color: #408080; font-style: italic } /* Comment */ -body .err { border: 1px solid #FF0000 } /* Error */ -body .k { color: #954121 } /* Keyword */ -body .o { color: #666666 } /* Operator */ -body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ -body .cp { color: #BC7A00 } /* Comment.Preproc */ -body .c1 { color: #408080; font-style: italic } /* Comment.Single */ -body .cs { color: #408080; font-style: italic } /* Comment.Special */ -body .gd { color: #A00000 } /* Generic.Deleted */ -body .ge { font-style: italic } /* Generic.Emph */ -body .gr { color: #FF0000 } /* Generic.Error */ -body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -body .gi { color: #00A000 } /* Generic.Inserted */ -body .go { color: #808080 } /* Generic.Output */ -body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -body .gs { font-weight: bold } /* Generic.Strong */ -body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -body .gt { color: #0040D0 } /* Generic.Traceback */ -body .kc { color: #954121 } /* Keyword.Constant */ -body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ -body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ -body .kp { color: #954121 } /* Keyword.Pseudo */ -body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ -body .kt { color: #B00040 } /* Keyword.Type */ -body .m { color: #666666 } /* Literal.Number */ -body .s { color: #219161 } /* Literal.String */ -body .na { color: #7D9029 } /* Name.Attribute */ -body .nb { color: #954121 } /* Name.Builtin */ -body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ -body .no { color: #880000 } /* Name.Constant */ -body .nd { color: #AA22FF } /* Name.Decorator */ -body .ni { color: #999999; font-weight: bold } /* Name.Entity */ -body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -body .nf { color: #0000FF } /* Name.Function */ -body .nl { color: #A0A000 } /* Name.Label */ -body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -body .nt { color: #954121; font-weight: bold } /* Name.Tag */ -body .nv { color: #19469D } /* Name.Variable */ -body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -body .w { color: #bbbbbb } /* Text.Whitespace */ -body .mf { color: #666666 } /* Literal.Number.Float */ -body .mh { color: #666666 } /* Literal.Number.Hex */ -body .mi { color: #666666 } /* Literal.Number.Integer */ -body .mo { color: #666666 } /* Literal.Number.Oct */ -body .sb { color: #219161 } /* Literal.String.Backtick */ -body .sc { color: #219161 } /* Literal.String.Char */ -body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ -body .s2 { color: #219161 } /* Literal.String.Double */ -body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -body .sh { color: #219161 } /* Literal.String.Heredoc */ -body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -body .sx { color: #954121 } /* Literal.String.Other */ -body .sr { color: #BB6688 } /* Literal.String.Regex */ -body .s1 { color: #219161 } /* Literal.String.Single */ -body .ss { color: #19469D } /* Literal.String.Symbol */ -body .bp { color: #954121 } /* Name.Builtin.Pseudo */ -body .vc { color: #19469D } /* Name.Variable.Class */ -body .vg { color: #19469D } /* Name.Variable.Global */ -body .vi { color: #19469D } /* Name.Variable.Instance */ -body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/node_modules/union/node_modules/pkginfo/docs/pkginfo.html b/node_modules/union/node_modules/pkginfo/docs/pkginfo.html deleted file mode 100644 index bf615fa..0000000 --- a/node_modules/union/node_modules/pkginfo/docs/pkginfo.html +++ /dev/null @@ -1,101 +0,0 @@ - pkginfo.js

        pkginfo.js

        /*
        - * pkginfo.js: Top-level include for the pkginfo module
        - *
        - * (C) 2011, Charlie Robbins
        - *
        - */
        - 
        -var fs = require('fs'),
        -    path = require('path');

        function pkginfo ([options, 'property', 'property' ..])

        - -

        @pmodule {Module} Parent module to read from.

        - -

        @options {Object|Array|string} Optional Options used when exposing properties.

        - -

        @arguments {string...} Optional Specified properties to expose.

        - -

        Exposes properties from the package.json file for the parent module on -it's exports. Valid usage:

        - -

        require('pkginfo')()

        - -

        require('pkginfo')('version', 'author');

        - -

        require('pkginfo')(['version', 'author']);

        - -

        require('pkginfo')({ include: ['version', 'author'] });

        var pkginfo = module.exports = function (pmodule, options) {
        -  var args = [].slice.call(arguments, 2).filter(function (arg) {
        -    return typeof arg === 'string';
        -  });
        -  

        Parse variable arguments

          if (Array.isArray(options)) {

        If the options passed in is an Array assume that -it is the Array of properties to expose from the -on the package.json file on the parent module.

            options = { include: options };
        -  }
        -  else if (typeof options === 'string') {

        Otherwise if the first argument is a string, then -assume that it is the first property to expose from -the package.json file on the parent module.

            options = { include: [options] };
        -  }
        -  

        Setup default options

          options = options || { include: [] };
        -  
        -  if (args.length > 0) {

        If additional string arguments have been passed in -then add them to the properties to expose on the -parent module.

            options.include = options.include.concat(args);
        -  }
        -  
        -  var pkg = pkginfo.read(pmodule, options.dir).package;
        -  Object.keys(pkg).forEach(function (key) {
        -    if (options.include.length > 0 && !~options.include.indexOf(key)) {
        -      return;
        -    }
        -    
        -    if (!pmodule.exports[key]) {
        -      pmodule.exports[key] = pkg[key];
        -    }
        -  });
        -  
        -  return pkginfo;
        -};

        function find (dir)

        - -

        @pmodule {Module} Parent module to read from.

        - -

        @dir {string} Optional Directory to start search from.

        - -

        Searches up the directory tree from dir until it finds a directory -which contains a package.json file.

        pkginfo.find = function (pmodule, dir) {
        -  dir = dir || pmodule.filename;
        -  dir = path.dirname(dir); 
        -  
        -  var files = fs.readdirSync(dir);
        -  
        -  if (~files.indexOf('package.json')) {
        -    return path.join(dir, 'package.json');
        -  }
        -  
        -  if (dir === '/') {
        -    throw new Error('Could not find package.json up from: ' + dir);
        -  }
        -  
        -  return pkginfo.find(dir);
        -};

        function read (pmodule, dir)

        - -

        @pmodule {Module} Parent module to read from.

        - -

        @dir {string} Optional Directory to start search from.

        - -

        Searches up the directory tree from dir until it finds a directory -which contains a package.json file and returns the package information.

        pkginfo.read = function (pmodule, dir) { 
        -  dir = pkginfo.find(pmodule, dir);
        -  
        -  var data = fs.readFileSync(dir).toString();
        -      
        -  return {
        -    dir: dir, 
        -    package: JSON.parse(data)
        -  };
        -};

        Call pkginfo on this module and expose version.

        pkginfo(module, {
        -  dir: __dirname,
        -  include: ['version'],
        -  target: pkginfo
        -});
        -
        -
        \ No newline at end of file diff --git a/node_modules/union/node_modules/pkginfo/examples/all-properties.js b/node_modules/union/node_modules/pkginfo/examples/all-properties.js deleted file mode 100644 index fd1d831..0000000 --- a/node_modules/union/node_modules/pkginfo/examples/all-properties.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * all-properties.js: Sample of including all properties from a package.json file - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/union/node_modules/pkginfo/examples/array-argument.js b/node_modules/union/node_modules/pkginfo/examples/array-argument.js deleted file mode 100644 index b1b6848..0000000 --- a/node_modules/union/node_modules/pkginfo/examples/array-argument.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * array-argument.js: Sample of including specific properties from a package.json file - * using Array argument syntax. - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, ['version', 'author']); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/union/node_modules/pkginfo/examples/multiple-properties.js b/node_modules/union/node_modules/pkginfo/examples/multiple-properties.js deleted file mode 100644 index b4b5fd6..0000000 --- a/node_modules/union/node_modules/pkginfo/examples/multiple-properties.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * multiple-properties.js: Sample of including multiple properties from a package.json file - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, 'version', 'author'); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/union/node_modules/pkginfo/examples/object-argument.js b/node_modules/union/node_modules/pkginfo/examples/object-argument.js deleted file mode 100644 index 28420c8..0000000 --- a/node_modules/union/node_modules/pkginfo/examples/object-argument.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * object-argument.js: Sample of including specific properties from a package.json file - * using Object argument syntax. - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, { - include: ['version', 'author'] - }); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/union/node_modules/pkginfo/examples/package.json b/node_modules/union/node_modules/pkginfo/examples/package.json deleted file mode 100644 index 1f2f01c..0000000 --- a/node_modules/union/node_modules/pkginfo/examples/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "simple-app", - "description": "A test fixture for pkginfo", - "version": "0.1.0", - "author": "Charlie Robbins ", - "keywords": ["test", "fixture"], - "main": "./index.js", - "scripts": { "test": "vows test/*-test.js --spec" }, - "engines": { "node": ">= 0.4.0" } -} diff --git a/node_modules/union/node_modules/pkginfo/examples/single-property.js b/node_modules/union/node_modules/pkginfo/examples/single-property.js deleted file mode 100644 index 4f44561..0000000 --- a/node_modules/union/node_modules/pkginfo/examples/single-property.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * single-property.js: Sample of including a single specific properties from a package.json file - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, 'version'); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/union/node_modules/pkginfo/lib/pkginfo.js b/node_modules/union/node_modules/pkginfo/lib/pkginfo.js deleted file mode 100644 index a4a6227..0000000 --- a/node_modules/union/node_modules/pkginfo/lib/pkginfo.js +++ /dev/null @@ -1,132 +0,0 @@ -/* - * pkginfo.js: Top-level include for the pkginfo module - * - * (C) 2011, Charlie Robbins - * - */ - -var fs = require('fs'), - path = require('path'); - -// -// ### function pkginfo ([options, 'property', 'property' ..]) -// #### @pmodule {Module} Parent module to read from. -// #### @options {Object|Array|string} **Optional** Options used when exposing properties. -// #### @arguments {string...} **Optional** Specified properties to expose. -// Exposes properties from the package.json file for the parent module on -// it's exports. Valid usage: -// -// `require('pkginfo')()` -// -// `require('pkginfo')('version', 'author');` -// -// `require('pkginfo')(['version', 'author']);` -// -// `require('pkginfo')({ include: ['version', 'author'] });` -// -var pkginfo = module.exports = function (pmodule, options) { - var args = [].slice.call(arguments, 2).filter(function (arg) { - return typeof arg === 'string'; - }); - - // - // **Parse variable arguments** - // - if (Array.isArray(options)) { - // - // If the options passed in is an Array assume that - // it is the Array of properties to expose from the - // on the package.json file on the parent module. - // - options = { include: options }; - } - else if (typeof options === 'string') { - // - // Otherwise if the first argument is a string, then - // assume that it is the first property to expose from - // the package.json file on the parent module. - // - options = { include: [options] }; - } - - // - // **Setup default options** - // - options = options || { include: [] }; - - if (args.length > 0) { - // - // If additional string arguments have been passed in - // then add them to the properties to expose on the - // parent module. - // - options.include = options.include.concat(args); - } - - var pkg = pkginfo.read(pmodule, options.dir).package; - Object.keys(pkg).forEach(function (key) { - if (options.include.length > 0 && !~options.include.indexOf(key)) { - return; - } - - if (!pmodule.exports[key]) { - pmodule.exports[key] = pkg[key]; - } - }); - - return pkginfo; -}; - -// -// ### function find (dir) -// #### @pmodule {Module} Parent module to read from. -// #### @dir {string} **Optional** Directory to start search from. -// Searches up the directory tree from `dir` until it finds a directory -// which contains a `package.json` file. -// -pkginfo.find = function (pmodule, dir) { - dir = dir || pmodule.filename; - dir = path.dirname(dir); - - var files = fs.readdirSync(dir); - - if (~files.indexOf('package.json')) { - return path.join(dir, 'package.json'); - } - - if (dir === '/') { - throw new Error('Could not find package.json up from: ' + dir); - } - else if (!dir || dir === '.') { - throw new Error('Cannot find package.json from unspecified directory'); - } - - return pkginfo.find(pmodule, dir); -}; - -// -// ### function read (pmodule, dir) -// #### @pmodule {Module} Parent module to read from. -// #### @dir {string} **Optional** Directory to start search from. -// Searches up the directory tree from `dir` until it finds a directory -// which contains a `package.json` file and returns the package information. -// -pkginfo.read = function (pmodule, dir) { - dir = pkginfo.find(pmodule, dir); - - var data = fs.readFileSync(dir).toString(); - - return { - dir: dir, - package: JSON.parse(data) - }; -}; - -// -// Call `pkginfo` on this module and expose version. -// -pkginfo(module, { - dir: __dirname, - include: ['version'], - target: pkginfo -}); \ No newline at end of file diff --git a/node_modules/union/node_modules/pkginfo/package.json b/node_modules/union/node_modules/pkginfo/package.json deleted file mode 100644 index 8670f9a..0000000 --- a/node_modules/union/node_modules/pkginfo/package.json +++ /dev/null @@ -1,36 +0,0 @@ -{ - "name": "pkginfo", - "version": "0.2.3", - "description": "An easy way to expose properties on a module from a package.json", - "author": { - "name": "Charlie Robbins", - "email": "charlie.robbins@gmail.com" - }, - "repository": { - "type": "git", - "url": "git://github.com/indexzero/node-pkginfo.git" - }, - "keywords": [ - "info", - "tools", - "package.json" - ], - "devDependencies": { - "vows": "0.6.x" - }, - "main": "./lib/pkginfo", - "scripts": { - "test": "vows test/*-test.js --spec" - }, - "engines": { - "node": ">= 0.4.0" - }, - "_id": "pkginfo@0.2.3", - "dependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "pkginfo@0.2.x" -} diff --git a/node_modules/union/node_modules/pkginfo/test/pkginfo-test.js b/node_modules/union/node_modules/pkginfo/test/pkginfo-test.js deleted file mode 100644 index 3156c00..0000000 --- a/node_modules/union/node_modules/pkginfo/test/pkginfo-test.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * pkginfo-test.js: Tests for the pkginfo module. - * - * (C) 2011, Charlie Robbins - * - */ - -var assert = require('assert'), - exec = require('child_process').exec, - fs = require('fs'), - path = require('path'), - vows = require('vows'), - pkginfo = require('../lib/pkginfo'); - -function assertProperties (source, target) { - assert.lengthOf(source, target.length + 1); - target.forEach(function (prop) { - assert.isTrue(!!~source.indexOf(prop)); - }); -} - -function testExposes (options) { - return { - topic: function () { - exec('node ' + path.join(__dirname, '..', 'examples', options.script), this.callback); - }, - "should expose that property correctly": function (err, stdout, stderr) { - assert.isNull(err); - - var exposed = stderr.match(/'(\w+)'/ig).map(function (p) { - return p.substring(1, p.length - 1); - }); - - return !options.assert - ? assertProperties(exposed, options.properties) - : options.assert(exposed); - } - } -} - -vows.describe('pkginfo').addBatch({ - "When using the pkginfo module": { - "and passed a single `string` argument": testExposes({ - script: 'single-property.js', - properties: ['version'] - }), - "and passed multiple `string` arguments": testExposes({ - script: 'multiple-properties.js', - properties: ['version', 'author'] - }), - "and passed an `object` argument": testExposes({ - script: 'object-argument.js', - properties: ['version', 'author'] - }), - "and passed an `array` argument": testExposes({ - script: 'array-argument.js', - properties: ['version', 'author'] - }), - "and passed no arguments": testExposes({ - script: 'all-properties.js', - assert: function (exposed) { - var pkg = fs.readFileSync(path.join(__dirname, '..', 'examples', 'package.json')).toString(), - keys = Object.keys(JSON.parse(pkg)); - - assertProperties(exposed, keys); - } - }) - } -}).export(module); diff --git a/node_modules/union/node_modules/qs/.gitmodules b/node_modules/union/node_modules/qs/.gitmodules deleted file mode 100644 index 49e31da..0000000 --- a/node_modules/union/node_modules/qs/.gitmodules +++ /dev/null @@ -1,6 +0,0 @@ -[submodule "support/expresso"] - path = support/expresso - url = git://github.com/visionmedia/expresso.git -[submodule "support/should"] - path = support/should - url = git://github.com/visionmedia/should.js.git diff --git a/node_modules/union/node_modules/qs/.npmignore b/node_modules/union/node_modules/qs/.npmignore deleted file mode 100644 index 3c3629e..0000000 --- a/node_modules/union/node_modules/qs/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/node_modules/union/node_modules/qs/.travis.yml b/node_modules/union/node_modules/qs/.travis.yml deleted file mode 100644 index 2c0a8f6..0000000 --- a/node_modules/union/node_modules/qs/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.6 - - 0.4 \ No newline at end of file diff --git a/node_modules/union/node_modules/qs/History.md b/node_modules/union/node_modules/qs/History.md deleted file mode 100644 index 3eaf7df..0000000 --- a/node_modules/union/node_modules/qs/History.md +++ /dev/null @@ -1,73 +0,0 @@ - -0.4.2 / 2012-02-08 -================== - - * Fixed: ensure objects are created when appropriate not arrays [aheckmann] - -0.4.1 / 2012-01-26 -================== - - * Fixed stringify()ing numbers. Closes #23 - -0.4.0 / 2011-11-21 -================== - - * Allow parsing of an existing object (for `bodyParser()`) [jackyz] - * Replaced expresso with mocha - -0.3.2 / 2011-11-08 -================== - - * Fixed global variable leak - -0.3.1 / 2011-08-17 -================== - - * Added `try/catch` around malformed uri components - * Add test coverage for Array native method bleed-though - -0.3.0 / 2011-07-19 -================== - - * Allow `array[index]` and `object[property]` syntaxes [Aria Stewart] - -0.2.0 / 2011-06-29 -================== - - * Added `qs.stringify()` [Cory Forsyth] - -0.1.0 / 2011-04-13 -================== - - * Added jQuery-ish array support - -0.0.7 / 2011-03-13 -================== - - * Fixed; handle empty string and `== null` in `qs.parse()` [dmit] - allows for convenient `qs.parse(url.parse(str).query)` - -0.0.6 / 2011-02-14 -================== - - * Fixed; support for implicit arrays - -0.0.4 / 2011-02-09 -================== - - * Fixed `+` as a space - -0.0.3 / 2011-02-08 -================== - - * Fixed case when right-hand value contains "]" - -0.0.2 / 2011-02-07 -================== - - * Fixed "=" presence in key - -0.0.1 / 2011-02-07 -================== - - * Initial release \ No newline at end of file diff --git a/node_modules/union/node_modules/qs/Makefile b/node_modules/union/node_modules/qs/Makefile deleted file mode 100644 index e4df837..0000000 --- a/node_modules/union/node_modules/qs/Makefile +++ /dev/null @@ -1,5 +0,0 @@ - -test: - @./node_modules/.bin/mocha - -.PHONY: test \ No newline at end of file diff --git a/node_modules/union/node_modules/qs/Readme.md b/node_modules/union/node_modules/qs/Readme.md deleted file mode 100644 index db0d145..0000000 --- a/node_modules/union/node_modules/qs/Readme.md +++ /dev/null @@ -1,54 +0,0 @@ -# node-querystring - - query string parser for node supporting nesting, as it was removed from `0.3.x`, so this library provides the previous and commonly desired behaviour (and twice as fast). Used by [express](http://expressjs.com), [connect](http://senchalabs.github.com/connect) and others. - -## Installation - - $ npm install qs - -## Examples - -```js -var qs = require('qs'); - -qs.parse('user[name][first]=Tobi&user[email]=tobi@learnboost.com'); -// => { user: { name: { first: 'Tobi' }, email: 'tobi@learnboost.com' } } - -qs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }}) -// => user[name]=Tobi&user[email]=tobi%40learnboost.com -``` - -## Testing - -Install dev dependencies: - - $ npm install -d - -and execute: - - $ make test - -## License - -(The MIT License) - -Copyright (c) 2010 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/union/node_modules/qs/benchmark.js b/node_modules/union/node_modules/qs/benchmark.js deleted file mode 100644 index 97e2c93..0000000 --- a/node_modules/union/node_modules/qs/benchmark.js +++ /dev/null @@ -1,17 +0,0 @@ - -var qs = require('./'); - -var times = 100000 - , start = new Date - , n = times; - -console.log('times: %d', times); - -while (n--) qs.parse('foo=bar'); -console.log('simple: %dms', new Date - start); - -var start = new Date - , n = times; - -while (n--) qs.parse('user[name][first]=tj&user[name][last]=holowaychuk'); -console.log('nested: %dms', new Date - start); \ No newline at end of file diff --git a/node_modules/union/node_modules/qs/examples.js b/node_modules/union/node_modules/qs/examples.js deleted file mode 100644 index 27617b7..0000000 --- a/node_modules/union/node_modules/qs/examples.js +++ /dev/null @@ -1,51 +0,0 @@ - -/** - * Module dependencies. - */ - -var qs = require('./'); - -var obj = qs.parse('foo'); -console.log(obj) - -var obj = qs.parse('foo=bar=baz'); -console.log(obj) - -var obj = qs.parse('users[]'); -console.log(obj) - -var obj = qs.parse('name=tj&email=tj@vision-media.ca'); -console.log(obj) - -var obj = qs.parse('users[]=tj&users[]=tobi&users[]=jane'); -console.log(obj) - -var obj = qs.parse('user[name][first]=tj&user[name][last]=holowaychuk'); -console.log(obj) - -var obj = qs.parse('users[][name][first]=tj&users[][name][last]=holowaychuk'); -console.log(obj) - -var obj = qs.parse('a=a&a=b&a=c'); -console.log(obj) - -var obj = qs.parse('user[tj]=tj&user[tj]=TJ'); -console.log(obj) - -var obj = qs.parse('user[names]=tj&user[names]=TJ&user[names]=Tyler'); -console.log(obj) - -var obj = qs.parse('user[name][first]=tj&user[name][first]=TJ'); -console.log(obj) - -var obj = qs.parse('user[0]=tj&user[1]=TJ'); -console.log(obj) - -var obj = qs.parse('user[0]=tj&user[]=TJ'); -console.log(obj) - -var obj = qs.parse('user[0]=tj&user[foo]=TJ'); -console.log(obj) - -var str = qs.stringify({ user: { name: 'Tobi', email: 'tobi@learnboost.com' }}); -console.log(str); \ No newline at end of file diff --git a/node_modules/union/node_modules/qs/index.js b/node_modules/union/node_modules/qs/index.js deleted file mode 100644 index d177d20..0000000 --- a/node_modules/union/node_modules/qs/index.js +++ /dev/null @@ -1,2 +0,0 @@ - -module.exports = require('./lib/querystring'); \ No newline at end of file diff --git a/node_modules/union/node_modules/qs/lib/querystring.js b/node_modules/union/node_modules/qs/lib/querystring.js deleted file mode 100644 index 6c72712..0000000 --- a/node_modules/union/node_modules/qs/lib/querystring.js +++ /dev/null @@ -1,264 +0,0 @@ - -/*! - * querystring - * Copyright(c) 2010 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Library version. - */ - -exports.version = '0.4.2'; - -/** - * Object#toString() ref for stringify(). - */ - -var toString = Object.prototype.toString; - -/** - * Cache non-integer test regexp. - */ - -var isint = /^[0-9]+$/; - -function promote(parent, key) { - if (parent[key].length == 0) return parent[key] = {}; - var t = {}; - for (var i in parent[key]) t[i] = parent[key][i]; - parent[key] = t; - return t; -} - -function parse(parts, parent, key, val) { - var part = parts.shift(); - // end - if (!part) { - if (Array.isArray(parent[key])) { - parent[key].push(val); - } else if ('object' == typeof parent[key]) { - parent[key] = val; - } else if ('undefined' == typeof parent[key]) { - parent[key] = val; - } else { - parent[key] = [parent[key], val]; - } - // array - } else { - var obj = parent[key] = parent[key] || []; - if (']' == part) { - if (Array.isArray(obj)) { - if ('' != val) obj.push(val); - } else if ('object' == typeof obj) { - obj[Object.keys(obj).length] = val; - } else { - obj = parent[key] = [parent[key], val]; - } - // prop - } else if (~part.indexOf(']')) { - part = part.substr(0, part.length - 1); - if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key); - parse(parts, obj, part, val); - // key - } else { - if (!isint.test(part) && Array.isArray(obj)) obj = promote(parent, key); - parse(parts, obj, part, val); - } - } -} - -/** - * Merge parent key/val pair. - */ - -function merge(parent, key, val){ - if (~key.indexOf(']')) { - var parts = key.split('[') - , len = parts.length - , last = len - 1; - parse(parts, parent, 'base', val); - // optimize - } else { - if (!isint.test(key) && Array.isArray(parent.base)) { - var t = {}; - for (var k in parent.base) t[k] = parent.base[k]; - parent.base = t; - } - set(parent.base, key, val); - } - - return parent; -} - -/** - * Parse the given obj. - */ - -function parseObject(obj){ - var ret = { base: {} }; - Object.keys(obj).forEach(function(name){ - merge(ret, name, obj[name]); - }); - return ret.base; -} - -/** - * Parse the given str. - */ - -function parseString(str){ - return String(str) - .split('&') - .reduce(function(ret, pair){ - try{ - pair = decodeURIComponent(pair.replace(/\+/g, ' ')); - } catch(e) { - // ignore - } - - var eql = pair.indexOf('=') - , brace = lastBraceInKey(pair) - , key = pair.substr(0, brace || eql) - , val = pair.substr(brace || eql, pair.length) - , val = val.substr(val.indexOf('=') + 1, val.length); - - // ?foo - if ('' == key) key = pair, val = ''; - - return merge(ret, key, val); - }, { base: {} }).base; -} - -/** - * Parse the given query `str` or `obj`, returning an object. - * - * @param {String} str | {Object} obj - * @return {Object} - * @api public - */ - -exports.parse = function(str){ - if (null == str || '' == str) return {}; - return 'object' == typeof str - ? parseObject(str) - : parseString(str); -}; - -/** - * Turn the given `obj` into a query string - * - * @param {Object} obj - * @return {String} - * @api public - */ - -var stringify = exports.stringify = function(obj, prefix) { - if (Array.isArray(obj)) { - return stringifyArray(obj, prefix); - } else if ('[object Object]' == toString.call(obj)) { - return stringifyObject(obj, prefix); - } else if ('string' == typeof obj) { - return stringifyString(obj, prefix); - } else { - return prefix + '=' + obj; - } -}; - -/** - * Stringify the given `str`. - * - * @param {String} str - * @param {String} prefix - * @return {String} - * @api private - */ - -function stringifyString(str, prefix) { - if (!prefix) throw new TypeError('stringify expects an object'); - return prefix + '=' + encodeURIComponent(str); -} - -/** - * Stringify the given `arr`. - * - * @param {Array} arr - * @param {String} prefix - * @return {String} - * @api private - */ - -function stringifyArray(arr, prefix) { - var ret = []; - if (!prefix) throw new TypeError('stringify expects an object'); - for (var i = 0; i < arr.length; i++) { - ret.push(stringify(arr[i], prefix + '[]')); - } - return ret.join('&'); -} - -/** - * Stringify the given `obj`. - * - * @param {Object} obj - * @param {String} prefix - * @return {String} - * @api private - */ - -function stringifyObject(obj, prefix) { - var ret = [] - , keys = Object.keys(obj) - , key; - - for (var i = 0, len = keys.length; i < len; ++i) { - key = keys[i]; - ret.push(stringify(obj[key], prefix - ? prefix + '[' + encodeURIComponent(key) + ']' - : encodeURIComponent(key))); - } - - return ret.join('&'); -} - -/** - * Set `obj`'s `key` to `val` respecting - * the weird and wonderful syntax of a qs, - * where "foo=bar&foo=baz" becomes an array. - * - * @param {Object} obj - * @param {String} key - * @param {String} val - * @api private - */ - -function set(obj, key, val) { - var v = obj[key]; - if (undefined === v) { - obj[key] = val; - } else if (Array.isArray(v)) { - v.push(val); - } else { - obj[key] = [v, val]; - } -} - -/** - * Locate last brace in `str` within the key. - * - * @param {String} str - * @return {Number} - * @api private - */ - -function lastBraceInKey(str) { - var len = str.length - , brace - , c; - for (var i = 0; i < len; ++i) { - c = str[i]; - if (']' == c) brace = false; - if ('[' == c) brace = true; - if ('=' == c && !brace) return i; - } -} diff --git a/node_modules/union/node_modules/qs/package.json b/node_modules/union/node_modules/qs/package.json deleted file mode 100644 index 13e4f5b..0000000 --- a/node_modules/union/node_modules/qs/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "qs", - "description": "querystring parser", - "version": "0.4.2", - "repository": { - "type": "git", - "url": "git://github.com/visionmedia/node-querystring.git" - }, - "devDependencies": { - "mocha": "*", - "should": "*" - }, - "author": { - "name": "TJ Holowaychuk", - "email": "tj@vision-media.ca", - "url": "http://tjholowaychuk.com" - }, - "main": "index", - "engines": { - "node": "*" - }, - "_id": "qs@0.4.2", - "dependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "_from": "qs@0.4.x" -} diff --git a/node_modules/union/node_modules/qs/test/mocha.opts b/node_modules/union/node_modules/qs/test/mocha.opts deleted file mode 100644 index 521cbb2..0000000 --- a/node_modules/union/node_modules/qs/test/mocha.opts +++ /dev/null @@ -1,2 +0,0 @@ ---require should ---ui exports diff --git a/node_modules/union/node_modules/qs/test/parse.js b/node_modules/union/node_modules/qs/test/parse.js deleted file mode 100644 index f219e27..0000000 --- a/node_modules/union/node_modules/qs/test/parse.js +++ /dev/null @@ -1,167 +0,0 @@ - -/** - * Module dependencies. - */ - -var qs = require('../'); - -module.exports = { - 'test basics': function(){ - qs.parse('0=foo').should.eql({ '0': 'foo' }); - - qs.parse('foo=c++') - .should.eql({ foo: 'c ' }); - - qs.parse('a[>=]=23') - .should.eql({ a: { '>=': '23' }}); - - qs.parse('a[<=>]==23') - .should.eql({ a: { '<=>': '=23' }}); - - qs.parse('a[==]=23') - .should.eql({ a: { '==': '23' }}); - - qs.parse('foo') - .should.eql({ foo: '' }); - - qs.parse('foo=bar') - .should.eql({ foo: 'bar' }); - - qs.parse('foo%3Dbar=baz') - .should.eql({ foo: 'bar=baz' }); - - qs.parse(' foo = bar = baz ') - .should.eql({ ' foo ': ' bar = baz ' }); - - qs.parse('foo=bar=baz') - .should.eql({ foo: 'bar=baz' }); - - qs.parse('foo=bar&bar=baz') - .should.eql({ foo: 'bar', bar: 'baz' }); - - qs.parse('foo=bar&baz') - .should.eql({ foo: 'bar', baz: '' }); - - qs.parse('cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World') - .should.eql({ - cht: 'p3' - , chd: 't:60,40' - , chs: '250x100' - , chl: 'Hello|World' - }); - }, - - 'test nesting': function(){ - qs.parse('ops[>=]=25') - .should.eql({ ops: { '>=': '25' }}); - - qs.parse('user[name]=tj') - .should.eql({ user: { name: 'tj' }}); - - qs.parse('user[name][first]=tj&user[name][last]=holowaychuk') - .should.eql({ user: { name: { first: 'tj', last: 'holowaychuk' }}}); - }, - - 'test escaping': function(){ - qs.parse('foo=foo%20bar') - .should.eql({ foo: 'foo bar' }); - }, - - 'test arrays': function(){ - qs.parse('images[]') - .should.eql({ images: [] }); - - qs.parse('user[]=tj') - .should.eql({ user: ['tj'] }); - - qs.parse('user[]=tj&user[]=tobi&user[]=jane') - .should.eql({ user: ['tj', 'tobi', 'jane'] }); - - qs.parse('user[names][]=tj&user[names][]=tyler') - .should.eql({ user: { names: ['tj', 'tyler'] }}); - - qs.parse('user[names][]=tj&user[names][]=tyler&user[email]=tj@vision-media.ca') - .should.eql({ user: { names: ['tj', 'tyler'], email: 'tj@vision-media.ca' }}); - - qs.parse('items=a&items=b') - .should.eql({ items: ['a', 'b'] }); - - qs.parse('user[names]=tj&user[names]=holowaychuk&user[names]=TJ') - .should.eql({ user: { names: ['tj', 'holowaychuk', 'TJ'] }}); - - qs.parse('user[name][first]=tj&user[name][first]=TJ') - .should.eql({ user: { name: { first: ['tj', 'TJ'] }}}); - - var o = qs.parse('existing[fcbaebfecc][name][last]=tj') - o.should.eql({ existing: { 'fcbaebfecc': { name: { last: 'tj' }}}}) - Array.isArray(o.existing).should.be.false; - }, - - 'test right-hand brackets': function(){ - qs.parse('pets=["tobi"]') - .should.eql({ pets: '["tobi"]' }); - - qs.parse('operators=[">=", "<="]') - .should.eql({ operators: '[">=", "<="]' }); - - qs.parse('op[>=]=[1,2,3]') - .should.eql({ op: { '>=': '[1,2,3]' }}); - - qs.parse('op[>=]=[1,2,3]&op[=]=[[[[1]]]]') - .should.eql({ op: { '>=': '[1,2,3]', '=': '[[[[1]]]]' }}); - }, - - 'test duplicates': function(){ - qs.parse('items=bar&items=baz&items=raz') - .should.eql({ items: ['bar', 'baz', 'raz'] }); - }, - - 'test empty': function(){ - qs.parse('').should.eql({}); - qs.parse(undefined).should.eql({}); - qs.parse(null).should.eql({}); - }, - - 'test arrays with indexes': function(){ - qs.parse('foo[0]=bar&foo[1]=baz').should.eql({ foo: ['bar', 'baz'] }); - qs.parse('foo[1]=bar&foo[0]=baz').should.eql({ foo: ['baz', 'bar'] }); - qs.parse('foo[base64]=RAWR').should.eql({ foo: { base64: 'RAWR' }}); - qs.parse('foo[64base]=RAWR').should.eql({ foo: { '64base': 'RAWR' }}); - }, - - 'test arrays becoming objects': function(){ - qs.parse('foo[0]=bar&foo[bad]=baz').should.eql({ foo: { 0: "bar", bad: "baz" }}); - qs.parse('foo[bad]=baz&foo[0]=bar').should.eql({ foo: { 0: "bar", bad: "baz" }}); - }, - - 'test bleed-through of Array native properties/methods': function(){ - Array.prototype.protoProperty = true; - Array.prototype.protoFunction = function () {}; - qs.parse('foo=bar').should.eql({ foo: 'bar' }); - }, - - 'test malformed uri': function(){ - qs.parse('{%:%}').should.eql({ '{%:%}': '' }); - qs.parse('foo=%:%}').should.eql({ 'foo': '%:%}' }); - }, - - 'test semi-parsed': function(){ - qs.parse({ 'user[name]': 'tobi' }) - .should.eql({ user: { name: 'tobi' }}); - - qs.parse({ 'user[name]': 'tobi', 'user[email][main]': 'tobi@lb.com' }) - .should.eql({ user: { name: 'tobi', email: { main: 'tobi@lb.com' } }}); - } - - // 'test complex': function(){ - // qs.parse('users[][name][first]=tj&users[foo]=bar') - // .should.eql({ - // users: [ { name: 'tj' }, { name: 'tobi' }, { foo: 'bar' }] - // }); - // - // qs.parse('users[][name][first]=tj&users[][name][first]=tobi') - // .should.eql({ - // users: [ { name: 'tj' }, { name: 'tobi' }] - // }); - // } -}; diff --git a/node_modules/union/node_modules/qs/test/stringify.js b/node_modules/union/node_modules/qs/test/stringify.js deleted file mode 100644 index c2195cb..0000000 --- a/node_modules/union/node_modules/qs/test/stringify.js +++ /dev/null @@ -1,103 +0,0 @@ - -/** - * Module dependencies. - */ - -var qs = require('../') - , should = require('should') - , str_identities = { - 'basics': [ - { str: 'foo=bar', obj: {'foo' : 'bar'}}, - { str: 'foo=%22bar%22', obj: {'foo' : '\"bar\"'}}, - { str: 'foo=', obj: {'foo': ''}}, - { str: 'foo=1&bar=2', obj: {'foo' : '1', 'bar' : '2'}}, - { str: 'my%20weird%20field=q1!2%22\'w%245%267%2Fz8)%3F', obj: {'my weird field': "q1!2\"'w$5&7/z8)?"}}, - { str: 'foo%3Dbaz=bar', obj: {'foo=baz': 'bar'}}, - { str: 'foo=bar&bar=baz', obj: {foo: 'bar', bar: 'baz'}} - ], - 'escaping': [ - { str: 'foo=foo%20bar', obj: {foo: 'foo bar'}}, - { str: 'cht=p3&chd=t%3A60%2C40&chs=250x100&chl=Hello%7CWorld', obj: { - cht: 'p3' - , chd: 't:60,40' - , chs: '250x100' - , chl: 'Hello|World' - }} - ], - 'nested': [ - { str: 'foo[]=bar&foo[]=quux', obj: {'foo' : ['bar', 'quux']}}, - { str: 'foo[]=bar', obj: {foo: ['bar']}}, - { str: 'foo[]=1&foo[]=2', obj: {'foo' : ['1', '2']}}, - { str: 'foo=bar&baz[]=1&baz[]=2&baz[]=3', obj: {'foo' : 'bar', 'baz' : ['1', '2', '3']}}, - { str: 'foo[]=bar&baz[]=1&baz[]=2&baz[]=3', obj: {'foo' : ['bar'], 'baz' : ['1', '2', '3']}}, - { str: 'x[y][z]=1', obj: {'x' : {'y' : {'z' : '1'}}}}, - { str: 'x[y][z][]=1', obj: {'x' : {'y' : {'z' : ['1']}}}}, - { str: 'x[y][z]=2', obj: {'x' : {'y' : {'z' : '2'}}}}, - { str: 'x[y][z][]=1&x[y][z][]=2', obj: {'x' : {'y' : {'z' : ['1', '2']}}}}, - { str: 'x[y][][z]=1', obj: {'x' : {'y' : [{'z' : '1'}]}}}, - { str: 'x[y][][z][]=1', obj: {'x' : {'y' : [{'z' : ['1']}]}}}, - { str: 'x[y][][z]=1&x[y][][w]=2', obj: {'x' : {'y' : [{'z' : '1', 'w' : '2'}]}}}, - { str: 'x[y][][v][w]=1', obj: {'x' : {'y' : [{'v' : {'w' : '1'}}]}}}, - { str: 'x[y][][z]=1&x[y][][v][w]=2', obj: {'x' : {'y' : [{'z' : '1', 'v' : {'w' : '2'}}]}}}, - { str: 'x[y][][z]=1&x[y][][z]=2', obj: {'x' : {'y' : [{'z' : '1'}, {'z' : '2'}]}}}, - { str: 'x[y][][z]=1&x[y][][w]=a&x[y][][z]=2&x[y][][w]=3', obj: {'x' : {'y' : [{'z' : '1', 'w' : 'a'}, {'z' : '2', 'w' : '3'}]}}}, - { str: 'user[name][first]=tj&user[name][last]=holowaychuk', obj: { user: { name: { first: 'tj', last: 'holowaychuk' }}}} - ], - 'errors': [ - { obj: 'foo=bar', message: 'stringify expects an object' }, - { obj: ['foo', 'bar'], message: 'stringify expects an object' } - ], - 'numbers': [ - { str: 'limit[]=1&limit[]=2&limit[]=3', obj: { limit: [1, 2, '3'] }}, - { str: 'limit=1', obj: { limit: 1 }} - ] - }; - - -// Assert error -function err(fn, msg){ - var err; - try { - fn(); - } catch (e) { - should.equal(e.message, msg); - return; - } - throw new Error('no exception thrown, expected "' + msg + '"'); -} - -function test(type) { - var str, obj; - for (var i = 0; i < str_identities[type].length; i++) { - str = str_identities[type][i].str; - obj = str_identities[type][i].obj; - qs.stringify(obj).should.eql(str); - } -} - -module.exports = { - 'test basics': function() { - test('basics'); - }, - - 'test escaping': function() { - test('escaping'); - }, - - 'test nested': function() { - test('nested'); - }, - - 'test numbers': function(){ - test('numbers'); - }, - - 'test errors': function() { - var obj, message; - for (var i = 0; i < str_identities['errors'].length; i++) { - message = str_identities['errors'][i].message; - obj = str_identities['errors'][i].obj; - err(function(){ qs.stringify(obj) }, message); - } - } -}; \ No newline at end of file diff --git a/node_modules/union/package.json b/node_modules/union/package.json deleted file mode 100644 index ca00666..0000000 --- a/node_modules/union/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "union", - "description": "A hybrid buffered / streaming middleware kernel backwards compatible with connect.", - "version": "0.3.0", - "author": { - "name": "Nodejitsu Inc.", - "email": "info@nodejitsu.com" - }, - "contributors": [ - { - "name": "Charlie Robbins", - "email": "charlie.robbins@gmail.com" - }, - { - "name": "Nuno Job", - "email": "nunojobpinto@gmail.com" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/flatiron/union.git" - }, - "dependencies": { - "pkginfo": "0.2.x", - "qs": "0.4.x" - }, - "devDependencies": { - "ecstatic": "git://github.com/jesusabdullah/node-ecstatic.git", - "director": "1.x.x", - "request": "2.x.x", - "vows": "0.6.x" - }, - "scripts": { - "test": "vows test/*-test.js --spec -i" - }, - "main": "./lib", - "engines": { - "node": ">= 0.4.0" - }, - "_id": "union@0.3.0", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "dist": { - "shasum": "17f3fd5c0995372e0753bc3857acfb8f30c9ea25" - }, - "_from": "union@git://github.com/flatiron/union.git" -} diff --git a/node_modules/union/test/after-test.js b/node_modules/union/test/after-test.js deleted file mode 100644 index b37d9c2..0000000 --- a/node_modules/union/test/after-test.js +++ /dev/null @@ -1,38 +0,0 @@ -var assert = require('assert'), - vows = require('vows'), - request = require('request'), - union = require('../'); - -function stream_callback(cb) { - return function () { - var stream = new union.ResponseStream(); - - stream.once("pipe", function (req) { - console.log(req); - return cb ? cb(null,req) : undefined; - }); - - return stream; - }; -} - -vows.describe('union/after').addBatch({ - 'When using `union`': { - 'a union server with after middleware': { - topic: function () { - var self = this; - - union.createServer({ - after: [ stream_callback(), stream_callback(self.callback) ] - }).listen(9000, function () { - request.get('http://localhost:9000'); - }); - }, - 'should preserve the request until the last call': function (req) { - assert.equal(req.req.httpVersion, '1.1'); - assert.equal(req.req.url, '/'); - assert.equal(req.req.method, 'GET'); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/union/test/double-write-test.js b/node_modules/union/test/double-write-test.js deleted file mode 100644 index a08a9cd..0000000 --- a/node_modules/union/test/double-write-test.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * simple-test.js: Simple tests for basic streaming and non-streaming HTTP requests with union. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - fs = require('fs'), - path = require('path'), - request = require('request'), - vows = require('vows'), - union = require('../lib/index'), - macros = require('./helpers/macros'); - -var doubleWrite = false, - server; - -server = union.createServer({ - before: [ - function (req, res) { - res.json(200, { 'hello': 'world' }); - res.emit('next'); - }, - function (req, res) { - doubleWrite = true; - res.json(200, { 'hello': 'world' }); - res.emit('next'); - } - ] -}); - - -vows.describe('union/simple').addBatch({ - "When using union": { - "an http server which attempts to write to the response twice": { - topic: function () { - server.listen(9091, this.callback); - }, - "a GET request to `/foo`": { - topic: function () { - request({ uri: 'http://localhost:9091/foo' }, this.callback); - }, - "it should respond with `{ 'hello': 'world' }`": function (err, res, body) { - macros.assertValidResponse(err, res); - assert.deepEqual(JSON.parse(body), { 'hello': 'world' }); - }, - "it should not write to the response twice": function () { - assert.isFalse(doubleWrite); - } - } - } - } -}).addBatch({ - "When the tests are over": { - "the server should close": function () { - server.close(); - } - } -}).export(module); - diff --git a/node_modules/union/test/ecstatic-test.js b/node_modules/union/test/ecstatic-test.js deleted file mode 100644 index 10c3063..0000000 --- a/node_modules/union/test/ecstatic-test.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * simple-test.js: Simple tests for basic streaming and non-streaming HTTP requests with union. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - ecstatic = require('ecstatic')(__dirname + '/fixtures/static'), - request = require('request'), - vows = require('vows'), - union = require('../'); - -vows.describe('union/ecstatic').addBatch({ - "When using union with ecstatic": { - topic: function () { - union.createServer({ - before: [ - ecstatic - ] - }).listen(8081, this.callback); - }, - "a request to /some-file.txt": { - topic: function () { - request({ uri: 'http://localhost:8081/some-file.txt' }, this.callback); - }, - "should respond with `hello world`": function (err, res, body) { - assert.isNull(err); - assert.equal(body, 'hello world\n'); - } - }, - "a request to /404.txt (which does not exist)": { - topic: function () { - request({ uri: 'http://localhost:8081/404.txt' }, this.callback); - }, - "should respond with 404 status code": function (err, res, body) { - assert.isNull(err); - assert.equal(res.statusCode, 404); - } - } - } -}).export(module); - diff --git a/node_modules/union/test/fixtures/static/some-file.txt b/node_modules/union/test/fixtures/static/some-file.txt deleted file mode 100644 index 3b18e51..0000000 --- a/node_modules/union/test/fixtures/static/some-file.txt +++ /dev/null @@ -1 +0,0 @@ -hello world diff --git a/node_modules/union/test/helpers/macros.js b/node_modules/union/test/helpers/macros.js deleted file mode 100644 index 7bec392..0000000 --- a/node_modules/union/test/helpers/macros.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - * macros.js: Simple test macros - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'); - -var macros = exports; - -macros.assertValidResponse = function (err, res) { - assert.isTrue(!err); - assert.equal(res.statusCode, 200); -}; - diff --git a/node_modules/union/test/simple-test.js b/node_modules/union/test/simple-test.js deleted file mode 100644 index ae02fe4..0000000 --- a/node_modules/union/test/simple-test.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * simple-test.js: Simple tests for basic streaming and non-streaming HTTP requests with union. - * - * (C) 2011, Nodejitsu Inc. - * MIT LICENSE - * - */ - -var assert = require('assert'), - fs = require('fs'), - path = require('path'), - spawn = require('child_process').spawn, - request = require('request'), - vows = require('vows'), - macros = require('./helpers/macros'); - -var examplesDir = path.join(__dirname, '..', 'examples', 'simple'), - simpleScript = path.join(examplesDir, 'simple.js'), - pkg = JSON.parse(fs.readFileSync(path.join(__dirname, '..', 'package.json'), 'utf8')), - fooURI = 'http://localhost:9090/foo', - server; - -vows.describe('union/simple').addBatch({ - "When using union": { - "a simple http server": { - topic: function () { - server = spawn(process.argv[0], [simpleScript]); - server.stdout.on('data', this.callback.bind(this, null)); - }, - "a GET request to `/foo`": { - topic: function () { - request({ uri: fooURI }, this.callback); - }, - "it should respond with `hello world`": function (err, res, body) { - macros.assertValidResponse(err, res); - assert.equal(body, 'hello world\n'); - }, - "it should respond with 'x-powered-by': 'union '": function (err, res, body) { - assert.isNull(err); - assert.equal(res.headers['x-powered-by'], 'union ' + pkg.version); - } - }, - "a POST request to `/foo`": { - topic: function () { - request.post({ uri: fooURI }, this.callback); - }, - "it should respond with `wrote to a stream!`": function (err, res, body) { - macros.assertValidResponse(err, res); - assert.equal(body, 'wrote to a stream!'); - } - } - } - } -}).addBatch({ - "When the tests are over": { - "the server should close": function () { - server.kill(); - } - } -}).export(module); - diff --git a/node_modules/union/test/status-code-test.js b/node_modules/union/test/status-code-test.js deleted file mode 100644 index ed49d86..0000000 --- a/node_modules/union/test/status-code-test.js +++ /dev/null @@ -1,31 +0,0 @@ -var assert = require('assert'), - request = require('request'), - vows = require('vows'), - union = require('../'); - -vows.describe('union/status-code').addBatch({ - 'When using `union`': { - 'with a server setting `res.statusCode`': { - topic: function () { - var server = union.createServer({ - before: [ - function (req, res) { - res.statusCode = 404; - res.end(); - } - ] - }); - server.listen(9091, this.callback); - }, - 'and sending a request': { - topic: function () { - request('http://localhost:9091/', this.callback); - }, - 'it should have proper `statusCode` set': function (err, res, body) { - assert.isTrue(!err); - assert.equal(res.statusCode, 404); - } - } - } - } -}).export(module); diff --git a/node_modules/union/test/streaming-test.js b/node_modules/union/test/streaming-test.js deleted file mode 100644 index 4ba5ad0..0000000 --- a/node_modules/union/test/streaming-test.js +++ /dev/null @@ -1,62 +0,0 @@ -var assert = require('assert'), - fs = require('fs'), - path = require('path'), - request = require('request'), - vows = require('vows'), - union = require('../'); - -vows.describe('union/streaming').addBatch({ - 'When using `union`': { - 'a simple union server': { - topic: function () { - var self = this; - - union.createServer({ - before: [ - function (req, res, next) { - req.on('end', function () { - self.callback(null, req.chunks); - }); - } - ], - stream: true - }).listen(9000, function () { - request.post('http://localhost:9000').write('hello world'); - }); - }, - 'should receive complete POST data': function (chunks) { - assert.equal(chunks, 'hello world'); - } - }, - "a simple pipe to a file": { - topic: function () { - var self = this; - - union.createServer({ - before: [ - function (req, res, next) { - var filename = path.join(__dirname, 'fixtures', 'pipe-write-test.txt'), - writeStream = fs.createWriteStream(filename); - - req.pipe(writeStream); - writeStream.on('close', function () { - res.writeHead(200); - fs.createReadStream(filename).pipe(res); - }); - } - ] - }).listen(9044, function () { - request({ - method: 'POST', - uri: 'http://localhost:9044', - body: 'hello world' - }, self.callback); - }); - }, - 'should receive complete POST data': function (err, res, body) { - assert.equal(body, 'hello world'); - } - } - } -}).export(module); - diff --git a/node_modules/union/union.png b/node_modules/union/union.png deleted file mode 100644 index 96c6e66..0000000 Binary files a/node_modules/union/union.png and /dev/null differ diff --git a/node_modules/vows/.npmignore b/node_modules/vows/.npmignore deleted file mode 100644 index 3c3629e..0000000 --- a/node_modules/vows/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/node_modules/vows/.travis.yml b/node_modules/vows/.travis.yml deleted file mode 100644 index aa1dc39..0000000 --- a/node_modules/vows/.travis.yml +++ /dev/null @@ -1,6 +0,0 @@ -language: node_js - -node_js: - - 0.4 - - 0.6 - diff --git a/node_modules/vows/LICENSE b/node_modules/vows/LICENSE deleted file mode 100644 index a1edd93..0000000 --- a/node_modules/vows/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2009 cloudhead - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/vows/Makefile b/node_modules/vows/Makefile deleted file mode 100644 index 6bf8991..0000000 --- a/node_modules/vows/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# -# Run all tests -# -test: - @@bin/vows test/* - -.PHONY: test install diff --git a/node_modules/vows/README.md b/node_modules/vows/README.md deleted file mode 100644 index bfa410e..0000000 --- a/node_modules/vows/README.md +++ /dev/null @@ -1,65 +0,0 @@ -Vows -==== - -> Asynchronous BDD & continuous integration for node.js - -#### # - -introduction ------------- -There are two reasons why we might want asynchronous testing. The first, and obvious reason is that node.js is asynchronous, and therefore our tests need to be. The second reason is to make test suites which target I/O libraries run much faster. - -_Vows_ is an experiment in making this possible, while adding a minimum of overhead. - -synopsis --------- - - var vows = require('vows'), - assert = require('assert'); - - vows.describe('Deep Thought').addBatch({ - 'An instance of DeepThought': { - topic: new DeepThought, - - 'should know the answer to the ultimate question of life': function (deepThought) { - assert.equal (deepThought.question('what is the answer to the universe?'), 42); - } - } - }); - -coverage reporting ------------------- -Code coverage reporting is available if _instrumented_ code is detected. Currently only _instrumentation_ via [node-jscoverage](https://github.com/visionmedia/node-jscoverage) is supported. When _instrumented_ code is detected and coverage reporting is enabled using any of the `--cover-plain`, `--cover-html`, or `--cover-json` options a code coverage map is generated. - -### downloading and installing [node-jscoverage](https://github.com/visionmedia/node-jscoverage) -[node-jscoverage](https://github.com/visionmedia/node-jscoverage) is a binary package that needs to be compiled from source: - - $ git clone https://github.com/visionmedia/node-jscoverage.git - $ cd node-jscoverage/ - $ ./configure - checking for a BSD-compatible install... /usr/bin/install -c - checking whether build environment is sane... yes - [...] - $ make && sudo make install - -### instrumenting with jscoverage - - $ jscoverage myfile.js myfile-instrumented.js - -installation ------------- - - $ npm install vows - -documentation -------------- - -Head over to - -authors -------- - -Alexis Sellier <>, Charlie Robbins, - -*...and many others* - diff --git a/node_modules/vows/bin/vows b/node_modules/vows/bin/vows deleted file mode 100755 index 0a0bcd1..0000000 --- a/node_modules/vows/bin/vows +++ /dev/null @@ -1,560 +0,0 @@ -#!/usr/bin/env node - -var path = require('path'), - fs = require('fs'), - util = require('util'), - events = require('events'); - -// -// Attempt to load Coffee-Script. If it's not available, continue on our -// merry way, if it is available, set it up so we can include `*.coffee` -// scripts and start searching for them. -// -var fileExt, specFileExt; - -try { - var coffee = require('coffee-script'); - if (require.extensions) { - require.extensions['.coffee'] = function (module, filename) { - var content = coffee.compile(fs.readFileSync(filename, 'utf8')); - return module._compile(content, filename); - }; - } else { - require.registerExtension('.coffee', function (content) { return coffee.compile(content) }); - } - fileExt = /\.(js|coffee)$/; - specFileExt = /[.(-|_)](test|spec)\.(js|coffee)$/; -} catch (_) { - fileExt = /\.js$/; - specFileExt = /[.(-|_)](test|spec)\.js$/; -} - -var inspect = require('eyes').inspector({ - stream: null, - styles: { string: 'grey', regexp: 'grey' } -}); - -var vows = require('../lib/vows'); -var cutils = require('../lib/vows/console'); -var stylize = require('../lib/vows/console').stylize; -var _reporter = require('../lib/vows/reporters/dot-matrix'), reporter = { - name: _reporter.name -}; -var _coverage; - -var help = [ - "usage: vows [FILE, ...] [options]", - "", - "options:", - " -v, --verbose Enable verbose output", - " -w, --watch Watch mode", - " -s, --silent Don't report", - " -i, --isolate Run each test in it's own vows process", - " -m PATTERN Only run tests matching the PATTERN string", - " -r PATTERN Only run tests matching the PATTERN regexp", - " --json Use JSON reporter", - " --spec Use Spec reporter", - " --dot-matrix Use Dot-Matrix reporter", - " --xunit Use xUnit reporter", - " --cover-plain Print plain coverage map if detected", - " --cover-html Write coverage map to \"coverage.html\"", - " --cover-json Write unified coverage map to \"coverage.json\"", - " --cover-xml Write coverage map to \"coverage.xml\" in Emma xml", - " --no-color Don't use terminal colors", - " --version Show version", - " -h, --help You're staring at it" -].join('\n'); - -var options = { - reporter: reporter, - matcher: /.*/, - watch: false, - coverage: false, - isolate: false, - nocolor: !process.stdout.isTTY -}; - -var files = []; - -// Get rid of process runner -// ('node' in most cases) -var arg, args = [], argv = process.argv.slice(2); - -// Current directory index, -// and path of test folder. -var root, testFolder; - -// -// Parse command-line parameters -// -while (arg = argv.shift()) { - if (arg === __filename) { continue } - - if (arg[0] !== '-') { - args.push(arg); - } else { - arg = arg.match(/^--?(.+)/)[1]; - - if (arg[0] === 'r') { - options.matcher = new(RegExp)(argv.shift()); - } else if (arg[0] === 'm') { - options.matcher = (function (str) { // Create an escaped RegExp - var specials = '. * + ? | ( ) [ ] { } \\ ^ ? ! = : $'.split(' ').join('|\\'), - regex = new(RegExp)('(\\' + specials + ')', 'g'); - return new(RegExp)(str.replace(regex, '\\$1')); - })(argv.shift()); - } else if (arg in options) { - options[arg] = true; - } else { - switch (arg) { - case 'json': - _reporter = require('../lib/vows/reporters/json'); - break; - case 'spec': - _reporter = require('../lib/vows/reporters/spec'); - break; - case 'dot-matrix': - _reporter = require('../lib/vows/reporters/dot-matrix'); - break; - case 'silent': - case 's': - _reporter = require('../lib/vows/reporters/silent'); - break; - case 'xunit': - _reporter = require('../lib/vows/reporters/xunit'); - break; - case 'cover-plain': - options.coverage = true; - _coverage = require('../lib/vows/coverage/report-plain'); - break; - case 'cover-html': - options.coverage = true; - _coverage = require('../lib/vows/coverage/report-html'); - break; - case 'cover-json': - options.coverage = true; - _coverage = require('../lib/vows/coverage/report-json'); - break; - case 'cover-xml': - options.coverage = true; - _coverage = require('../lib/vows/coverage/report-xml'); - break; - case 'verbose': - case 'v': - options.verbose = true; - break; - case 'watch': - case 'w': - options.watch = true; - break; - case 'supress-stdout': - options.supressStdout = true; - break; - case 'isolate': - case 'i': - options.isolate = true; - break; - case 'no-color': - options.nocolor = true; - break; - case 'color': - options.nocolor = false; - break; - case 'no-error': - options.error = false; - break; - case 'version': - console.log('vows ' + vows.version); - process.exit(0); - case 'help': - case 'h': - console.log(help); - process.exit(0); - break; - } - } - } -} - -if (options.nocolor) { - cutils.nocolor = true; - inspect = require('eyes').inspector({ stream: null, styles: false }); -} - -if (options.supressStdout) { - _reporter.setStream && _reporter.setStream(process.stdout); - var devNullStream = fs.createWriteStream('/dev/null'); - process.__defineGetter__('stdout', function () { - return devNullStream; - }); -} - -if (options.watch) { - options.reporter = reporter = require('../lib/vows/reporters/watch'); -} - -msg('bin', 'argv', args); -msg('bin', 'options', { reporter: options.reporter.name, matcher: options.matcher }); - -if (args.length === 0 || options.watch) { - msg('bin', 'discovering', 'folder structure'); - root = fs.readdirSync('.'); - - if (root.indexOf('test') !== -1) { - testFolder = 'test'; - } else if (root.indexOf('spec') !== -1) { - testFolder = 'spec'; - } else { - abort("runner", "couldn't find test folder"); - } - msg('bin', 'discovered', "./" + testFolder); - if (args.length === 0) { - args = paths(testFolder).filter(function (f) { - return specFileExt.test(f); - }); - - if (options.watch) { - args = args.concat(paths('lib'), paths('src')); - } - } -} - -if (! options.watch) { - reporter.report = function (data, filename) { - switch (data[0]) { - case 'subject': - case 'vow': - case 'context': - case 'error': - _reporter.report(data, filename); - break; - case 'end': - (options.verbose || _reporter.name === 'json') && - _reporter.report(data); - break; - case 'finish': - options.verbose ? - _reporter.print('\n') - : - _reporter.print(' '); - break; - } - }; - reporter.reset = function () { _reporter.reset && _reporter.reset() }; - reporter.print = _reporter.print; - - files = args.map(function (a) { - return (!a.match(/^\//)) - ? path.join(process.cwd(), a.replace(fileExt, '')) - : a.replace(fileExt, ''); - }); - - runSuites(importSuites(files), function (results) { - var status = results.errored ? 2 : (results.broken ? 1 : 0); - - !options.verbose && _reporter.print('\n'); - msg('runner', 'finish'); - _reporter.report(['finish', results], { - write: function (str) { - util.print(str.replace(/^\n\n/, '\n')); - } - }); - try { - if (options.coverage === true && _$jscoverage !== undefined) { - _coverage.report(_$jscoverage); - } - } catch (err) { - // ignore the undefined jscoverage - } - if (process.stdout.write('')) { // Check if stdout is drained - process.exit(status); - } else { - process.stdout.on('drain', function () { - process.exit(status); - }); - } - }); -} else { - // - // Watch mode - // - (function () { - var pendulum = [ - '. ', '.. ', '... ', ' ...', - ' ..', ' .', ' .', ' ..', - '... ', '.. ', '. ' - ]; - var strobe = ['.', ' ']; - var status, - cue, - current = 0, - running = 0, - lastRun, - colors = ['32m', '33m', '31m'], - timer = setInterval(tick, 100); - process.on('uncaughtException', exception); - process.on('exit', cleanup); - process.on('SIGINT', function () { - process.exit(0); - }); - process.on('SIGQUIT', function () { - changed(); - }); - - cursorHide(); - - // Run every 100ms - function tick() { - if (running && (cue !== strobe)) { - cue = strobe, current = 0; - } else if (!running && (cue !== pendulum)) { - cue = pendulum, current = 0; - } - - eraseLine(); - lastRun && !running && esc(colors[status.errored ? 2 : (status.broken ? 1 : 0)]); - print(cue[current]); - - if (current == cue.length - 1) { current = -1 } - - current ++; - esc('39m'); - cursorRestore(); - } - - // - // Utility functions - // - function print(str) { util.print(str) } - function esc(str) { print("\x1b[" + str) } - function eraseLine() { esc("0K") } - function cursorRestore() { esc("0G") } - function cursorHide() { esc("?25l") } - function cursorShow() { esc("?25h") } - function cleanup() { eraseLine(), cursorShow(), clearInterval(timer), print('\n') } - function exception(err) { print(err.stack || err.message || JSON.stringify(err)), running = 0} - - // - // Get a matching test for a given file - // - function getMatchingTest(file, join) { - join || (join = '-'); - var testFile; - if (specFileExt.test(file)) { - testFile = path.join(testFolder, file); - } - else { - var root, extension; - _s = file.split('.'), root = _s[0], extension = _s[1]; - testFile = path.join(testFolder, root + join + testFolder + "." + extension); - } - - try { - fs.statSync(testFile); - } catch (e) { - if (join == '-') { - return getMatchingTest(file, '_'); - } - else { - msg('watcher', 'no equivalence found, running all tests.'); - testFile = null; - } - } - return testFile; - } - - // - // Called when a file has been modified. - // Run the matching tests and change the status. - // - function changed(file) { - status = { honored: 0, broken: 0, errored: 0, pending: 0 }; - - msg('watcher', 'detected change in', file); - - file = getMatchingTest(file); - - var files = (specFileExt.test(file) ? [file] : paths(testFolder)).map(function (p) { - return path.join(process.cwd(), p); - }).filter(function (p) { - return specFileExt.test(p); - }).map(function (p) { - var cache = require.main.moduleCache || require.cache; - if (cache[p]) { delete(cache[p]) } - return p; - }).map(function (p) { - return p.replace(fileExt, ''); - }); - - running ++; - - runSuites(importSuites(files), function (results) { - delete(results.time); - print(cutils.result(results).join('') + '\n\n'); - lastRun = new(Date); - status = results; - running --; - }); - } - - msg('watcher', 'watching', args); - - // - // Watch all relevant files, - // and call `changed()` on change. - // - args.forEach(function (p) { - fs.watchFile(p, function (current, previous) { - if (new(Date)(current.mtime).valueOf() === - new(Date)(previous.mtime).valueOf()) { return } - else { - changed(p); - } - }); - }); - })(); -} - -function runSuites(suites, callback) { - var results = { - honored: 0, - broken: 0, - errored: 0, - pending: 0, - total: 0, - time: 0 - }; - reporter.reset(); - - (function run(suites, callback) { - var suite = suites.shift(); - if (suite) { - msg('runner', "running", suite.subject + ' ', options.watch ? false : true); - suite.run(options, function (result) { - Object.keys(result).forEach(function (k) { - results[k] += result[k]; - }); - run(suites, callback); - }); - } else { - callback(results); - } - })(suites, callback); -} - -function importSuites(files) { - msg(options.watcher ? 'watcher' : 'runner', 'loading', files); - - var spawn = require('child_process').spawn; - - function cwdname(f) { - return f.replace(process.cwd() + '/', '') + '.js'; - } - - function wrapSpawn(f) { - f = cwdname(f); - return function (options, callback) { - var args = [process.argv[1], '--json', '--supress-stdout', f], - p = spawn(process.execPath, args), - result; - - p.on('exit', function (code) { - callback( - !result ? - {errored: 1, total: 1} - : - result - ); - }); - - var buffer = []; - p.stdout.on('data', function (data) { - data = data.toString().split(/\n/g); - if (data.length == 1) { - buffer.push(data[0]); - } else { - data[0] = buffer.concat(data[0]).join(''); - buffer = [data.pop()]; - - data.forEach(function (data) { - if (data) { - data = JSON.parse(data); - if (data && data[0] === 'finish') { - result = data[1]; - } else { - reporter.report(data); - } - } - }); - } - }); - - p.stderr.pipe(process.stderr); - } - } - - return files.reduce(options.isolate ? function (suites, f) { - return suites.concat({ - run: wrapSpawn(f) - }); - } : function (suites, f) { - var obj = require(f); - return suites.concat(Object.keys(obj).map(function (s) { - obj[s]._filename = cwdname(f); - return obj[s]; - })); - }, []) -} - -// -// Recursively traverse a hierarchy, returning -// a list of all relevant .js files. -// -function paths(dir) { - var paths = []; - - try { fs.statSync(dir) } - catch (e) { return [] } - - (function traverse(dir, stack) { - stack.push(dir); - fs.readdirSync(stack.join('/')).forEach(function (file) { - // - // Skip dotfiles and `vendor` directory before `fs.stat()`ing them. - // Not doing so causes race conditions with Emacs buffer files - // (`.#filename.js`). - // - if (file[0] == '.' || file === 'vendor') { - return; - } - - var path = stack.concat([file]).join('/'), - stat = fs.statSync(path); - - if (stat.isFile() && fileExt.test(file)) { - paths.push(path); - } else if (stat.isDirectory()) { - traverse(file, stack); - } - }); - stack.pop(); - })(dir || '.', []); - - return paths; -} - -function msg(cmd, subject, str, p) { - if (options.verbose) { - util[p ? 'print' : 'puts']( stylize('vows ', 'green') - + stylize(cmd, 'bold') - + ' ' + subject + ' ' - + (str ? (typeof(str) === 'string' ? str : inspect(str)) : '') - ); - } -} - -function abort(cmd, str) { - console.log(stylize('vows ', 'red') + stylize(cmd, 'bold') + ' ' + str); - console.log(stylize('vows ', 'red') + stylize(cmd, 'bold') + ' exiting'); - process.exit(-1); -} diff --git a/node_modules/vows/lib/assert/error.js b/node_modules/vows/lib/assert/error.js deleted file mode 100644 index 3f52271..0000000 --- a/node_modules/vows/lib/assert/error.js +++ /dev/null @@ -1,42 +0,0 @@ -var stylize = require('../vows/console').stylize; -var inspect = require('../vows/console').inspect; - -require('assert').AssertionError.prototype.toString = function () { - var that = this, - source; - - if (this.stack) { - source = this.stack.match(/([a-zA-Z0-9._-]+\.(?:js|coffee))(:\d+):\d+/); - } - - function parse(str) { - var actual = inspect(that.actual, {showHidden: that.actual instanceof Error}), - expected; - - if (that.expected instanceof Function) { - expected = that.expected.name; - } - else { - expected = inspect(that.expected, {showHidden: that.actual instanceof Error}); - } - - return str.replace(/{actual}/g, actual). - replace(/{operator}/g, stylize(that.operator, 'bold')). - replace(/{expected}/g, expected); - } - - if (this.message) { - var msg = stylize(parse(this.message), 'yellow'); - if (source) { - msg += stylize(' // ' + source[1] + source[2], 'grey'); - } - return msg; - } else { - return stylize([ - this.expected, - this.operator, - this.actual - ].join(' '), 'yellow'); - } -}; - diff --git a/node_modules/vows/lib/assert/macros.js b/node_modules/vows/lib/assert/macros.js deleted file mode 100644 index 154aa14..0000000 --- a/node_modules/vows/lib/assert/macros.js +++ /dev/null @@ -1,215 +0,0 @@ -var assert = require('assert'), - utils = require('./utils'); - -var messages = { - 'equal' : "expected {expected},\n\tgot\t {actual} ({operator})", - 'notEqual' : "didn't expect {actual} ({operator})" -}; -messages['strictEqual'] = messages['deepEqual'] = messages['equal']; -messages['notStrictEqual'] = messages['notDeepEqual'] = messages['notEqual']; - -for (var key in messages) { - assert[key] = (function (key, callback) { - return function (actual, expected, message) { - callback(actual, expected, message || messages[key]); - }; - })(key, assert[key]); -} - -assert.ok = (function (callback) { - return function (actual, message) { - callback(actual, message || "expected expression to evaluate to {expected}, but was {actual}"); - }; -})(assert.ok); - -assert.match = function (actual, expected, message) { - if (! expected.test(actual)) { - assert.fail(actual, expected, message || "expected {actual} to match {expected}", "match", assert.match); - } -}; -assert.matches = assert.match; - -assert.isTrue = function (actual, message) { - if (actual !== true) { - assert.fail(actual, true, message || "expected {expected}, got {actual}", "===", assert.isTrue); - } -}; -assert.isFalse = function (actual, message) { - if (actual !== false) { - assert.fail(actual, false, message || "expected {expected}, got {actual}", "===", assert.isFalse); - } -}; -assert.isZero = function (actual, message) { - if (actual !== 0) { - assert.fail(actual, 0, message || "expected {expected}, got {actual}", "===", assert.isZero); - } -}; -assert.isNotZero = function (actual, message) { - if (actual === 0) { - assert.fail(actual, 0, message || "expected non-zero value, got {actual}", "===", assert.isNotZero); - } -}; - -assert.greater = function (actual, expected, message) { - if (actual <= expected) { - assert.fail(actual, expected, message || "expected {actual} to be greater than {expected}", ">", assert.greater); - } -}; -assert.lesser = function (actual, expected, message) { - if (actual >= expected) { - assert.fail(actual, expected, message || "expected {actual} to be lesser than {expected}", "<", assert.lesser); - } -}; - -assert.inDelta = function (actual, expected, delta, message) { - var lower = expected - delta; - var upper = expected + delta; - if (actual < lower || actual > upper) { - assert.fail(actual, expected, message || "expected {actual} to be in within *" + delta.toString() + "* of {expected}", null, assert.inDelta); - } -}; - -// -// Inclusion -// -assert.include = function (actual, expected, message) { - if ((function (obj) { - if (isArray(obj) || isString(obj)) { - return obj.indexOf(expected) === -1; - } else if (isObject(actual)) { - return ! obj.hasOwnProperty(expected); - } - return true; - })(actual)) { - assert.fail(actual, expected, message || "expected {actual} to include {expected}", "include", assert.include); - } -}; -assert.includes = assert.include; - -assert.deepInclude = function (actual, expected, message) { - if (!isArray(actual)) { - return assert.include(actual, expected, message); - } - if (!actual.some(function (item) { return utils.deepEqual(item, expected) })) { - assert.fail(actual, expected, message || "expected {actual} to include {expected}", "include", assert.deepInclude); - } -}; -assert.deepIncludes = assert.deepInclude; - -// -// Length -// -assert.isEmpty = function (actual, message) { - if ((isObject(actual) && Object.keys(actual).length > 0) || actual.length > 0) { - assert.fail(actual, 0, message || "expected {actual} to be empty", "length", assert.isEmpty); - } -}; -assert.isNotEmpty = function (actual, message) { - if ((isObject(actual) && Object.keys(actual).length === 0) || actual.length === 0) { - assert.fail(actual, 0, message || "expected {actual} to be not empty", "length", assert.isNotEmpty); - } -}; - -assert.lengthOf = function (actual, expected, message) { - if (actual.length !== expected) { - assert.fail(actual, expected, message || "expected {actual} to have {expected} element(s)", "length", assert.length); - } -}; - -// -// Type -// -assert.isArray = function (actual, message) { - assertTypeOf(actual, 'array', message || "expected {actual} to be an Array", assert.isArray); -}; -assert.isObject = function (actual, message) { - assertTypeOf(actual, 'object', message || "expected {actual} to be an Object", assert.isObject); -}; -assert.isNumber = function (actual, message) { - if (isNaN(actual)) { - assert.fail(actual, 'number', message || "expected {actual} to be of type {expected}", "isNaN", assert.isNumber); - } else { - assertTypeOf(actual, 'number', message || "expected {actual} to be a Number", assert.isNumber); - } -}; -assert.isBoolean = function (actual, message) { - if (actual !== true && actual !== false) { - assert.fail(actual, 'boolean', message || "expected {actual} to be a Boolean", "===", assert.isBoolean); - } -}; -assert.isNaN = function (actual, message) { - if (actual === actual) { - assert.fail(actual, 'NaN', message || "expected {actual} to be NaN", "===", assert.isNaN); - } -}; -assert.isNull = function (actual, message) { - if (actual !== null) { - assert.fail(actual, null, message || "expected {expected}, got {actual}", "===", assert.isNull); - } -}; -assert.isNotNull = function (actual, message) { - if (actual === null) { - assert.fail(actual, null, message || "expected non-null value, got {actual}", "===", assert.isNotNull); - } -}; -assert.isUndefined = function (actual, message) { - if (actual !== undefined) { - assert.fail(actual, undefined, message || "expected {actual} to be {expected}", "===", assert.isUndefined); - } -}; -assert.isDefined = function (actual, message) { - if(actual === undefined) { - assert.fail(actual, 0, message || "expected {actual} to be defined", "===", assert.isDefined); - } -}; -assert.isString = function (actual, message) { - assertTypeOf(actual, 'string', message || "expected {actual} to be a String", assert.isString); -}; -assert.isFunction = function (actual, message) { - assertTypeOf(actual, 'function', message || "expected {actual} to be a Function", assert.isFunction); -}; -assert.typeOf = function (actual, expected, message) { - assertTypeOf(actual, expected, message, assert.typeOf); -}; -assert.instanceOf = function (actual, expected, message) { - if (! (actual instanceof expected)) { - assert.fail(actual, expected, message || "expected {actual} to be an instance of {expected}", "instanceof", assert.instanceOf); - } -}; - -// -// Utility functions -// - -function assertTypeOf(actual, expected, message, caller) { - if (typeOf(actual) !== expected) { - assert.fail(actual, expected, message || "expected {actual} to be of type {expected}", "typeOf", caller); - } -}; - -function isArray (obj) { - return Array.isArray(obj); -} - -function isString (obj) { - return typeof(obj) === 'string' || obj instanceof String; -} - -function isObject (obj) { - return typeof(obj) === 'object' && obj && !isArray(obj); -} - -// A better `typeof` -function typeOf(value) { - var s = typeof(value), - types = [Object, Array, String, RegExp, Number, Function, Boolean, Date]; - - if (s === 'object' || s === 'function') { - if (value) { - types.forEach(function (t) { - if (value instanceof t) { s = t.name.toLowerCase() } - }); - } else { s = 'null' } - } - return s; -} diff --git a/node_modules/vows/lib/assert/utils.js b/node_modules/vows/lib/assert/utils.js deleted file mode 100644 index dccd0f6..0000000 --- a/node_modules/vows/lib/assert/utils.js +++ /dev/null @@ -1,77 +0,0 @@ - -// Taken from node/lib/assert.js -exports.deepEqual = function (actual, expected) { - if (actual === expected) { - return true; - - } else if (Buffer.isBuffer(actual) && Buffer.isBuffer(expected)) { - if (actual.length != expected.length) return false; - - for (var i = 0; i < actual.length; i++) { - if (actual[i] !== expected[i]) return false; - } - return true; - - } else if (actual instanceof Date && expected instanceof Date) { - return actual.getTime() === expected.getTime(); - - } else if (typeof actual != 'object' && typeof expected != 'object') { - return actual == expected; - - } else { - return objEquiv(actual, expected); - } -} - -// Taken from node/lib/assert.js -exports.notDeepEqual = function (actual, expected, message) { - if (exports.deepEqual(actual, expected)) { - fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); - } -} - -// Taken from node/lib/assert.js -function isUndefinedOrNull(value) { - return value === null || value === undefined; -} - -// Taken from node/lib/assert.js -function isArguments(object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; -} - -// Taken from node/lib/assert.js -function objEquiv(a, b) { - if (isUndefinedOrNull(a) || isUndefinedOrNull(b)) - return false; - if (a.prototype !== b.prototype) return false; - if (isArguments(a)) { - if (!isArguments(b)) { - return false; - } - a = pSlice.call(a); - b = pSlice.call(b); - return exports.deepEqual(a, b); - } - try { - var ka = Object.keys(a), - kb = Object.keys(b), - key, i; - } catch (e) { - return false; - } - if (ka.length != kb.length) - return false; - ka.sort(); - kb.sort(); - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) - return false; - } - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!exports.deepEqual(a[key], b[key])) return false; - } - return true; -} - diff --git a/node_modules/vows/lib/vows.js b/node_modules/vows/lib/vows.js deleted file mode 100644 index 363f96f..0000000 --- a/node_modules/vows/lib/vows.js +++ /dev/null @@ -1,255 +0,0 @@ -// -// Vows.js - asynchronous event-based BDD for node.js -// -// usage: -// -// var vows = require('vows'); -// -// vows.describe('Deep Thought').addBatch({ -// "An instance of DeepThought": { -// topic: new DeepThought, -// -// "should know the answer to the ultimate question of life": function (deepThought) { -// assert.equal (deepThought.question('what is the answer to the universe?'), 42); -// } -// } -// }).run(); -// -var util = require('util'), - path = require('path'), - events = require('events'), - vows = exports; - -// Options -vows.options = { - Emitter: events.EventEmitter, - reporter: require('./vows/reporters/dot-matrix'), - matcher: /.*/, - error: true // Handle "error" event -}; - -vows.__defineGetter__('reporter', function () { - return vows.options.reporter; -}); - -var stylize = require('./vows/console').stylize; -var console = vows.console = require('./vows/console'); - -vows.inspect = require('./vows/console').inspect; -vows.prepare = require('./vows/extras').prepare; -vows.tryEnd = require('./vows/suite').tryEnd; - -// -// Assertion Macros & Extensions -// -require('./assert/error'); -require('./assert/macros'); - -// -// Suite constructor -// -var Suite = require('./vows/suite').Suite; - -// -// This function gets added to events.EventEmitter.prototype, by default. -// It's essentially a wrapper around `on`, which adds all the specification -// goodness. -// -function addVow(vow) { - var batch = vow.batch, - event = vow.binding.context.event || 'success', - self = this; - - batch.total ++; - batch.vows.push(vow); - - // always set a listener on the event - this.on(event, function () { - var args = Array.prototype.slice.call(arguments); - // If the vow is a sub-event then we know it is an - // emitted event. So I don't muck with the arguments - // However the legacy behavior: - // If the callback is expecting two or more arguments, - // pass the error as the first (null) and the result after. - if (!(this.ctx && this.ctx.isEvent) && - vow.callback.length >= 2 && batch.suite.options.error) { - args.unshift(null); - } - runTest(args, this.ctx); - vows.tryEnd(batch); - }); - - if (event !== 'error') { - this.on("error", function (err) { - if (vow.callback.length >= 2 || !batch.suite.options.error) { - runTest(arguments, this.ctx); - } else { - output('errored', { type: 'promise', error: err.stack || - err.message || JSON.stringify(err) }); - } - vows.tryEnd(batch); - }); - } - - // in case an event fired before we could listen - if (this._vowsEmitedEvents && - this._vowsEmitedEvents.hasOwnProperty(event)) { - // make sure no one is messing with me - if (Array.isArray(this._vowsEmitedEvents[event])) { - // I don't think I need to optimize for one event, - // I think it is more important to make sure I check the vow n times - self._vowsEmitedEvents[event].forEach(function(args) { - runTest(args, self.ctx); - }); - } else { - // initial conditions problem - throw new Error('_vowsEmitedEvents[' + event + '] is not an Array') - } - vows.tryEnd(batch); - } - - return this; - - function runTest(args, ctx) { - if (vow.callback instanceof String) { - return output('pending'); - } - - if (vow.binding.context.isEvent && vow.binding.context.after) { - var after = vow.binding.context.after; - // only need to check order. I won't get here if the after event - // has never been emitted - if (self._vowsEmitedEventsOrder.indexOf(after) > - self._vowsEmitedEventsOrder.indexOf(event)) { - output('broken', event + ' emitted before ' + after); - return; - } - } - - // Run the test, and try to catch `AssertionError`s and other exceptions; - // increment counters accordingly. - try { - vow.callback.apply(ctx === global || !ctx ? vow.binding : ctx, args); - output('honored'); - } catch (e) { - if (e.name && e.name.match(/AssertionError/)) { - output('broken', e.toString().replace(/\`/g, '`')); - } else { - output('errored', e.stack || e.message || e); - } - } - } - - function output(status, exception) { - batch[status] ++; - vow.status = status; - - if (vow.context && batch.lastContext !== vow.context) { - batch.lastContext = vow.context; - batch.suite.report(['context', vow.context]); - } - batch.suite.report(['vow', { - title: vow.description, - context: vow.context, - status: status, - exception: exception || null - }]); - } -}; - -// -// On exit, check that all promises have been fired. -// If not, report an error message. -// -process.on('exit', function () { - var results = { honored: 0, broken: 0, errored: 0, pending: 0, total: 0 }, - failure; - - vows.suites.forEach(function (s) { - if ((s.results.total > 0) && (s.results.time === null)) { - s.reporter.print('\n\n'); - s.reporter.report(['error', { error: "Asynchronous Error", suite: s }]); - } - s.batches.forEach(function (b) { - var unFired = []; - - b.vows.forEach(function (vow) { - if (! vow.status) { - if (unFired.indexOf(vow.context) === -1) { - unFired.push(vow.context); - } - } - }); - - if (unFired.length > 0) { util.print('\n') } - - unFired.forEach(function (title) { - s.reporter.report(['error', { - error: "callback not fired", - context: title, - batch: b, - suite: s - }]); - }); - - if (b.status === 'begin') { - failure = true; - results.errored ++; - results.total ++; - } - Object.keys(results).forEach(function (k) { results[k] += b[k] }); - }); - }); - if (failure) { - util.puts(console.result(results)); - } -}); - -vows.suites = []; - -// We need the old emit function so we can hook it -// and do magic to deal with events that have fired -var oldEmit = vows.options.Emitter.prototype.emit; - -// -// Create a new test suite -// -vows.describe = function (subject) { - var suite = new(Suite)(subject); - - this.options.Emitter.prototype.addVow = addVow; - // just in case someone emit's before I get to it - this.options.Emitter.prototype.emit = function (event) { - this._vowsEmitedEvents = this._vowsEmitedEvents || {}; - this._vowsEmitedEventsOrder = this._vowsEmitedEventsOrder || []; - // slice off the event - var args = Array.prototype.slice.call(arguments, 1); - // if multiple events are fired, add or push - if (this._vowsEmitedEvents.hasOwnProperty(event)) { - this._vowsEmitedEvents[event].push(args); - } else { - this._vowsEmitedEvents[event] = [args]; - } - - // push the event onto a stack so I have an order - this._vowsEmitedEventsOrder.push(event); - return oldEmit.apply(this, arguments); - } - this.suites.push(suite); - - // - // Add any additional arguments as batches if they're present - // - if (arguments.length > 1) { - for (var i = 1, l = arguments.length; i < l; ++i) { - suite.addBatch(arguments[i]); - } - } - - return suite; -}; - - -vows.version = JSON.parse(require('fs') - .readFileSync(path.join(__dirname, '..', 'package.json'))) - .version diff --git a/node_modules/vows/lib/vows/console.js b/node_modules/vows/lib/vows/console.js deleted file mode 100644 index 900cef9..0000000 --- a/node_modules/vows/lib/vows/console.js +++ /dev/null @@ -1,140 +0,0 @@ -var eyes = require('eyes').inspector({ stream: null, styles: false }); - -// Stylize a string -this.stylize = function stylize(str, style) { - if (module.exports.nocolor) { - return str; - } - - var styles = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'cyan' : [96, 39], - 'yellow' : [33, 39], - 'green' : [32, 39], - 'red' : [31, 39], - 'grey' : [90, 39], - 'green-hi' : [92, 32], - }; - return '\033[' + styles[style][0] + 'm' + str + - '\033[' + styles[style][1] + 'm'; -}; - -var $ = this.$ = function (str) { - str = new(String)(str); - - ['bold', 'grey', 'yellow', 'red', 'green', 'white', 'cyan', 'italic'].forEach(function (style) { - Object.defineProperty(str, style, { - get: function () { - return exports.$(exports.stylize(this, style)); - } - }); - }); - return str; -}; - -this.puts = function (options) { - var stylize = exports.stylize; - options.stream || (options.stream = process.stdout); - options.tail = options.tail || ''; - - return function (args) { - args = Array.prototype.slice.call(arguments); - if (!options.raw) { - args = args.map(function (a) { - return a.replace(/`([^`]+)`/g, function (_, capture) { return stylize(capture, 'italic') }) - .replace(/\*([^*]+)\*/g, function (_, capture) { return stylize(capture, 'bold') }) - .replace(/\n/g, function (_, capture) { return ' \n ' } ); - }); - } - return options.stream.write(args.join('\n') + options.tail); - }; -}; - -this.result = function (event) { - var result = [], buffer = [], time = '', header; - var complete = event.honored + event.pending + event.errored + event.broken; - var status = (event.errored && 'errored') || (event.broken && 'broken') || - (event.honored && 'honored') || (event.pending && 'pending'); - - if (event.total === 0) { - return [$("Could not find any tests to run.").bold.red]; - } - - event.honored && result.push($(event.honored).bold + " honored"); - event.broken && result.push($(event.broken).bold + " broken"); - event.errored && result.push($(event.errored).bold + " errored"); - event.pending && result.push($(event.pending).bold + " pending"); - - if (complete < event.total) { - result.push($(event.total - complete).bold + " dropped"); - } - - result = result.join(' ∙ '); - - header = { - honored: '✓ ' + $('OK').bold.green, - broken: '✗ ' + $('Broken').bold.yellow, - errored: '✗ ' + $('Errored').bold.red, - pending: '- ' + $('Pending').bold.cyan - }[status] + ' » '; - - if (typeof(event.time) === 'number') { - time = ' (' + event.time.toFixed(3) + 's)'; - time = this.stylize(time, 'grey'); - } - buffer.push(header + result + time + '\n'); - - return buffer; -}; - -this.inspect = function inspect(val) { - if (module.exports.nocolor) { - return eyes(val); - } - - return '\033[1m' + eyes(val) + '\033[22m'; -}; - -this.error = function (obj) { - var string = '✗ ' + $('Errored ').red + '» '; - string += $(obj.error).red.bold + '\n'; - string += (obj.context ? ' in ' + $(obj.context).red + '\n': ''); - string += ' in ' + $(obj.suite.subject).red + '\n'; - string += ' in ' + $(obj.suite._filename).red; - - return string; -}; - -this.contextText = function (event) { - return ' ' + event; -}; - -this.vowText = function (event) { - var buffer = []; - - buffer.push(' ' + { - honored: ' ✓ ', - broken: ' ✗ ', - errored: ' ✗ ', - pending: ' - ' - }[event.status] + this.stylize(event.title, ({ - honored: 'green', - broken: 'yellow', - errored: 'red', - pending: 'cyan' - })[event.status])); - - if (event.status === 'broken') { - buffer.push(' » ' + event.exception); - } else if (event.status === 'errored') { - if (event.exception.type === 'promise') { - buffer.push(' » ' + this.stylize("An unexpected error was caught: " + - this.stylize(event.exception.error, 'bold'), 'red')); - } else { - buffer.push(' ' + this.stylize(event.exception, 'red')); - } - } - return buffer.join('\n'); -}; diff --git a/node_modules/vows/lib/vows/context.js b/node_modules/vows/lib/vows/context.js deleted file mode 100644 index b11d676..0000000 --- a/node_modules/vows/lib/vows/context.js +++ /dev/null @@ -1,76 +0,0 @@ - -this.Context = function (vow, ctx, env) { - var that = this; - - this.tests = vow.callback; - this.topics = (ctx.topics || []).slice(0); - this.emitter = null; - this.env = env || {}; - this.env.context = this; - - this.env.callback = function (/* arguments */) { - var ctx = this; - var args = Array.prototype.slice.call(arguments); - - var emit = (function (args) { - // - // Convert callback-style results into events. - // - if (vow.batch.suite.options.error) { - return function () { - var e = args.shift(); - that.emitter.ctx = ctx; - // We handle a special case, where the first argument is a - // boolean, in which case we treat it as a result, and not - // an error. This is useful for `path.exists` and other - // functions like it, which only pass a single boolean - // parameter instead of the more common (error, result) pair. - if (typeof(e) === 'boolean' && args.length === 0) { - that.emitter.emit.call(that.emitter, 'success', e); - } else { - if (e) { that.emitter.emit.apply(that.emitter, ['error', e].concat(args)) } - else { that.emitter.emit.apply(that.emitter, ['success'].concat(args)) } - } - }; - } else { - return function () { - that.emitter.ctx = ctx; - that.emitter.emit.apply(that.emitter, ['success'].concat(args)); - }; - } - })(args.slice(0)); - // If `this.callback` is called synchronously, - // the emitter will not have been set yet, - // so we defer the emition, that way it'll behave - // asynchronously. - if (that.emitter) { emit() } - else { process.nextTick(emit) } - }; - this.name = vow.description; - // events is an alias for on - if (this.name === 'events') { - this.name = vow.description = 'on'; - } - - // if this is a sub-event context AND it's context was an event, - // then I must enforce event order. - // this will not do a good job of handling pin-pong events - if (this.name === 'on' && ctx.isEvent) { - this.after = ctx.name; - } - - if (ctx.name === 'on') { - this.isEvent = true; - this.event = this.name; - this.after = ctx.after; - } else { - this.isEvent = false; - this.event = 'success'; - } - - this.title = [ - ctx.title || '', - vow.description || '' - ].join(/^[#.:]/.test(vow.description) ? '' : ' ').trim(); -}; - diff --git a/node_modules/vows/lib/vows/coverage/file.js b/node_modules/vows/lib/vows/coverage/file.js deleted file mode 100644 index 5bdef90..0000000 --- a/node_modules/vows/lib/vows/coverage/file.js +++ /dev/null @@ -1,29 +0,0 @@ - -exports.coverage = function (filename, data) { - var ret = { - filename: filename, - coverage: 0, - hits: 0, - misses: 0, - sloc : 0 - }; - - var source = data.source; - ret.source = source.map(function (line, num) { - num++; - - if (data[num] === 0) { - ret.misses++; - ret.sloc++; - } else if (data[num] !== undefined) { - ret.hits++; - ret.sloc++; - } - - return { line: line, coverage: (data[num] === undefined ? '' : data[num]) }; - }); - - ret.coverage = (ret.hits / ret.sloc) * 100; - - return ret; -}; \ No newline at end of file diff --git a/node_modules/vows/lib/vows/coverage/fragments/coverage-foot.html b/node_modules/vows/lib/vows/coverage/fragments/coverage-foot.html deleted file mode 100644 index 691287b..0000000 --- a/node_modules/vows/lib/vows/coverage/fragments/coverage-foot.html +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/node_modules/vows/lib/vows/coverage/fragments/coverage-head.html b/node_modules/vows/lib/vows/coverage/fragments/coverage-head.html deleted file mode 100644 index aa2f107..0000000 --- a/node_modules/vows/lib/vows/coverage/fragments/coverage-head.html +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - diff --git a/node_modules/vows/lib/vows/coverage/report-html.js b/node_modules/vows/lib/vows/coverage/report-html.js deleted file mode 100644 index f7e5b72..0000000 --- a/node_modules/vows/lib/vows/coverage/report-html.js +++ /dev/null @@ -1,54 +0,0 @@ -var util = require('util'), - fs = require('fs'), - file = require('./file'); - -this.name = 'coverage-report-html'; - -function getCoverageClass( data ) { - var fullCoverage= (data.coverage == 100); - var okCoverage= (!fullCoverage && data.coverage >=60); - var coverageClass= ''; - if( fullCoverage ) coverageClass= 'fullCoverage'; - else if( okCoverage) coverageClass= 'okCoverage'; - else coverageClass= 'poorCoverage'; - return coverageClass; -} -this.report = function (coverageMap) { - var out, head, foot; - - try { - out = fs.openSync("coverage.html", "w"); - head = fs.readFileSync(__dirname + "/fragments/coverage-head.html", "utf8"); - foot = fs.readFileSync(__dirname + "/fragments/coverage-foot.html", "utf8"); - } catch (error) { - util.print("Error: Unable to write to file coverage.html\n"); - return; - } - - fs.writeSync(out, head); - - for (var filename in coverageMap) { - if (coverageMap.hasOwnProperty(filename)) { - var data = file.coverage(filename, coverageMap[filename]); - var coverageClass= getCoverageClass( data ); - fs.writeSync(out, "

        " + filename + "

        \n"); - fs.writeSync(out, '' + "[ hits: " + data.hits); - fs.writeSync(out, ", misses: " + data.misses + ", sloc: " + data.sloc); - fs.writeSync(out, ", coverage: " + data.coverage.toFixed(2) + "% ]" + "
        [+]\n"); - fs.writeSync(out, "\n"); - fs.writeSync(out, "
        \n"); - } - } - - fs.writeSync(out, foot); - fs.close(out); -}; diff --git a/node_modules/vows/lib/vows/coverage/report-json.js b/node_modules/vows/lib/vows/coverage/report-json.js deleted file mode 100644 index bcbab25..0000000 --- a/node_modules/vows/lib/vows/coverage/report-json.js +++ /dev/null @@ -1,54 +0,0 @@ -var util = require('util'), - fs = require('fs'), - file = require('./file'); - -this.name = 'coverage-report-json'; - -this.report = function (coverageMap) { - var output = { - meta: { - "generator": "vowsjs", - "generated": new Date().toString(), - "instrumentation": "node-jscoverage", - "file-version": "1.0" - }, - files: [ ], - coverage: [ ] - }; - - - for (var filename in coverageMap) { - if (coverageMap.hasOwnProperty(filename)) { - var data = file.coverage(filename, coverageMap[filename]); - - var coverage = { - file: filename, - coverage: data.coverage.toFixed(2), - hits: data.hits, - misses: data.misses, - sloc: data.sloc, - source: { } - }; - - for (var i = 0; i < data.source.length; i++) { - coverage.source[i + 1] = { - line: data.source[i].line, - coverage: data.source[i].coverage - }; - } - - output.coverage.push(coverage); - - output.files.push(filename); - } - } - - try { - out = fs.openSync("coverage.json", "w"); - fs.writeSync(out, JSON.stringify(output)); - fs.close(out); - } catch (error) { - util.print("Error: Unable to write to file coverage.json\n"); - return; - } -}; diff --git a/node_modules/vows/lib/vows/coverage/report-plain.js b/node_modules/vows/lib/vows/coverage/report-plain.js deleted file mode 100644 index 9de7005..0000000 --- a/node_modules/vows/lib/vows/coverage/report-plain.js +++ /dev/null @@ -1,38 +0,0 @@ -var util = require('util'), - file = require('./file'); - -this.name = 'coverage-report-plain'; - -function lpad(str, width) { - str = String(str); - var n = width - str.length; - - if (n < 1) { - return str; - } - - while (n--) { - str = ' ' + str; - } - - return str; -} - - -this.report = function (coverageMap) { - for (var filename in coverageMap) { - if (coverageMap.hasOwnProperty(filename)) { - var data = file.coverage(filename, coverageMap[filename]); - - util.print(filename + ":\n"); - util.print("[ hits: " + data.hits + ", misses: " + data.misses); - util.print(", sloc: " + data.sloc + ", coverage: " + data.coverage.toFixed(2) + "% ]\n"); - - for (var i = 0; i < data.source.length; i++) { - util.print(lpad(data.source[i].coverage, 5) + " | " + data.source[i].line + "\n"); - } - - util.print("\n"); - } - } -}; diff --git a/node_modules/vows/lib/vows/coverage/report-xml.js b/node_modules/vows/lib/vows/coverage/report-xml.js deleted file mode 100644 index b9ff95b..0000000 --- a/node_modules/vows/lib/vows/coverage/report-xml.js +++ /dev/null @@ -1,81 +0,0 @@ -var fs = require('fs'), - file = require('./file'); - -this.name = 'coverage-report-xml'; - -this.report = function (coverageMap) { - var all = { - xml: '', - packages: 0, - files: 0, - lines: 0, - hits: 0 - }, - data = {}; - - // group data by path - for (var filename in coverageMap) { - if (coverageMap.hasOwnProperty(filename)) { - var pkg = (filename.indexOf('/') > 0) - ? filename.substr(0, filename.lastIndexOf('/')) - : filename; - if (!data[pkg]) { - data[pkg] = {}; - } - data[pkg][ (filename.indexOf('/')) - ? filename.substr(filename.lastIndexOf('/') + 1, filename.length) - : filename ] - = file.coverage(filename, coverageMap[filename]); - } - } - - // generate groups xml-fragment - for (var pkg in data) { - if (data.hasOwnProperty(pkg)) { - var pkgStat = { - xml: '', - files: 0, - lines: 0, - hits: 0 - }; - - all.xml += '\t\n'; - - for (var filename in data[pkg]) { - if (data[pkg].hasOwnProperty(filename)) { - pkgStat.files += 1; - pkgStat.lines += data[pkg][filename].sloc; - pkgStat.hits += data[pkg][filename].hits; - - pkgStat.xml += '\t\t\n' - + '\t\t\t\n' - + '\t\t\n'; - } - } - - all.packages += 1; - all.files += pkgStat.files; - all.lines += pkgStat.lines; - all.hits += pkgStat.hits; - - all.xml += '\t\t\n' - + pkgStat.xml - + '\t\n'; - } - } - - all.xml = '\n' - + '\n\n' - + '\t\n' - + '\t\n' - + '\t\n' - + '\t\n' - + '\t\n' - + '\n\n' - + '\n' - + '\t\n' - + all.xml - + '\n\n\n'; - - fs.writeFileSync('coverage.xml', all.xml); -}; diff --git a/node_modules/vows/lib/vows/extras.js b/node_modules/vows/lib/vows/extras.js deleted file mode 100644 index a90d7a5..0000000 --- a/node_modules/vows/lib/vows/extras.js +++ /dev/null @@ -1,28 +0,0 @@ -var events = require('events'); -// -// Wrap a Node.js style async function into an EventEmmitter -// -this.prepare = function (obj, targets) { - targets.forEach(function (target) { - if (target in obj) { - obj[target] = (function (fun) { - return function () { - var args = Array.prototype.slice.call(arguments); - var ee = new(events.EventEmitter); - - args.push(function (err /* [, data] */) { - var args = Array.prototype.slice.call(arguments, 1); - - if (err) { ee.emit.apply(ee, ['error', err].concat(args)) } - else { ee.emit.apply(ee, ['success'].concat(args)) } - }); - fun.apply(obj, args); - - return ee; - }; - })(obj[target]); - } - }); - return obj; -}; - diff --git a/node_modules/vows/lib/vows/reporters/dot-matrix.js b/node_modules/vows/lib/vows/reporters/dot-matrix.js deleted file mode 100644 index 0ecf590..0000000 --- a/node_modules/vows/lib/vows/reporters/dot-matrix.js +++ /dev/null @@ -1,67 +0,0 @@ -var options = { tail: '' }, - console = require('../../vows/console'), - stylize = console.stylize, - puts = console.puts(options); -// -// Console reporter -// -var messages = [], lastContext; - -this.name = 'dot-matrix'; -this.setStream = function (s) { - options.stream = s; -}; - -this.reset = function () { - messages = []; - lastContext = null; -}; -this.report = function (data) { - var event = data[1]; - - switch (data[0]) { - case 'subject': - // messages.push(stylize(event, 'underline') + '\n'); - break; - case 'context': - break; - case 'vow': - if (event.status === 'honored') { - puts(stylize('·', 'green')); - } else if (event.status === 'pending') { - puts(stylize('-', 'cyan')); - } else { - if (lastContext !== event.context) { - lastContext = event.context; - messages.push(' ' + event.context); - } - if (event.status === 'broken') { - puts(stylize('✗', 'yellow')); - messages.push(console.vowText(event)); - } else if (event.status === 'errored') { - puts(stylize('✗', 'red')); - messages.push(console.vowText(event)); - } - messages.push(''); - } - break; - case 'end': - puts(' '); - break; - case 'finish': - if (messages.length) { - puts('\n\n' + messages.join('\n')); - } else { - puts(''); - } - puts(console.result(event).join('\n')); - break; - case 'error': - puts(console.error(event)); - break; - } -}; - -this.print = function (str) { - puts(str); -}; diff --git a/node_modules/vows/lib/vows/reporters/json.js b/node_modules/vows/lib/vows/reporters/json.js deleted file mode 100644 index 20c1366..0000000 --- a/node_modules/vows/lib/vows/reporters/json.js +++ /dev/null @@ -1,33 +0,0 @@ -var options = { tail: '\n', raw: true }; -var console = require('../../vows/console'); -var puts = console.puts(options); - -// -// Console JSON reporter -// -this.name = 'json'; -this.setStream = function (s) { - options.stream = s; -}; - -function removeCircularSuite(obj, suite) { - var result = {}; - - if (typeof obj !== 'object' || obj === null) return obj; - - Object.keys(obj).forEach(function(key) { - if (obj[key] === suite) { - result[key] = {}; - } else { - result[key] = removeCircularSuite(obj[key], suite || obj.suite); - } - }); - - return result; -}; - -this.report = function (obj) { - puts(JSON.stringify(removeCircularSuite(obj))); -}; - -this.print = function (str) {}; diff --git a/node_modules/vows/lib/vows/reporters/silent.js b/node_modules/vows/lib/vows/reporters/silent.js deleted file mode 100644 index fe90a33..0000000 --- a/node_modules/vows/lib/vows/reporters/silent.js +++ /dev/null @@ -1,8 +0,0 @@ -// -// Silent reporter - "Shhh" -// -this.name = 'silent'; -this.reset = function () {}; -this.report = function () {}; -this.print = function () {}; - diff --git a/node_modules/vows/lib/vows/reporters/spec.js b/node_modules/vows/lib/vows/reporters/spec.js deleted file mode 100644 index d1c6dd8..0000000 --- a/node_modules/vows/lib/vows/reporters/spec.js +++ /dev/null @@ -1,42 +0,0 @@ -var util = require('util'); - -var options = { tail: '\n' }; -var console = require('../../vows/console'); -var stylize = console.stylize, - puts = console.puts(options); -// -// Console reporter -// - -this.name = 'spec'; -this.setStream = function (s) { - options.stream = s; -}; -this.report = function (data) { - var event = data[1]; - - switch (data[0]) { - case 'subject': - puts('\n♢ ' + stylize(event, 'bold') + '\n'); - break; - case 'context': - puts(console.contextText(event)); - break; - case 'vow': - puts(console.vowText(event)); - break; - case 'end': - util.print('\n'); - break; - case 'finish': - puts(console.result(event).join('\n')); - break; - case 'error': - puts(console.error(event)); - break; - } -}; - -this.print = function (str) { - util.print(str); -}; diff --git a/node_modules/vows/lib/vows/reporters/watch.js b/node_modules/vows/lib/vows/reporters/watch.js deleted file mode 100644 index 58f6e3c..0000000 --- a/node_modules/vows/lib/vows/reporters/watch.js +++ /dev/null @@ -1,37 +0,0 @@ -var options = {}; -var console = require('../../vows/console'); -var spec = require('../../vows/reporters/spec'); -var stylize = console.stylize, - puts = console.puts(options); -// -// Console reporter -// -var lastContext; - -this.name = 'watch'; -this.setStream = function (s) { - options.stream = s; -}; -this.reset = function () { - lastContext = null; -}; -this.report = function (data) { - var event = data[1]; - - switch (data[0]) { - case 'vow': - if (['honored', 'pending'].indexOf(event.status) === -1) { - if (lastContext !== event.context) { - lastContext = event.context; - puts(console.contextText(event.context)); - } - puts(console.vowText(event)); - puts(''); - } - break; - case 'error': - puts(console.error(event)); - break; - } -}; -this.print = function (str) {}; diff --git a/node_modules/vows/lib/vows/reporters/xunit.js b/node_modules/vows/lib/vows/reporters/xunit.js deleted file mode 100644 index 411a948..0000000 --- a/node_modules/vows/lib/vows/reporters/xunit.js +++ /dev/null @@ -1,90 +0,0 @@ -// xunit outoput for vows, so we can run things under hudson -// -// The translation to xunit is simple. Most likely more tags/attributes can be -// added, see: http://ant.1045680.n5.nabble.com/schema-for-junit-xml-output-td1375274.html -// - -var puts = require('util').puts; - -var buffer = [], - curSubject = null; - -function xmlEnc(value) { - return !value ? value : String(value).replace(/&/g, "&") - .replace(/>/g, ">") - .replace(/'; -} - -function cdata(data) { - return ''; -} - -this.name = 'xunit'; -this.report = function (data) { - var event = data[1]; - - switch (data[0]) { - case 'subject': - curSubject = event; - break; - case 'context': - break; - case 'vow': - switch (event.status) { - case 'honored': - buffer.push(tag('testcase', {classname: curSubject, name: event.context + ': ' + event.title}, true)); - break; - case 'broken': - var err = tag('error', {type: 'vows.event.broken', message: 'Broken test'}, false, cdata(event.exception)); - buffer.push(tag('testcase', {classname: curSubject, name: event.context + ': ' + event.title}, false, err)); - break; - case 'errored': - var skip = tag('skipped', {type: 'vows.event.errored', message: 'Errored test'}, false, cdata(event.exception)); - buffer.push(tag('testcase', {classname: curSubject, name: event.context + ': ' + event.title}, false, skip)); - break; - case 'pending': - // nop - break; - } - break; - case 'end': - buffer.push(end('testcase')); - break; - case 'finish': - buffer.unshift(tag('testsuite', {name: 'Vows test', tests: event.total, timestamp: (new Date()).toUTCString(), errors: event.errored, failures: event.broken, skip: event.pending, time: event.time})); - buffer.push(end('testsuite')); - puts(buffer.join('\n')); - break; - case 'error': - break; - } -}; - -this.print = function (str) { }; diff --git a/node_modules/vows/lib/vows/suite.js b/node_modules/vows/lib/vows/suite.js deleted file mode 100644 index 737b295..0000000 --- a/node_modules/vows/lib/vows/suite.js +++ /dev/null @@ -1,380 +0,0 @@ -var events = require('events'), - path = require('path'); - -var vows = require('../vows'); -var Context = require('../vows/context').Context; - -this.Suite = function (subject) { - this.subject = subject; - this.matcher = /.*/; - this.reporter = require('./reporters/dot-matrix'); - this.batches = []; - this.options = { error: true }; - this.reset(); -}; - -this.Suite.prototype = new(function () { - this.reset = function () { - this.results = { - honored: 0, - broken: 0, - errored: 0, - pending: 0, - total: 0, - time: null - }; - this.batches.forEach(function (b) { - b.lastContext = null; - b.remaining = b._remaining; - b.honored = b.broken = b.errored = b.total = b.pending = 0; - b.vows.forEach(function (vow) { vow.status = null }); - b.teardowns = []; - }); - }; - - this.addBatch = function (tests) { - this.batches.push({ - tests: tests, - suite: this, - vows: [], - remaining: 0, - _remaining: 0, - honored: 0, - broken: 0, - errored: 0, - pending: 0, - total: 0, - teardowns: [] - }); - return this; - }; - this.addVows = this.addBatch; - - this.parseBatch = function (batch, matcher) { - var tests = batch.tests; - - if ('topic' in tests) { - throw new(Error)("missing top-level context."); - } - // Count the number of vows/promises expected to fire, - // so we know when the tests are over. - // We match the keys against `matcher`, to decide - // whether or not they should be included in the test. - // Any key, including assertion function keys can be matched. - // If a child matches, then the n parent topics must not be skipped. - (function count(tests, _match) { - var match = false; - - var keys = Object.keys(tests).filter(function (k) { - return k !== 'topic' && k !== 'teardown'; - }); - - for (var i = 0, key; i < keys.length; i++) { - key = keys[i]; - - // If the parent node, or this one matches. - match = _match || matcher.test(key); - - if (typeof(tests[key]) === 'object') { - match = count(tests[key], match); - } else { - if (typeof(tests[key]) === 'string') { - tests[key] = new(String)(tests[key]); - } - if (! match) { - tests[key]._skip = true; - } - } - } - - // If any of the children matched, - // don't skip this node. - for (var i = 0; i < keys.length; i++) { - if (! tests[keys[i]]._skip) { match = true } - } - - if (match) { batch.remaining ++ } - else { tests._skip = true } - - return match; - })(tests, false); - - batch._remaining = batch.remaining; - }; - - this.runBatch = function (batch) { - var topic, - tests = batch.tests, - promise = batch.promise = new(events.EventEmitter); - - var that = this; - - batch.status = 'begin'; - - // The test runner, it calls itself recursively, passing the - // previous context to the inner contexts. This is so the `topic` - // functions have access to all the previous context topics in their - // arguments list. - // It is defined and invoked at the same time. - // If it encounters a `topic` function, it waits for the returned - // promise to emit (the topic), at which point it runs the functions under it, - // passing the topic as an argument. - (function run(ctx, lastTopic) { - var old = false; - topic = ctx.tests.topic; - - if (typeof(topic) === 'function') { - if (ctx.isEvent || ctx.name === 'on') { - throw new Error('Event context cannot contain a topic'); - } - - // Run the topic, passing the previous context topics - // If topic `throw`s an exception, pass it down as a value - try { - topic = topic.apply(ctx.env, ctx.topics); - } - catch (ex) { - topic = ex; - } - - if (typeof(topic) === 'undefined') { ctx._callback = true } - } - - // If this context has a topic, store it in `lastTopic`, - // if not, use the last topic, passed down by a parent - // context. - if (typeof(topic) !== 'undefined' || ctx._callback) { - lastTopic = topic; - } else { - old = true; - topic = lastTopic; - } - - // If the topic doesn't return an event emitter (such as a promise), - // we create it ourselves, and emit the value on the next tick. - if (! (topic && - topic.constructor === events.EventEmitter)) { - // If the context is a traditional vow, then a topic can ONLY - // be an EventEmitter. However if the context is a sub-event - // then the topic may be an instanceof EventEmitter - if (!ctx.isEvent || - (ctx.isEvent && !(topic instanceof events.EventEmitter))) { - - ctx.emitter = new(events.EventEmitter); - - if (! ctx._callback) { - process.nextTick(function (val) { - return function () { - ctx.emitter.emit("success", val) - }; - }(topic)); - } - // if I have a callback, push the new topic back up to - // lastTopic - if (ctx._callback) { - lastTopic = topic = ctx.emitter; - } else { - topic = ctx.emitter; - } - } - } - - topic.on(ctx.event, function (val) { - // Once the topic fires, add the return value - // to the beginning of the topics list, so it - // becomes the first argument for the next topic. - // If we're using the parent topic, no need to - // prepend it to the topics list, or we'll get - // duplicates. - if (!old || ctx.isEvent) { - Array.prototype.unshift.apply(ctx.topics, arguments) - }; - }); - if (topic.setMaxListeners) { topic.setMaxListeners(Infinity) } - // Now run the tests, or sub-contexts - Object.keys(ctx.tests).filter(function (k) { - return ctx.tests[k] && k !== 'topic' && - k !== 'teardown' && !ctx.tests[k]._skip; - }).forEach(function (item) { - // Create a new evaluation context, - // inheriting from the parent one. - var env = Object.create(ctx.env); - env.suite = that; - - // Holds the current test or context - var vow = Object.create({ - callback: ctx.tests[item], - context: ctx.title, - description: item, - binding: ctx.env, - status: null, - batch: batch - }); - - // If we encounter a function, add it to the callbacks - // of the `topic` function, so it'll get called once the - // topic fires. - // If we encounter an object literal, we recurse, sending it - // our current context. - if ((typeof(vow.callback) === 'function') || - (vow.callback instanceof String)) { - topic.addVow(vow); - } else if (typeof(vow.callback) === 'object') { - // If there's a setup stage, we have to wait for it to fire, - // before calling the inner context. - // If the event has already fired, the context is 'on' or - // there is no setup stage, just run the inner context - // synchronously. - if (topic && - ctx.name !== 'on' && - !topic._vowsEmitedEvents.hasOwnProperty(ctx.event)) { - topic.on(ctx.event, function (ctx) { - return function (val) { - return run(new(Context)(vow, ctx, env), lastTopic); - }; - }(ctx)); - } else { - run(new(Context)(vow, ctx, env), lastTopic); - } - } - }); - // Teardown - if (ctx.tests.teardown) { - batch.teardowns.push(ctx); - } - if (! ctx.tests._skip) { - batch.remaining --; - } - // Check if we're done running the tests - exports.tryEnd(batch); - // This is our initial, empty context - })(new(Context)({ callback: tests, context: null, description: null }, {})); - return promise; - }; - - this.report = function () { - return this.reporter.report.apply(this.reporter, arguments); - }; - - this.run = function (options, callback) { - var that = this, start; - - options = options || {}; - - for (var k in options) { this.options[k] = options[k] } - - this.matcher = this.options.matcher || this.matcher; - this.reporter = this.options.reporter || this.reporter; - - this.batches.forEach(function (batch) { - that.parseBatch(batch, that.matcher); - }); - - this.reset(); - - start = new(Date); - - if (this.batches.filter(function (b) { return b.remaining > 0 }).length) { - this.report(['subject', this.subject]); - } - - return (function run(batches) { - var batch = batches.shift(); - - if (batch) { - // If the batch has no vows to run, - // go to the next one. - if (batch.remaining === 0) { - run(batches); - } else { - that.runBatch(batch).on('end', function () { - run(batches); - }); - } - } else { - that.results.time = (new(Date) - start) / 1000; - that.report(['finish', that.results]); - - if (callback) { callback(that.results) } - - if (that.results.honored + that.results.pending === that.results.total) { - return 0; - } else { - return 1; - } - } - })(this.batches.slice(0)); - }; - - this.runParallel = function () {}; - - this.export = function (module, options) { - for (var k in (options || {})) { this.options[k] = options[k] } - - if (require.main === module) { - return this.run(); - } else { - return module.exports[this.subject] = this; - } - }; - this.exportTo = function (module, options) { // Alias, for JSLint - return this.export(module, options); - }; -}); - -// -// Checks if all the tests in the batch have been run, -// and triggers the next batch (if any), by emitting the 'end' event. -// -this.tryEnd = function (batch) { - var result, style, time; - - if (batch.honored + batch.broken + batch.errored + batch.pending === batch.total && - batch.remaining === 0) { - - Object.keys(batch).forEach(function (k) { - (k in batch.suite.results) && (batch.suite.results[k] += batch[k]); - }); - - if (batch.teardowns) { - for (var i = batch.teardowns.length - 1, ctx; i >= 0; i--) { - runTeardown(batch.teardowns[i]); - } - - maybeFinish(); - } - - function runTeardown(teardown) { - var env = Object.create(teardown.env); - - Object.defineProperty(env, "callback", { - get: function () { - teardown.awaitingCallback = true; - - return function () { - teardown.awaitingCallback = false; - maybeFinish(); - }; - } - }); - - teardown.tests.teardown.apply(env, teardown.topics); - } - - function maybeFinish() { - var pending = batch.teardowns.filter(function (teardown) { - return teardown.awaitingCallback; - }); - - if (pending.length === 0) { - finish(); - } - } - - function finish() { - batch.status = 'end'; - batch.suite.report(['end']); - batch.promise.emit('end', batch.honored, batch.broken, batch.errored, batch.pending); - } - } -}; diff --git a/node_modules/vows/node_modules/eyes/LICENSE b/node_modules/vows/node_modules/eyes/LICENSE deleted file mode 100644 index a1edd93..0000000 --- a/node_modules/vows/node_modules/eyes/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2009 cloudhead - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/vows/node_modules/eyes/Makefile b/node_modules/vows/node_modules/eyes/Makefile deleted file mode 100644 index a121dea..0000000 --- a/node_modules/vows/node_modules/eyes/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -test: - @@node test/eyes-test.js - -.PHONY: test diff --git a/node_modules/vows/node_modules/eyes/README.md b/node_modules/vows/node_modules/eyes/README.md deleted file mode 100644 index 7a92158..0000000 --- a/node_modules/vows/node_modules/eyes/README.md +++ /dev/null @@ -1,72 +0,0 @@ -eyes -==== - -a customizable value inspector for Node.js - -synopsis --------- - -I was tired of looking at cluttered output in the console -- something needed to be done, -`sys.inspect()` didn't display regexps correctly, and was too verbose, and I had an hour or two to spare. -So I decided to have some fun. _eyes_ were born. - -![eyes-ss](http://dl.dropbox.com/u/251849/eyes-js-ss.gif) - -_example of the output of a user-customized eyes.js inspector_ - -*eyes* also deals with circular objects in an intelligent way, and can pretty-print object literals. - -usage ------ - - var inspect = require('eyes').inspector({styles: {all: 'magenta'}}); - - inspect(something); // inspect with the settings passed to `inspector` - -or - - var eyes = require('eyes'); - - eyes.inspect(something); // inspect with the default settings - -you can pass a _label_ to `inspect()`, to keep track of your inspections: - - eyes.inspect(something, "a random value"); - -If you want to return the output of eyes without printing it, you can set it up this way: - - var inspect = require('eyes').inspector({ stream: null }); - - sys.puts(inspect({ something: 42 })); - -customization -------------- - -These are the default styles and settings used by _eyes_. - styles: { // Styles applied to stdout - all: 'cyan', // Overall style applied to everything - label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]` - other: 'inverted', // Objects which don't have a literal representation, such as functions - key: 'bold', // The keys in object literals, like 'a' in `{a: 1}` - - special: 'grey', // null, undefined... - string: 'green', - number: 'magenta', - bool: 'blue', // true false - regexp: 'green', // /\d+/ - }, - pretty: true, // Indent object literals - hideFunctions: false, // Don't output functions at all - stream: process.stdout, // Stream to write to, or null - maxLength: 2048 // Truncate output if longer - -You can overwrite them with your own, by passing a similar object to `inspector()` or `inspect()`. - - var inspect = require('eyes').inspector({ - styles: { - all: 'magenta', - special: 'bold' - }, - maxLength: 512 - }); - diff --git a/node_modules/vows/node_modules/eyes/lib/eyes.js b/node_modules/vows/node_modules/eyes/lib/eyes.js deleted file mode 100644 index 10d964b..0000000 --- a/node_modules/vows/node_modules/eyes/lib/eyes.js +++ /dev/null @@ -1,236 +0,0 @@ -// -// Eyes.js - a customizable value inspector for Node.js -// -// usage: -// -// var inspect = require('eyes').inspector({styles: {all: 'magenta'}}); -// inspect(something); // inspect with the settings passed to `inspector` -// -// or -// -// var eyes = require('eyes'); -// eyes.inspect(something); // inspect with the default settings -// -var eyes = exports, - stack = []; - -eyes.defaults = { - styles: { // Styles applied to stdout - all: 'cyan', // Overall style applied to everything - label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]` - other: 'inverted', // Objects which don't have a literal representation, such as functions - key: 'bold', // The keys in object literals, like 'a' in `{a: 1}` - special: 'grey', // null, undefined... - string: 'green', - number: 'magenta', - bool: 'blue', // true false - regexp: 'green', // /\d+/ - }, - pretty: true, // Indent object literals - hideFunctions: false, - showHidden: false, - stream: process.stdout, - maxLength: 2048 // Truncate output if longer -}; - -// Return a curried inspect() function, with the `options` argument filled in. -eyes.inspector = function (options) { - var that = this; - return function (obj, label, opts) { - return that.inspect.call(that, obj, label, - merge(options || {}, opts || {})); - }; -}; - -// If we have a `stream` defined, use it to print a styled string, -// if not, we just return the stringified object. -eyes.inspect = function (obj, label, options) { - options = merge(this.defaults, options || {}); - - if (options.stream) { - return this.print(stringify(obj, options), label, options); - } else { - return stringify(obj, options) + (options.styles ? '\033[39m' : ''); - } -}; - -// Output using the 'stream', and an optional label -// Loop through `str`, and truncate it after `options.maxLength` has been reached. -// Because escape sequences are, at this point embeded within -// the output string, we can't measure the length of the string -// in a useful way, without separating what is an escape sequence, -// versus a printable character (`c`). So we resort to counting the -// length manually. -eyes.print = function (str, label, options) { - for (var c = 0, i = 0; i < str.length; i++) { - if (str.charAt(i) === '\033') { i += 4 } // `4` because '\033[25m'.length + 1 == 5 - else if (c === options.maxLength) { - str = str.slice(0, i - 1) + '…'; - break; - } else { c++ } - } - return options.stream.write.call(options.stream, (label ? - this.stylize(label, options.styles.label, options.styles) + ': ' : '') + - this.stylize(str, options.styles.all, options.styles) + '\033[0m' + "\n"); -}; - -// Apply a style to a string, eventually, -// I'd like this to support passing multiple -// styles. -eyes.stylize = function (str, style, styles) { - var codes = { - 'bold' : [1, 22], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'cyan' : [36, 39], - 'magenta' : [35, 39], - 'blue' : [34, 39], - 'yellow' : [33, 39], - 'green' : [32, 39], - 'red' : [31, 39], - 'grey' : [90, 39] - }, endCode; - - if (style && codes[style]) { - endCode = (codes[style][1] === 39 && styles.all) ? codes[styles.all][0] - : codes[style][1]; - return '\033[' + codes[style][0] + 'm' + str + - '\033[' + endCode + 'm'; - } else { return str } -}; - -// Convert any object to a string, ready for output. -// When an 'array' or an 'object' are encountered, they are -// passed to specialized functions, which can then recursively call -// stringify(). -function stringify(obj, options) { - var that = this, stylize = function (str, style) { - return eyes.stylize(str, options.styles[style], options.styles) - }, index, result; - - if ((index = stack.indexOf(obj)) !== -1) { - return stylize(new(Array)(stack.length - index + 1).join('.'), 'special'); - } - stack.push(obj); - - result = (function (obj) { - switch (typeOf(obj)) { - case "string" : obj = stringifyString(obj.indexOf("'") === -1 ? "'" + obj + "'" - : '"' + obj + '"'); - return stylize(obj, 'string'); - case "regexp" : return stylize('/' + obj.source + '/', 'regexp'); - case "number" : return stylize(obj + '', 'number'); - case "function" : return options.stream ? stylize("Function", 'other') : '[Function]'; - case "null" : return stylize("null", 'special'); - case "undefined": return stylize("undefined", 'special'); - case "boolean" : return stylize(obj + '', 'bool'); - case "date" : return stylize(obj.toUTCString()); - case "array" : return stringifyArray(obj, options, stack.length); - case "object" : return stringifyObject(obj, options, stack.length); - } - })(obj); - - stack.pop(); - return result; -}; - -// Escape invisible characters in a string -function stringifyString (str, options) { - return str.replace(/\\/g, '\\\\') - .replace(/\n/g, '\\n') - .replace(/[\u0001-\u001F]/g, function (match) { - return '\\0' + match[0].charCodeAt(0).toString(8); - }); -} - -// Convert an array to a string, such as [1, 2, 3]. -// This function calls stringify() for each of the elements -// in the array. -function stringifyArray(ary, options, level) { - var out = []; - var pretty = options.pretty && (ary.length > 4 || ary.some(function (o) { - return (o !== null && typeof(o) === 'object' && Object.keys(o).length > 0) || - (Array.isArray(o) && o.length > 0); - })); - var ws = pretty ? '\n' + new(Array)(level * 4 + 1).join(' ') : ' '; - - for (var i = 0; i < ary.length; i++) { - out.push(stringify(ary[i], options)); - } - - if (out.length === 0) { - return '[]'; - } else { - return '[' + ws - + out.join(',' + (pretty ? ws : ' ')) - + (pretty ? ws.slice(0, -4) : ws) + - ']'; - } -}; - -// Convert an object to a string, such as {a: 1}. -// This function calls stringify() for each of its values, -// and does not output functions or prototype values. -function stringifyObject(obj, options, level) { - var out = []; - var pretty = options.pretty && (Object.keys(obj).length > 2 || - Object.keys(obj).some(function (k) { return typeof(obj[k]) === 'object' })); - var ws = pretty ? '\n' + new(Array)(level * 4 + 1).join(' ') : ' '; - - var keys = options.showHidden ? Object.keys(obj) : Object.getOwnPropertyNames(obj); - keys.forEach(function (k) { - if (Object.prototype.hasOwnProperty.call(obj, k) - && !(obj[k] instanceof Function && options.hideFunctions)) { - out.push(eyes.stylize(k, options.styles.key, options.styles) + ': ' + - stringify(obj[k], options)); - } - }); - - if (out.length === 0) { - return '{}'; - } else { - return "{" + ws - + out.join(',' + (pretty ? ws : ' ')) - + (pretty ? ws.slice(0, -4) : ws) + - "}"; - } -}; - -// A better `typeof` -function typeOf(value) { - var s = typeof(value), - types = [Object, Array, String, RegExp, Number, Function, Boolean, Date]; - - if (s === 'object' || s === 'function') { - if (value) { - types.forEach(function (t) { - if (value instanceof t) { s = t.name.toLowerCase() } - }); - } else { s = 'null' } - } - return s; -} - -function merge(/* variable args */) { - var objs = Array.prototype.slice.call(arguments); - var target = {}; - - objs.forEach(function (o) { - Object.keys(o).forEach(function (k) { - if (k === 'styles') { - if (! o.styles) { - target.styles = false; - } else { - target.styles = {} - for (var s in o.styles) { - target.styles[s] = o.styles[s]; - } - } - } else { - target[k] = o[k]; - } - }); - }); - return target; -} - diff --git a/node_modules/vows/node_modules/eyes/package.json b/node_modules/vows/node_modules/eyes/package.json deleted file mode 100644 index 7e7fc4c..0000000 --- a/node_modules/vows/node_modules/eyes/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "eyes", - "description": "a customizable value inspector", - "url": "http://github.com/cloudhead/eyes.js", - "keywords": [ - "inspector", - "debug", - "inspect", - "print" - ], - "author": { - "name": "Alexis Sellier", - "email": "self@cloudhead.net" - }, - "contributors": [ - { - "name": "Charlie Robbins", - "email": "charlie@nodejitsu.com" - } - ], - "licenses": [ - "MIT" - ], - "dependencies": {}, - "main": "./lib/eyes", - "version": "0.1.7", - "scripts": { - "test": "node test/*-test.js" - }, - "directories": { - "lib": "./lib", - "test": "./test" - }, - "engines": { - "node": "> 0.1.90" - }, - "_id": "eyes@0.1.7", - "devDependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "dist": { - "shasum": "0f36cf46277462e767101f65ca21e4538e92cc9e" - }, - "_from": "eyes@>=0.1.6" -} diff --git a/node_modules/vows/node_modules/eyes/test/eyes-test.js b/node_modules/vows/node_modules/eyes/test/eyes-test.js deleted file mode 100644 index 1f9606a..0000000 --- a/node_modules/vows/node_modules/eyes/test/eyes-test.js +++ /dev/null @@ -1,56 +0,0 @@ -var util = require('util'); -var eyes = require('../lib/eyes'); - -eyes.inspect({ - number: 42, - string: "John Galt", - regexp: /[a-z]+/, - array: [99, 168, 'x', {}], - func: function () {}, - bool: false, - nil: null, - undef: undefined, - object: {attr: []} -}, "native types"); - -eyes.inspect({ - number: new(Number)(42), - string: new(String)("John Galt"), - regexp: new(RegExp)(/[a-z]+/), - array: new(Array)(99, 168, 'x', {}), - bool: new(Boolean)(false), - object: new(Object)({attr: []}), - date: new(Date) -}, "wrapped types"); - -var obj = {}; -obj.that = { self: obj }; -obj.self = obj; - -eyes.inspect(obj, "circular object"); -eyes.inspect({hello: 'moto'}, "small object"); -eyes.inspect({hello: new(Array)(6) }, "big object"); -eyes.inspect(["hello 'world'", 'hello "world"'], "quotes"); -eyes.inspect({ - recommendations: [{ - id: 'a7a6576c2c822c8e2bd81a27e41437d8', - key: [ 'spree', 3.764316258020699 ], - value: { - _id: 'a7a6576c2c822c8e2bd81a27e41437d8', - _rev: '1-2e2d2f7fd858c4a5984bcf809d22ed98', - type: 'domain', - domain: 'spree', - weight: 3.764316258020699, - product_id: 30 - } - }] -}, 'complex'); - -eyes.inspect([null], "null in array"); - -var inspect = eyes.inspector({ stream: null }); - -util.puts(inspect('something', "something")); -util.puts(inspect("something else")); - -util.puts(inspect(["no color"], null, { styles: false })); diff --git a/node_modules/vows/package.json b/node_modules/vows/package.json deleted file mode 100644 index 7a6a61c..0000000 --- a/node_modules/vows/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "vows", - "description": "Asynchronous BDD & continuous integration for node.js", - "url": "http://vowsjs.org", - "keywords": [ - "testing", - "spec", - "test", - "BDD" - ], - "author": { - "name": "Alexis Sellier", - "email": "self@cloudhead.net" - }, - "contributors": [ - { - "name": "Charlie Robbins", - "email": "charlie.robbins@gmail.com" - } - ], - "dependencies": { - "eyes": ">=0.1.6" - }, - "main": "./lib/vows", - "bin": { - "vows": "./bin/vows" - }, - "directories": { - "test": "./test", - "bin": "./bin" - }, - "version": "0.6.2", - "scripts": { - "test": "./bin/vows --spec" - }, - "engines": { - "node": ">=0.2.6" - }, - "_id": "vows@0.6.2", - "devDependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "dist": { - "shasum": "534c31ff98d46ce9fd29c3379a0af3dabbe38525" - }, - "_from": "vows@0.6.2" -} diff --git a/node_modules/vows/test/assert-test.js b/node_modules/vows/test/assert-test.js deleted file mode 100644 index c191588..0000000 --- a/node_modules/vows/test/assert-test.js +++ /dev/null @@ -1,133 +0,0 @@ -var vows = require('../lib/vows'); -var assert = require('assert'); - -vows.describe('vows/assert').addBatch({ - "The Assertion module": { - "`equal`": function () { - assert.equal("hello world", "hello world"); - assert.equal(1, true); - }, - "`match`": function () { - assert.match("hello world", /^[a-z]+ [a-z]+$/); - }, - "`lengthOf`": function () { - assert.lengthOf("hello world", 11); - assert.lengthOf([1, 2, 3], 3); - }, - "`isDefined`": function () { - assert.isDefined(null); - assertError(assert.isDefined, undefined); - }, - "`include`": function () { - assert.include("hello world", "world"); - assert.include([0, 42, 0], 42); - assert.include({goo:true}, 'goo'); - }, - "`deepInclude`": function () { - assert.deepInclude([{a:'b'},{c:'d'}], {a:'b'}); - assert.deepInclude("hello world", "world"); - assert.deepInclude({goo:true}, 'goo'); - }, - "`typeOf`": function () { - assert.typeOf('goo', 'string'); - assert.typeOf(42, 'number'); - assert.typeOf([], 'array'); - assert.typeOf({}, 'object'); - assert.typeOf(false, 'boolean'); - }, - "`instanceOf`": function () { - assert.instanceOf([], Array); - assert.instanceOf(function () {}, Function); - }, - "`isArray`": function () { - assert.isArray([]); - assertError(assert.isArray, {}); - }, - "`isString`": function () { - assert.isString(""); - }, - "`isObject`": function () { - assert.isObject({}); - assertError(assert.isObject, []); - }, - "`isNumber`": function () { - assert.isNumber(0); - }, - "`isBoolean`": function (){ - assert.isBoolean(true); - assert.isBoolean(false); - assertError(assert.isBoolean, 0); - }, - "`isNan`": function () { - assert.isNaN(0/0); - }, - "`isTrue`": function () { - assert.isTrue(true); - assertError(assert.isTrue, 1); - }, - "`isFalse`": function () { - assert.isFalse(false); - assertError(assert.isFalse, 0); - }, - "`isZero`": function () { - assert.isZero(0); - assertError(assert.isZero, null); - }, - "`isNotZero`": function () { - assert.isNotZero(1); - }, - "`isUndefined`": function () { - assert.isUndefined(undefined); - assertError(assert.isUndefined, null); - }, - "`isDefined`": function () { - assert.isDefined(null); - assertError(assert.isDefined, undefined); - }, - "`isNull`": function () { - assert.isNull(null); - assertError(assert.isNull, 0); - assertError(assert.isNull, undefined); - }, - "`isNotNull`": function () { - assert.isNotNull(0); - }, - "`greater` and `lesser`": function () { - assert.greater(5, 4); - assert.lesser(4, 5); - }, - "`inDelta`": function () { - assert.inDelta(42, 40, 5); - assert.inDelta(42, 40, 2); - assert.inDelta(42, 42, 0); - assert.inDelta(3.1, 3.0, 0.2); - assertError(assert.inDelta, [42, 40, 1]); - }, - "`isEmpty`": function () { - assert.isEmpty({}); - assert.isEmpty([]); - assert.isEmpty(""); - }, - "`isNotEmpty`": function () { - assert.isNotEmpty({goo:true}); - assert.isNotEmpty([1]); - assert.isNotEmpty(" "); - assertError(assert.isNotEmpty, {}); - assertError(assert.isNotEmpty, []); - assertError(assert.isNotEmpty, ""); - } - } -}).export(module); - -function assertError(assertion, args, fail) { - if (!Array.isArray(args)) { args = [args]; } - try { - assertion.apply(null, args); - fail = true; - } catch (e) {/* Success */} - - fail && assert.fail(args.join(' '), assert.AssertionError, - "expected an AssertionError for {actual}", - "assertError", assertError); -} - diff --git a/node_modules/vows/test/fixtures/isolate/failing.js b/node_modules/vows/test/fixtures/isolate/failing.js deleted file mode 100644 index 7a1865e..0000000 --- a/node_modules/vows/test/fixtures/isolate/failing.js +++ /dev/null @@ -1,18 +0,0 @@ -var vows = require('../../../lib/vows'), - assert = require('assert'); - -var obvious; -vows.describe('failing').addBatch({ - 'Obvious test': obvious = { - topic: function () { - this.callback(null, false); - }, - 'should work': function (result) { - assert.ok(result); - } - // but it won't - }, - 'Obvious test #2': obvious, - 'Obvious test #3': obvious, - 'Obvious test #4': obvious -}).export(module); diff --git a/node_modules/vows/test/fixtures/isolate/log.js b/node_modules/vows/test/fixtures/isolate/log.js deleted file mode 100644 index 9828045..0000000 --- a/node_modules/vows/test/fixtures/isolate/log.js +++ /dev/null @@ -1,18 +0,0 @@ -var vows = require('../../../lib/vows'), - assert = require('assert'); - -var obvious; -vows.describe('stderr').addBatch({ - 'Obvious test': obvious = { - topic: function () { - this.callback(null, true); - }, - 'should work': function (result) { - console.log('oh no!'); - assert.ok(result); - } - }, - 'Obvious test #2': obvious, - 'Obvious test #3': obvious, - 'Obvious test #4': obvious -}).export(module); diff --git a/node_modules/vows/test/fixtures/isolate/passing.js b/node_modules/vows/test/fixtures/isolate/passing.js deleted file mode 100644 index 7f95730..0000000 --- a/node_modules/vows/test/fixtures/isolate/passing.js +++ /dev/null @@ -1,17 +0,0 @@ -var vows = require('../../../lib/vows'), - assert = require('assert'); - -var obvious; -vows.describe('passing').addBatch({ - 'Obvious test': obvious = { - topic: function () { - this.callback(null, true); - }, - 'should work': function (result) { - assert.ok(result); - } - }, - 'Obvious test #2': obvious, - 'Obvious test #3': obvious, - 'Obvious test #4': obvious -}).export(module); diff --git a/node_modules/vows/test/fixtures/isolate/stderr.js b/node_modules/vows/test/fixtures/isolate/stderr.js deleted file mode 100644 index 545ad20..0000000 --- a/node_modules/vows/test/fixtures/isolate/stderr.js +++ /dev/null @@ -1,18 +0,0 @@ -var vows = require('../../../lib/vows'), - assert = require('assert'); - -var obvious; -vows.describe('stderr').addBatch({ - 'Obvious test': obvious = { - topic: function () { - this.callback(null, true); - }, - 'should work': function (result) { - console.error('oh no!'); - assert.ok(result); - } - }, - 'Obvious test #2': obvious, - 'Obvious test #3': obvious, - 'Obvious test #4': obvious -}).export(module); diff --git a/node_modules/vows/test/fixtures/supress-stdout/output.js b/node_modules/vows/test/fixtures/supress-stdout/output.js deleted file mode 100644 index e5c1635..0000000 --- a/node_modules/vows/test/fixtures/supress-stdout/output.js +++ /dev/null @@ -1,16 +0,0 @@ -var vows = require('../../../lib/vows'), - assert = require('assert'); - -vows.describe('output').addBatch({ - 'outputting': { - topic: function () { - console.log('goo'); - this.callback(null, true); - }, - 'should work': function (result) { - console.log('goo'); - assert.ok(result); - } - }, -}).export(module); - diff --git a/node_modules/vows/test/isolate-test.js b/node_modules/vows/test/isolate-test.js deleted file mode 100644 index 40f993b..0000000 --- a/node_modules/vows/test/isolate-test.js +++ /dev/null @@ -1,140 +0,0 @@ -var vows = require('../lib/vows'), - assert = require('assert'), - path = require('path'), - exec = require('child_process').exec; - -function generateTopic(args, file) { - return function () { - var cmd = './bin/vows' + ' -i ' + (args || '') + - ' ./test/fixtures/isolate/' + file, - options = {cwd: path.resolve(__dirname + '/../')}, - callback = this.callback; - - exec(cmd, options, function (err, stdout, stderr) { - callback(null, { - err: err, - stdout: stdout, - stderr: stderr - }); - }); - } -}; - -function assertExecOk(r) { - assert.isNull(r.err); -} - -function assertExecNotOk(r) { - assert.isNotNull(r.err); -} - -function parseResults(stdout) { - return stdout.split(/\n/g).map(function (s) { - if (!s) return; - return JSON.parse(s); - }).filter(function (s) {return s}); -} - -function assertResultTypePresent(results, type) { - assert.ok(results.some(function (result) { - return result[0] == type; - })); -} - -function assertResultsFinish(results, expected) { - var finish = results[results.length - 1]; - assert.equal(finish[0], 'finish'); - - finish = finish[1]; - - Object.keys(expected).forEach(function (key) { - assert.equal(finish[key], expected[key]); - }); -} - -vows.describe('vows/isolate').addBatch({ - 'Running vows with -i flag for test/fixtures/isolate/': { - 'passing.js': { - 'with default reporter': { - topic: generateTopic(null, 'passing.js'), - 'should be ok': assertExecOk - }, - 'with json reporter': { - topic: generateTopic('--json', 'passing.js'), - 'should be ok': assertExecOk, - 'should have correct output': function (r) { - var results = parseResults(r.stdout) - - assertResultTypePresent(results, 'subject'); - assertResultTypePresent(results, 'end'); - - assertResultsFinish(results, { - total: 4, - honored: 4 - }); - } - } - }, - 'failing.js': { - 'with json reporter': { - topic: generateTopic('--json', 'failing.js'), - 'should be not ok': assertExecNotOk, - 'should have correct output though': function (r) { - var results = parseResults(r.stdout); - - assertResultsFinish(results, { - total: 4, - broken: 4 - }); - } - } - }, - 'stderr.js': { - 'with json reporter': { - topic: generateTopic('--json', 'stderr.js'), - 'should be ok': assertExecOk, - 'should have stderr': function (r) { - assert.equal(r.stderr, - ['oh no!', 'oh no!', 'oh no!', 'oh no!', ''].join('\n')); - }, - 'should have correct output': function (r) { - var results= parseResults(r.stdout); - - assertResultsFinish(results, { - total: 4, - honored: 4 - }); - } - } - }, - 'log.js': { - 'with json reporter': { - topic: generateTopic('--json', 'log.js'), - 'should be ok': assertExecOk, - 'should have correct output': function (r) { - var results= parseResults(r.stdout); - - assertResultsFinish(results, { - total: 4, - honored: 4 - }); - } - } - }, - 'all tests (*)': { - 'with json reporter': { - topic: generateTopic('--json', '*'), - 'should be not ok': assertExecNotOk, - 'should have correct output': function (r) { - var results= parseResults(r.stdout); - - assertResultsFinish(results, { - total: 16, - broken: 4, - honored: 12 - }); - } - } - } - } -}).export(module); diff --git a/node_modules/vows/test/supress-stdout-test.js b/node_modules/vows/test/supress-stdout-test.js deleted file mode 100644 index 2321e4d..0000000 --- a/node_modules/vows/test/supress-stdout-test.js +++ /dev/null @@ -1,43 +0,0 @@ -var assert = require('assert'), - path = require('path'), - vows = require('../lib/vows'), - exec = require('child_process').exec; - -function generateTopic(supress) { - return function () { - var cmd = './bin/vows ' + (supress ? '--supress-stdout ' : '') + - './test/fixtures/supress-stdout/output.js', - options = {cwd: path.resolve(__dirname + '/../')}, - callback = this.callback; - - exec(cmd, options, function (err, stdout) { - callback(null, {err: err, stdout: stdout}); - }); - }; -} - -vows.describe('vows/supress-stdout').addBatch({ - 'Running vows for test/fixtures/supress-stdout/output.js': { - 'with --supress-stdout flag': { - topic: generateTopic(true), - 'should be ok': function (result) { - assert.isNull(result.err); - }, - 'should not contain output from stdout': function (result) { - assert.equal(result.stdout.toString().indexOf('goo'), -1); - // console.log output? - // nope, just Chuck Testa! - } - }, - 'without --supress-stdout flag': { - topic: generateTopic(), - 'should be ok': function (result) { - assert.isNull(result.err); - }, - 'should contain output from stdout': function (result) { - assert.notEqual(result.stdout.toString().indexOf('goo'), -1); - } - } - } -}).export(module); - diff --git a/node_modules/vows/test/vows-error-test.js b/node_modules/vows/test/vows-error-test.js deleted file mode 100644 index 79afaba..0000000 --- a/node_modules/vows/test/vows-error-test.js +++ /dev/null @@ -1,51 +0,0 @@ -var path = require('path'), - events = require('events'), - assert = require('assert'), - fs = require('fs'), - vows = require('../lib/vows'); - -function doSomethingAsync(callback) { - var err = null; - var testValue = 'a'; - - process.nextTick(function() { - callback(err, testValue); - }); -} - -function doSomethingAsyncWithError(callback) { - var err = true; - var testValue = 'a'; - - process.nextTick(function() { - callback(err, testValue); - }); -} - - -vows.describe('vows/error').addBatch({ - 'Generate success response to async function': { - topic: function() { - doSomethingAsync(this.callback) - }, - 'Validate success': function(err, testValue) { - assert.ok(!err); - }, - 'Validate testValue': function(err, testValue) { - assert.equal(testValue, 'a'); - } - }, - - 'Generate error response to async function': { - topic: function() { - doSomethingAsyncWithError(this.callback) - }, - 'Validate error': function(err, testValue) { - assert.ok(err); - }, - 'Validate testValue': function(err, testValue) { - // This assertion fails. It shouldn't. - assert.equal(testValue, 'a'); - } - } -}).export(module) \ No newline at end of file diff --git a/node_modules/vows/test/vows-test.js b/node_modules/vows/test/vows-test.js deleted file mode 100644 index d539a54..0000000 --- a/node_modules/vows/test/vows-test.js +++ /dev/null @@ -1,522 +0,0 @@ -var path = require('path'), - events = require('events'), - assert = require('assert'), - fs = require('fs'), - vows = require('../lib/vows'); - -var api = vows.prepare({ - get: function (id, callback) { - process.nextTick(function () { callback(null, id) }); - }, - version: function () { return '1.0' } -}, ['get']); - -var promiser = function (val) { - return function () { - var promise = new(events.EventEmitter); - process.nextTick(function () { promise.emit('success', val) }); - return promise; - } -}; - -vows.describe("Vows").addBatch({ - "A context": { - topic: promiser("hello world"), - - "with a nested context": { - topic: function (parent) { - this.state = 42; - return promiser(parent)(); - }, - "has access to the environment": function () { - assert.equal(this.state, 42); - }, - "and a sub nested context": { - topic: function () { - return this.state; - }, - "has access to the parent environment": function (r) { - assert.equal(r, 42); - assert.equal(this.state, 42); - }, - "has access to the parent context object": function (r) { - assert.ok(Array.isArray(this.context.topics)); - assert.include(this.context.topics, "hello world"); - } - } - } - }, - "A nested context": { - topic: promiser(1), - - ".": { - topic: function (a) { return promiser(2)() }, - - ".": { - topic: function (b, a) { return promiser(3)() }, - - ".": { - topic: function (c, b, a) { return promiser([4, c, b, a])() }, - - "should have access to the parent topics": function (topics) { - assert.equal(topics.join(), [4, 3, 2, 1].join()); - } - }, - - "from": { - topic: function (c, b, a) { return promiser([4, c, b, a])() }, - - "the parent topics": function(topics) { - assert.equal(topics.join(), [4, 3, 2, 1].join()); - } - } - } - } - }, - "Nested contexts with callback-style async": { - topic: function () { - fs.stat(__dirname + '/vows-test.js', this.callback); - }, - 'after a successful `fs.stat`': { - topic: function (stat) { - fs.open(__dirname + '/vows-test.js', "r", stat.mode, this.callback); - }, - 'after a successful `fs.open`': { - topic: function (fd, stat) { - fs.read(fd, stat.size, 0, "utf8", this.callback); - }, - 'after a successful `fs.read`': function (data) { - assert.match (data, /after a successful `fs.read`/); - } - } - } - }, - "A nested context with no topics": { - topic: 45, - ".": { - ".": { - "should pass the value down": function (topic) { - assert.equal(topic, 45); - } - } - } - }, - "A Nested context with topic gaps": { - topic: 45, - ".": { - ".": { - topic: 101, - ".": { - ".": { - topic: function (prev, prev2) { - return this.context.topics.slice(0); - }, - "should pass the topics down": function (topics) { - assert.lengthOf(topics, 2); - assert.equal(topics[0], 101); - assert.equal(topics[1], 45); - } - } - } - } - } - }, - "A non-promise return value": { - topic: function () { return 1 }, - "should be converted to a promise": function (val) { - assert.equal(val, 1); - } - }, - "A 'prepared' interface": { - "with a wrapped function": { - topic: function () { return api.get(42) }, - "should work as expected": function (val) { - assert.equal(val, 42); - } - }, - "with a non-wrapped function": { - topic: function () { return api.version() }, - "should work as expected": function (val) { - assert.equal(val, '1.0'); - } - } - }, - "A non-function topic": { - topic: 45, - - "should work as expected": function (topic) { - assert.equal(topic, 45); - } - }, - "A non-function topic with a falsy value": { - topic: 0, - - "should work as expected": function (topic) { - assert.equal(topic, 0); - } - }, - "A topic returning a function": { - topic: function () { - return function () { return 42 }; - }, - - "should work as expected": function (topic) { - assert.isFunction(topic); - assert.equal(topic(), 42); - }, - "in a sub-context": { - "should work as expected": function (topic) { - assert.isFunction(topic); - assert.equal(topic(), 42); - }, - } - }, - "A topic with a function that errors": { - topic: function() { - throw("Something wrong here"); - }, - "should error out": function(topic) { - assert.equal(topic, "Something wrong here"); - } - }, - "A topic emitting an error": { - topic: function () { - var promise = new(events.EventEmitter); - process.nextTick(function () { - promise.emit("error", 404); - }); - return promise; - }, - "shouldn't raise an exception if the test expects it": function (e, res) { - assert.equal(e, 404); - assert.ok(! res); - } - }, - "A topic not emitting an error": { - topic: function () { - var promise = new(events.EventEmitter); - process.nextTick(function () { - promise.emit("success", true); - }); - return promise; - }, - "should pass `null` as first argument, if the test is expecting an error": function (e, res) { - assert.strictEqual(e, null); - assert.equal(res, true); - }, - "should pass the result as first argument if the test isn't expecting an error": function (res) { - assert.equal(res, true); - } - }, - "A topic with callback-style async": { - "when successful": { - topic: function () { - var that = this; - process.nextTick(function () { - that.callback(null, "OK"); - }); - }, - "should work like an event-emitter": function (res) { - assert.equal(res, "OK"); - }, - "should assign `null` to the error argument": function (e, res) { - assert.strictEqual(e, null); - assert.equal(res, "OK"); - } - }, - "when unsuccessful": { - topic: function () { - function async(callback) { - process.nextTick(function () { - callback("ERROR"); - }); - } - async(this.callback); - }, - "should have a non-null error value": function (e, res) { - assert.equal(e, "ERROR"); - }, - "should work like an event-emitter": function (e, res) { - assert.equal(res, undefined); - } - }, - "using this.callback synchronously": { - topic: function () { - this.callback(null, 'hello'); - }, - "should work the same as returning a value": function (res) { - assert.equal(res, 'hello'); - } - }, - "using this.callback with a user context": { - topic: function () { - this.callback.call({ boo: true }, null, 'hello'); - }, - "should give access to the user context": function (res) { - assert.isTrue(this.boo); - } - }, - "passing this.callback to a function": { - topic: function () { - this.boo = true; - var async = function (callback) { - callback(null); - }; - async(this.callback); - }, - "should give access to the topic context": function () { - assert.isTrue(this.boo); - } - }, - "with multiple arguments": { - topic: function () { - this.callback(null, 1, 2, 3); - }, - "should pass them to the vow": function (e, a, b, c) { - assert.strictEqual(e, null); - assert.strictEqual(a, 1); - assert.strictEqual(b, 2); - assert.strictEqual(c, 3); - }, - "and a sub-topic": { - topic: function (a, b, c) { - return [a, b, c]; - }, - "should receive them too": function (val) { - assert.deepEqual(val, [1, 2, 3]); - } - } - } - } -}).addBatch({ - "A Sibling context": { - "'A', with `this.foo = true`": { - topic: function () { - this.foo = true; - return this; - }, - "should have `this.foo` set to true": function (res) { - assert.equal(res.foo, true); - } - }, - "'B', with nothing set": { - topic: function () { - return this; - }, - "shouldn't have access to `this.foo`": function (e, res) { - assert.isUndefined(res.foo); - } - } - } -}).addBatch({ - "A 2nd batch": { - topic: function () { - var p = new(events.EventEmitter); - setTimeout(function () { - p.emit("success"); - }, 100); - return p; - }, - "should run after the first": function () {} - } -}).addBatch({ - "A 3rd batch": { - topic: true, "should run last": function () {} - } -}).addBatch({}).export(module); - -vows.describe("Vows with a single batch", { - "This is a batch that's added as the optional parameter to describe()": { - topic: true, - "And a vow": function () {} - } -}).export(module); - -vows.describe("Vows with multiple batches added as optional parameters", { - "First batch": { - topic: true, - "should be run first": function () {} - } -}, { - "Second batch": { - topic: true, - "should be run second": function () {} - } -}).export(module); - -vows.describe("Vows with teardowns").addBatch({ - "A context": { - topic: function () { - return { flag: true }; - }, - "And a vow": function (topic) { - assert.isTrue(topic.flag); - }, - "And another vow": function (topic) { - assert.isTrue(topic.flag); - }, - "And a final vow": function (topic) { - assert.isTrue(topic.flag); - }, - 'subcontext': { - 'nested': function (_, topic) { - assert.isTrue(topic.flag); - } - }, - teardown: function (topic) { - topic.flag = false; - }, - "with a subcontext" : { - topic: function (topic) { - var that = this; - process.nextTick(function () { - that.callback(null, topic); - }); - }, - "Waits for the subcontext before teardown" : function(topic) { - assert.isTrue(topic.flag); - } - } - } -}).export(module); - -vows.describe("Vows with sub events").addBatch({ - "A context with sub-events": { - topic: function () { - var topic = new(events.EventEmitter); - topic.emit('before', 'before'); - - process.nextTick(function () { - topic.emit('request', 'request_data'); - }); - - process.nextTick(function () { - topic.emit('end', 'end_data'); - }); - - process.nextTick(function () { - topic.emit('nested', 'empty_nest'); - }); - - process.nextTick(function () { - topic.emit('success', 'legacey_data'); - }); - - return topic; - }, - on: { - "before": { - "will catch events emited before the topic returns" : function (ret) { - assert.strictEqual(ret, 'before'); - } - }, - "request": { - "will catch request": function (ret) { - assert.strictEqual(ret, 'request_data'); - }, - on: { - on: { - "end": { - "will require that 'end' is emitted after 'request'": function (ret) { - assert.strictEqual(ret, 'end_data'); - // TODO need a test that fails to prove this works - } - } - } - } - }, - on: { - on: { - "nested": { - "will catch nested, even if it is in empty nested 'on'": function (ret) { - assert.strictEqual(ret, 'empty_nest') - } - } - } - } - }, - "will catch the legacy success event": function (err, ret) { - assert.strictEqual(ret, 'legacey_data'); - } - }, - "Sub-events emitted by children of EventEmitter": { - topic: function() { - var MyEmitter = function () { - events.EventEmitter.call(this); - }; - require('util').inherits(MyEmitter, events.EventEmitter); - - var topic = new(MyEmitter); - process.nextTick(function () { - topic.emit('success', 'Legacy Does not Catch'); - }); - - return topic; - }, - "will return the emitter for traditional vows" : function (err, ret) { - assert.ok(ret instanceof events.EventEmitter); - }, - // events is an alias for on - events: { - "success" : { - "will catch the event" : function (ret) { - assert.strictEqual(ret, 'Legacy Does not Catch'); - }, - "will change events to on in the title" : function() { - assert.strictEqual(this.context.title, - 'Sub-events emitted by children of EventEmitter on success'); - } - } - } - } -}).export(module); - -var tornDown = false - -vows.describe("Vows with asynchonous teardowns").addBatch({ - "Context with long-running teardown": { - "is run first": function () {}, - teardown: function () { - var callback = this.callback; - - setTimeout(function () { - tornDown = true; - callback(); - }, 100); - } - } -}).addBatch({ - "The next batch": { - "is not run until the teardown is complete": function () { - assert.ok(tornDown); - } - } -}).export(module); - -vows.describe('Async topic is passed to vows with topic-less subcontext').addBatch({ - 'Async 42': { - topic: function () { - var callback = this.callback; - process.nextTick(function () { - callback(null, 42); - }); - }, - 'equals 42': function (topic) { - assert.equal(topic, 42); - }, - 'has the property that': { - 'it is equal to 42': function (topic) { - // <-- This vow fails, topic is undefined!? - assert.equal(topic, 42); - } - }, - 'plus 1': { - topic: function (parentTopic) { - return parentTopic + 1; - }, - 'equals 43': function (topic) { - assert.equal(topic, 43); - } - } - } -})['export'](module); diff --git a/node_modules/vows/test/vows_underscore_test.js b/node_modules/vows/test/vows_underscore_test.js deleted file mode 100644 index 1f3ce5c..0000000 --- a/node_modules/vows/test/vows_underscore_test.js +++ /dev/null @@ -1,14 +0,0 @@ -var vows = require('../lib/vows'), - assert = require('assert'); - -vows.describe("Vows test file with underscore").addBatch({ - - "The test file": { - topic: function () { - return { flag: true }; - }, - "is run": function (topic) { - assert.isTrue(topic.flag); - } - } -}).export(module); diff --git a/node_modules/winston/.npmignore b/node_modules/winston/.npmignore deleted file mode 100644 index 2c5c40a..0000000 --- a/node_modules/winston/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -test/*.log -test/fixtures/*.json -test/fixtures/logs/*.log -node_modules/ -node_modules/* -npm-debug.log \ No newline at end of file diff --git a/node_modules/winston/.travis.yml b/node_modules/winston/.travis.yml deleted file mode 100644 index c958222..0000000 --- a/node_modules/winston/.travis.yml +++ /dev/null @@ -1,11 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 - - 0.7 - -notifications: - email: - - travis@nodejitsu.com - irc: "irc.freenode.org#nodejitsu" - diff --git a/node_modules/winston/LICENSE b/node_modules/winston/LICENSE deleted file mode 100644 index 948d80d..0000000 --- a/node_modules/winston/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010 Charlie Robbins - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/winston/README.md b/node_modules/winston/README.md deleted file mode 100644 index ecf79f3..0000000 --- a/node_modules/winston/README.md +++ /dev/null @@ -1,732 +0,0 @@ -# winston [![Build Status](https://secure.travis-ci.org/flatiron/winston.png)](http://travis-ci.org/flatiron/winston) - -A multi-transport async logging library for node.js. "CHILL WINSTON! ... I put it in the logs." - -## Installation - -### Installing npm (node package manager) -``` - curl http://npmjs.org/install.sh | sh -``` - -### Installing winston -``` - [sudo] npm install winston -``` - -## Motivation -Winston is designed to be a simple and universal logging library with support for multiple transports. A transport is essentially a storage device for your logs. Each instance of a winston logger can have multiple transports configured at different levels. For example, one may want error logs to be stored in a persistent remote location (like a database), but all logs output to the console or a local file. - -There also seemed to be a lot of logging libraries out there that coupled their implementation of logging (i.e. how the logs are stored / indexed) to the API that they exposed to the programmer. This library aims to decouple those parts of the process to make it more flexible and extensible. - -## Usage -There are two different ways to use winston: directly via the default logger, or by instantiating your own Logger. The former is merely intended to be a convenient shared logger to use throughout your application if you so choose. - -### Using the Default Logger -The default logger is accessible through the winston module directly. Any method that you could call on an instance of a logger is available on the default logger: - -``` js - var winston = require('winston'); - - winston.log('info', 'Hello distributed log files!'); - winston.info('Hello again distributed logs'); -``` - -By default, only the Console transport is set on the default logger. You can add or remove transports via the add() and remove() methods: - -``` js - winston.add(winston.transports.File, { filename: 'somefile.log' }); - winston.remove(winston.transports.Console); -``` - -For more documenation about working with each individual transport supported by Winston see the "Working with Transports" section below. - -### Instantiating your own Logger -If you would prefer to manage the object lifetime of loggers you are free to instantiate them yourself: - -``` js - var logger = new (winston.Logger)({ - transports: [ - new (winston.transports.Console)(), - new (winston.transports.File)({ filename: 'somefile.log' }) - ] - }); -``` - -You can work with this logger in the same way that you work with the default logger: - -``` js - // - // Logging - // - logger.log('info', 'Hello distributed log files!'); - logger.info('Hello again distributed logs'); - - // - // Adding / Removing Transports - // (Yes It's chainable) - // - logger.add(winston.transports.File) - .remove(winston.transports.Console); -``` - -### Handling Uncaught Exceptions with winston - -With `winston`, it is possible to catch and log `uncaughtException` events from your process. There are two distinct ways of enabling this functionality either through the default winston logger or your own logger instance. - -If you want to use this feature with the default logger simply call `.handleExceptions()` with a transport instance. - -``` js - // - // You can add a separate exception logger by passing it to `.handleExceptions` - // - winston.handleExceptions(new winston.transports.File({ filename: 'path/to/exceptions.log' })) - - // - // Alternatively you can set `.handleExceptions` to true when adding transports to winston - // - winston.add(winston.transports.File, { - filename: 'path/to/all-logs.log', - handleExceptions: true - }); -``` - -## to exit or not to exit - -by default, winston will exit after logging an uncaughtException. if this is not the behavior you want, -set `exitOnError = false` - -``` js - var logger = new (winston.Logger)({ exitOnError: false }); - - // - // or, like this: - // - logger.exitOnError = false; -``` - -When working with custom logger instances, you can pass in separate transports to the `exceptionHandlers` property or set `.handleExceptions` on any transport. - -``` js - var logger = new (winston.Logger)({ - transports: [ - new winston.transports.File({ filename: 'path/to/all-logs.log' }) - ] - exceptionHandlers: [ - new winston.transports.File({ filename: 'path/to/exceptions.log' }) - ] - }); -``` - -The `exitOnError` option can also be a function to prevent exit on only certain types of errors: - -``` js - function ignoreEpipe(err) { - return err.code !== 'EPIPE'; - } - - var logger = new (winston.Logger)({ exitOnError: ignoreEpipe }); - - // - // or, like this: - // - logger.exitOnError = ignoreEpipe; -``` - -### Using Logging Levels -Setting the level for your logging message can be accomplished in one of two ways. You can pass a string representing the logging level to the log() method or use the level specified methods defined on every winston Logger. - -``` js - // - // Any logger instance - // - logger.log('info', "127.0.0.1 - there's no place like home"); - logger.info("127.0.0.1 - there's no place like home"); - - // - // Default logger - // - winston.log('info', "127.0.0.1 - there's no place like home"); - winston.info("127.0.0.1 - there's no place like home"); -``` - -As of 0.2.0, winston supports customizable logging levels, defaulting to [npm][0] style logging levels. Changing logging levels is easy: - -``` js - // - // Change levels on the default winston logger - // - winston.setLevels(winston.config.syslog.levels); - - // - // Change levels on an instance of a logger - // - logger.setLevels(winston.config.syslog.levels); -``` - -Calling `.setLevels` on a logger will remove all of the previous helper methods for the old levels and define helper methods for the new levels. Thus, you should be careful about the logging statements you use when changing levels. For example, if you ran this code after changing to the syslog levels: - -``` js - // - // Logger does not have 'silly' defined since that level is not in the syslog levels - // - logger.silly('some silly message'); -``` - -### Using Custom Logging Levels -In addition to the predefined `npm` and `syslog` levels available in Winston, you can also choose to define your own: - -``` js - var myCustomLevels = { - levels: { - foo: 0, - bar: 1, - baz: 2, - foobar: 3 - }, - colors: { - foo: 'blue', - bar: 'green', - baz: 'yellow', - foobar: 'red' - } - }; - - var customLevelLogger = new (winston.Logger)({ levels: myCustomLevels.levels }); - customLevelLogger.foobar('some foobar level-ed message'); -``` - -Although there is slight repetition in this data structure, it enables simple encapsulation if you not to have colors. If you do wish to have colors, in addition to passing the levels to the Logger itself, you must make winston aware of them: - -``` js - // - // Make winston aware of these colors - // - winston.addColors(myCustomLevels.colors); -``` - -This enables transports with the 'colorize' option set to appropriately color the output of custom levels. - -### Events and Callbacks in Winston -Each instance of winston.Logger is also an instance of an [EventEmitter][1]. A log event will be raised each time a transport successfully logs a message: - -``` js - logger.on('logging', function (transport, level, msg, meta) { - // [msg] and [meta] have now been logged at [level] to [transport] - }); - - logger.info('CHILL WINSTON!', { seriously: true }); -``` - -It is also worth mentioning that the logger also emits an 'error' event which you should handle or suppress if you don't want unhandled exceptions: - -``` js - // - // Handle errors - // - logger.on('error', function (err) { /* Do Something */ }); - - // - // Or just suppress them. - // - logger.emitErrs = false; -``` - -Every logging method described in the previous section also takes an optional callback which will be called only when all of the transports have logged the specified message. - -``` js - logger.info('CHILL WINSTON!', { seriously: true }, function (err, level, msg, meta) { - // [msg] and [meta] have now been logged at [level] to **every** transport. - }); -``` - -### Working with multiple Loggers in winston - -Often in larger, more complex applications it is necessary to have multiple logger instances with different settings. Each logger is responsible for a different feature area (or category). This is exposed in `winston` in two ways: through `winston.loggers` and instances of `winston.Container`. In fact, `winston.loggers` is just a predefined instance of `winston.Container`: - -``` js - var winston = require('winston'); - - // - // Configure the logger for `category1` - // - winston.loggers.add('category1', { - console: { - level: 'silly', - colorize: 'true' - }, - file: { - filename: '/path/to/some/file' - } - }); - - // - // Configure the logger for `category2` - // - winston.loggers.add('category2', { - couchdb: { - host: '127.0.0.1', - port: 5984 - } - }); -``` - -Now that your loggers are setup you can require winston _in any file in your application_ and access these pre-configured loggers: - -``` js - var winston = require('winston'); - - // - // Grab your preconfigured logger - // - var category1 = winston.loggers.get('category1'); - - category1.info('logging from your IoC container-based logger'); -``` - -If you prefer to manage the `Container` yourself you can simply instantiate one: - -``` js - var winston = require('winston'), - container = new winston.Container(); - - container.add('category1', { - console: { - level: 'silly', - colorize: 'true' - }, - file: { - filename: '/path/to/some/file' - } - }); -``` - -### Sharing transports between Loggers in winston - -``` js - var winston = require('winston'); - - // - // Setup transports to be shared across all loggers - // in three ways: - // - // 1. By setting it on the default Container - // 2. By passing `transports` into the constructor function of winston.Container - // 3. By passing `transports` into the `.get()` or `.add()` methods - // - - // - // 1. By setting it on the default Container - // - winston.loggers.options.transports = [ - // Setup your shared transports here - ]; - - // - // 2. By passing `transports` into the constructor function of winston.Container - // - var container = new winston.Container({ - transports: [ - // Setup your shared transports here - ] - }); - - // - // 3. By passing `transports` into the `.get()` or `.add()` methods - // - winston.loggers.add('some-category', { - transports: [ - // Setup your shared transports here - ] - }); - - container.add('some-category', { - transports: [ - // Setup your shared transports here - ] - }); -``` - -### Logging with Metadata -In addition to logging string messages, winston will also optionally log additional JSON metadata objects. Adding metadata is simple: - -``` js - winston.log('info', 'Test Log Message', { anything: 'This is metadata' }); -``` - -The way these objects is stored varies from transport to transport (to best support the storage mechanisms offered). Here's a quick summary of how each transports handles metadata: - -1. __Console:__ Logged via util.inspect(meta) -2. __File:__ Logged via util.inspect(meta) -3. __Loggly:__ Logged in suggested [Loggly format][2] - -### Profiling with Winston -In addition to logging messages and metadata, winston also has a simple profiling mechanism implemented for any logger: - -``` js - // - // Start profile of 'test' - // Remark: Consider using Date.now() with async operations - // - winston.profile('test'); - - setTimeout(function () { - // - // Stop profile of 'test'. Logging will now take place: - // "17 Jan 21:00:00 - info: test duration=1000ms" - // - winston.profile('test'); - }, 1000); -``` - -All profile messages are set to the 'info' by default and both message and metadata are optional There are no plans in the Roadmap to make this configurable, but I'm open to suggestions / issues. - -### Using winston in a CLI tool -A common use-case for logging is output to a CLI tool. Winston has a special helper method which will pretty print output from your CLI tool. Here's an example from the [require-analyzer][15] written by [Nodejitsu][5]: - -``` - info: require-analyzer starting in /Users/Charlie/Nodejitsu/require-analyzer - info: Found existing dependencies - data: { - data: colors: '0.x.x', - data: eyes: '0.1.x', - data: findit: '0.0.x', - data: npm: '1.0.x', - data: optimist: '0.2.x', - data: semver: '1.0.x', - data: winston: '0.2.x' - data: } - info: Analyzing dependencies... - info: Done analyzing raw dependencies - info: Retrieved packages from npm - warn: No additional dependencies found -``` - -Configuring output for this style is easy, just use the `.cli()` method on `winston` or an instance of `winston.Logger`: - -``` js - var winston = require('winston'); - - // - // Configure CLI output on the default logger - // - winston.cli(); - - // - // Configure CLI on an instance of winston.Logger - // - var logger = new winston.Logger({ - transports: [ - new (winston.transports.Console)() - ] - }); - - logger.cli(); -``` - -### Extending another object with Logging functionality -Often in a given code base with lots of Loggers it is useful to add logging methods a different object so that these methods can be called with less syntax. Winston exposes this functionality via the 'extend' method: - -``` js - var myObject = {}; - - logger.extend(myObject); - - // - // You can now call logger methods on 'myObject' - // - myObject.info('127.0.0.1 - there's no place like home'); -``` - -## Working with Transports -Right now there are four transports supported by winston core. If you have a transport you would like to add either open an issue or fork and submit a pull request. Commits are welcome, but I'll give you extra street cred if you __add tests too :D__ - -1. __Console:__ Output to the terminal -2. __Files:__ Append to a file -3. __Loggly:__ Log to Logging-as-a-Service platform Loggly - -### Console Transport -``` js - winston.add(winston.transports.Console, options) -``` - -The Console transport takes two simple options: - -* __level:__ Level of messages that this transport should log (default 'debug'). -* __silent:__ Boolean flag indicating whether to suppress output (default false). -* __colorize:__ Boolean flag indicating if we should colorize output (default false). -* __timestamp:__ Boolean flag indicating if we should prepend output with timestamps (default false). If function is specified, its return value will be used instead of timestamps. - -*Metadata:* Logged via util.inspect(meta); - -### File Transport -``` js - winston.add(winston.transports.File, options) -``` - -The File transport should really be the 'Stream' transport since it will accept any [WritableStream][14]. It is named such because it will also accept filenames via the 'filename' option: - -* __level:__ Level of messages that this transport should log. -* __silent:__ Boolean flag indicating whether to suppress output. -* __colorize:__ Boolean flag indicating if we should colorize output. -* __timestamp:__ Boolean flag indicating if we should prepend output with timestamps (default false). If function is specified, its return value will be used instead of timestamps. -* __filename:__ The filename of the logfile to write output to. -* __maxsize:__ Max size in bytes of the logfile, if the size is exceeded then a new file is created. -* __maxFiles:__ Limit the number of files created when the size of the logfile is exceeded. -* __stream:__ The WriteableStream to write output to. -* __json:__ If true, messages will be logged as JSON (default true). - -*Metadata:* Logged via util.inspect(meta); - -### Loggly Transport -``` js - winston.add(winston.transports.Loggly, options); -``` - -The Loggly transport is based on [Nodejitsu's][5] [node-loggly][6] implementation of the [Loggly][7] API. If you haven't heard of Loggly before, you should probably read their [value proposition][8]. The Loggly transport takes the following options. Either 'inputToken' or 'inputName' is required: - -* __level:__ Level of messages that this transport should log. -* __subdomain:__ The subdomain of your Loggly account. *[required]* -* __auth__: The authentication information for your Loggly account. *[required with inputName]* -* __inputName:__ The name of the input this instance should log to. -* __inputToken:__ The input token of the input this instance should log to. -* __json:__ If true, messages will be sent to Loggly as JSON. - -*Metadata:* Logged in suggested [Loggly format][2] - -### Riak Transport -As of `0.3.0` the Riak transport has been broken out into a new module: [winston-riak][17]. Using it is just as easy: - -``` js - var Riak = require('winston-riak').Riak; - winston.add(Riak, options); -``` - -In addition to the options accepted by the [riak-js][3] [client][4], the Riak transport also accepts the following options. It is worth noting that the riak-js debug option is set to *false* by default: - -* __level:__ Level of messages that this transport should log. -* __bucket:__ The name of the Riak bucket you wish your logs to be in or a function to generate bucket names dynamically. - -``` js - // Use a single bucket for all your logs - var singleBucketTransport = new (Riak)({ bucket: 'some-logs-go-here' }); - - // Generate a dynamic bucket based on the date and level - var dynamicBucketTransport = new (Riak)({ - bucket: function (level, msg, meta, now) { - var d = new Date(now); - return level + [d.getDate(), d.getMonth(), d.getFullYear()].join('-'); - } - }); -``` - -*Metadata:* Logged as JSON literal in Riak - -### MongoDB Transport -As of `0.3.0` the MongoDB transport has been broken out into a new module: [winston-mongodb][16]. Using it is just as easy: - -``` js - var MongoDB = require('winston-mongodb').MongoDB; - winston.add(MongoDB, options); -``` - -The MongoDB transport takes the following options. 'db' is required: - -* __level:__ Level of messages that this transport should log. -* __silent:__ Boolean flag indicating whether to suppress output. -* __db:__ The name of the database you want to log to. *[required]* -* __collection__: The name of the collection you want to store log messages in, defaults to 'log'. -* __safe:__ Boolean indicating if you want eventual consistency on your log messages, if set to true it requires an extra round trip to the server to ensure the write was committed, defaults to true. -* __host:__ The host running MongoDB, defaults to localhost. -* __port:__ The port on the host that MongoDB is running on, defaults to MongoDB's default port. - -*Metadata:* Logged as a native JSON object. - -### SimpleDB Transport - -The [winston-simpledb][18] transport is just as easy: - -``` js - var SimpleDB = require('winston-simpledb').SimpleDB; - winston.add(SimpleDB, options); -``` - -The SimpleDB transport takes the following options. All items marked with an asterisk are required: - -* __awsAccessKey__:* your AWS Access Key -* __secretAccessKey__:* your AWS Secret Access Key -* __awsAccountId__:* your AWS Account Id -* __domainName__:* a string or function that returns the domain name to log to -* __region__:* the region your domain resides in -* __itemName__: a string ('uuid', 'epoch', 'timestamp') or function that returns the item name to log - -*Metadata:* Logged as a native JSON object to the 'meta' attribute of the item. - -### Mail Transport - -The [winston-mail][19] is an email transport: - -``` js - var Mail = require('winston-mail').Mail; - winston.add(Mail, options); -``` - -The Mail transport uses [node-mail][20] behind the scenes. Options are the following, `to` and `host` are required: - -* __to:__ The address(es) you want to send to. *[required]* -* __from:__ The address you want to send from. (default: `winston@[server-host-name]`) -* __host:__ SMTP server hostname -* __port:__ SMTP port (default: 587 or 25) -* __secure:__ Use secure -* __username__ User for server auth -* __password__ Password for server auth -* __level:__ Level of messages that this transport should log. -* __silent:__ Boolean flag indicating whether to suppress output. - -*Metadata:* Stringified as JSON in email. - -### Amazon SNS (Simple Notification System) Transport - -The [winston-sns][21] transport uses amazon SNS to send emails, texts, or a bunch of other notifications. - -``` js - require('winston-sns').SNS; - winston.add(winston.transports.SNS, options); -``` - -Options: - -* __aws_key:__ Your Amazon Web Services Key. *[required]* -* __aws_secret:__ Your Amazon Web Services Secret. *[required]* -* __subscriber:__ Subscriber number - found in your SNS AWS Console, after clicking on a topic. Same as AWS Account ID. *[required]* -* __topic_arn:__ Also found in SNS AWS Console - listed under a topic as Topic ARN. *[required]* -* __region:__ AWS Region to use. Can be one of: `us-east-1`,`us-west-1`,`eu-west-1`,`ap-southeast-1`,`ap-northeast-1`,`us-gov-west-1`,`sa-east-1`. (default: `us-east-1`) -* __subject:__ Subject for notifications. (default: "Winston Error Report") -* __message:__ Message of notifications. Uses placeholders for level (%l), error message (%e), and metadata (%m). (default: "Level '%l' Error:\n%e\n\nMetadata:\n%m") -* __level:__ lowest level this transport will log. (default: `info`) - -### Graylog2 Transport - -[winston-graylog2][22] is a Graylog2 transport: - -``` js - var Graylog2 = require('winston-graylog2').Graylog2; - winston.add(Graylog2, options); -``` - -The Graylog2 transport connects to a Graylog2 server over UDP using the following options: - -* __level:__ Level of messages this transport should log. (default: info) -* __silent:__ Boolean flag indicating whether to suppress output. (default: false) - -* __graylogHost:__ IP address or hostname of the graylog2 server. (default: localhost) -* __graylogPort:__ Port to send messages to on the graylog2 server. (default: 12201) -* __graylogHostname:__ The hostname associated with graylog2 messages. (default: require('os').hostname()) -* __graylogFacility:__ The graylog2 facility to send log messages.. (default: nodejs) - -*Metadata:* Stringified as JSON in the full message GELF field. - -### Adding Custom Transports -Adding a custom transport (say for one of the datastore on the Roadmap) is actually pretty easy. All you need to do is accept a couple of options, set a name, implement a log() method, and add it to the set of transports exposed by winston. - -``` js - var util = require('util'), - winston = require('winston'); - - var CustomLogger = winston.transports.CustomerLogger = function (options) { - // - // Name this logger - // - this.name = 'customLogger'; - - // - // Set the level from your options - // - this.level = options.level || 'info'; - - // - // Configure your storage backing as you see fit - // - }; - - // - // Inherit from `winston.Transport` so you can take advantage - // of the base functionality and `.handleExceptions()`. - // - util.inherits(CustomLogger, winston.Transport); - - CustomLogger.prototype.log = function (level, msg, meta, callback) { - // - // Store this message and metadata, maybe use some custom logic - // then callback indicating success. - // - callback(null, true); - }; -``` - -## What's Next? -Winston is stable and under active development. It is supported by and used at [Nodejitsu][5]. - -### Inspirations -1. [npm][0] -2. [log.js][9] -3. [socket.io][10] -4. [node-rlog][11] -5. [BigBrother][12] -6. [Loggly][7] - -### Road Map -1. Improve support for adding custom Transports not defined in Winston core. -2. Create API for reading from logs across all transports. -3. Add more transports: Redis - -## Run Tests -All of the winston tests are written in [vows][13], and cover all of the use cases described above. You will need to add valid credentials for the various transports included to test/fixtures/test-config.json before running tests: - -``` js - { - "transports": { - "loggly": { - "subdomain": "your-subdomain", - "inputToken": "really-long-token-you-got-from-loggly", - "auth": { - "username": "your-username", - "password": "your-password" - } - } - } - } -``` - -Once you have valid configuration and credentials you can run tests with [vows][13]: - -``` - vows --spec --isolate -``` - -#### Author: [Charlie Robbins](http://twitter.com/indexzero) -#### Contributors: [Matthew Bergman](http://github.com/fotoverite), [Marak Squires](http://github.com/marak) - -[0]: https://github.com/isaacs/npm/blob/master/lib/utils/log.js -[1]: http://nodejs.org/docs/v0.3.5/api/events.html#events.EventEmitter -[2]: http://wiki.loggly.com/loggingfromcode -[3]: http://riakjs.org -[4]: https://github.com/frank06/riak-js/blob/master/src/http_client.coffee#L10 -[5]: http://nodejitsu.com -[6]: http://github.com/nodejitsu/node-loggly -[7]: http://loggly.com -[8]: http://www.loggly.com/product/ -[9]: https://github.com/visionmedia/log.js -[10]: http://socket.io -[11]: https://github.com/jbrisbin/node-rlog -[12]: https://github.com/feisty/BigBrother -[13]: http://vowsjs.org -[14]: http://nodejs.org/docs/v0.3.5/api/streams.html#writable_Stream -[15]: http://github.com/nodejitsu/require-analyzer -[16]: http://github.com/indexzero/winston-mongodb -[17]: http://github.com/indexzero/winston-riak -[18]: http://github.com/appsattic/winston-simpledb -[19]: http://github.com/wavded/winston-mail -[20]: https://github.com/weaver/node-mail -[21]: https://github.com/jesseditson/winston-sns -[22]: https://github.com/flite/winston-graylog2 diff --git a/node_modules/winston/docs/docco.css b/node_modules/winston/docs/docco.css deleted file mode 100644 index bd54134..0000000 --- a/node_modules/winston/docs/docco.css +++ /dev/null @@ -1,194 +0,0 @@ -/*--------------------- Layout and Typography ----------------------------*/ -body { - font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; - font-size: 15px; - line-height: 22px; - color: #252519; - margin: 0; padding: 0; -} -a { - color: #261a3b; -} - a:visited { - color: #261a3b; - } -p { - margin: 0 0 15px 0; -} -h4, h5, h6 { - color: #333; - margin: 6px 0 6px 0; - font-size: 13px; -} - h2, h3 { - margin-bottom: 0; - color: #000; - } - h1 { - margin-top: 40px; - margin-bottom: 15px; - color: #000; - } -#container { - position: relative; -} -#background { - position: fixed; - top: 0; left: 525px; right: 0; bottom: 0; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - z-index: -1; -} -#jump_to, #jump_page { - background: white; - -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; - -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; - font: 10px Arial; - text-transform: uppercase; - cursor: pointer; - text-align: right; -} -#jump_to, #jump_wrapper { - position: fixed; - right: 0; top: 0; - padding: 5px 10px; -} - #jump_wrapper { - padding: 0; - display: none; - } - #jump_to:hover #jump_wrapper { - display: block; - } - #jump_page { - padding: 5px 0 3px; - margin: 0 0 25px 25px; - } - #jump_page .source { - display: block; - padding: 5px 10px; - text-decoration: none; - border-top: 1px solid #eee; - } - #jump_page .source:hover { - background: #f5f5ff; - } - #jump_page .source:first-child { - } -table td { - border: 0; - outline: 0; -} - td.docs, th.docs { - max-width: 450px; - min-width: 450px; - min-height: 5px; - padding: 10px 25px 1px 50px; - overflow-x: hidden; - vertical-align: top; - text-align: left; - } - .docs pre { - margin: 15px 0 15px; - padding-left: 15px; - } - .docs p tt, .docs p code { - background: #f8f8ff; - border: 1px solid #dedede; - font-size: 12px; - padding: 0 0.2em; - } - .pilwrap { - position: relative; - } - .pilcrow { - font: 12px Arial; - text-decoration: none; - color: #454545; - position: absolute; - top: 3px; left: -20px; - padding: 1px 2px; - opacity: 0; - -webkit-transition: opacity 0.2s linear; - } - td.docs:hover .pilcrow { - opacity: 1; - } - td.code, th.code { - padding: 14px 15px 16px 25px; - width: 100%; - vertical-align: top; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - } - pre, tt, code { - font-size: 12px; line-height: 18px; - font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; - margin: 0; padding: 0; - } - - -/*---------------------- Syntax Highlighting -----------------------------*/ -td.linenos { background-color: #f0f0f0; padding-right: 10px; } -span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } -body .hll { background-color: #ffffcc } -body .c { color: #408080; font-style: italic } /* Comment */ -body .err { border: 1px solid #FF0000 } /* Error */ -body .k { color: #954121 } /* Keyword */ -body .o { color: #666666 } /* Operator */ -body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ -body .cp { color: #BC7A00 } /* Comment.Preproc */ -body .c1 { color: #408080; font-style: italic } /* Comment.Single */ -body .cs { color: #408080; font-style: italic } /* Comment.Special */ -body .gd { color: #A00000 } /* Generic.Deleted */ -body .ge { font-style: italic } /* Generic.Emph */ -body .gr { color: #FF0000 } /* Generic.Error */ -body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -body .gi { color: #00A000 } /* Generic.Inserted */ -body .go { color: #808080 } /* Generic.Output */ -body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -body .gs { font-weight: bold } /* Generic.Strong */ -body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -body .gt { color: #0040D0 } /* Generic.Traceback */ -body .kc { color: #954121 } /* Keyword.Constant */ -body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ -body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ -body .kp { color: #954121 } /* Keyword.Pseudo */ -body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ -body .kt { color: #B00040 } /* Keyword.Type */ -body .m { color: #666666 } /* Literal.Number */ -body .s { color: #219161 } /* Literal.String */ -body .na { color: #7D9029 } /* Name.Attribute */ -body .nb { color: #954121 } /* Name.Builtin */ -body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ -body .no { color: #880000 } /* Name.Constant */ -body .nd { color: #AA22FF } /* Name.Decorator */ -body .ni { color: #999999; font-weight: bold } /* Name.Entity */ -body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -body .nf { color: #0000FF } /* Name.Function */ -body .nl { color: #A0A000 } /* Name.Label */ -body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -body .nt { color: #954121; font-weight: bold } /* Name.Tag */ -body .nv { color: #19469D } /* Name.Variable */ -body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -body .w { color: #bbbbbb } /* Text.Whitespace */ -body .mf { color: #666666 } /* Literal.Number.Float */ -body .mh { color: #666666 } /* Literal.Number.Hex */ -body .mi { color: #666666 } /* Literal.Number.Integer */ -body .mo { color: #666666 } /* Literal.Number.Oct */ -body .sb { color: #219161 } /* Literal.String.Backtick */ -body .sc { color: #219161 } /* Literal.String.Char */ -body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ -body .s2 { color: #219161 } /* Literal.String.Double */ -body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -body .sh { color: #219161 } /* Literal.String.Heredoc */ -body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -body .sx { color: #954121 } /* Literal.String.Other */ -body .sr { color: #BB6688 } /* Literal.String.Regex */ -body .s1 { color: #219161 } /* Literal.String.Single */ -body .ss { color: #19469D } /* Literal.String.Symbol */ -body .bp { color: #954121 } /* Name.Builtin.Pseudo */ -body .vc { color: #19469D } /* Name.Variable.Class */ -body .vg { color: #19469D } /* Name.Variable.Global */ -body .vi { color: #19469D } /* Name.Variable.Instance */ -body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/node_modules/winston/docs/winston.html b/node_modules/winston/docs/winston.html deleted file mode 100644 index 0c7f087..0000000 --- a/node_modules/winston/docs/winston.html +++ /dev/null @@ -1,86 +0,0 @@ - winston.js

        winston.js

        /*
        - * winston.js: Top-level include defining Winston.
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        -
        -var winston = exports;

        Expose version using pkginfo

        require('pkginfo')(module, 'version');

        Include transports defined by default by winston

        winston.transports = require('./winston/transports');
        -
        -var common           = require('./winston/common');
        -winston.hash           = common.hash;
        -winston.clone          = common.clone;
        -winston.longestElement = common.longestElement;
        -winston.exception      = require('./winston/exception');
        -winston.config         = require('./winston/config');
        -winston.addColors      = winston.config.addColors; 
        -winston.Logger         = require('./winston/logger').Logger;
        -winston.Transport      = require('./winston/transports/transport').Transport;

        We create and expose a 'defaultLogger' so that the programmer may do the -following without the need to create an instance of winston.Logger directly:

        - -
        var winston = require('winston');
        -winston.log('info', 'some message');
        -winston.error('some error'); 
        -
        var defaultLogger = new winston.Logger({ 
        -  transports: [new winston.transports.Console()] 
        -});

        Pass through the target methods onto `winston.

        var methods = [
        -  'log', 
        -  'add', 
        -  'remove', 
        -  'profile', 
        -  'extend', 
        -  'cli', 
        -  'handleExceptions', 
        -  'unhandleExceptions'
        -];
        -common.setLevels(winston, null, defaultLogger.levels);
        -methods.forEach(function (method) {
        -  winston[method] = function () {
        -    return defaultLogger[method].apply(defaultLogger, arguments);
        -  };
        -});

        function cli ()

        - -

        Configures the default winston logger to have the -settings for command-line interfaces: no timestamp, -colors enabled, padded output, and additional levels.

        winston.cli = function () {
        -  winston.padLevels = true;
        -  common.setLevels(winston, defaultLogger.levels, winston.config.cli.levels);
        -  defaultLogger.setLevels(winston.config.cli.levels);
        -  winston.config.addColors(winston.config.cli.colors);
        -  
        -  if (defaultLogger.transports.console) {
        -    defaultLogger.transports.console.colorize = true;
        -    defaultLogger.transports.console.timestamp = false;
        -  }
        -  
        -  return winston;
        -};

        function setLevels (target)

        - -

        @target {Object} Target levels to use

        - -

        Sets the target levels specified on the default winston logger.

        winston.setLevels = function (target) {
        -  common.setLevels(winston, defaultLogger.levels, target);
        -  defaultLogger.setLevels(target);
        -};

        Define getters / setters for appropriate properties of the -default logger which need to be exposed by winston.

        ['emitErrs', 'padLevels', 'levelLength'].forEach(function (prop) {
        -  Object.defineProperty(winston, prop, {
        -    get: function () {
        -      return defaultLogger[prop];
        -    },
        -    set: function (val) {
        -      defaultLogger[prop] = val;
        -    }
        -  });
        -});

        @default {Object} -The default transports and exceptionHandlers for -the default winston logger.

        Object.defineProperty(winston, 'default', {
        -  get: function () {
        -    return {
        -      transports: defaultLogger.transports,
        -      exceptionHandlers: defaultLogger.exceptionHandlers
        -    };
        -  }
        -});
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/docs/winston/common.html b/node_modules/winston/docs/winston/common.html deleted file mode 100644 index 1ab139c..0000000 --- a/node_modules/winston/docs/winston/common.html +++ /dev/null @@ -1,140 +0,0 @@ - common.js

        common.js

        /*
        - * common.js: Internal helper and utility functions for winston
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        -
        -var util = require('util'),
        -    crypto = require('crypto'),
        -    loggly = require('loggly'),
        -    config = require('./config');

        function setLevels (target, past, current)

        - -

        @target {Object} Object on which to set levels.

        - -

        @past {Object} Previous levels set on target.

        - -

        @current {Object} Current levels to set on target.

        - -

        Create functions on the target objects for each level -in current.levels. If past is defined, remove functions -for each of those levels.

        exports.setLevels = function (target, past, current, isDefault) {
        -  if (past) {
        -    Object.keys(past).forEach(function (level) {
        -      delete target[level];
        -    });
        -  }
        -
        -  target.levels = current || config.npm.levels;
        -  if (target.padLevels) {
        -    target.levelLength = exports.longestElement(Object.keys(target.levels));
        -  }
        -  

        Define prototype methods for each log level - e.g. target.log('info', msg) <=> target.info(msg)

          Object.keys(target.levels).forEach(function (level) {
        -    target[level] = function (msg) {
        -      var args     = Array.prototype.slice.call(arguments),
        -          callback = typeof args[args.length - 1] === 'function' ? args.pop() : null,
        -          meta     = args.length === 2 ? args.pop() : null;
        -
        -      return target.log(level, msg, meta, callback);
        -    };
        -  });
        -  
        -  return target;
        -};

        function longestElement

        - -

        @xs {Array} Array to calculate against

        - -

        Returns the longest element in the xs array.

        exports.longestElement = function (xs) {
        -  return Math.max.apply(
        -    null,
        -    xs.map(function (x) { return x.length })
        -  );
        -};

        function clone (obj)

        - -

        @obj {Object} Object to clone.

        - -

        Helper method for deep cloning pure JSON objects -i.e. JSON objects that are either literals or objects (no Arrays, etc)

        exports.clone = function (obj) {
        -  var copy = {};
        -  for (var i in obj) {
        -    if (Array.isArray(obj[i])) {
        -      copy[i] = obj[i].slice(0);
        -    }
        -    else {
        -      copy[i] = obj[i] instanceof Object ? exports.clone(obj[i]) : obj[i];
        -    }
        -  }
        -
        -  return copy;
        -};

        function log (options)

        - -

        @options {Object} All information about the log serialization.

        - -

        Generic logging function for returning timestamped strings -with the following options:

        - -

        { - level: 'level to add to serialized message', - message: 'message to serialize', - meta: 'additional logging metadata to serialize', - colorize: false, // Colorizes output (only if .json is false) - timestamp: true // Adds a timestamp to the serialized message - }

        exports.log = function (options) {
        -  var timestampFn = typeof options.timestamp === 'function' ? options.timestamp : exports.timestamp,
        -      timestamp   = options.timestamp ? timestampFn() : null,
        -      meta        = options.meta ? exports.clone(options.meta) : null,
        -      output;
        -
        -  if (options.json) {
        -    output         = meta || {};
        -    output.level   = options.level;
        -    output.message = options.message;
        -    
        -    if (timestamp) {
        -      output.timestamp = timestamp;
        -    }
        -    
        -    return JSON.stringify(output);
        -  }
        -
        -  output = timestamp ? timestamp + ' - ' : '';
        -  output += options.colorize ? config.colorize(options.level) : options.level;
        -  output += (': ' + options.message);
        -
        -  if (meta && typeof meta === 'object' && Object.keys(meta).length > 0) {
        -    output += ' ' + loggly.serialize(meta);
        -  }
        -
        -  return output;
        -};

        function hash (str)

        - -

        @str {string} String to hash.

        - -

        Utility function for creating unique ids -e.g. Profiling incoming HTTP requests on the same tick

        exports.hash = function (str) {
        -  return crypto.createHash('sha1').update(str).digest('hex');
        -};

        Borrowed from node.js core

        - -

        I wanted a universal lowercase header message, as opposed to the DEBUG -(i.e. all uppercase header) used only in util.debug()

        var months = ['Jan', 'Feb', 'Mar', 'Apr', 
        -              'May', 'Jun', 'Jul', 'Aug', 
        -              'Sep', 'Oct', 'Nov', 'Dec'];

        function pad (n)

        - -

        Returns a padded string if n < 10.

        exports.pad = function (n) {
        -  return n < 10 ? '0' + n.toString(10) : n.toString(10);
        -};

        function timestamp ()

        - -

        Returns a timestamp string for the current time.

        exports.timestamp = function () {
        -  var d = new Date();
        -  var time = [
        -    exports.pad(d.getHours()),
        -    exports.pad(d.getMinutes()),
        -    exports.pad(d.getSeconds())
        -  ].join(':');
        -              
        -  return [d.getDate(), months[d.getMonth()], time].join(' ');
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/docs/winston/config.html b/node_modules/winston/docs/winston/config.html deleted file mode 100644 index c623d64..0000000 --- a/node_modules/winston/docs/winston/config.html +++ /dev/null @@ -1,37 +0,0 @@ - config.js

        config.js

        /*
        - * config.js: Default settings for all levels that winston knows about 
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        -
        -var colors = require('colors');
        -
        -var config = exports, 
        -    allColors = exports.allColors = {};
        -
        -config.addColors = function (colors) {
        -  mixin(allColors, colors);
        -};
        -
        -config.colorize = function (level) {
        -  return level[allColors[level]];
        -};

        Export config sets

        config.cli    = require('./config/cli-config');
        -config.npm    = require('./config/npm-config');
        -config.syslog = require('./config/syslog-config');

        Add colors for pre-defined config sets

        config.addColors(config.npm.colors);
        -config.addColors(config.syslog.colors);
        -
        -function mixin (target) {
        -  var args = Array.prototype.slice.call(arguments, 1);
        -
        -  args.forEach(function (a) {
        -    var keys = Object.keys(a);
        -    for (var i = 0; i < keys.length; i++) {
        -      target[keys[i]] = a[keys[i]];
        -    }
        -  });
        -  return target;
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/docs/winston/config/cli-config.html b/node_modules/winston/docs/winston/config/cli-config.html deleted file mode 100644 index 075edd0..0000000 --- a/node_modules/winston/docs/winston/config/cli-config.html +++ /dev/null @@ -1,37 +0,0 @@ - cli-config.js

        cli-config.js

        /*
        - * cli-config.js: Config that conform to commonly used CLI logging levels. 
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        - 
        -var cliConfig = exports;
        -
        -cliConfig.levels = {
        -  silly: 0,
        -  input: 1,
        -  verbose: 2,
        -  prompt: 3,
        -  info: 4,
        -  data: 5,
        -  help: 6,
        -  warn: 7,
        -  debug: 8,
        -  error: 9
        -};
        -
        -cliConfig.colors = {
        -  silly: 'magenta',
        -  input: 'grey',
        -  verbose: 'cyan',
        -  prompt: 'grey',
        -  info: 'green',
        -  data: 'grey',
        -  help: 'cyan',
        -  warn: 'yellow',
        -  debug: 'blue',
        -  error: 'red'
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/docs/winston/config/npm-config.html b/node_modules/winston/docs/winston/config/npm-config.html deleted file mode 100644 index 8517430..0000000 --- a/node_modules/winston/docs/winston/config/npm-config.html +++ /dev/null @@ -1,29 +0,0 @@ - npm-config.js

        npm-config.js

        /*
        - * npm-config.js: Config that conform to npm logging levels. 
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        - 
        -var npmConfig = exports;
        -
        -npmConfig.levels = {
        -  silly: 0, 
        -  verbose: 1, 
        -  info: 2, 
        -  warn: 3,
        -  debug: 4, 
        -  error: 5
        -};
        -
        -npmConfig.colors = {
        -  silly: 'magenta',
        -  verbose: 'cyan',
        -  info: 'green',
        -  warn: 'yellow',
        -  debug: 'blue',
        -  error: 'red'
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/docs/winston/config/syslog-config.html b/node_modules/winston/docs/winston/config/syslog-config.html deleted file mode 100644 index 6da0993..0000000 --- a/node_modules/winston/docs/winston/config/syslog-config.html +++ /dev/null @@ -1,33 +0,0 @@ - syslog-config.js

        syslog-config.js

        /*
        - * syslog-config.js: Config that conform to syslog logging levels. 
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        - 
        -var syslogConfig = exports;
        -
        -syslogConfig.levels = {
        -  debug: 0, 
        -  info: 1, 
        -  notice: 2, 
        -  warning: 3,
        -  error: 4, 
        -  crit: 5,
        -  alert: 6,
        -  emerg: 7
        -};
        -
        -syslogConfig.colors = {
        -  debug: 'blue',
        -  info: 'green',
        -  notice: 'yellow',
        -  warning: 'red',
        -  error: 'red', 
        -  crit: 'red',
        -  alert: 'yellow',
        -  emerg: 'red'
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/docs/winston/exception.html b/node_modules/winston/docs/winston/exception.html deleted file mode 100644 index f6a4a6c..0000000 --- a/node_modules/winston/docs/winston/exception.html +++ /dev/null @@ -1,56 +0,0 @@ - exception.js

        exception.js

        /*
        - * exception.js: Utility methods for gathing information about uncaughtExceptions.
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        - 
        -var os = require('os'),
        -    stackTrace = require('stack-trace');
        -    
        -var exception = exports;
        -
        -exception.getAllInfo = function (err) {
        -  return {
        -    process: exception.getProcessInfo(),
        -    os:      exception.getOsInfo(),
        -    trace:   exception.getTrace(err)
        -  };
        -};
        -
        -exception.getProcessInfo = function () {
        -  return {
        -    pid:         process.pid,
        -    uid:         process.getuid(),
        -    gid:         process.getgid(),
        -    cwd:         process.cwd(),
        -    execPath:    process.execPath,
        -    version:     process.version,
        -    argv:        process.argv,
        -    memoryUsage: process.memoryUsage()
        -  };
        -};
        -
        -exception.getOsInfo = function () {
        -  return {
        -    loadavg: os.loadavg(),
        -    uptime:  os.uptime()
        -  };
        -};
        -
        -exception.getTrace = function (err) {
        -  var trace = err ? stackTrace.parse(err) : stackTrace.get();
        -  return trace.map(function (site) {
        -    return {
        -      column:   site.getColumnNumber(),
        -      file:     site.getFileName(),
        -      function: site.getFunctionName(),
        -      line:     site.getLineNumber(),
        -      method:   site.getMethodName(),
        -      native:   site.isNative(),
        -    }
        -  });
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/docs/winston/logger.html b/node_modules/winston/docs/winston/logger.html deleted file mode 100644 index de7038a..0000000 --- a/node_modules/winston/docs/winston/logger.html +++ /dev/null @@ -1,344 +0,0 @@ - logger.js

        logger.js

        /*
        - * logger.js: Core logger object used by winston.
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        - 
        -var events = require('events'),
        -    util = require('util'),
        -    async = require('async'),
        -    config = require('./config'),
        -    common = require('./common'),
        -    exception = require('./exception');
        -
        -function capitalize(str) {
        -  return str && str[0].toUpperCase() + str.slice(1);
        -}

        Time constants

        var ticksPerMillisecond = 10000;

        function Logger (options)

        - -

        @options {Object} Options for this instance.

        - -

        Constructor function for the Logger object responsible -for persisting log messages and metadata to one or more transports.

        var Logger = exports.Logger = function (options) {
        -  events.EventEmitter.call(this);
        -  options = options || {};
        -  
        -  var self = this,
        -      handleExceptions = false;
        -  

        Set Levels and default logging level

          this.padLevels = options.padLevels || false;
        -  this.setLevels(options.levels);
        -  

        Setup other intelligent default settings.

          this.level             = options.level || 'info';
        -  this.emitErrs          = options.emitErrs || false;
        -  this.stripColors       = options.stripColors || false;
        -  this.transports        = {};
        -  this.exceptionHandlers = {};
        -  this.profilers         = {};
        -  this._names            = [];
        -  this._hnames           = [];
        -  
        -  if (options.transports) {
        -    options.transports.forEach(function (transport) {
        -      self.add(transport, null, true);
        -      
        -      if (transport.handleExceptions) {
        -        handleExceptions = true;
        -      }
        -    });
        -  }
        -  
        -  if (options.exceptionHandlers) {
        -    options.exceptionHandlers.forEach(function (handler) {
        -      self._hnames.push(handler.name);
        -      self.exceptionHandlers[handler.name] = handler;
        -    });
        -  }
        -  
        -  if (options.handleExceptions || handleExceptions) {
        -    this.handleExceptions();
        -  }
        -};

        Inherit from events.EventEmitter.

        util.inherits(Logger, events.EventEmitter);

        function extend (target)

        - -

        @target {Object} Target to extend.

        - -

        Extends the target object with a 'log' method -along with a method for each level in this instance.

        Logger.prototype.extend = function (target) {
        -  var self = this;
        -  ['log', 'profile'].concat(Object.keys(this.levels)).forEach(function (method) {
        -    target[method] = function () {
        -      return self[method].apply(self, arguments);
        -    };
        -  });
        -  
        -  return this;
        -};

        function log (level, msg, [meta], callback)

        - -

        @level {string} Level at which to log the message.

        - -

        @msg {string} Message to log

        - -

        @meta {Object} Optional Additional metadata to attach

        - -

        @callback {function} Continuation to respond to when complete.

        - -

        Core logging method exposed to Winston. Metadata is optional.

        Logger.prototype.log = function (level, msg) {
        -  var self = this, 
        -      callback,
        -      meta;
        -  
        -  if (arguments.length === 3) {
        -    if (typeof arguments[2] === 'function') {
        -      meta = {};
        -      callback = arguments[2];
        -    }
        -    else if (typeof arguments[2] === 'object') {
        -      meta = arguments[2];
        -    }
        -  }
        -  else if (arguments.length === 4) {
        -    meta = arguments[2];
        -    callback = arguments[3];
        -  }

        If we should pad for levels, do so

          if (this.padLevels) {
        -    msg = new Array(this.levelLength - level.length).join(' ') + msg;
        -  }
        -
        -  function onError (err) {
        -    if (callback) {
        -      callback(err);
        -    }
        -    else if (self.emitErrs) {
        -      self.emit('error', err);
        -    };
        -  }
        -  
        -  if (this.transports.length === 0) {
        -    return onError(new Error('Cannot log with no transports.'));
        -  }
        -  else if (typeof self.levels[level] === 'undefined') {
        -    return onError(new Error('Unknown log level: ' + level));
        -  }
        -  

        For consideration of terminal 'color" programs like colors.js, -which can add ANSI escape color codes to strings, we destyle the -ANSI color escape codes when this.stripColors is set.

        - -

        see: http://en.wikipedia.org/wiki/ANSIescapecode

          if (this.stripColors) {
        -    var code = /\u001b\[\d+m/g;
        -    msg = ('' + msg).replace(code, '');
        -  }
        -  
        -  for (var i = 0, l = this._names.length; i < l; i++) {
        -    var transport = this.transports[this._names[i]];
        -    if ((transport.level && self.levels[transport.level] <= self.levels[level])
        -      || (!transport.level && self.levels[self.level] <= self.levels[level])) {
        -      transport.log(level, msg, meta, function (err) {
        -        self.emit('logging', transport, level, msg, meta);
        -      });
        -    }
        -  }
        -  

        Immediately respond to the callback

          if (callback) {
        -    callback(null, level, msg, meta);    
        -  }
        -  
        -  return this;
        -};

        function handleExceptions ()

        - -

        Handles uncaughtException events for the current process

        Logger.prototype.handleExceptions = function () {
        -  var args = Array.prototype.slice.call(arguments),
        -      handlers = [],
        -      self = this;
        -      
        -  args.forEach(function (a) {
        -    if (Array.isArray(a)) {
        -      handlers = handlers.concat(a);
        -    }
        -    else {
        -      handlers.push(a);
        -    }
        -  });
        -  
        -  handlers.forEach(function (handler) {
        -    self.exceptionHandlers[handler.name] = handler;
        -  });
        -  
        -  this._hnames = Object.keys(self.exceptionHandlers);
        -    
        -  if (!this.catchExceptions) {
        -    this.catchExceptions = this._uncaughtException.bind(this);
        -    process.on('uncaughtException', this.catchExceptions);
        -  }
        -};

        function unhandleExceptions ()

        - -

        Removes any handlers to uncaughtException events -for the current process

        Logger.prototype.unhandleExceptions = function () {
        -  var self = this;
        -  
        -  if (this.catchExceptions) {
        -    Object.keys(this.exceptionHandlers).forEach(function (name) {
        -      if (handler.close) {
        -        handler.close();
        -      }
        -    });
        -    
        -    this.exceptionHandlers = {};
        -    Object.keys(this.transports).forEach(function (name) {
        -      var transport = self.transports[name];
        -      if (transport.handleExceptions) {
        -        transport.handleExceptions = false;
        -      }
        -    })
        -    
        -    process.removeListener('uncaughtException', this.catchExceptions);
        -    this.catchExceptions = false;    
        -  }
        -};

        function add (transport, [options])

        - -

        @transport {Transport} Prototype of the Transport object to add.

        - -

        @options {Object} Optional Options for the Transport to add.

        - -

        @instance {Boolean} Optional Value indicating if transport is already instantiated.

        - -

        Adds a transport of the specified type to this instance.

        Logger.prototype.add = function (transport, options, created) {
        -  var instance = created ? transport : (new (transport)(options));
        -  
        -  if (!instance.name && !instance.log) {
        -    throw new Error('Unknown transport with no log() method');
        -  }
        -  else if (this.transports[instance.name]) {
        -    throw new Error('Transport already attached: ' + instance.name);
        -  }
        -  
        -  this.transports[instance.name] = instance;
        -  this._names = Object.keys(this.transports);
        -  

        Listen for the error event on the new Transport

          instance._onError = this._onError.bind(this, instance)
        -  instance.on('error', instance._onError);
        -
        -  return this;
        -};

        function remove (transport)

        - -

        @transport {Transport} Transport to remove.

        - -

        Removes a transport of the specified type from this instance.

        Logger.prototype.remove = function (transport) {
        -  var name = transport.name || transport.prototype.name;
        -    
        -  if (!this.transports[name]) {
        -    throw new Error('Transport ' + name + ' not attached to this instance');
        -  }
        -  
        -  var instance = this.transports[name];
        -  delete this.transports[name];
        -  this._names = Object.keys(this.transports);
        -  
        -  if (instance.close) {
        -    instance.close();
        -  }
        -  
        -  instance.removeListener('error', instance._onError);
        -  return this;
        -};

        function profile (id, [msg, meta, callback])

        - -

        @id {string} Unique id of the profiler

        - -

        @msg {string} Optional Message to log

        - -

        @meta {Object} Optional Additional metadata to attach

        - -

        @callback {function} Optional Continuation to respond to when complete.

        - -

        Tracks the time inbetween subsequent calls to this method -with the same id parameter. The second call to this method -will log the difference in milliseconds along with the message.

        Logger.prototype.profile = function (id) {
        -  var now = Date.now(), then, args,
        -      msg, meta, callback;
        -  
        -  if (this.profilers[id] && arguments.length !== 1) {
        -    then = this.profilers[id];
        -    delete this.profilers[id];
        -    

        Support variable arguments: msg, meta, callback

            args     = Array.prototype.slice.call(arguments);
        -    callback = typeof args[args.length - 1] === 'function' ? args.pop() : null;
        -    meta     = typeof args[args.length - 1] === 'object' ? args.pop() : {};
        -    msg      = args.length === 2 ? args[1] : id; 
        -    

        Set the duration property of the metadata

            meta.duration = now - then + 'ms'; 
        -    return this.info(msg, meta, callback);
        -  }
        -  else {
        -    this.profilers[id] = now;
        -  }
        -  
        -  return this;
        -};

        function setLevels (target)

        - -

        @target {Object} Target levels to use on this instance

        - -

        Sets the target levels specified on this instance.

        Logger.prototype.setLevels = function (target) {
        -  return common.setLevels(this, this.levels, target);
        -};

        function cli ()

        - -

        Configures this instance to have the default -settings for command-line interfaces: no timestamp, -colors enabled, padded output, and additional levels.

        Logger.prototype.cli = function () {
        -  this.padLevels = true;
        -  this.setLevels(config.cli.levels);
        -  config.addColors(config.cli.colors);
        -  
        -  if (this.transports.console) {
        -    this.transports.console.colorize = true;
        -    this.transports.console.timestamp = false;
        -  }
        -  
        -  return this;
        -};

        @private function _uncaughtException (err)

        - -

        @err {Error} Error to handle

        - -

        Logs all relevant information around the err and -exits the current process.

        Logger.prototype._uncaughtException = function (err) {
        -  var self = this,
        -      responded = false,
        -      info = exception.getAllInfo(err),
        -      handlers = this._getExceptionHandlers(),
        -      timeout;
        -  
        -  function logAndWait (transport, next) {
        -    transport.logException('uncaughtException', info, next);
        -  }
        -  
        -  function gracefulExit () {
        -    if (!responded) {

        Remark: Currently ignoring any exceptions from transports - when catching uncaught exceptions.

              clearTimeout(timeout);
        -      responded = true;
        -      process.exit(1);
        -    }
        -  }
        -  
        -  if (!handlers || handlers.length === 0) {
        -    return gracefulExit();
        -  }
        -  

        Log to all transports and allow the operation to take -only up to 3000ms.

          async.forEach(handlers, logAndWait, gracefulExit);
        -  timeout = setTimeout(gracefulExit, 3000);
        -};

        @private function _getExceptionHandlers ()

        - -

        Returns the list of transports and exceptionHandlers -for this instance.

        Logger.prototype._getExceptionHandlers = function () {
        -  var self = this;
        -
        -  return this._hnames.map(function (name) {
        -    return self.exceptionHandlers[name];
        -  }).concat(this._names.map(function (name) {
        -    return self.transports[name].handleExceptions && self.transports[name];
        -  })).filter(Boolean);
        -};

        @private function _onError (transport, err)

        - -

        @transport {Object} Transport on which the error occured

        - -

        @err {Error} Error that occurred on the transport

        - -

        Bubbles the error, err, that occured on the specified transport -up from this instance if emitErrs has been set.

        Logger.prototype._onError = function (transport, err) {
        -  if (self.emitErrs) {
        -    self.emit('error', err, transport);
        -  }
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/docs/winston/transports.html b/node_modules/winston/docs/winston/transports.html deleted file mode 100644 index bc92fc8..0000000 --- a/node_modules/winston/docs/winston/transports.html +++ /dev/null @@ -1,29 +0,0 @@ - transports.js

        transports.js

        /*
        - * transports.js: Set of all transports Winston knows about
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        -
        -var fs = require('fs'),
        -    path = require('path');
        -
        -var transports = exports;
        -
        -function capitalize (str) {
        -  return str && str[0].toUpperCase() + str.slice(1);
        -};

        Setup all transports as lazy-loaded getters.

        fs.readdirSync(path.join(__dirname, 'transports')).forEach(function (file) {
        -  var transport = file.replace('.js', ''),
        -      name  = capitalize(transport);
        -  
        -  if (transport === 'transport') {
        -    return;
        -  }
        -  
        -  transports.__defineGetter__(name, function () {
        -    return require('./transports/' + transport)[name];
        -  });
        -});
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/docs/winston/transports/console.html b/node_modules/winston/docs/winston/transports/console.html deleted file mode 100644 index 3d45f36..0000000 --- a/node_modules/winston/docs/winston/transports/console.html +++ /dev/null @@ -1,59 +0,0 @@ - console.js

        console.js

        /*
        - * console.js: Transport for outputting to the console
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        -
        -var events = require('events'),
        -    util = require('util'),
        -    colors = require('colors'),
        -    common = require('../common'),
        -    Transport = require('./transport').Transport;

        function Console (options)

        - -

        @options {Object} Options for this instance.

        - -

        Constructor function for the Console transport object responsible -for persisting log messages and metadata to a terminal or TTY.

        var Console = exports.Console = function (options) {
        -  Transport.call(this, options);
        -  options = options || {};
        -  
        -  this.name      = 'console';
        -  this.json      = options.json     || false;
        -  this.colorize  = options.colorize || false;
        -  this.timestamp = typeof options.timestamp !== 'undefined' ? options.timestamp : false;
        -};

        Inherit from winston.Transport.

        util.inherits(Console, Transport);

        Expose the name of this Transport on the prototype

        Console.prototype.name = 'console';

        function log (level, msg, [meta], callback)

        - -

        @level {string} Level at which to log the message.

        - -

        @msg {string} Message to log

        - -

        @meta {Object} Optional Additional metadata to attach

        - -

        @callback {function} Continuation to respond to when complete.

        - -

        Core logging method exposed to Winston. Metadata is optional.

        Console.prototype.log = function (level, msg, meta, callback) {
        -  if (this.silent) {
        -    return callback(null, true);
        -  }
        -    
        -  var self = this, output = common.log({
        -    level:     level,
        -    message:   msg,
        -    meta:      meta,
        -    colorize:  this.colorize, 
        -    timestamp: this.timestamp
        -  });
        -  
        -  if (level === 'error' || level === 'debug') {
        -    util.error(output);
        -  }
        -  else {
        -    util.puts(output);
        -  }

        Emit the logged event immediately because the event loop -will not exit until process.stdout has drained anyway.

          self.emit('logged');
        -  callback(null, true);
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/docs/winston/transports/couchdb.html b/node_modules/winston/docs/winston/transports/couchdb.html deleted file mode 100644 index b7690de..0000000 --- a/node_modules/winston/docs/winston/transports/couchdb.html +++ /dev/null @@ -1,84 +0,0 @@ - couchdb.js

        couchdb.js

        /*
        - * Couchdb.js: Transport for logging to Couchdb
        - *
        - * (C) 2011 Max Ogden
        - * MIT LICENSE
        - *
        - */
        -
        -var events = require('events'),
        -    http = require('http'),
        -    util = require('util'),
        -    common = require('../common'),
        -    Transport = require('./transport').Transport; 

        function Couchdb (options)

        - -

        @options {Object} Options for this instance.

        - -

        Constructor function for the Console transport object responsible -for making arbitrary HTTP requests whenever log messages and metadata -are received.

        var Couchdb = exports.Couchdb = function (options) {
        -  Transport.call(this, options);
        -
        -  this.name   = 'Couchdb'; 
        -  this.db     = options.db;
        -  this.user   = options.user;
        -  this.pass   = options.pass;
        -  this.host   = options.host   || 'localhost';
        -  this.port   = options.port   || 5984;
        -
        -  if (options.auth) {

        TODO: add http basic auth options for outgoing HTTP requests

          }
        -  
        -  if (options.ssl) {

        TODO: add ssl support for outgoing HTTP requests

          }  
        -};

        Inherit from winston.Transport.

        util.inherits(Couchdb, Transport);

        Expose the name of this Transport on the prototype

        Couchdb.prototype.name = 'Couchdb';

        function log (level, msg, [meta], callback)

        - -

        @level {string} Level at which to log the message.

        - -

        @msg {string} Message to log

        - -

        @meta {Object} Optional Additional metadata to attach

        - -

        @callback {function} Continuation to respond to when complete.

        - -

        Core logging method exposed to Winston. Metadata is optional.

        Couchdb.prototype.log = function (level, msg, meta, callback) {
        -  if (this.silent) {
        -    return callback(null, true);
        -  }
        -  
        -  var self = this,
        -      message = common.clone(meta),
        -      options,
        -      req;
        -      
        -  message.level = level;
        -  message.message = msg;

        Prepare options for outgoing HTTP request

          options = {
        -    host: this.host,
        -    port: this.port,
        -    path: "/" + this.db,
        -    method: "POST",
        -    headers: {"content-type": "application/json"}
        -  };
        -  
        -  if (options.user && options.pass) {
        -    options.headers["Authorization"] = "Basic " + new Buffer(options.user + ":" + options.pass).toString('base64');
        -  }
        -  

        Perform HTTP logging request

          req = http.request(options, function (res) { 

        No callback on request, fire and forget about the response

            self.emit('logged', res);
        -  }); 
        -
        -  req.on('error', function (err) {

        Propagate the error back up to the Logger that this -instance belongs to.

            self.emit('error', err);
        -  });
        -  

        Write logging event to the outgoing request body

          req.write(JSON.stringify({ 
        -    method: 'log', 
        -    params: { 
        -      timestamp: new Date(), // RFC3339/ISO8601 format instead of common.timestamp()
        -      msg: msg, 
        -      level: level, 
        -      meta: meta 
        -    } 
        -  }));
        -  
        -  req.end();
        -  

        Always return true, regardless of any errors

          callback(null, true);
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/docs/winston/transports/file.html b/node_modules/winston/docs/winston/transports/file.html deleted file mode 100644 index bba8459..0000000 --- a/node_modules/winston/docs/winston/transports/file.html +++ /dev/null @@ -1,211 +0,0 @@ - file.js

        file.js

        /*
        - * file.js: Transport for outputting to a local log file
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        -
        -var events = require('events'),
        -    fs = require('fs'),
        -    path = require('path'),
        -    util = require('util'),
        -    colors = require('colors'),
        -    common = require('../common'),
        -    Transport = require('./transport').Transport;
        -    

        function File (options)

        - -

        @options {Object} Options for this instance.

        - -

        Constructor function for the File transport object responsible -for persisting log messages and metadata to one or more files.

        var File = exports.File = function (options) {
        -  Transport.call(this, options);
        -  

        Helper function which throws an Error in the event -that any of the rest of the arguments is present in options.

          function throwIf (target /*, illegal... */) {
        -    Array.prototype.slice.call(arguments, 1).forEach(function (name) {
        -      if (options[name]) {
        -        throw new Error('Cannot set ' + name + ' and ' + target + 'together');
        -      }
        -    });
        -  }
        -  
        -  if (options.filename || options.dirname) {
        -    throwIf('filename or dirname', 'stream');
        -    this._basename = this.filename = path.basename(options.filename) || 'winston.log';
        -    this.dirname   = options.dirname || path.dirname(options.filename);
        -    this.options   = options.options || { flags: 'a' };    
        -  }
        -  else if (options.stream) {
        -    throwIf('stream', 'filename', 'maxsize');
        -    this.stream = options.stream;
        -  }
        -  else {
        -    throw new Error('Cannot log to file without filename or stream.');
        -  }
        -    
        -  this.json      = options.json !== false;
        -  this.colorize  = options.colorize  || false;
        -  this.maxsize   = options.maxsize   || null;
        -  this.timestamp = typeof options.timestamp !== 'undefined' ? options.timestamp : false;

        Internal state variables representing the number -of files this instance has created and the current -size (in bytes) of the current logfile.

          this._size    = 0;
        -  this._created = 0;
        -  this._buffer  = [];
        -};

        Inherit from winston.Transport.

        util.inherits(File, Transport);

        Expose the name of this Transport on the prototype

        File.prototype.name = 'file';

        function log (level, msg, [meta], callback)

        - -

        @level {string} Level at which to log the message.

        - -

        @msg {string} Message to log

        - -

        @meta {Object} Optional Additional metadata to attach

        - -

        @callback {function} Continuation to respond to when complete.

        - -

        Core logging method exposed to Winston. Metadata is optional.

        File.prototype.log = function (level, msg, meta, callback) {
        -  if (this.silent) {
        -    return callback(null, true);
        -  }
        -
        -  var self = this, output = common.log({
        -    level:     level,
        -    message:   msg,
        -    meta:      meta,
        -    json:      this.json,
        -    colorize:  this.colorize,
        -    timestamp: this.timestamp
        -  }) + '\n';
        -  
        -  this._size += output.length;
        -  
        -  function onDrain () {
        -    self.emit('logged');
        -  }
        -  
        -  if (!this.filename) {

        If there is no filename on this instance then it was configured -with a raw WriteableStream instance and we should not perform any -size restrictions.

            this.stream.write(output);
        -    this.stream.once('drain', onDrain);
        -  }
        -  else {
        -    this.open(function (err) {
        -      if (err) {

        If there was an error enqueue the message

                return self._buffer.push(output);
        -      }
        -      
        -      self.stream.write(output);
        -      self.stream.once('drain', onDrain);
        -    });
        -  }
        -
        -  callback(null, true);
        -};

        function open (callback)

        - -

        @callback {function} Continuation to respond to when complete

        - -

        Checks to see if a new file needs to be created based on the maxsize -(if any) and the current size of the file used.

        File.prototype.open = function (callback) {
        -  if (this.opening) {

        If we are already attempting to open the next -available file then respond with a value indicating -that the message should be buffered.

            return callback(true);
        -  }
        -  else if (!this.stream || (this.maxsize && this._size >= this.maxsize)) {

        If we dont have a stream or have exceeded our size, then create -the next stream and respond with a value indicating that -the message should be buffered.

            callback(true);
        -    return this._createStream();
        -  }
        -  

        Otherwise we have a valid (and ready) stream.

          callback();
        -};

        function close ()

        - -

        Closes the stream associated with this instance.

        File.prototype.close = function() {
        -  var self = this;
        -
        -  if (this.stream) {
        -    this.stream.end();
        -    this.stream.destroySoon();
        -    
        -    this.stream.once('drain', function () {
        -      self.emit('flush');
        -      self.emit('closed');
        -    });
        -  }
        -};

        function flush ()

        - -

        Flushes any buffered messages to the current stream -used by this instance.

        File.prototype.flush = function () {
        -  var self = this;

        Iterate over the _buffer of enqueued messaged -and then write them to the newly created stream.

          this._buffer.forEach(function (str) {
        -    process.nextTick(function () {
        -      self.stream.write(str);
        -      self._size += str.length;
        -    });
        -  });
        -  

        Quickly truncate the _buffer once the write operations -have been started

          self._buffer.length = 0;
        -  

        When the stream has drained we have flushed -our buffer.

          self.stream.once('drain', function () {
        -    self.emit('flush');
        -    self.emit('logged');
        -  });
        -};

        @private function _createStream ()

        - -

        Attempts to open the next appropriate file for this instance -based on the common state (such as maxsize and _basename).

        File.prototype._createStream = function () {
        -  var self = this;
        -  this.opening = true;
        -    
        -  (function checkFile (target) {
        -    var fullname = path.join(self.dirname, target);
        -    

        Creates the WriteStream and then flushes any -buffered messages.

            function createAndFlush (size) {
        -      if (self.stream) {
        -        self.stream.end();
        -        self.stream.destroySoon();
        -      }
        -      
        -      self._size = size;
        -      self.filename = target;
        -      self.stream = fs.createWriteStream(fullname, self.options);
        -      

        When the current stream has finished flushing -then we can be sure we have finished opening -and thus can emit the open event.

              self.once('flush', function () {
        -        self.opening = false;
        -        self.emit('open', fullname);
        -      });

        Remark: It is possible that in the time it has taken to find the -next logfile to be written more data than maxsize has been buffered, -but for sensible limits (10s - 100s of MB) this seems unlikely in less -than one second.

              self.flush();
        -    }
        -
        -    fs.stat(fullname, function (err, stats) {
        -      if (err) {
        -        if (err.code !== 'ENOENT') {
        -          return self.emit('error', err);
        -        }
        -        
        -        return createAndFlush(0);
        -      }
        -      
        -      if (!stats || (self.maxsize && stats.size >= self.maxsize)) {

        If stats.size is greater than the maxsize for -this instance then try again

                return checkFile(self._getFile(true));
        -      }
        -      
        -      createAndFlush(stats.size);
        -    });
        -  })(this._getFile());  
        -};

        @private function _getFile ()

        - -

        Gets the next filename to use for this instance -in the case that log filesizes are being capped.

        File.prototype._getFile = function (inc) {
        -  var self = this,
        -      ext = path.extname(this._basename),
        -      basename = path.basename(this._basename, ext);
        -  
        -  if (inc) {

        Increment the number of files created or -checked by this instance.

            this._created += 1;
        -  }
        -  
        -  return this._created 
        -    ? basename + this._created + ext
        -    : basename + ext;
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/docs/winston/transports/loggly.html b/node_modules/winston/docs/winston/transports/loggly.html deleted file mode 100644 index 7652318..0000000 --- a/node_modules/winston/docs/winston/transports/loggly.html +++ /dev/null @@ -1,118 +0,0 @@ - loggly.js

        loggly.js

        /*
        - * loggly.js: Transport for logginh to remote Loggly API
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        -
        -var events = require('events'),
        -    loggly = require('loggly'),
        -    util = require('util'),
        -    async = require('async'),
        -    common = require('../common'),
        -    Transport = require('./transport').Transport; 

        function Loggly (options)

        - -

        @options {Object} Options for this instance.

        - -

        Constructor function for the Loggly transport object responsible -for persisting log messages and metadata to Loggly; 'LaaS'.

        var Loggly = exports.Loggly = function (options) {
        -  Transport.call(this, options);
        -
        -  if (!options.subdomain) {
        -    throw new Error('Loggly Subdomain is required');
        -  }
        -  
        -  if (!options.inputToken && !options.inputName) {
        -    throw new Error('Target input token or name is required.');
        -  }
        -  
        -  if (!options.auth && options.inputName) {
        -    throw new Error('Loggly authentication is required');
        -  }
        -  
        -  this.name = 'loggly'; 
        -  this.logBuffer = [];
        -  
        -  this.client = loggly.createClient({
        -    subdomain: options.subdomain,
        -    auth: options.auth || null,
        -    json: options.json || false
        -  });
        -  
        -  if (options.inputToken) {
        -    this.inputToken = options.inputToken;
        -    this.ready = true;
        -  }
        -  else if (options.inputName) {
        -    this.ready = false;
        -    this.inputName = options.inputName;
        -    
        -    var self = this;
        -    this.client.getInput(this.inputName, function (err, input) {
        -      if (err) {
        -        throw err;
        -      }
        -      
        -      self.inputToken = input.input_token;
        -      self.ready = true;
        -    });
        -  }
        -};

        Inherit from winston.Transport.

        util.inherits(Loggly, Transport);

        Expose the name of this Transport on the prototype

        Loggly.prototype.name = 'loggly';

        function log (level, msg, [meta], callback)

        - -

        @level {string} Level at which to log the message.

        - -

        @msg {string} Message to log

        - -

        @meta {Object} Optional Additional metadata to attach

        - -

        @callback {function} Continuation to respond to when complete.

        - -

        Core logging method exposed to Winston. Metadata is optional.

        Loggly.prototype.log = function (level, msg, meta, callback) {
        -  if (this.silent) {
        -    return callback(null, true);
        -  }
        -
        -  var self = this,
        -      message = common.clone(meta);
        -      
        -  message.level = level;
        -  message.message = msg;
        -  
        -  if (!this.ready) {

        If we haven't gotten the input token yet -add this message to the log buffer.

            this.logBuffer.push(message);
        -  }
        -  else if (this.ready && this.logBuffer.length > 0) {

        Otherwise if we have buffered messages -add this message to the buffer and flush them.

            this.logBuffer.push(message);
        -    this.flush();
        -  }
        -  else {

        Otherwise just log the message as normal

            this.client.log(this.inputToken, message, function () {
        -      self.emit('logged');
        -    });
        -  }
        -  
        -  callback(null, true);
        -};

        function flush ()

        - -

        Flushes any buffered messages to the current stream -used by this instance.

        Loggly.prototype.flush = function () {
        -  var self = this;
        -  
        -  function logMsg (msg, next) {
        -    self.client.log(self.inputToken, msg, function (err) {
        -      if (err) {
        -        self.emit('error', err);
        -      }
        -      
        -      next();
        -    });
        -  }
        -  

        Initiate calls to loggly for each message in the buffer

          async.forEach(this.logBuffer, logMsg, function () {
        -    self.emit('logged');
        -  });
        -  
        -  process.nextTick(function () {

        Then quickly truncate the list

            self.logBuffer.length = 0;
        -  });
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/docs/winston/transports/transport.html b/node_modules/winston/docs/winston/transports/transport.html deleted file mode 100644 index f0cc4b9..0000000 --- a/node_modules/winston/docs/winston/transports/transport.html +++ /dev/null @@ -1,50 +0,0 @@ - transport.js

        transport.js

        /*
        - * transport.js: Base Transport object for all Winston transports.
        - *
        - * (C) 2010 Charlie Robbins
        - * MIT LICENCE
        - *
        - */
        -
        -var events = require('events'),
        -    util = require('util'); 

        function Transport (options)

        - -

        @options {Object} Options for this instance.

        - -

        Constructor function for the Tranport object responsible -base functionality for all winston transports.

        var Transport = exports.Transport = function (options) {
        -  events.EventEmitter.call(this);
        -  
        -  options               = options        || {};  
        -  this.level            = options.level  || 'info';
        -  this.silent           = options.silent || false;
        -  this.handleExceptions = options.handleExceptions || false;
        -};

        Inherit from events.EventEmitter.

        util.inherits(Transport, events.EventEmitter);

        function logException (msg, meta, callback)

        - -

        @msg {string} Message to log

        - -

        @meta {Object} Optional Additional metadata to attach

        - -

        @callback {function} Continuation to respond to when complete.

        - -

        Logs the specified msg, meta and responds to the callback once the log -operation is complete to ensure that the event loop will not exit before -all logging has completed.

        Transport.prototype.logException = function (msg, meta, callback) {
        -  var self = this;
        -  
        -  function onLogged () {
        -    self.removeListener('error', onError);
        -    callback();
        -  }
        -  
        -  function onError () {
        -    self.removeListener('logged', onLogged);
        -    callback();
        -  }
        -  
        -  this.once('logged', onLogged);
        -  this.once('error', onError);  
        -  this.log('error', msg, meta, function () { });
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/docs/winston/transports/webhook.html b/node_modules/winston/docs/winston/transports/webhook.html deleted file mode 100644 index 7191495..0000000 --- a/node_modules/winston/docs/winston/transports/webhook.html +++ /dev/null @@ -1,82 +0,0 @@ - webhook.js

        webhook.js

        /*
        - * webhook.js: Transport for logging to remote http endpoints ( POST / RECEIVE webhooks )
        - *
        - * (C) 2011 Marak Squires
        - * MIT LICENCE
        - *
        - */
        -
        -var events = require('events'),
        -    http = require('http'),
        -    util = require('util'),
        -    common = require('../common'),
        -    Transport = require('./transport').Transport; 

        function WebHook (options)

        - -

        @options {Object} Options for this instance.

        - -

        Constructor function for the Console transport object responsible -for making arbitrary HTTP requests whenever log messages and metadata -are received.

        var Webhook = exports.Webhook = function (options) {
        -  Transport.call(this, options);
        -
        -  this.name   = 'webhook'; 
        -  this.host   = options.host   || 'localhost';
        -  this.port   = options.port   || 8080;
        -  this.method = options.method || 'POST';
        -  this.path   = options.path   || '/winston-log';
        -
        -  if (options.auth) {

        TODO: add http basic auth options for outgoing HTTP requests

          }
        -  
        -  if (options.ssl) {

        TODO: add ssl support for outgoing HTTP requests

          }  
        -};

        Inherit from winston.Transport.

        util.inherits(Webhook, Transport);

        Expose the name of this Transport on the prototype

        Webhook.prototype.name = 'webhook';

        function log (level, msg, [meta], callback)

        - -

        @level {string} Level at which to log the message.

        - -

        @msg {string} Message to log

        - -

        @meta {Object} Optional Additional metadata to attach

        - -

        @callback {function} Continuation to respond to when complete.

        - -

        Core logging method exposed to Winston. Metadata is optional.

        Webhook.prototype.log = function (level, msg, meta, callback) {
        -  if (this.silent) {
        -    return callback(null, true);
        -  }
        -  
        -  var self = this,
        -      message = common.clone(meta),
        -      options,
        -      req;
        -      
        -  message.level = level;
        -  message.message = msg;

        Prepare options for outgoing HTTP request

          options = {
        -    host: this.host,
        -    port: this.port,
        -    path: this.path,
        -    method: this.method
        -  };
        -  

        Perform HTTP logging request

          req = http.request(options, function (res) { 

        No callback on request, fire and forget about the response

            self.emit('logged');
        -  }); 
        -
        -  req.on('error', function (err) {

        Propagate the error back up to the Logger that this -instance belongs to.

            self.emit('error', err);
        -  });
        -  

        Write logging event to the outgoing request body

        - -

        jsonMessage is currently conforming to JSON-RPC v1.0, -but without the unique id since there is no anticipated response -see: http://en.wikipedia.org/wiki/JSON-RPC

          req.write(JSON.stringify({ 
        -    method: 'log', 
        -    params: { 
        -      timestamp: common.timestamp(), 
        -      msg: msg, 
        -      level: level, 
        -      meta: meta 
        -    } 
        -  }));
        -  
        -  req.end();
        -  

        Always return true, regardless of any errors

          callback(null, true);
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/examples/couchdb.js b/node_modules/winston/examples/couchdb.js deleted file mode 100644 index ce2d960..0000000 --- a/node_modules/winston/examples/couchdb.js +++ /dev/null @@ -1,18 +0,0 @@ -var winston = require('../lib/winston'); - -// -// Create a new winston logger instance with two tranports: Console, and Couchdb -// -// -// The Console transport will simply output to the console screen -// The Couchdb tranport will perform an HTTP POST request to the specified CouchDB instance -// -var logger = new (winston.Logger)({ - transports: [ - new (winston.transports.Console)(), - new (winston.transports.Couchdb)({ 'host': 'localhost', 'db': 'logs' }) - // if you need auth do this: new (winston.transports.Couchdb)({ 'user': 'admin', 'pass': 'admin', 'host': 'localhost', 'db': 'logs' }) - ] -}); - -logger.log('info', 'Hello webhook log files!', { 'foo': 'bar' }); diff --git a/node_modules/winston/examples/raw-mode.js b/node_modules/winston/examples/raw-mode.js deleted file mode 100644 index 89e070d..0000000 --- a/node_modules/winston/examples/raw-mode.js +++ /dev/null @@ -1,10 +0,0 @@ -var winston = require('../lib/winston'); - -var logger = new (winston.Logger)({ - transports: [ - new (winston.transports.Console)({ raw: true }), - ] -}); - -logger.log('info', 'Hello, this is a raw logging event', { 'foo': 'bar' }); -logger.log('info', 'Hello, this is a raw logging event 2', { 'foo': 'bar' }); diff --git a/node_modules/winston/examples/webhook-post.js b/node_modules/winston/examples/webhook-post.js deleted file mode 100644 index 0fa1c8d..0000000 --- a/node_modules/winston/examples/webhook-post.js +++ /dev/null @@ -1,17 +0,0 @@ -var winston = require('../lib/winston'); - -// -// Create a new winston logger instance with two tranports: Console, and Webhook -// -// -// The Console transport will simply output to the console screen -// The Webhook tranports will perform an HTTP POST request to an abritrary end-point ( for post/recieve webhooks ) -// -var logger = new (winston.Logger)({ - transports: [ - new (winston.transports.Console)(), - new (winston.transports.Webhook)({ 'host': 'localhost', 'port': 8080, 'path': '/collectdata' }) - ] -}); - -logger.log('info', 'Hello webhook log files!', { 'foo': 'bar' }); diff --git a/node_modules/winston/lib/winston.js b/node_modules/winston/lib/winston.js deleted file mode 100644 index 51bfb45..0000000 --- a/node_modules/winston/lib/winston.js +++ /dev/null @@ -1,143 +0,0 @@ -/* - * winston.js: Top-level include defining Winston. - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var winston = exports; - -// -// Expose version using `pkginfo` -// -require('pkginfo')(module, 'version'); - -// -// Include transports defined by default by winston -// -winston.transports = require('./winston/transports'); - -// -// Expose utility methods -// -var common = require('./winston/common'); -winston.hash = common.hash; -winston.clone = common.clone; -winston.longestElement = common.longestElement; -winston.exception = require('./winston/exception'); -winston.config = require('./winston/config'); -winston.addColors = winston.config.addColors; - -// -// Expose core Logging-related prototypes. -// -winston.Container = require('./winston/container').Container; -winston.Logger = require('./winston/logger').Logger; -winston.Transport = require('./winston/transports/transport').Transport; - -// -// We create and expose a default `Container` to `winston.loggers` so that the -// programmer may manage multiple `winston.Logger` instances without any additional overhead. -// -// ### some-file1.js -// -// var logger = require('winston').loggers.get('something'); -// -// ### some-file2.js -// -// var logger = require('winston').loggers.get('something'); -// -winston.loggers = new winston.Container(); - -// -// We create and expose a 'defaultLogger' so that the programmer may do the -// following without the need to create an instance of winston.Logger directly: -// -// var winston = require('winston'); -// winston.log('info', 'some message'); -// winston.error('some error'); -// -var defaultLogger = new winston.Logger({ - transports: [new winston.transports.Console()] -}); - -// -// Pass through the target methods onto `winston. -// -var methods = [ - 'log', - 'add', - 'remove', - 'profile', - 'startTimer', - 'extend', - 'cli', - 'handleExceptions', - 'unhandleExceptions' -]; -common.setLevels(winston, null, defaultLogger.levels); -methods.forEach(function (method) { - winston[method] = function () { - return defaultLogger[method].apply(defaultLogger, arguments); - }; -}); - -// -// ### function cli () -// Configures the default winston logger to have the -// settings for command-line interfaces: no timestamp, -// colors enabled, padded output, and additional levels. -// -winston.cli = function () { - winston.padLevels = true; - common.setLevels(winston, defaultLogger.levels, winston.config.cli.levels); - defaultLogger.setLevels(winston.config.cli.levels); - winston.config.addColors(winston.config.cli.colors); - - if (defaultLogger.transports.console) { - defaultLogger.transports.console.colorize = true; - defaultLogger.transports.console.timestamp = false; - } - - return winston; -}; - -// -// ### function setLevels (target) -// #### @target {Object} Target levels to use -// Sets the `target` levels specified on the default winston logger. -// -winston.setLevels = function (target) { - common.setLevels(winston, defaultLogger.levels, target); - defaultLogger.setLevels(target); -}; - -// -// Define getters / setters for appropriate properties of the -// default logger which need to be exposed by winston. -// -['emitErrs', 'exitOnError', 'padLevels', 'level', 'levelLength', 'stripColors'].forEach(function (prop) { - Object.defineProperty(winston, prop, { - get: function () { - return defaultLogger[prop]; - }, - set: function (val) { - defaultLogger[prop] = val; - } - }); -}); - -// -// @default {Object} -// The default transports and exceptionHandlers for -// the default winston logger. -// -Object.defineProperty(winston, 'default', { - get: function () { - return { - transports: defaultLogger.transports, - exceptionHandlers: defaultLogger.exceptionHandlers - }; - } -}); diff --git a/node_modules/winston/lib/winston/common.js b/node_modules/winston/lib/winston/common.js deleted file mode 100644 index 9b8abeb..0000000 --- a/node_modules/winston/lib/winston/common.js +++ /dev/null @@ -1,264 +0,0 @@ -/* - * common.js: Internal helper and utility functions for winston - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var util = require('util'), - crypto = require('crypto'), - config = require('./config'); - -// -// ### function setLevels (target, past, current) -// #### @target {Object} Object on which to set levels. -// #### @past {Object} Previous levels set on target. -// #### @current {Object} Current levels to set on target. -// Create functions on the target objects for each level -// in current.levels. If past is defined, remove functions -// for each of those levels. -// -exports.setLevels = function (target, past, current, isDefault) { - if (past) { - Object.keys(past).forEach(function (level) { - delete target[level]; - }); - } - - target.levels = current || config.npm.levels; - if (target.padLevels) { - target.levelLength = exports.longestElement(Object.keys(target.levels)); - } - - // - // Define prototype methods for each log level - // e.g. target.log('info', msg) <=> target.info(msg) - // - Object.keys(target.levels).forEach(function (level) { - target[level] = function (msg) { - var args = Array.prototype.slice.call(arguments), - callback = typeof args[args.length - 1] === 'function' || !args[args.length - 1] ? args.pop() : null, - meta = args.length === 2 ? args.pop() : null; - - return target.log(level, msg, meta, callback); - }; - }); - - return target; -}; - -// -// ### function longestElement -// #### @xs {Array} Array to calculate against -// Returns the longest element in the `xs` array. -// -exports.longestElement = function (xs) { - return Math.max.apply( - null, - xs.map(function (x) { return x.length; }) - ); -}; - -// -// ### function clone (obj) -// #### @obj {Object} Object to clone. -// Helper method for deep cloning pure JSON objects -// i.e. JSON objects that are either literals or objects (no Arrays, etc) -// -exports.clone = function (obj) { - // we only need to clone refrence types (Object) - if (!(obj instanceof Object)) { - return obj; - } - else if (obj instanceof Date) { - return obj; - } - - var copy = {}; - for (var i in obj) { - if (Array.isArray(obj[i])) { - copy[i] = obj[i].slice(0); - } - else if (obj[i] instanceof Buffer) { - copy[i] = obj[i].slice(0); - } - else if (typeof obj[i] != 'function') { - copy[i] = obj[i] instanceof Object ? exports.clone(obj[i]) : obj[i]; - } - } - - return copy; -}; - -// -// ### function log (options) -// #### @options {Object} All information about the log serialization. -// Generic logging function for returning timestamped strings -// with the following options: -// -// { -// level: 'level to add to serialized message', -// message: 'message to serialize', -// meta: 'additional logging metadata to serialize', -// colorize: false, // Colorizes output (only if `.json` is false) -// timestamp: true // Adds a timestamp to the serialized message -// } -// -exports.log = function (options) { - var timestampFn = typeof options.timestamp === 'function' ? options.timestamp : exports.timestamp, - timestamp = options.timestamp ? timestampFn() : null, - meta = options.meta ? exports.clone(options.meta) : null, - output; - - // - // raw mode is intended for outputing winston as streaming JSON to STDOUT - // - if (options.raw) { - output = meta || {}; - output.level = options.level; - output.message = options.message.stripColors; - return JSON.stringify(output); - } - - // - // json mode is intended for pretty printing multi-line json to the terminal - // - if (options.json) { - output = meta || {}; - output.level = options.level; - output.message = options.message; - - if (timestamp) { - output.timestamp = timestamp; - } - - return typeof options.stringify === 'function' - ? options.stringify(output) - : JSON.stringify(output, function(key, value) { - if (value instanceof Buffer) { - return value.toString('base64'); - } - return value; - }); - } - - output = timestamp ? timestamp + ' - ' : ''; - output += options.colorize ? config.colorize(options.level) : options.level; - output += (': ' + options.message); - - if (meta) { - if (typeof meta !== 'object') { - output += ' ' + meta; - } - else if (Object.keys(meta).length > 0) { - output += ' ' + exports.serialize(meta); - } - } - - return output; -}; - -exports.capitalize = function (str) { - return str && str[0].toUpperCase() + str.slice(1); -}; - -// -// ### function hash (str) -// #### @str {string} String to hash. -// Utility function for creating unique ids -// e.g. Profiling incoming HTTP requests on the same tick -// -exports.hash = function (str) { - return crypto.createHash('sha1').update(str).digest('hex'); -}; - -// -// ## Borrowed from node.js core -// I wanted a universal lowercase header message, as opposed to the `DEBUG` -// (i.e. all uppercase header) used only in `util.debug()` -// -var months = ['Jan', 'Feb', 'Mar', 'Apr', - 'May', 'Jun', 'Jul', 'Aug', - 'Sep', 'Oct', 'Nov', 'Dec']; - -// -// ### function pad (n) -// Returns a padded string if `n < 10`. -// -exports.pad = function (n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); -}; - -// -// ### function timestamp () -// Returns a timestamp string for the current time. -// -exports.timestamp = function () { - var d = new Date(); - var time = [ - exports.pad(d.getHours()), - exports.pad(d.getMinutes()), - exports.pad(d.getSeconds()) - ].join(':'); - - return [d.getDate(), months[d.getMonth()], time].join(' '); -}; - -// -// ### function serialize (obj, key) -// #### @obj {Object|literal} Object to serialize -// #### @key {string} **Optional** Optional key represented by obj in a larger object -// Performs simple comma-separated, `key=value` serialization for Loggly when -// logging to non-JSON inputs. -// -exports.serialize = function (obj, key) { - if (obj === null) { - obj = 'null'; - } - else if (obj === undefined) { - obj = 'undefined'; - } - else if (obj === false) { - obj = 'false'; - } - - if (typeof obj !== 'object') { - return key ? key + '=' + obj : obj; - } - - if (obj instanceof Buffer) { - return key ? key + '=' + obj.toString('base64') : obj.toString('base64'); - } - - var msg = '', - keys = Object.keys(obj), - length = keys.length; - - for (var i = 0; i < length; i++) { - if (Array.isArray(obj[keys[i]])) { - msg += keys[i] + '=['; - - for (var j = 0, l = obj[keys[i]].length; j < l; j++) { - msg += exports.serialize(obj[keys[i]][j]); - if (j < l - 1) { - msg += ', '; - } - } - - msg += ']'; - } - else if (obj[keys[i]] instanceof Date) { - msg += keys[i] + '=' + obj[keys[i]]; - } - else { - msg += exports.serialize(obj[keys[i]], keys[i]); - } - - if (i < length - 1) { - msg += ', '; - } - } - - return msg; -}; diff --git a/node_modules/winston/lib/winston/config.js b/node_modules/winston/lib/winston/config.js deleted file mode 100644 index 45e9283..0000000 --- a/node_modules/winston/lib/winston/config.js +++ /dev/null @@ -1,45 +0,0 @@ -/* - * config.js: Default settings for all levels that winston knows about - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var colors = require('colors'); - -var config = exports, - allColors = exports.allColors = {}; - -config.addColors = function (colors) { - mixin(allColors, colors); -}; - -config.colorize = function (level) { - return level[allColors[level]]; -}; - -// -// Export config sets -// -config.cli = require('./config/cli-config'); -config.npm = require('./config/npm-config'); -config.syslog = require('./config/syslog-config'); - -// -// Add colors for pre-defined config sets -// -config.addColors(config.npm.colors); -config.addColors(config.syslog.colors); - -function mixin (target) { - var args = Array.prototype.slice.call(arguments, 1); - - args.forEach(function (a) { - var keys = Object.keys(a); - for (var i = 0; i < keys.length; i++) { - target[keys[i]] = a[keys[i]]; - } - }); - return target; -}; \ No newline at end of file diff --git a/node_modules/winston/lib/winston/config/cli-config.js b/node_modules/winston/lib/winston/config/cli-config.js deleted file mode 100644 index 9798ddc..0000000 --- a/node_modules/winston/lib/winston/config/cli-config.js +++ /dev/null @@ -1,35 +0,0 @@ -/* - * cli-config.js: Config that conform to commonly used CLI logging levels. - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var cliConfig = exports; - -cliConfig.levels = { - silly: 0, - input: 1, - verbose: 2, - prompt: 3, - info: 4, - data: 5, - help: 6, - warn: 7, - debug: 8, - error: 9 -}; - -cliConfig.colors = { - silly: 'magenta', - input: 'grey', - verbose: 'cyan', - prompt: 'grey', - info: 'green', - data: 'grey', - help: 'cyan', - warn: 'yellow', - debug: 'blue', - error: 'red' -}; \ No newline at end of file diff --git a/node_modules/winston/lib/winston/config/npm-config.js b/node_modules/winston/lib/winston/config/npm-config.js deleted file mode 100644 index 464f735..0000000 --- a/node_modules/winston/lib/winston/config/npm-config.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * npm-config.js: Config that conform to npm logging levels. - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var npmConfig = exports; - -npmConfig.levels = { - silly: 0, - verbose: 1, - info: 2, - warn: 3, - debug: 4, - error: 5 -}; - -npmConfig.colors = { - silly: 'magenta', - verbose: 'cyan', - info: 'green', - warn: 'yellow', - debug: 'blue', - error: 'red' -}; \ No newline at end of file diff --git a/node_modules/winston/lib/winston/config/syslog-config.js b/node_modules/winston/lib/winston/config/syslog-config.js deleted file mode 100644 index a198abc..0000000 --- a/node_modules/winston/lib/winston/config/syslog-config.js +++ /dev/null @@ -1,31 +0,0 @@ -/* - * syslog-config.js: Config that conform to syslog logging levels. - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var syslogConfig = exports; - -syslogConfig.levels = { - debug: 0, - info: 1, - notice: 2, - warning: 3, - error: 4, - crit: 5, - alert: 6, - emerg: 7 -}; - -syslogConfig.colors = { - debug: 'blue', - info: 'green', - notice: 'yellow', - warning: 'red', - error: 'red', - crit: 'red', - alert: 'yellow', - emerg: 'red' -}; \ No newline at end of file diff --git a/node_modules/winston/lib/winston/container.js b/node_modules/winston/lib/winston/container.js deleted file mode 100644 index 0e67b20..0000000 --- a/node_modules/winston/lib/winston/container.js +++ /dev/null @@ -1,101 +0,0 @@ -/* - * container.js: Inversion of control container for winston logger instances - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var common = require('./common'), - winston = require('../winston'); - -// -// ### function Container (options) -// #### @options {Object} Default pass-thru options for Loggers -// Constructor function for the Container object responsible for managing -// a set of `winston.Logger` instances based on string ids. -// -var Container = exports.Container = function (options) { - this.loggers = {}; - this.options = options || {}; - this.default = { - transports: [ - new winston.transports.Console({ - level: 'silly', - colorize: false - }) - ] - } -}; - -// -// ### function get / add (id, options) -// #### @id {string} Id of the Logger to get -// #### @options {Object} **Optional** Options for the Logger instance -// Retreives a `winston.Logger` instance for the specified `id`. If -// an instance does not exist, one is created. -// -Container.prototype.get = Container.prototype.add = function (id, options) { - if (!this.loggers[id]) { - options = common.clone(options || this.options || this.default); - options.transports = options.transports || []; - - if (options.transports.length === 0 && (!options || !options['console'])) { - options.transports.push(this.default.transports[0]); - } - - Object.keys(options).forEach(function (key) { - if (key === 'transports') { - return; - } - - var name = common.capitalize(key); - - if (!winston.transports[name]) { - throw new Error('Cannot add unknown transport: ' + name); - } - - var namedOptions = options[key]; - namedOptions.id = id; - options.transports.push(new (winston.transports[name])(namedOptions)); - }); - - this.loggers[id] = new winston.Logger(options); - } - - return this.loggers[id]; -}; - -// -// ### function close (id) -// #### @id {string} **Optional** Id of the Logger instance to find -// Returns a boolean value indicating if this instance -// has a logger with the specified `id`. -// -Container.prototype.has = function (id) { - return !!this.loggers[id]; -}; - -// -// ### function close (id) -// #### @id {string} **Optional** Id of the Logger instance to close -// Closes a `Logger` instance with the specified `id` if it exists. -// If no `id` is supplied then all Loggers are closed. -// -Container.prototype.close = function (id) { - var self = this; - - function _close (id) { - if (!self.loggers[id]) { - return; - } - - self.loggers[id].close(); - delete self.loggers[id]; - } - - return id ? _close(id) : Object.keys(this.loggers).forEach(function (id) { - _close(id); - }); -}; - diff --git a/node_modules/winston/lib/winston/exception.js b/node_modules/winston/lib/winston/exception.js deleted file mode 100644 index 2a01e91..0000000 --- a/node_modules/winston/lib/winston/exception.js +++ /dev/null @@ -1,55 +0,0 @@ -/* - * exception.js: Utility methods for gathing information about uncaughtExceptions. - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var os = require('os'), - stackTrace = require('stack-trace'); - -var exception = exports; - -exception.getAllInfo = function (err) { - return { - process: exception.getProcessInfo(), - os: exception.getOsInfo(), - trace: exception.getTrace(err), - stack: err.stack.split('\n') - }; -}; - -exception.getProcessInfo = function () { - return { - pid: process.pid, - uid: process.getuid(), - gid: process.getgid(), - cwd: process.cwd(), - execPath: process.execPath, - version: process.version, - argv: process.argv, - memoryUsage: process.memoryUsage() - }; -}; - -exception.getOsInfo = function () { - return { - loadavg: os.loadavg(), - uptime: os.uptime() - }; -}; - -exception.getTrace = function (err) { - var trace = err ? stackTrace.parse(err) : stackTrace.get(); - return trace.map(function (site) { - return { - column: site.getColumnNumber(), - file: site.getFileName(), - function: site.getFunctionName(), - line: site.getLineNumber(), - method: site.getMethodName(), - native: site.isNative(), - } - }); -}; \ No newline at end of file diff --git a/node_modules/winston/lib/winston/logger.js b/node_modules/winston/lib/winston/logger.js deleted file mode 100644 index baaa057..0000000 --- a/node_modules/winston/lib/winston/logger.js +++ /dev/null @@ -1,515 +0,0 @@ -/* - * logger.js: Core logger object used by winston. - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var events = require('events'), - util = require('util'), - async = require('async'), - config = require('./config'), - common = require('./common'), - exception = require('./exception'); - -// -// Time constants -// -var ticksPerMillisecond = 10000; - -// -// ### function Logger (options) -// #### @options {Object} Options for this instance. -// Constructor function for the Logger object responsible -// for persisting log messages and metadata to one or more transports. -// -var Logger = exports.Logger = function (options) { - events.EventEmitter.call(this); - options = options || {}; - - var self = this, - handleExceptions = false; - - // - // Set Levels and default logging level - // - this.padLevels = options.padLevels || false; - this.setLevels(options.levels); - if (options.colors) { - config.addColors(options.colors); - } - - // - // Hoist other options onto this instance. - // - this.level = options.level || 'info'; - this.emitErrs = options.emitErrs || false; - this.stripColors = options.stripColors || false; - this.exitOnError = typeof options.exitOnError !== 'undefined' - ? options.exitOnError - : true; - - // - // Setup other intelligent default settings. - // - this.transports = {}; - this.rewriters = []; - this.exceptionHandlers = {}; - this.profilers = {}; - this._names = []; - this._hnames = []; - - if (options.transports) { - options.transports.forEach(function (transport) { - self.add(transport, null, true); - - if (transport.handleExceptions) { - handleExceptions = true; - } - }); - } - - if (options.rewriters) { - options.rewriters.forEach(function(rewriter) { - self.addRewriter(rewriter); - }); - } - - if (options.exceptionHandlers) { - handleExceptions = true; - options.exceptionHandlers.forEach(function (handler) { - self._hnames.push(handler.name); - self.exceptionHandlers[handler.name] = handler; - }); - } - - if (options.handleExceptions || handleExceptions) { - this.handleExceptions(); - } -}; - -// -// Inherit from `events.EventEmitter`. -// -util.inherits(Logger, events.EventEmitter); - -// -// ### function extend (target) -// #### @target {Object} Target to extend. -// Extends the target object with a 'log' method -// along with a method for each level in this instance. -// -Logger.prototype.extend = function (target) { - var self = this; - ['log', 'profile', 'startTimer'].concat(Object.keys(this.levels)).forEach(function (method) { - target[method] = function () { - return self[method].apply(self, arguments); - }; - }); - - return this; -}; - -// -// ### function log (level, msg, [meta], callback) -// #### @level {string} Level at which to log the message. -// #### @msg {string} Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} Continuation to respond to when complete. -// Core logging method exposed to Winston. Metadata is optional. -// -Logger.prototype.log = function (level, msg) { - var self = this, - callback, - meta; - - if (arguments.length === 3) { - if (typeof arguments[2] === 'function') { - meta = {}; - callback = arguments[2]; - } - else if (typeof arguments[2] === 'object') { - meta = arguments[2]; - } - } - else if (arguments.length === 4) { - meta = arguments[2]; - callback = arguments[3]; - } - - // If we should pad for levels, do so - if (this.padLevels) { - msg = new Array(this.levelLength - level.length).join(' ') + msg; - } - - function onError (err) { - if (callback) { - callback(err); - } - else if (self.emitErrs) { - self.emit('error', err); - }; - } - - if (this.transports.length === 0) { - return onError(new Error('Cannot log with no transports.')); - } - else if (typeof self.levels[level] === 'undefined') { - return onError(new Error('Unknown log level: ' + level)); - } - - this.rewriters.forEach(function(rewriter) { - meta = rewriter(level, msg, meta); - }); - - // - // For consideration of terminal 'color" programs like colors.js, - // which can add ANSI escape color codes to strings, we destyle the - // ANSI color escape codes when `this.stripColors` is set. - // - // see: http://en.wikipedia.org/wiki/ANSI_escape_code - // - if (this.stripColors) { - var code = /\u001b\[\d+m/g; - msg = ('' + msg).replace(code, ''); - } - - for (var i = 0, l = this._names.length; i < l; i++) { - var transport = this.transports[this._names[i]]; - if ((transport.level && self.levels[transport.level] <= self.levels[level]) - || (!transport.level && self.levels[self.level] <= self.levels[level])) { - transport.log(level, msg, meta, function (err) { - self.emit('logging', transport, level, msg, meta); - }); - } - } - - // - // Immediately respond to the callback - // - if (callback) { - callback(null, level, msg, meta); - } - - return this; -}; - -// -// ### function close () -// Cleans up resources (streams, event listeners) for all -// transports associated with this instance (if necessary). -// -Logger.prototype.close = function () { - var self = this; - - this._names.forEach(function (name) { - var transport = self.transports[name]; - if (transport && transport.close) { - transport.close(); - } - }); -}; - -// -// ### function handleExceptions () -// Handles `uncaughtException` events for the current process -// -Logger.prototype.handleExceptions = function () { - var args = Array.prototype.slice.call(arguments), - handlers = [], - self = this; - - args.forEach(function (a) { - if (Array.isArray(a)) { - handlers = handlers.concat(a); - } - else { - handlers.push(a); - } - }); - - handlers.forEach(function (handler) { - self.exceptionHandlers[handler.name] = handler; - }); - - this._hnames = Object.keys(self.exceptionHandlers); - - if (!this.catchExceptions) { - this.catchExceptions = this._uncaughtException.bind(this); - process.on('uncaughtException', this.catchExceptions); - } -}; - -// -// ### function unhandleExceptions () -// Removes any handlers to `uncaughtException` events -// for the current process -// -Logger.prototype.unhandleExceptions = function () { - var self = this; - - if (this.catchExceptions) { - Object.keys(this.exceptionHandlers).forEach(function (name) { - if (handler.close) { - handler.close(); - } - }); - - this.exceptionHandlers = {}; - Object.keys(this.transports).forEach(function (name) { - var transport = self.transports[name]; - if (transport.handleExceptions) { - transport.handleExceptions = false; - } - }) - - process.removeListener('uncaughtException', this.catchExceptions); - this.catchExceptions = false; - } -}; - -// -// ### function add (transport, [options]) -// #### @transport {Transport} Prototype of the Transport object to add. -// #### @options {Object} **Optional** Options for the Transport to add. -// #### @instance {Boolean} **Optional** Value indicating if `transport` is already instantiated. -// Adds a transport of the specified type to this instance. -// -Logger.prototype.add = function (transport, options, created) { - var instance = created ? transport : (new (transport)(options)); - - if (!instance.name && !instance.log) { - throw new Error('Unknown transport with no log() method'); - } - else if (this.transports[instance.name]) { - throw new Error('Transport already attached: ' + instance.name); - } - - this.transports[instance.name] = instance; - this._names = Object.keys(this.transports); - - // - // Listen for the `error` event on the new Transport - // - instance._onError = this._onError.bind(this, instance) - instance.on('error', instance._onError); - - // - // If this transport has `handleExceptions` set to `true` - // and we are not already handling exceptions, do so. - // - if (transport.handleExceptions && !this.catchExceptions) { - this.handleExceptions(); - } - - return this; -}; - -// -// ### function addRewriter (transport, [options]) -// #### @transport {Transport} Prototype of the Transport object to add. -// #### @options {Object} **Optional** Options for the Transport to add. -// #### @instance {Boolean} **Optional** Value indicating if `transport` is already instantiated. -// Adds a transport of the specified type to this instance. -// -Logger.prototype.addRewriter = function(rewriter) { - this.rewriters.push(rewriter); -} - -// -// ### function clear () -// Remove all transports from this instance -// -Logger.prototype.clear = function () { - for (var name in this.transports) { - this.remove({ name: name }); - } -}; - -// -// ### function remove (transport) -// #### @transport {Transport} Transport to remove. -// Removes a transport of the specified type from this instance. -// -Logger.prototype.remove = function (transport) { - var name = transport.name || transport.prototype.name; - - if (!this.transports[name]) { - throw new Error('Transport ' + name + ' not attached to this instance'); - } - - var instance = this.transports[name]; - delete this.transports[name]; - this._names = Object.keys(this.transports); - - if (instance.close) { - instance.close(); - } - - instance.removeListener('error', instance._onError); - return this; -}; - -var ProfileHandler = function (logger) { - this.logger = logger; - - this.start = Date.now(); - - this.done = function (msg) { - var args, callback, meta; - args = Array.prototype.slice.call(arguments); - callback = typeof args[args.length - 1] === 'function' ? args.pop() : null; - meta = typeof args[args.length - 1] === 'object' ? args.pop() : {}; - - meta.duration = (Date.now()) - this.start + 'ms'; - - return this.logger.info(msg, meta, callback); - } -} - -Logger.prototype.startTimer = function () { - return new ProfileHandler(this); -} - -// -// ### function profile (id, [msg, meta, callback]) -// #### @id {string} Unique id of the profiler -// #### @msg {string} **Optional** Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} **Optional** Continuation to respond to when complete. -// Tracks the time inbetween subsequent calls to this method -// with the same `id` parameter. The second call to this method -// will log the difference in milliseconds along with the message. -// -Logger.prototype.profile = function (id) { - var now = Date.now(), then, args, - msg, meta, callback; - - if (this.profilers[id]) { - then = this.profilers[id]; - delete this.profilers[id]; - - // Support variable arguments: msg, meta, callback - args = Array.prototype.slice.call(arguments); - callback = typeof args[args.length - 1] === 'function' ? args.pop() : null; - meta = typeof args[args.length - 1] === 'object' ? args.pop() : {}; - msg = args.length === 2 ? args[1] : id; - - // Set the duration property of the metadata - meta.duration = now - then + 'ms'; - return this.info(msg, meta, callback); - } - else { - this.profilers[id] = now; - } - - return this; -}; - -// -// ### function setLevels (target) -// #### @target {Object} Target levels to use on this instance -// Sets the `target` levels specified on this instance. -// -Logger.prototype.setLevels = function (target) { - return common.setLevels(this, this.levels, target); -}; - -// -// ### function cli () -// Configures this instance to have the default -// settings for command-line interfaces: no timestamp, -// colors enabled, padded output, and additional levels. -// -Logger.prototype.cli = function () { - this.padLevels = true; - this.setLevels(config.cli.levels); - config.addColors(config.cli.colors); - - if (this.transports.console) { - this.transports.console.colorize = true; - this.transports.console.timestamp = false; - } - - return this; -}; - -// -// ### @private function _uncaughtException (err) -// #### @err {Error} Error to handle -// Logs all relevant information around the `err` and -// exits the current process. -// -Logger.prototype._uncaughtException = function (err) { - var self = this, - responded = false, - info = exception.getAllInfo(err), - handlers = this._getExceptionHandlers(), - timeout, - doExit; - - // - // Calculate if we should exit on this error - // - doExit = typeof this.exitOnError === 'function' - ? this.exitOnError(err) - : this.exitOnError; - - function logAndWait(transport, next) { - transport.logException('uncaughtException', info, next, err); - } - - function gracefulExit() { - if (doExit && !responded) { - // - // Remark: Currently ignoring any exceptions from transports - // when catching uncaught exceptions. - // - clearTimeout(timeout); - responded = true; - process.exit(1); - } - } - - if (!handlers || handlers.length === 0) { - return gracefulExit(); - } - - // - // Log to all transports and allow the operation to take - // only up to `3000ms`. - // - async.forEach(handlers, logAndWait, gracefulExit); - if (doExit) { - timeout = setTimeout(gracefulExit, 3000); - } -}; - -// -// ### @private function _getExceptionHandlers () -// Returns the list of transports and exceptionHandlers -// for this instance. -// -Logger.prototype._getExceptionHandlers = function () { - var self = this; - - return this._hnames.map(function (name) { - return self.exceptionHandlers[name]; - }).concat(this._names.map(function (name) { - return self.transports[name].handleExceptions && self.transports[name]; - })).filter(Boolean); -}; - -// -// ### @private function _onError (transport, err) -// #### @transport {Object} Transport on which the error occured -// #### @err {Error} Error that occurred on the transport -// Bubbles the error, `err`, that occured on the specified `transport` -// up from this instance if `emitErrs` has been set. -// -Logger.prototype._onError = function (transport, err) { - if (this.emitErrs) { - this.emit('error', err, transport); - } -}; diff --git a/node_modules/winston/lib/winston/transports.js b/node_modules/winston/lib/winston/transports.js deleted file mode 100644 index 5080634..0000000 --- a/node_modules/winston/lib/winston/transports.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * transports.js: Set of all transports Winston knows about - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var fs = require('fs'), - path = require('path'), - common = require('./common'); - -var transports = exports; - -// -// Setup all transports as lazy-loaded getters. -// -fs.readdirSync(path.join(__dirname, 'transports')).forEach(function (file) { - var transport = file.replace('.js', ''), - name = common.capitalize(transport); - - if (transport === 'transport') { - return; - } - - transports.__defineGetter__(name, function () { - return require('./transports/' + transport)[name]; - }); -}); \ No newline at end of file diff --git a/node_modules/winston/lib/winston/transports/console.js b/node_modules/winston/lib/winston/transports/console.js deleted file mode 100644 index 835d075..0000000 --- a/node_modules/winston/lib/winston/transports/console.js +++ /dev/null @@ -1,87 +0,0 @@ -/* - * console.js: Transport for outputting to the console - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var events = require('events'), - util = require('util'), - colors = require('colors'), - common = require('../common'), - Transport = require('./transport').Transport; - -// -// ### function Console (options) -// #### @options {Object} Options for this instance. -// Constructor function for the Console transport object responsible -// for persisting log messages and metadata to a terminal or TTY. -// -var Console = exports.Console = function (options) { - Transport.call(this, options); - options = options || {}; - - this.name = 'console'; - this.json = options.json || false; - this.colorize = options.colorize || false; - this.timestamp = typeof options.timestamp !== 'undefined' ? options.timestamp : false; - - if (this.json) { - this.stringify = options.stringify || function (obj) { - return JSON.stringify(obj, null, 2); - }; - } -}; - -// -// Inherit from `winston.Transport`. -// -util.inherits(Console, Transport); - -// -// Expose the name of this Transport on the prototype -// -Console.prototype.name = 'console'; - -// -// ### function log (level, msg, [meta], callback) -// #### @level {string} Level at which to log the message. -// #### @msg {string} Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} Continuation to respond to when complete. -// Core logging method exposed to Winston. Metadata is optional. -// -Console.prototype.log = function (level, msg, meta, callback) { - if (this.silent) { - return callback(null, true); - } - - var self = this, - output; - - output = common.log({ - colorize: this.colorize, - json: this.json, - level: level, - message: msg, - meta: meta, - stringify: this.stringify, - timestamp: this.timestamp, - raw: this.raw - }); - - if (level === 'error' || level === 'debug') { - util.error(output); - } - else { - util.puts(output); - } - - // - // Emit the `logged` event immediately because the event loop - // will not exit until `process.stdout` has drained anyway. - // - self.emit('logged'); - callback(null, true); -}; \ No newline at end of file diff --git a/node_modules/winston/lib/winston/transports/couchdb.js b/node_modules/winston/lib/winston/transports/couchdb.js deleted file mode 100644 index 61ad74a..0000000 --- a/node_modules/winston/lib/winston/transports/couchdb.js +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Couchdb.js: Transport for logging to Couchdb - * - * (C) 2011 Max Ogden - * MIT LICENSE - * - */ - -var events = require('events'), - http = require('http'), - util = require('util'), - common = require('../common'), - Transport = require('./transport').Transport; - -// -// ### function Couchdb (options) -// #### @options {Object} Options for this instance. -// Constructor function for the Console transport object responsible -// for making arbitrary HTTP requests whenever log messages and metadata -// are received. -// -var Couchdb = exports.Couchdb = function (options) { - Transport.call(this, options); - - this.name = 'Couchdb'; - this.db = options.db; - this.user = options.user; - this.pass = options.pass; - this.host = options.host || 'localhost'; - this.port = options.port || 5984; - - if (options.auth) { - // - // TODO: add http basic auth options for outgoing HTTP requests - // - } - - if (options.ssl) { - // - // TODO: add ssl support for outgoing HTTP requests - // - } -}; - -// -// Inherit from `winston.Transport`. -// -util.inherits(Couchdb, Transport); - -// -// Expose the name of this Transport on the prototype -// -Couchdb.prototype.name = 'Couchdb'; - -// -// ### function log (level, msg, [meta], callback) -// #### @level {string} Level at which to log the message. -// #### @msg {string} Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} Continuation to respond to when complete. -// Core logging method exposed to Winston. Metadata is optional. -// -Couchdb.prototype.log = function (level, msg, meta, callback) { - if (this.silent) { - return callback(null, true); - } - - var self = this, - message = common.clone(meta || {}), - options, - req; - - message.level = level; - message.message = msg; - - // Prepare options for outgoing HTTP request - options = { - host: this.host, - port: this.port, - path: "/" + this.db, - method: "POST", - headers: {"content-type": "application/json"} - }; - - if (options.user && options.pass) { - options.headers["Authorization"] = "Basic " + new Buffer(options.user + ":" + options.pass).toString('base64'); - } - - // Perform HTTP logging request - req = http.request(options, function (res) { - // - // No callback on request, fire and forget about the response - // - self.emit('logged', res); - }); - - req.on('error', function (err) { - // - // Propagate the `error` back up to the `Logger` that this - // instance belongs to. - // - self.emit('error', err); - }); - - // - // Write logging event to the outgoing request body - // - req.write(JSON.stringify({ - method: 'log', - params: { - timestamp: new Date(), // RFC3339/ISO8601 format instead of common.timestamp() - msg: msg, - level: level, - meta: meta - } - })); - - req.end(); - - // Always return true, regardless of any errors - callback(null, true); -}; \ No newline at end of file diff --git a/node_modules/winston/lib/winston/transports/file.js b/node_modules/winston/lib/winston/transports/file.js deleted file mode 100644 index 0a96c01..0000000 --- a/node_modules/winston/lib/winston/transports/file.js +++ /dev/null @@ -1,332 +0,0 @@ -/* - * file.js: Transport for outputting to a local log file - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var events = require('events'), - fs = require('fs'), - path = require('path'), - util = require('util'), - colors = require('colors'), - common = require('../common'), - Transport = require('./transport').Transport; - -// -// ### function File (options) -// #### @options {Object} Options for this instance. -// Constructor function for the File transport object responsible -// for persisting log messages and metadata to one or more files. -// -var File = exports.File = function (options) { - Transport.call(this, options); - - // - // Helper function which throws an `Error` in the event - // that any of the rest of the arguments is present in `options`. - // - function throwIf (target /*, illegal... */) { - Array.prototype.slice.call(arguments, 1).forEach(function (name) { - if (options[name]) { - throw new Error('Cannot set ' + name + ' and ' + target + 'together'); - } - }); - } - - if (options.filename || options.dirname) { - throwIf('filename or dirname', 'stream'); - this._basename = this.filename = path.basename(options.filename) || 'winston.log'; - this.dirname = options.dirname || path.dirname(options.filename); - this.options = options.options || { flags: 'a' }; - } - else if (options.stream) { - throwIf('stream', 'filename', 'maxsize'); - this.stream = options.stream; - } - else { - throw new Error('Cannot log to file without filename or stream.'); - } - - this.json = options.json !== false; - this.colorize = options.colorize || false; - this.maxsize = options.maxsize || null; - this.maxFiles = options.maxFiles || null; - this.timestamp = typeof options.timestamp !== 'undefined' ? options.timestamp : false; - - // - // Internal state variables representing the number - // of files this instance has created and the current - // size (in bytes) of the current logfile. - // - this._size = 0; - this._created = 0; - this._buffer = []; - this._draining = false; -}; - -// -// Inherit from `winston.Transport`. -// -util.inherits(File, Transport); - -// -// Expose the name of this Transport on the prototype -// -File.prototype.name = 'file'; - -// -// ### function log (level, msg, [meta], callback) -// #### @level {string} Level at which to log the message. -// #### @msg {string} Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} Continuation to respond to when complete. -// Core logging method exposed to Winston. Metadata is optional. -// -File.prototype.log = function (level, msg, meta, callback) { - if (this.silent) { - return callback(null, true); - } - - var self = this, output = common.log({ - level: level, - message: msg, - meta: meta, - json: this.json, - colorize: this.colorize, - timestamp: this.timestamp - }) + '\n'; - - this._size += output.length; - - if (!this.filename) { - // - // If there is no `filename` on this instance then it was configured - // with a raw `WriteableStream` instance and we should not perform any - // size restrictions. - // - this.stream.write(output); - self._lazyDrain(); - } - else { - this.open(function (err) { - if (err) { - // - // If there was an error enqueue the message - // - return self._buffer.push(output); - } - - self.stream.write(output); - self._lazyDrain(); - }); - } - - callback(null, true); -}; - -// -// ### function open (callback) -// #### @callback {function} Continuation to respond to when complete -// Checks to see if a new file needs to be created based on the `maxsize` -// (if any) and the current size of the file used. -// -File.prototype.open = function (callback) { - if (this.opening) { - // - // If we are already attempting to open the next - // available file then respond with a value indicating - // that the message should be buffered. - // - return callback(true); - } - else if (!this.stream || (this.maxsize && this._size >= this.maxsize)) { - // - // If we dont have a stream or have exceeded our size, then create - // the next stream and respond with a value indicating that - // the message should be buffered. - // - callback(true); - return this._createStream(); - } - - // - // Otherwise we have a valid (and ready) stream. - // - callback(); -}; - -// -// ### function close () -// Closes the stream associated with this instance. -// -File.prototype.close = function () { - var self = this; - - if (this.stream) { - this.stream.end(); - this.stream.destroySoon(); - - this.stream.once('drain', function () { - self.emit('flush'); - self.emit('closed'); - }); - } -}; - -// -// ### function flush () -// Flushes any buffered messages to the current `stream` -// used by this instance. -// -File.prototype.flush = function () { - var self = this; - - // - // Iterate over the `_buffer` of enqueued messaged - // and then write them to the newly created stream. - // - this._buffer.forEach(function (str) { - process.nextTick(function () { - self.stream.write(str); - self._size += str.length; - }); - }); - - // - // Quickly truncate the `_buffer` once the write operations - // have been started - // - self._buffer.length = 0; - - // - // When the stream has drained we have flushed - // our buffer. - // - self.stream.once('drain', function () { - self.emit('flush'); - self.emit('logged'); - }); -}; - -// -// ### @private function _createStream () -// Attempts to open the next appropriate file for this instance -// based on the common state (such as `maxsize` and `_basename`). -// -File.prototype._createStream = function () { - var self = this; - this.opening = true; - - (function checkFile (target) { - var fullname = path.join(self.dirname, target); - - // - // Creates the `WriteStream` and then flushes any - // buffered messages. - // - function createAndFlush (size) { - if (self.stream) { - self.stream.end(); - self.stream.destroySoon(); - } - - self._size = size; - self.filename = target; - self.stream = fs.createWriteStream(fullname, self.options); - - // - // When the current stream has finished flushing - // then we can be sure we have finished opening - // and thus can emit the `open` event. - // - self.once('flush', function () { - self.opening = false; - self.emit('open', fullname); - }); - - // - // Remark: It is possible that in the time it has taken to find the - // next logfile to be written more data than `maxsize` has been buffered, - // but for sensible limits (10s - 100s of MB) this seems unlikely in less - // than one second. - // - self.flush(); - } - - fs.stat(fullname, function (err, stats) { - if (err) { - if (err.code !== 'ENOENT') { - return self.emit('error', err); - } - - return createAndFlush(0); - } - - if (!stats || (self.maxsize && stats.size >= self.maxsize)) { - // - // If `stats.size` is greater than the `maxsize` for - // this instance then try again - // - return checkFile(self._getFile(true)); - } - - createAndFlush(stats.size); - }); - })(this._getFile()); -}; - -// -// ### @private function _getFile () -// Gets the next filename to use for this instance -// in the case that log filesizes are being capped. -// -File.prototype._getFile = function (inc) { - var self = this, - ext = path.extname(this._basename), - basename = path.basename(this._basename, ext), - remaining; - - if (inc) { - // - // Increment the number of files created or - // checked by this instance. - // - // Check for maxFiles option and delete file - if (this.maxFiles && (this._created >= (this.maxFiles - 1))) { - remaining = this._created - (this.maxFiles - 1); - if (remaining === 0) { - fs.unlinkSync(path.join(this.dirname, basename + ext)); - } - else { - fs.unlinkSync(path.join(this.dirname, basename + remaining + ext)); - } - } - - this._created += 1; - } - - return this._created - ? basename + this._created + ext - : basename + ext; -}; - -// -// ### @private function _lazyDrain () -// Lazily attempts to emit the `logged` event when `this.stream` has -// drained. This is really just a simple mutex that only works because -// Node.js is single-threaded. -// -File.prototype._lazyDrain = function () { - var self = this; - - if (!this._draining && this.stream) { - this._draining = true; - - this.stream.once('drain', function () { - this._draining = false; - self.emit('logged'); - }); - } -}; \ No newline at end of file diff --git a/node_modules/winston/lib/winston/transports/loggly.js b/node_modules/winston/lib/winston/transports/loggly.js deleted file mode 100644 index dd5762b..0000000 --- a/node_modules/winston/lib/winston/transports/loggly.js +++ /dev/null @@ -1,161 +0,0 @@ -/* - * loggly.js: Transport for logginh to remote Loggly API - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var events = require('events'), - loggly = require('loggly'), - util = require('util'), - async = require('async'), - common = require('../common'), - Transport = require('./transport').Transport; - -// -// ### function Loggly (options) -// #### @options {Object} Options for this instance. -// Constructor function for the Loggly transport object responsible -// for persisting log messages and metadata to Loggly; 'LaaS'. -// -var Loggly = exports.Loggly = function (options) { - Transport.call(this, options); - - function valid() { - return options.inputToken - || options.inputName && options.auth - || options.inputName && options.inputs && options.inputs[options.inputName] - || options.id && options.inputs && options.inputs[options.id]; - } - - if (!options.subdomain) { - throw new Error('Loggly Subdomain is required'); - } - - if (!valid()) { - throw new Error('Target input token or name is required.'); - } - - this.name = 'loggly'; - this.logBuffer = []; - - this.client = loggly.createClient({ - subdomain: options.subdomain, - auth: options.auth || null, - json: options.json || false - }); - - if (options.inputToken) { - this.inputToken = options.inputToken; - this.ready = true; - } - else if (options.inputs && (options.inputs[options.inputName] - || options.inputs[options.id])) { - this.inputToken = options.inputs[options.inputName] || options.inputs[options.id]; - this.ready = true; - } - else if (options.inputName) { - this.ready = false; - this.inputName = options.inputName; - - var self = this; - this.client.getInput(this.inputName, function (err, input) { - if (err) { - throw err; - } - - self.inputToken = input.input_token; - self.ready = true; - }); - } -}; - -// -// Inherit from `winston.Transport`. -// -util.inherits(Loggly, Transport); - -// -// Expose the name of this Transport on the prototype -// -Loggly.prototype.name = 'loggly'; - -// -// ### function log (level, msg, [meta], callback) -// #### @level {string} Level at which to log the message. -// #### @msg {string} Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} Continuation to respond to when complete. -// Core logging method exposed to Winston. Metadata is optional. -// -Loggly.prototype.log = function (level, msg, meta, callback) { - if (this.silent) { - return callback(null, true); - } - - var self = this, - message = common.clone(meta || {}); - - message.level = level; - message.message = msg; - - if (!this.ready) { - // - // If we haven't gotten the input token yet - // add this message to the log buffer. - // - this.logBuffer.push(message); - } - else if (this.ready && this.logBuffer.length > 0) { - // - // Otherwise if we have buffered messages - // add this message to the buffer and flush them. - // - this.logBuffer.push(message); - this.flush(); - } - else { - // - // Otherwise just log the message as normal - // - this.client.log(this.inputToken, message, function () { - self.emit('logged'); - }); - } - - callback(null, true); -}; - -// -// ### function flush () -// Flushes any buffered messages to the current `stream` -// used by this instance. -// -Loggly.prototype.flush = function () { - var self = this; - - function logMsg (msg, next) { - self.client.log(self.inputToken, msg, function (err) { - if (err) { - self.emit('error', err); - } - - next(); - }); - } - - // - // Initiate calls to loggly for each message in the buffer - // - async.forEach(this.logBuffer, logMsg, function () { - self.emit('logged'); - }); - - process.nextTick(function () { - // - // Then quickly truncate the list - // - self.logBuffer.length = 0; - }); -}; \ No newline at end of file diff --git a/node_modules/winston/lib/winston/transports/transport.js b/node_modules/winston/lib/winston/transports/transport.js deleted file mode 100644 index 1489cb5..0000000 --- a/node_modules/winston/lib/winston/transports/transport.js +++ /dev/null @@ -1,59 +0,0 @@ -/* - * transport.js: Base Transport object for all Winston transports. - * - * (C) 2010 Charlie Robbins - * MIT LICENCE - * - */ - -var events = require('events'), - util = require('util'); - -// -// ### function Transport (options) -// #### @options {Object} Options for this instance. -// Constructor function for the Tranport object responsible -// base functionality for all winston transports. -// -var Transport = exports.Transport = function (options) { - events.EventEmitter.call(this); - - options = options || {}; - this.level = options.level || 'info'; - this.silent = options.silent || false; - this.raw = options.raw || false; - - this.handleExceptions = options.handleExceptions || false; -}; - -// -// Inherit from `events.EventEmitter`. -// -util.inherits(Transport, events.EventEmitter); - -// -// ### function logException (msg, meta, callback) -// #### @msg {string} Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} Continuation to respond to when complete. -// Logs the specified `msg`, `meta` and responds to the callback once the log -// operation is complete to ensure that the event loop will not exit before -// all logging has completed. -// -Transport.prototype.logException = function (msg, meta, callback) { - var self = this; - - function onLogged () { - self.removeListener('error', onError); - callback(); - } - - function onError () { - self.removeListener('logged', onLogged); - callback(); - } - - this.once('logged', onLogged); - this.once('error', onError); - this.log('error', msg, meta, function () { }); -}; \ No newline at end of file diff --git a/node_modules/winston/lib/winston/transports/webhook.js b/node_modules/winston/lib/winston/transports/webhook.js deleted file mode 100644 index bf8eb27..0000000 --- a/node_modules/winston/lib/winston/transports/webhook.js +++ /dev/null @@ -1,136 +0,0 @@ -/* - * webhook.js: Transport for logging to remote http endpoints ( POST / RECEIVE webhooks ) - * - * (C) 2011 Marak Squires - * MIT LICENCE - * - */ - -var events = require('events'), - http = require('http'), - https = require('https'), - util = require('util'), - common = require('../common'), - Transport = require('./transport').Transport; - -// -// ### function WebHook (options) -// #### @options {Object} Options for this instance. -// Constructor function for the Console transport object responsible -// for making arbitrary HTTP requests whenever log messages and metadata -// are received. -// -var Webhook = exports.Webhook = function (options) { - Transport.call(this, options); - - this.name = 'webhook'; - this.host = options.host || 'localhost'; - this.port = options.port || 8080; - this.method = options.method || 'POST'; - this.path = options.path || '/winston-log'; - - if (options.auth) { - this.auth = {}; - this.auth.username = options.auth.username || ''; - this.auth.password = options.auth.password || ''; - } - - if (options.ssl) { - this.ssl = {}; - this.ssl.key = options.ssl.key || null; - this.ssl.cert = options.ssl.cert || null; - this.ssl.ca = options.ssl.ca; - } -}; - -// -// Inherit from `winston.Transport`. -// -util.inherits(Webhook, Transport); - -// -// Expose the name of this Transport on the prototype -// -Webhook.prototype.name = 'webhook'; - -// -// ### function log (level, msg, [meta], callback) -// #### @level {string} Level at which to log the message. -// #### @msg {string} Message to log -// #### @meta {Object} **Optional** Additional metadata to attach -// #### @callback {function} Continuation to respond to when complete. -// Core logging method exposed to Winston. Metadata is optional. -// -Webhook.prototype.log = function (level, msg, meta, callback) { - if (this.silent) { - return callback(null, true); - } - - var self = this, - message = common.clone(meta), - options, - req; - - message.level = level; - message.message = msg; - - // Prepare options for outgoing HTTP request - options = { - host: this.host, - port: this.port, - path: this.path, - method: this.method, - headers: { 'Content-Type': 'application/json' } - }; - - if (this.ssl) { - options.ca = this.ssl.ca; - options.key = this.ssl.key; - options.cert = this.ssl.cert; - } - - if (this.auth) { - // Encode `Authorization` header used by Basic Auth - options.headers['Authorization'] = 'Basic ' + new Buffer( - this.auth.username + ':' + this.auth.password, 'utf8' - ).toString('base64'); - } - - // Perform HTTP logging request - req = (self.ssl ? https : http).request(options, function (res) { - // - // No callback on request, fire and forget about the response - // - self.emit('logged'); - }); - - req.on('error', function (err) { - // - // Propagate the `error` back up to the `Logger` that this - // instance belongs to. - // - self.emit('error', err); - }); - - // - // Write logging event to the outgoing request body - // - // jsonMessage is currently conforming to JSON-RPC v1.0, - // but without the unique id since there is no anticipated response - // see: http://en.wikipedia.org/wiki/JSON-RPC - // - req.write(JSON.stringify({ - method: 'log', - params: { - timestamp: new Date(), - msg: msg, - level: level, - meta: meta - } - })); - - req.end(); - - // Always return true, regardless of any errors - callback(null, true); -}; diff --git a/node_modules/winston/node_modules/async/.gitmodules b/node_modules/winston/node_modules/async/.gitmodules deleted file mode 100644 index a9aae98..0000000 --- a/node_modules/winston/node_modules/async/.gitmodules +++ /dev/null @@ -1,9 +0,0 @@ -[submodule "deps/nodeunit"] - path = deps/nodeunit - url = git://github.com/caolan/nodeunit.git -[submodule "deps/UglifyJS"] - path = deps/UglifyJS - url = https://github.com/mishoo/UglifyJS.git -[submodule "deps/nodelint"] - path = deps/nodelint - url = https://github.com/tav/nodelint.git diff --git a/node_modules/winston/node_modules/async/.npmignore b/node_modules/winston/node_modules/async/.npmignore deleted file mode 100644 index 9bdfc97..0000000 --- a/node_modules/winston/node_modules/async/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -deps -dist -test -nodelint.cfg \ No newline at end of file diff --git a/node_modules/winston/node_modules/async/LICENSE b/node_modules/winston/node_modules/async/LICENSE deleted file mode 100644 index b7f9d50..0000000 --- a/node_modules/winston/node_modules/async/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010 Caolan McMahon - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/node_modules/winston/node_modules/async/Makefile b/node_modules/winston/node_modules/async/Makefile deleted file mode 100644 index bad647c..0000000 --- a/node_modules/winston/node_modules/async/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -PACKAGE = asyncjs -NODEJS = $(if $(shell test -f /usr/bin/nodejs && echo "true"),nodejs,node) -CWD := $(shell pwd) -NODEUNIT = $(CWD)/node_modules/nodeunit/bin/nodeunit -UGLIFY = $(CWD)/node_modules/uglify-js/bin/uglifyjs -NODELINT = $(CWD)/node_modules/nodelint/nodelint - -BUILDDIR = dist - -all: clean test build - -build: $(wildcard lib/*.js) - mkdir -p $(BUILDDIR) - $(UGLIFY) lib/async.js > $(BUILDDIR)/async.min.js - -test: - $(NODEUNIT) test - -clean: - rm -rf $(BUILDDIR) - -lint: - $(NODELINT) --config nodelint.cfg lib/async.js - -.PHONY: test build all diff --git a/node_modules/winston/node_modules/async/README.md b/node_modules/winston/node_modules/async/README.md deleted file mode 100644 index 0cf7fc9..0000000 --- a/node_modules/winston/node_modules/async/README.md +++ /dev/null @@ -1,1022 +0,0 @@ -# Async.js - -Async is a utility module which provides straight-forward, powerful functions -for working with asynchronous JavaScript. Although originally designed for -use with [node.js](http://nodejs.org), it can also be used directly in the -browser. - -Async provides around 20 functions that include the usual 'functional' -suspects (map, reduce, filter, forEach…) as well as some common patterns -for asynchronous control flow (parallel, series, waterfall…). All these -functions assume you follow the node.js convention of providing a single -callback as the last argument of your async function. - - -## Quick Examples - - async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file - }); - - async.filter(['file1','file2','file3'], path.exists, function(results){ - // results now equals an array of the existing files - }); - - async.parallel([ - function(){ ... }, - function(){ ... } - ], callback); - - async.series([ - function(){ ... }, - function(){ ... } - ]); - -There are many more functions available so take a look at the docs below for a -full list. This module aims to be comprehensive, so if you feel anything is -missing please create a GitHub issue for it. - - -## Download - -Releases are available for download from -[GitHub](http://github.com/caolan/async/downloads). -Alternatively, you can install using Node Package Manager (npm): - - npm install async - - -__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 17.5kb Uncompressed - -__Production:__ [async.min.js](https://github.com/caolan/async/raw/master/dist/async.min.js) - 1.7kb Packed and Gzipped - - -## In the Browser - -So far its been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. Usage: - - - - - -## Documentation - -### Collections - -* [forEach](#forEach) -* [map](#map) -* [filter](#filter) -* [reject](#reject) -* [reduce](#reduce) -* [detect](#detect) -* [sortBy](#sortBy) -* [some](#some) -* [every](#every) -* [concat](#concat) - -### Control Flow - -* [series](#series) -* [parallel](#parallel) -* [whilst](#whilst) -* [until](#until) -* [waterfall](#waterfall) -* [queue](#queue) -* [auto](#auto) -* [iterator](#iterator) -* [apply](#apply) -* [nextTick](#nextTick) - -### Utils - -* [memoize](#memoize) -* [unmemoize](#unmemoize) -* [log](#log) -* [dir](#dir) -* [noConflict](#noConflict) - - -## Collections - - -### forEach(arr, iterator, callback) - -Applies an iterator function to each item in an array, in parallel. -The iterator is called with an item from the list and a callback for when it -has finished. If the iterator passes an error to this callback, the main -callback for the forEach function is immediately called with the error. - -Note, that since this function applies the iterator to each item in parallel -there is no guarantee that the iterator functions will complete in order. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(err) - A callback which is called after all the iterator functions - have finished, or an error has occurred. - -__Example__ - - // assuming openFiles is an array of file names and saveFile is a function - // to save the modified contents of that file: - - async.forEach(openFiles, saveFile, function(err){ - // if any of the saves produced an error, err would equal that error - }); - ---------------------------------------- - - -### forEachSeries(arr, iterator, callback) - -The same as forEach only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. This means the iterator functions will complete in order. - - ---------------------------------------- - - -### forEachLimit(arr, limit, iterator, callback) - -The same as forEach only the iterator is applied to batches of items in the -array, in series. The next batch of iterators is only called once the current -one has completed processing. - -__Arguments__ - -* arr - An array to iterate over. -* limit - How many items should be in each batch. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(err) - A callback which is called after all the iterator functions - have finished, or an error has occurred. - -__Example__ - - // Assume documents is an array of JSON objects and requestApi is a - // function that interacts with a rate-limited REST api. - - async.forEachLimit(documents, 20, requestApi, function(err){ - // if any of the saves produced an error, err would equal that error - }); ---------------------------------------- - - -### map(arr, iterator, callback) - -Produces a new array of values by mapping each value in the given array through -the iterator function. The iterator is called with an item from the array and a -callback for when it has finished processing. The callback takes 2 arguments, -an error and the transformed item from the array. If the iterator passes an -error to this callback, the main callback for the map function is immediately -called with the error. - -Note, that since this function applies the iterator to each item in parallel -there is no guarantee that the iterator functions will complete in order, however -the results array will be in the same order as the original array. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed - with an error (which can be null) and a transformed item. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is an array of the - transformed items from the original array. - -__Example__ - - async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file - }); - ---------------------------------------- - - -### mapSeries(arr, iterator, callback) - -The same as map only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. The results array will be in the same order as the original. - - ---------------------------------------- - - -### filter(arr, iterator, callback) - -__Alias:__ select - -Returns a new array of all the values which pass an async truth test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like path.exists. This operation is -performed in parallel, but the results array will be in the same order as the -original. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(results) - A callback which is called after all the iterator - functions have finished. - -__Example__ - - async.filter(['file1','file2','file3'], path.exists, function(results){ - // results now equals an array of the existing files - }); - ---------------------------------------- - - -### filterSeries(arr, iterator, callback) - -__alias:__ selectSeries - -The same as filter only the iterator is applied to each item in the array in -series. The next iterator is only called once the current one has completed -processing. The results array will be in the same order as the original. - ---------------------------------------- - - -### reject(arr, iterator, callback) - -The opposite of filter. Removes values that pass an async truth test. - ---------------------------------------- - - -### rejectSeries(arr, iterator, callback) - -The same as filter, only the iterator is applied to each item in the array -in series. - - ---------------------------------------- - - -### reduce(arr, memo, iterator, callback) - -__aliases:__ inject, foldl - -Reduces a list of values into a single value using an async iterator to return -each successive step. Memo is the initial state of the reduction. This -function only operates in series. For performance reasons, it may make sense to -split a call to this function into a parallel map, then use the normal -Array.prototype.reduce on the results. This function is for situations where -each step in the reduction needs to be async, if you can get the data before -reducing it then its probably a good idea to do so. - -__Arguments__ - -* arr - An array to iterate over. -* memo - The initial state of the reduction. -* iterator(memo, item, callback) - A function applied to each item in the - array to produce the next step in the reduction. The iterator is passed a - callback which accepts an optional error as its first argument, and the state - of the reduction as the second. If an error is passed to the callback, the - reduction is stopped and the main callback is immediately called with the - error. -* callback(err, result) - A callback which is called after all the iterator - functions have finished. Result is the reduced value. - -__Example__ - - async.reduce([1,2,3], 0, function(memo, item, callback){ - // pointless async: - process.nextTick(function(){ - callback(null, memo + item) - }); - }, function(err, result){ - // result is now equal to the last value of memo, which is 6 - }); - ---------------------------------------- - - -### reduceRight(arr, memo, iterator, callback) - -__Alias:__ foldr - -Same as reduce, only operates on the items in the array in reverse order. - - ---------------------------------------- - - -### detect(arr, iterator, callback) - -Returns the first value in a list that passes an async truth test. The -iterator is applied in parallel, meaning the first iterator to return true will -fire the detect callback with that result. That means the result might not be -the first item in the original array (in terms of order) that passes the test. - -If order within the original array is important then look at detectSeries. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(result) - A callback which is called as soon as any iterator returns - true, or after all the iterator functions have finished. Result will be - the first item in the array that passes the truth test (iterator) or the - value undefined if none passed. - -__Example__ - - async.detect(['file1','file2','file3'], path.exists, function(result){ - // result now equals the first file in the list that exists - }); - ---------------------------------------- - - -### detectSeries(arr, iterator, callback) - -The same as detect, only the iterator is applied to each item in the array -in series. This means the result is always the first in the original array (in -terms of array order) that passes the truth test. - - ---------------------------------------- - - -### sortBy(arr, iterator, callback) - -Sorts a list by the results of running each value through an async iterator. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed - with an error (which can be null) and a value to use as the sort criteria. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is the items from - the original array sorted by the values returned by the iterator calls. - -__Example__ - - async.sortBy(['file1','file2','file3'], function(file, callback){ - fs.stat(file, function(err, stats){ - callback(err, stats.mtime); - }); - }, function(err, results){ - // results is now the original array of files sorted by - // modified date - }); - - ---------------------------------------- - - -### some(arr, iterator, callback) - -__Alias:__ any - -Returns true if at least one element in the array satisfies an async test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like path.exists. Once any iterator -call returns true, the main callback is immediately called. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(result) - A callback which is called as soon as any iterator returns - true, or after all the iterator functions have finished. Result will be - either true or false depending on the values of the async tests. - -__Example__ - - async.some(['file1','file2','file3'], path.exists, function(result){ - // if result is true then at least one of the files exists - }); - ---------------------------------------- - - -### every(arr, iterator, callback) - -__Alias:__ all - -Returns true if every element in the array satisfies an async test. -_The callback for each iterator call only accepts a single argument of true or -false, it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like path.exists. - -__Arguments__ - -* arr - An array to iterate over. -* iterator(item, callback) - A truth test to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed. -* callback(result) - A callback which is called after all the iterator - functions have finished. Result will be either true or false depending on - the values of the async tests. - -__Example__ - - async.every(['file1','file2','file3'], path.exists, function(result){ - // if result is true then every file exists - }); - ---------------------------------------- - - -### concat(arr, iterator, callback) - -Applies an iterator to each item in a list, concatenating the results. Returns the -concatenated list. The iterators are called in parallel, and the results are -concatenated as they return. There is no guarantee that the results array will -be returned in the original order of the arguments passed to the iterator function. - -__Arguments__ - -* arr - An array to iterate over -* iterator(item, callback) - A function to apply to each item in the array. - The iterator is passed a callback which must be called once it has completed - with an error (which can be null) and an array of results. -* callback(err, results) - A callback which is called after all the iterator - functions have finished, or an error has occurred. Results is an array containing - the concatenated results of the iterator function. - -__Example__ - - async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){ - // files is now a list of filenames that exist in the 3 directories - }); - ---------------------------------------- - - -### concatSeries(arr, iterator, callback) - -Same as async.concat, but executes in series instead of parallel. - - -## Control Flow - - -### series(tasks, [callback]) - -Run an array of functions in series, each one running once the previous -function has completed. If any functions in the series pass an error to its -callback, no more functions are run and the callback for the series is -immediately called with the value of the error. Once the tasks have completed, -the results are passed to the final callback as an array. - -It is also possible to use an object instead of an array. Each property will be -run as a function and the results will be passed to the final callback as an object -instead of an array. This can be a more readable way of handling results from -async.series. - - -__Arguments__ - -* tasks - An array or object containing functions to run, each function is passed - a callback it must call on completion. -* callback(err, results) - An optional callback to run once all the functions - have completed. This function gets an array of all the arguments passed to - the callbacks used in the array. - -__Example__ - - async.series([ - function(callback){ - // do some stuff ... - callback(null, 'one'); - }, - function(callback){ - // do some more stuff ... - callback(null, 'two'); - }, - ], - // optional callback - function(err, results){ - // results is now equal to ['one', 'two'] - }); - - - // an example using an object instead of an array - async.series({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - }, - }, - function(err, results) { - // results is now equal to: {one: 1, two: 2} - }); - - ---------------------------------------- - - -### parallel(tasks, [callback]) - -Run an array of functions in parallel, without waiting until the previous -function has completed. If any of the functions pass an error to its -callback, the main callback is immediately called with the value of the error. -Once the tasks have completed, the results are passed to the final callback as an -array. - -It is also possible to use an object instead of an array. Each property will be -run as a function and the results will be passed to the final callback as an object -instead of an array. This can be a more readable way of handling results from -async.parallel. - - -__Arguments__ - -* tasks - An array or object containing functions to run, each function is passed a - callback it must call on completion. -* callback(err, results) - An optional callback to run once all the functions - have completed. This function gets an array of all the arguments passed to - the callbacks used in the array. - -__Example__ - - async.parallel([ - function(callback){ - setTimeout(function(){ - callback(null, 'one'); - }, 200); - }, - function(callback){ - setTimeout(function(){ - callback(null, 'two'); - }, 100); - }, - ], - // optional callback - function(err, results){ - // in this case, the results array will equal ['two','one'] - // because the functions were run in parallel and the second - // function had a shorter timeout before calling the callback. - }); - - - // an example using an object instead of an array - async.parallel({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - }, - }, - function(err, results) { - // results is now equals to: {one: 1, two: 2} - }); - - ---------------------------------------- - - -### whilst(test, fn, callback) - -Repeatedly call fn, while test returns true. Calls the callback when stopped, -or an error occurs. - -__Arguments__ - -* test() - synchronous truth test to perform before each execution of fn. -* fn(callback) - A function to call each time the test passes. The function is - passed a callback which must be called once it has completed with an optional - error as the first argument. -* callback(err) - A callback which is called after the test fails and repeated - execution of fn has stopped. - -__Example__ - - var count = 0; - - async.whilst( - function () { return count < 5; }, - function (callback) { - count++; - setTimeout(callback, 1000); - }, - function (err) { - // 5 seconds have passed - } - ); - - ---------------------------------------- - - -### until(test, fn, callback) - -Repeatedly call fn, until test returns true. Calls the callback when stopped, -or an error occurs. - -The inverse of async.whilst. - - ---------------------------------------- - - -### waterfall(tasks, [callback]) - -Runs an array of functions in series, each passing their results to the next in -the array. However, if any of the functions pass an error to the callback, the -next function is not executed and the main callback is immediately called with -the error. - -__Arguments__ - -* tasks - An array of functions to run, each function is passed a callback it - must call on completion. -* callback(err, [results]) - An optional callback to run once all the functions - have completed. This will be passed the results of the last task's callback. - - - -__Example__ - - async.waterfall([ - function(callback){ - callback(null, 'one', 'two'); - }, - function(arg1, arg2, callback){ - callback(null, 'three'); - }, - function(arg1, callback){ - // arg1 now equals 'three' - callback(null, 'done'); - } - ], function (err, result) { - // result now equals 'done' - }); - - ---------------------------------------- - - -### queue(worker, concurrency) - -Creates a queue object with the specified concurrency. Tasks added to the -queue will be processed in parallel (up to the concurrency limit). If all -workers are in progress, the task is queued until one is available. Once -a worker has completed a task, the task's callback is called. - -__Arguments__ - -* worker(task, callback) - An asynchronous function for processing a queued - task. -* concurrency - An integer for determining how many worker functions should be - run in parallel. - -__Queue objects__ - -The queue object returned by this function has the following properties and -methods: - -* length() - a function returning the number of items waiting to be processed. -* concurrency - an integer for determining how many worker functions should be - run in parallel. This property can be changed after a queue is created to - alter the concurrency on-the-fly. -* push(task, [callback]) - add a new task to the queue, the callback is called - once the worker has finished processing the task. - instead of a single task, an array of tasks can be submitted. the respective callback is used for every task in the list. -* saturated - a callback that is called when the queue length hits the concurrency and further tasks will be queued -* empty - a callback that is called when the last item from the queue is given to a worker -* drain - a callback that is called when the last item from the queue has returned from the worker - -__Example__ - - // create a queue object with concurrency 2 - - var q = async.queue(function (task, callback) { - console.log('hello ' + task.name); - callback(); - }, 2); - - - // assign a callback - q.drain = function() { - console.log('all items have been processed'); - } - - // add some items to the queue - - q.push({name: 'foo'}, function (err) { - console.log('finished processing foo'); - }); - q.push({name: 'bar'}, function (err) { - console.log('finished processing bar'); - }); - - // add some items to the queue (batch-wise) - - q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) { - console.log('finished processing bar'); - }); - - ---------------------------------------- - - -### auto(tasks, [callback]) - -Determines the best order for running functions based on their requirements. -Each function can optionally depend on other functions being completed first, -and each function is run as soon as its requirements are satisfied. If any of -the functions pass an error to their callback, that function will not complete -(so any other functions depending on it will not run) and the main callback -will be called immediately with the error. Functions also receive an object -containing the results of functions which have completed so far. - -__Arguments__ - -* tasks - An object literal containing named functions or an array of - requirements, with the function itself the last item in the array. The key - used for each function or array is used when specifying requirements. The - syntax is easier to understand by looking at the example. -* callback(err, results) - An optional callback which is called when all the - tasks have been completed. The callback will receive an error as an argument - if any tasks pass an error to their callback. If all tasks complete - successfully, it will receive an object containing their results. - -__Example__ - - async.auto({ - get_data: function(callback){ - // async code to get some data - }, - make_folder: function(callback){ - // async code to create a directory to store a file in - // this is run at the same time as getting the data - }, - write_file: ['get_data', 'make_folder', function(callback){ - // once there is some data and the directory exists, - // write the data to a file in the directory - callback(null, filename); - }], - email_link: ['write_file', function(callback, results){ - // once the file is written let's email a link to it... - // results.write_file contains the filename returned by write_file. - }] - }); - -This is a fairly trivial example, but to do this using the basic parallel and -series functions would look like this: - - async.parallel([ - function(callback){ - // async code to get some data - }, - function(callback){ - // async code to create a directory to store a file in - // this is run at the same time as getting the data - } - ], - function(results){ - async.series([ - function(callback){ - // once there is some data and the directory exists, - // write the data to a file in the directory - }, - email_link: function(callback){ - // once the file is written let's email a link to it... - } - ]); - }); - -For a complicated series of async tasks using the auto function makes adding -new tasks much easier and makes the code more readable. - - ---------------------------------------- - - -### iterator(tasks) - -Creates an iterator function which calls the next function in the array, -returning a continuation to call the next one after that. Its also possible to -'peek' the next iterator by doing iterator.next(). - -This function is used internally by the async module but can be useful when -you want to manually control the flow of functions in series. - -__Arguments__ - -* tasks - An array of functions to run, each function is passed a callback it - must call on completion. - -__Example__ - - var iterator = async.iterator([ - function(){ sys.p('one'); }, - function(){ sys.p('two'); }, - function(){ sys.p('three'); } - ]); - - node> var iterator2 = iterator(); - 'one' - node> var iterator3 = iterator2(); - 'two' - node> iterator3(); - 'three' - node> var nextfn = iterator2.next(); - node> nextfn(); - 'three' - - ---------------------------------------- - - -### apply(function, arguments..) - -Creates a continuation function with some arguments already applied, a useful -shorthand when combined with other control flow functions. Any arguments -passed to the returned function are added to the arguments originally passed -to apply. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to automatically apply when the - continuation is called. - -__Example__ - - // using apply - - async.parallel([ - async.apply(fs.writeFile, 'testfile1', 'test1'), - async.apply(fs.writeFile, 'testfile2', 'test2'), - ]); - - - // the same process without using apply - - async.parallel([ - function(callback){ - fs.writeFile('testfile1', 'test1', callback); - }, - function(callback){ - fs.writeFile('testfile2', 'test2', callback); - }, - ]); - -It's possible to pass any number of additional arguments when calling the -continuation: - - node> var fn = async.apply(sys.puts, 'one'); - node> fn('two', 'three'); - one - two - three - ---------------------------------------- - - -### nextTick(callback) - -Calls the callback on a later loop around the event loop. In node.js this just -calls process.nextTick, in the browser it falls back to setTimeout(callback, 0), -which means other higher priority events may precede the execution of the callback. - -This is used internally for browser-compatibility purposes. - -__Arguments__ - -* callback - The function to call on a later loop around the event loop. - -__Example__ - - var call_order = []; - async.nextTick(function(){ - call_order.push('two'); - // call_order now equals ['one','two] - }); - call_order.push('one') - - -## Utils - - -### memoize(fn, [hasher]) - -Caches the results of an async function. When creating a hash to store function -results against, the callback is omitted from the hash and an optional hash -function can be used. - -__Arguments__ - -* fn - the function you to proxy and cache results from. -* hasher - an optional function for generating a custom hash for storing - results, it has all the arguments applied to it apart from the callback, and - must be synchronous. - -__Example__ - - var slow_fn = function (name, callback) { - // do something - callback(null, result); - }; - var fn = async.memoize(slow_fn); - - // fn can now be used as if it were slow_fn - fn('some name', function () { - // callback - }); - - -### unmemoize(fn) - -Undoes a memoized function, reverting it to the original, unmemoized -form. Comes handy in tests. - -__Arguments__ - -* fn - the memoized function - - -### log(function, arguments) - -Logs the result of an async function to the console. Only works in node.js or -in browsers that support console.log and console.error (such as FF and Chrome). -If multiple arguments are returned from the async function, console.log is -called on each argument in order. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to apply to the function. - -__Example__ - - var hello = function(name, callback){ - setTimeout(function(){ - callback(null, 'hello ' + name); - }, 1000); - }; - - node> async.log(hello, 'world'); - 'hello world' - - ---------------------------------------- - - -### dir(function, arguments) - -Logs the result of an async function to the console using console.dir to -display the properties of the resulting object. Only works in node.js or -in browsers that support console.dir and console.error (such as FF and Chrome). -If multiple arguments are returned from the async function, console.dir is -called on each argument in order. - -__Arguments__ - -* function - The function you want to eventually apply all arguments to. -* arguments... - Any number of arguments to apply to the function. - -__Example__ - - var hello = function(name, callback){ - setTimeout(function(){ - callback(null, {hello: name}); - }, 1000); - }; - - node> async.dir(hello, 'world'); - {hello: 'world'} - - ---------------------------------------- - - -### noConflict() - -Changes the value of async back to its original value, returning a reference to the -async object. diff --git a/node_modules/winston/node_modules/async/index.js b/node_modules/winston/node_modules/async/index.js deleted file mode 100644 index 8e23845..0000000 --- a/node_modules/winston/node_modules/async/index.js +++ /dev/null @@ -1,3 +0,0 @@ -// This file is just added for convenience so this repository can be -// directly checked out into a project's deps folder -module.exports = require('./lib/async'); diff --git a/node_modules/winston/node_modules/async/lib/async.js b/node_modules/winston/node_modules/async/lib/async.js deleted file mode 100644 index 52276d6..0000000 --- a/node_modules/winston/node_modules/async/lib/async.js +++ /dev/null @@ -1,692 +0,0 @@ -/*global setTimeout: false, console: false */ -(function () { - - var async = {}; - - // global on the server, window in the browser - var root = this, - previous_async = root.async; - - if (typeof module !== 'undefined' && module.exports) { - module.exports = async; - } - else { - root.async = async; - } - - async.noConflict = function () { - root.async = previous_async; - return async; - }; - - //// cross-browser compatiblity functions //// - - var _forEach = function (arr, iterator) { - if (arr.forEach) { - return arr.forEach(iterator); - } - for (var i = 0; i < arr.length; i += 1) { - iterator(arr[i], i, arr); - } - }; - - var _map = function (arr, iterator) { - if (arr.map) { - return arr.map(iterator); - } - var results = []; - _forEach(arr, function (x, i, a) { - results.push(iterator(x, i, a)); - }); - return results; - }; - - var _reduce = function (arr, iterator, memo) { - if (arr.reduce) { - return arr.reduce(iterator, memo); - } - _forEach(arr, function (x, i, a) { - memo = iterator(memo, x, i, a); - }); - return memo; - }; - - var _keys = function (obj) { - if (Object.keys) { - return Object.keys(obj); - } - var keys = []; - for (var k in obj) { - if (obj.hasOwnProperty(k)) { - keys.push(k); - } - } - return keys; - }; - - //// exported async module functions //// - - //// nextTick implementation with browser-compatible fallback //// - if (typeof process === 'undefined' || !(process.nextTick)) { - async.nextTick = function (fn) { - setTimeout(fn, 0); - }; - } - else { - async.nextTick = process.nextTick; - } - - async.forEach = function (arr, iterator, callback) { - callback = callback || function () {}; - if (!arr.length) { - return callback(); - } - var completed = 0; - _forEach(arr, function (x) { - iterator(x, function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - if (completed === arr.length) { - callback(); - } - } - }); - }); - }; - - async.forEachSeries = function (arr, iterator, callback) { - callback = callback || function () {}; - if (!arr.length) { - return callback(); - } - var completed = 0; - var iterate = function () { - iterator(arr[completed], function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - if (completed === arr.length) { - callback(); - } - else { - iterate(); - } - } - }); - }; - iterate(); - }; - - async.forEachLimit = function (arr, limit, iterator, callback) { - callback = callback || function () {}; - if (!arr.length || limit <= 0) { - return callback(); - } - var completed = 0; - var started = 0; - var running = 0; - - (function replenish () { - if (completed === arr.length) { - return callback(); - } - - while (running < limit && started < arr.length) { - iterator(arr[started], function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - running -= 1; - if (completed === arr.length) { - callback(); - } - else { - replenish(); - } - } - }); - started += 1; - running += 1; - } - })(); - }; - - - var doParallel = function (fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [async.forEach].concat(args)); - }; - }; - var doSeries = function (fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [async.forEachSeries].concat(args)); - }; - }; - - - var _asyncMap = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (err, v) { - results[x.index] = v; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - }; - async.map = doParallel(_asyncMap); - async.mapSeries = doSeries(_asyncMap); - - - // reduce only has a series version, as doing reduce in parallel won't - // work in many situations. - async.reduce = function (arr, memo, iterator, callback) { - async.forEachSeries(arr, function (x, callback) { - iterator(memo, x, function (err, v) { - memo = v; - callback(err); - }); - }, function (err) { - callback(err, memo); - }); - }; - // inject alias - async.inject = async.reduce; - // foldl alias - async.foldl = async.reduce; - - async.reduceRight = function (arr, memo, iterator, callback) { - var reversed = _map(arr, function (x) { - return x; - }).reverse(); - async.reduce(reversed, memo, iterator, callback); - }; - // foldr alias - async.foldr = async.reduceRight; - - var _filter = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (v) { - if (v) { - results.push(x); - } - callback(); - }); - }, function (err) { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - }; - async.filter = doParallel(_filter); - async.filterSeries = doSeries(_filter); - // select alias - async.select = async.filter; - async.selectSeries = async.filterSeries; - - var _reject = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (v) { - if (!v) { - results.push(x); - } - callback(); - }); - }, function (err) { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - }; - async.reject = doParallel(_reject); - async.rejectSeries = doSeries(_reject); - - var _detect = function (eachfn, arr, iterator, main_callback) { - eachfn(arr, function (x, callback) { - iterator(x, function (result) { - if (result) { - main_callback(x); - main_callback = function () {}; - } - else { - callback(); - } - }); - }, function (err) { - main_callback(); - }); - }; - async.detect = doParallel(_detect); - async.detectSeries = doSeries(_detect); - - async.some = function (arr, iterator, main_callback) { - async.forEach(arr, function (x, callback) { - iterator(x, function (v) { - if (v) { - main_callback(true); - main_callback = function () {}; - } - callback(); - }); - }, function (err) { - main_callback(false); - }); - }; - // any alias - async.any = async.some; - - async.every = function (arr, iterator, main_callback) { - async.forEach(arr, function (x, callback) { - iterator(x, function (v) { - if (!v) { - main_callback(false); - main_callback = function () {}; - } - callback(); - }); - }, function (err) { - main_callback(true); - }); - }; - // all alias - async.all = async.every; - - async.sortBy = function (arr, iterator, callback) { - async.map(arr, function (x, callback) { - iterator(x, function (err, criteria) { - if (err) { - callback(err); - } - else { - callback(null, {value: x, criteria: criteria}); - } - }); - }, function (err, results) { - if (err) { - return callback(err); - } - else { - var fn = function (left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - }; - callback(null, _map(results.sort(fn), function (x) { - return x.value; - })); - } - }); - }; - - async.auto = function (tasks, callback) { - callback = callback || function () {}; - var keys = _keys(tasks); - if (!keys.length) { - return callback(null); - } - - var results = {}; - - var listeners = []; - var addListener = function (fn) { - listeners.unshift(fn); - }; - var removeListener = function (fn) { - for (var i = 0; i < listeners.length; i += 1) { - if (listeners[i] === fn) { - listeners.splice(i, 1); - return; - } - } - }; - var taskComplete = function () { - _forEach(listeners.slice(0), function (fn) { - fn(); - }); - }; - - addListener(function () { - if (_keys(results).length === keys.length) { - callback(null, results); - callback = function () {}; - } - }); - - _forEach(keys, function (k) { - var task = (tasks[k] instanceof Function) ? [tasks[k]]: tasks[k]; - var taskCallback = function (err) { - if (err) { - callback(err); - // stop subsequent errors hitting callback multiple times - callback = function () {}; - } - else { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - taskComplete(); - } - }; - var requires = task.slice(0, Math.abs(task.length - 1)) || []; - var ready = function () { - return _reduce(requires, function (a, x) { - return (a && results.hasOwnProperty(x)); - }, true); - }; - if (ready()) { - task[task.length - 1](taskCallback, results); - } - else { - var listener = function () { - if (ready()) { - removeListener(listener); - task[task.length - 1](taskCallback, results); - } - }; - addListener(listener); - } - }); - }; - - async.waterfall = function (tasks, callback) { - callback = callback || function () {}; - if (!tasks.length) { - return callback(); - } - var wrapIterator = function (iterator) { - return function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - var args = Array.prototype.slice.call(arguments, 1); - var next = iterator.next(); - if (next) { - args.push(wrapIterator(next)); - } - else { - args.push(callback); - } - async.nextTick(function () { - iterator.apply(null, args); - }); - } - }; - }; - wrapIterator(async.iterator(tasks))(); - }; - - async.parallel = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - async.map(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args); - }); - } - }, callback); - } - else { - var results = {}; - async.forEach(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.series = function (tasks, callback) { - callback = callback || function () {}; - if (tasks.constructor === Array) { - async.mapSeries(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args); - }); - } - }, callback); - } - else { - var results = {}; - async.forEachSeries(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.iterator = function (tasks) { - var makeCallback = function (index) { - var fn = function () { - if (tasks.length) { - tasks[index].apply(null, arguments); - } - return fn.next(); - }; - fn.next = function () { - return (index < tasks.length - 1) ? makeCallback(index + 1): null; - }; - return fn; - }; - return makeCallback(0); - }; - - async.apply = function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - return function () { - return fn.apply( - null, args.concat(Array.prototype.slice.call(arguments)) - ); - }; - }; - - var _concat = function (eachfn, arr, fn, callback) { - var r = []; - eachfn(arr, function (x, cb) { - fn(x, function (err, y) { - r = r.concat(y || []); - cb(err); - }); - }, function (err) { - callback(err, r); - }); - }; - async.concat = doParallel(_concat); - async.concatSeries = doSeries(_concat); - - async.whilst = function (test, iterator, callback) { - if (test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.whilst(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.until = function (test, iterator, callback) { - if (!test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.until(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.queue = function (worker, concurrency) { - var workers = 0; - var q = { - tasks: [], - concurrency: concurrency, - saturated: null, - empty: null, - drain: null, - push: function (data, callback) { - if(data.constructor !== Array) { - data = [data]; - } - _forEach(data, function(task) { - q.tasks.push({ - data: task, - callback: typeof callback === 'function' ? callback : null - }); - if (q.saturated && q.tasks.length == concurrency) { - q.saturated(); - } - async.nextTick(q.process); - }); - }, - process: function () { - if (workers < q.concurrency && q.tasks.length) { - var task = q.tasks.shift(); - if(q.empty && q.tasks.length == 0) q.empty(); - workers += 1; - worker(task.data, function () { - workers -= 1; - if (task.callback) { - task.callback.apply(task, arguments); - } - if(q.drain && q.tasks.length + workers == 0) q.drain(); - q.process(); - }); - } - }, - length: function () { - return q.tasks.length; - }, - running: function () { - return workers; - } - }; - return q; - }; - - var _console_fn = function (name) { - return function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - fn.apply(null, args.concat([function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (typeof console !== 'undefined') { - if (err) { - if (console.error) { - console.error(err); - } - } - else if (console[name]) { - _forEach(args, function (x) { - console[name](x); - }); - } - } - }])); - }; - }; - async.log = _console_fn('log'); - async.dir = _console_fn('dir'); - /*async.info = _console_fn('info'); - async.warn = _console_fn('warn'); - async.error = _console_fn('error');*/ - - async.memoize = function (fn, hasher) { - var memo = {}; - var queues = {}; - hasher = hasher || function (x) { - return x; - }; - var memoized = function () { - var args = Array.prototype.slice.call(arguments); - var callback = args.pop(); - var key = hasher.apply(null, args); - if (key in memo) { - callback.apply(null, memo[key]); - } - else if (key in queues) { - queues[key].push(callback); - } - else { - queues[key] = [callback]; - fn.apply(null, args.concat([function () { - memo[key] = arguments; - var q = queues[key]; - delete queues[key]; - for (var i = 0, l = q.length; i < l; i++) { - q[i].apply(null, arguments); - } - }])); - } - }; - memoized.unmemoized = fn; - return memoized; - }; - - async.unmemoize = function (fn) { - return function () { - return (fn.unmemoized || fn).apply(null, arguments); - } - }; - -}()); diff --git a/node_modules/winston/node_modules/async/package.json b/node_modules/winston/node_modules/async/package.json deleted file mode 100644 index 7c21115..0000000 --- a/node_modules/winston/node_modules/async/package.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "name": "async", - "description": "Higher-order functions and common patterns for asynchronous code", - "main": "./index", - "author": { - "name": "Caolan McMahon" - }, - "version": "0.1.18", - "repository": { - "type": "git", - "url": "git://github.com/caolan/async.git" - }, - "bugs": { - "url": "http://github.com/caolan/async/issues" - }, - "licenses": [ - { - "type": "MIT", - "url": "http://github.com/caolan/async/raw/master/LICENSE" - } - ], - "devDependencies": { - "nodeunit": ">0.0.0", - "uglify-js": "1.2.x", - "nodelint": ">0.0.0" - }, - "_id": "async@0.1.18", - "dependencies": {}, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "dist": { - "shasum": "829cc0a073302c965c81484c291caee05d49ca3a" - }, - "_from": "async@0.1.x" -} diff --git a/node_modules/winston/node_modules/colors/MIT-LICENSE.txt b/node_modules/winston/node_modules/colors/MIT-LICENSE.txt deleted file mode 100644 index 7dca107..0000000 --- a/node_modules/winston/node_modules/colors/MIT-LICENSE.txt +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2010 - -Marak Squires -Alexis Sellier (cloudhead) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/winston/node_modules/colors/ReadMe.md b/node_modules/winston/node_modules/colors/ReadMe.md deleted file mode 100644 index 1c6b0d0..0000000 --- a/node_modules/winston/node_modules/colors/ReadMe.md +++ /dev/null @@ -1,77 +0,0 @@ -# colors.js - get color and style in your node.js console ( and browser ) like what - - - - -## Installation - - npm install colors - -## colors and styles! - -- bold -- italic -- underline -- inverse -- yellow -- cyan -- white -- magenta -- green -- red -- grey -- blue -- rainbow -- zebra -- random - -## Usage - -``` js -var colors = require('./colors'); - -console.log('hello'.green); // outputs green text -console.log('i like cake and pies'.underline.red) // outputs red underlined text -console.log('inverse the color'.inverse); // inverses the color -console.log('OMG Rainbows!'.rainbow); // rainbow (ignores spaces) -``` - -# Creating Custom themes - -```js - -var require('colors'); - -colors.setTheme({ - silly: 'rainbow', - input: 'grey', - verbose: 'cyan', - prompt: 'grey', - info: 'green', - data: 'grey', - help: 'cyan', - warn: 'yellow', - debug: 'blue', - error: 'red' -}); - -// outputs red text -console.log("this is an error".error); - -// outputs yellow text -console.log("this is a warning".warn); -``` - - -### Contributors - -Marak (Marak Squires) -Alexis Sellier (cloudhead) -mmalecki (Maciej Małecki) -nicoreed (Nico Reed) -morganrallen (Morgan Allen) -JustinCampbell (Justin Campbell) -ded (Dustin Diaz) - - -#### , Marak Squires , Justin Campbell, Dustin Diaz (@ded) diff --git a/node_modules/winston/node_modules/colors/colors.js b/node_modules/winston/node_modules/colors/colors.js deleted file mode 100644 index a7198f1..0000000 --- a/node_modules/winston/node_modules/colors/colors.js +++ /dev/null @@ -1,269 +0,0 @@ -/* -colors.js - -Copyright (c) 2010 - -Marak Squires -Alexis Sellier (cloudhead) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - -*/ - -var isHeadless = false; - -if (typeof module !== 'undefined') { - isHeadless = true; -} - -if (!isHeadless) { - var exports = {}; - var module = {}; - var colors = exports; - exports.mode = "browser"; -} else { - exports.mode = "console"; -} - -// -// Prototypes the string object to have additional method calls that add terminal colors -// -var addProperty = function (color, func) { - var allowOverride = ['bold']; - exports[color] = function(str) { - return func.apply(str); - }; - String.prototype.__defineGetter__(color, func); -} - -// -// Iterate through all default styles and colors -// - -var x = ['bold', 'underline', 'italic', 'inverse', 'grey', 'black', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta']; -x.forEach(function (style) { - - // __defineGetter__ at the least works in more browsers - // http://robertnyman.com/javascript/javascript-getters-setters.html - // Object.defineProperty only works in Chrome - addProperty(style, function () { - return stylize(this, style); - }); -}); - -function sequencer(map) { - return function () { - if (!isHeadless) { - return this.replace(/( )/, '$1'); - } - var exploded = this.split(""); - var i = 0; - exploded = exploded.map(map); - return exploded.join(""); - } -} - -var rainbowMap = (function () { - var rainbowColors = ['red','yellow','green','blue','magenta']; //RoY G BiV - return function (letter, i, exploded) { - if (letter == " ") { - return letter; - } else { - return stylize(letter, rainbowColors[i++ % rainbowColors.length]); - } - } -})(); - -exports.addSequencer = function (name, map) { - addProperty(name, sequencer(map)); -} - -exports.addSequencer('rainbow', rainbowMap); -exports.addSequencer('zebra', function (letter, i, exploded) { - return i % 2 === 0 ? letter : letter.inverse; -}); - -exports.setTheme = function (theme) { - Object.keys(theme).forEach(function(prop){ - addProperty(prop, function(){ - return exports[theme[prop]](this); - }); - }); -} - -function stylize(str, style) { - - if (exports.mode == 'console') { - var styles = { - //styles - 'bold' : ['\033[1m', '\033[22m'], - 'italic' : ['\033[3m', '\033[23m'], - 'underline' : ['\033[4m', '\033[24m'], - 'inverse' : ['\033[7m', '\033[27m'], - //grayscale - 'white' : ['\033[37m', '\033[39m'], - 'grey' : ['\033[90m', '\033[39m'], - 'black' : ['\033[30m', '\033[39m'], - //colors - 'blue' : ['\033[34m', '\033[39m'], - 'cyan' : ['\033[36m', '\033[39m'], - 'green' : ['\033[32m', '\033[39m'], - 'magenta' : ['\033[35m', '\033[39m'], - 'red' : ['\033[31m', '\033[39m'], - 'yellow' : ['\033[33m', '\033[39m'] - }; - } else if (exports.mode == 'browser') { - var styles = { - //styles - 'bold' : ['', ''], - 'italic' : ['', ''], - 'underline' : ['', ''], - 'inverse' : ['', ''], - //grayscale - 'white' : ['', ''], - 'grey' : ['', ''], - 'black' : ['', ''], - //colors - 'blue' : ['', ''], - 'cyan' : ['', ''], - 'green' : ['', ''], - 'magenta' : ['', ''], - 'red' : ['', ''], - 'yellow' : ['', ''] - }; - } else if (exports.mode == 'none') { - return str; - } else { - console.log('unsupported mode, try "browser", "console" or "none"'); - } - return styles[style][0] + str + styles[style][1]; -}; - -// don't summon zalgo -addProperty('zalgo', function () { - return zalgo(this); -}); - -// please no -function zalgo(text, options) { - var soul = { - "up" : [ - '̍','̎','̄','̅', - '̿','̑','̆','̐', - '͒','͗','͑','̇', - '̈','̊','͂','̓', - '̈','͊','͋','͌', - '̃','̂','̌','͐', - '̀','́','̋','̏', - '̒','̓','̔','̽', - '̉','ͣ','ͤ','ͥ', - 'ͦ','ͧ','ͨ','ͩ', - 'ͪ','ͫ','ͬ','ͭ', - 'ͮ','ͯ','̾','͛', - '͆','̚' - ], - "down" : [ - '̖','̗','̘','̙', - '̜','̝','̞','̟', - '̠','̤','̥','̦', - '̩','̪','̫','̬', - '̭','̮','̯','̰', - '̱','̲','̳','̹', - '̺','̻','̼','ͅ', - '͇','͈','͉','͍', - '͎','͓','͔','͕', - '͖','͙','͚','̣' - ], - "mid" : [ - '̕','̛','̀','́', - '͘','̡','̢','̧', - '̨','̴','̵','̶', - '͜','͝','͞', - '͟','͠','͢','̸', - '̷','͡',' ҉' - ] - }, - all = [].concat(soul.up, soul.down, soul.mid), - zalgo = {}; - - function randomNumber(range) { - r = Math.floor(Math.random()*range); - return r; - }; - - function is_char(character) { - var bool = false; - all.filter(function(i){ - bool = (i == character); - }); - return bool; - } - - function heComes(text, options){ - result = ''; - options = options || {}; - options["up"] = options["up"] || true; - options["mid"] = options["mid"] || true; - options["down"] = options["down"] || true; - options["size"] = options["size"] || "maxi"; - var counts; - text = text.split(''); - for(var l in text){ - if(is_char(l)) { continue; } - result = result + text[l]; - - counts = {"up" : 0, "down" : 0, "mid" : 0}; - - switch(options.size) { - case 'mini': - counts.up = randomNumber(8); - counts.min= randomNumber(2); - counts.down = randomNumber(8); - break; - case 'maxi': - counts.up = randomNumber(16) + 3; - counts.min = randomNumber(4) + 1; - counts.down = randomNumber(64) + 3; - break; - default: - counts.up = randomNumber(8) + 1; - counts.mid = randomNumber(6) / 2; - counts.down= randomNumber(8) + 1; - break; - } - - var arr = ["up", "mid", "down"]; - for(var d in arr){ - var index = arr[d]; - for (var i = 0 ; i <= counts[index]; i++) - { - if(options[index]) { - result = result + soul[index][randomNumber(soul[index].length)]; - } - } - } - } - return result; - }; - return heComes(text); -} - -addProperty('stripColors', function() { - return ("" + this).replace(/\u001b\[\d+m/g,''); -}); diff --git a/node_modules/winston/node_modules/colors/example.html b/node_modules/winston/node_modules/colors/example.html deleted file mode 100644 index ab95649..0000000 --- a/node_modules/winston/node_modules/colors/example.html +++ /dev/null @@ -1,74 +0,0 @@ - - - - - Colors Example - - - - - - \ No newline at end of file diff --git a/node_modules/winston/node_modules/colors/example.js b/node_modules/winston/node_modules/colors/example.js deleted file mode 100644 index 3da2986..0000000 --- a/node_modules/winston/node_modules/colors/example.js +++ /dev/null @@ -1,65 +0,0 @@ -var colors = require('./colors'); - -//colors.mode = "browser"; - -var test = colors.red("hopefully colorless output"); -console.log('Rainbows are fun!'.rainbow); -console.log('So '.italic + 'are'.underline + ' styles! '.bold + 'inverse'.inverse); // styles not widely supported -console.log('Chains are also cool.'.bold.italic.underline.red); // styles not widely supported -//console.log('zalgo time!'.zalgo); -console.log(test.stripColors); -console.log("a".grey + " b".black); - -console.log("Zebras are so fun!".zebra); - -console.log(colors.rainbow('Rainbows are fun!')); -console.log(colors.italic('So ') + colors.underline('are') + colors.bold(' styles! ') + colors.inverse('inverse')); // styles not widely supported -console.log(colors.bold(colors.italic(colors.underline(colors.red('Chains are also cool.'))))); // styles not widely supported -//console.log(colors.zalgo('zalgo time!')); -console.log(colors.stripColors(test)); -console.log(colors.grey("a") + colors.black(" b")); - -colors.addSequencer("america", function(letter, i, exploded) { - if(letter === " ") return letter; - switch(i%3) { - case 0: return letter.red; - case 1: return letter.white; - case 2: return letter.blue; - } -}); - -colors.addSequencer("random", (function() { - var available = ['bold', 'underline', 'italic', 'inverse', 'grey', 'yellow', 'red', 'green', 'blue', 'white', 'cyan', 'magenta']; - - return function(letter, i, exploded) { - return letter === " " ? letter : letter[available[Math.round(Math.random() * (available.length - 1))]]; - }; -})()); - -console.log("AMERICA! F--K YEAH!".america); -console.log("So apparently I've been to Mars, with all the little green men. But you know, I don't recall.".random); - -// -// Custom themes -// - -colors.setTheme({ - silly: 'rainbow', - input: 'grey', - verbose: 'cyan', - prompt: 'grey', - info: 'green', - data: 'grey', - help: 'cyan', - warn: 'yellow', - debug: 'blue', - error: 'red' -}); - -// outputs red text -console.log("this is an error".error); - -// outputs yellow text -console.log("this is a warning".warn); - - diff --git a/node_modules/winston/node_modules/colors/package.json b/node_modules/winston/node_modules/colors/package.json deleted file mode 100644 index 0658342..0000000 --- a/node_modules/winston/node_modules/colors/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "colors", - "description": "get colors in your node.js console like what", - "version": "0.6.0-1", - "author": { - "name": "Marak Squires" - }, - "repository": { - "type": "git", - "url": "git://github.com/Marak/colors.js.git" - }, - "engines": { - "node": ">=0.1.90" - }, - "main": "colors", - "_id": "colors@0.6.0-1", - "dependencies": {}, - "devDependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "dist": { - "shasum": "90eed55eb9b8d279846013bfc762fc487ffbd818" - }, - "_from": "colors@0.x.x" -} diff --git a/node_modules/winston/node_modules/colors/test.js b/node_modules/winston/node_modules/colors/test.js deleted file mode 100644 index 1c03d65..0000000 --- a/node_modules/winston/node_modules/colors/test.js +++ /dev/null @@ -1,65 +0,0 @@ -var assert = require('assert'), - colors = require('./colors'); - -// -// This is a pretty nice example on how tests shouldn't be written. However, -// it's more about API stability than about really testing it (although it's -// a pretty complete test suite). -// - -var s = 'string'; - -function a(s, code) { - return '\033[' + code.toString() + 'm' + s + '\033[39m'; -} - -function aE(s, color, code) { - assert.equal(s[color], a(s, code)); - assert.equal(colors[color](s), a(s, code)); - assert.equal(s[color], colors[color](s)); - assert.equal(s[color].stripColors, s); - assert.equal(s[color].stripColors, colors.stripColors(s)); -} - -function h(s, color) { - return '' + s + ''; - // that's pretty dumb approach to testing it -} - -var stylesColors = ['white', 'grey', 'black', 'blue', 'cyan', 'green', 'magenta', 'red', 'yellow']; -var stylesAll = stylesColors.concat(['bold', 'italic', 'underline', 'inverse', 'rainbow']); - -colors.mode = 'console'; -assert.equal(s.bold, '\033[1m' + s + '\033[22m'); -assert.equal(s.italic, '\033[3m' + s + '\033[23m'); -assert.equal(s.underline, '\033[4m' + s + '\033[24m'); -assert.equal(s.inverse, '\033[7m' + s + '\033[27m'); -assert.ok(s.rainbow); -aE(s, 'white', 37); -aE(s, 'grey', 90); -aE(s, 'black', 30); -aE(s, 'blue', 34); -aE(s, 'cyan', 36); -aE(s, 'green', 32); -aE(s, 'magenta', 35); -aE(s, 'red', 31); -aE(s, 'yellow', 33); -assert.equal(s, 'string'); - -colors.mode = 'browser'; -assert.equal(s.bold, '' + s + ''); -assert.equal(s.italic, '' + s + ''); -assert.equal(s.underline, '' + s + ''); -assert.equal(s.inverse, '' + s + ''); -assert.ok(s.rainbow); -stylesColors.forEach(function (color) { - assert.equal(s[color], h(s, color)); - assert.equal(colors[color](s), h(s, color)); -}); - -colors.mode = 'none'; -stylesAll.forEach(function (style) { - assert.equal(s[style], s); - assert.equal(colors[style](s), s); -}); - diff --git a/node_modules/winston/node_modules/eyes/LICENSE b/node_modules/winston/node_modules/eyes/LICENSE deleted file mode 100644 index a1edd93..0000000 --- a/node_modules/winston/node_modules/eyes/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (c) 2009 cloudhead - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/node_modules/winston/node_modules/eyes/Makefile b/node_modules/winston/node_modules/eyes/Makefile deleted file mode 100644 index a121dea..0000000 --- a/node_modules/winston/node_modules/eyes/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -test: - @@node test/eyes-test.js - -.PHONY: test diff --git a/node_modules/winston/node_modules/eyes/README.md b/node_modules/winston/node_modules/eyes/README.md deleted file mode 100644 index 7a92158..0000000 --- a/node_modules/winston/node_modules/eyes/README.md +++ /dev/null @@ -1,72 +0,0 @@ -eyes -==== - -a customizable value inspector for Node.js - -synopsis --------- - -I was tired of looking at cluttered output in the console -- something needed to be done, -`sys.inspect()` didn't display regexps correctly, and was too verbose, and I had an hour or two to spare. -So I decided to have some fun. _eyes_ were born. - -![eyes-ss](http://dl.dropbox.com/u/251849/eyes-js-ss.gif) - -_example of the output of a user-customized eyes.js inspector_ - -*eyes* also deals with circular objects in an intelligent way, and can pretty-print object literals. - -usage ------ - - var inspect = require('eyes').inspector({styles: {all: 'magenta'}}); - - inspect(something); // inspect with the settings passed to `inspector` - -or - - var eyes = require('eyes'); - - eyes.inspect(something); // inspect with the default settings - -you can pass a _label_ to `inspect()`, to keep track of your inspections: - - eyes.inspect(something, "a random value"); - -If you want to return the output of eyes without printing it, you can set it up this way: - - var inspect = require('eyes').inspector({ stream: null }); - - sys.puts(inspect({ something: 42 })); - -customization -------------- - -These are the default styles and settings used by _eyes_. - styles: { // Styles applied to stdout - all: 'cyan', // Overall style applied to everything - label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]` - other: 'inverted', // Objects which don't have a literal representation, such as functions - key: 'bold', // The keys in object literals, like 'a' in `{a: 1}` - - special: 'grey', // null, undefined... - string: 'green', - number: 'magenta', - bool: 'blue', // true false - regexp: 'green', // /\d+/ - }, - pretty: true, // Indent object literals - hideFunctions: false, // Don't output functions at all - stream: process.stdout, // Stream to write to, or null - maxLength: 2048 // Truncate output if longer - -You can overwrite them with your own, by passing a similar object to `inspector()` or `inspect()`. - - var inspect = require('eyes').inspector({ - styles: { - all: 'magenta', - special: 'bold' - }, - maxLength: 512 - }); - diff --git a/node_modules/winston/node_modules/eyes/lib/eyes.js b/node_modules/winston/node_modules/eyes/lib/eyes.js deleted file mode 100644 index 10d964b..0000000 --- a/node_modules/winston/node_modules/eyes/lib/eyes.js +++ /dev/null @@ -1,236 +0,0 @@ -// -// Eyes.js - a customizable value inspector for Node.js -// -// usage: -// -// var inspect = require('eyes').inspector({styles: {all: 'magenta'}}); -// inspect(something); // inspect with the settings passed to `inspector` -// -// or -// -// var eyes = require('eyes'); -// eyes.inspect(something); // inspect with the default settings -// -var eyes = exports, - stack = []; - -eyes.defaults = { - styles: { // Styles applied to stdout - all: 'cyan', // Overall style applied to everything - label: 'underline', // Inspection labels, like 'array' in `array: [1, 2, 3]` - other: 'inverted', // Objects which don't have a literal representation, such as functions - key: 'bold', // The keys in object literals, like 'a' in `{a: 1}` - special: 'grey', // null, undefined... - string: 'green', - number: 'magenta', - bool: 'blue', // true false - regexp: 'green', // /\d+/ - }, - pretty: true, // Indent object literals - hideFunctions: false, - showHidden: false, - stream: process.stdout, - maxLength: 2048 // Truncate output if longer -}; - -// Return a curried inspect() function, with the `options` argument filled in. -eyes.inspector = function (options) { - var that = this; - return function (obj, label, opts) { - return that.inspect.call(that, obj, label, - merge(options || {}, opts || {})); - }; -}; - -// If we have a `stream` defined, use it to print a styled string, -// if not, we just return the stringified object. -eyes.inspect = function (obj, label, options) { - options = merge(this.defaults, options || {}); - - if (options.stream) { - return this.print(stringify(obj, options), label, options); - } else { - return stringify(obj, options) + (options.styles ? '\033[39m' : ''); - } -}; - -// Output using the 'stream', and an optional label -// Loop through `str`, and truncate it after `options.maxLength` has been reached. -// Because escape sequences are, at this point embeded within -// the output string, we can't measure the length of the string -// in a useful way, without separating what is an escape sequence, -// versus a printable character (`c`). So we resort to counting the -// length manually. -eyes.print = function (str, label, options) { - for (var c = 0, i = 0; i < str.length; i++) { - if (str.charAt(i) === '\033') { i += 4 } // `4` because '\033[25m'.length + 1 == 5 - else if (c === options.maxLength) { - str = str.slice(0, i - 1) + '…'; - break; - } else { c++ } - } - return options.stream.write.call(options.stream, (label ? - this.stylize(label, options.styles.label, options.styles) + ': ' : '') + - this.stylize(str, options.styles.all, options.styles) + '\033[0m' + "\n"); -}; - -// Apply a style to a string, eventually, -// I'd like this to support passing multiple -// styles. -eyes.stylize = function (str, style, styles) { - var codes = { - 'bold' : [1, 22], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'cyan' : [36, 39], - 'magenta' : [35, 39], - 'blue' : [34, 39], - 'yellow' : [33, 39], - 'green' : [32, 39], - 'red' : [31, 39], - 'grey' : [90, 39] - }, endCode; - - if (style && codes[style]) { - endCode = (codes[style][1] === 39 && styles.all) ? codes[styles.all][0] - : codes[style][1]; - return '\033[' + codes[style][0] + 'm' + str + - '\033[' + endCode + 'm'; - } else { return str } -}; - -// Convert any object to a string, ready for output. -// When an 'array' or an 'object' are encountered, they are -// passed to specialized functions, which can then recursively call -// stringify(). -function stringify(obj, options) { - var that = this, stylize = function (str, style) { - return eyes.stylize(str, options.styles[style], options.styles) - }, index, result; - - if ((index = stack.indexOf(obj)) !== -1) { - return stylize(new(Array)(stack.length - index + 1).join('.'), 'special'); - } - stack.push(obj); - - result = (function (obj) { - switch (typeOf(obj)) { - case "string" : obj = stringifyString(obj.indexOf("'") === -1 ? "'" + obj + "'" - : '"' + obj + '"'); - return stylize(obj, 'string'); - case "regexp" : return stylize('/' + obj.source + '/', 'regexp'); - case "number" : return stylize(obj + '', 'number'); - case "function" : return options.stream ? stylize("Function", 'other') : '[Function]'; - case "null" : return stylize("null", 'special'); - case "undefined": return stylize("undefined", 'special'); - case "boolean" : return stylize(obj + '', 'bool'); - case "date" : return stylize(obj.toUTCString()); - case "array" : return stringifyArray(obj, options, stack.length); - case "object" : return stringifyObject(obj, options, stack.length); - } - })(obj); - - stack.pop(); - return result; -}; - -// Escape invisible characters in a string -function stringifyString (str, options) { - return str.replace(/\\/g, '\\\\') - .replace(/\n/g, '\\n') - .replace(/[\u0001-\u001F]/g, function (match) { - return '\\0' + match[0].charCodeAt(0).toString(8); - }); -} - -// Convert an array to a string, such as [1, 2, 3]. -// This function calls stringify() for each of the elements -// in the array. -function stringifyArray(ary, options, level) { - var out = []; - var pretty = options.pretty && (ary.length > 4 || ary.some(function (o) { - return (o !== null && typeof(o) === 'object' && Object.keys(o).length > 0) || - (Array.isArray(o) && o.length > 0); - })); - var ws = pretty ? '\n' + new(Array)(level * 4 + 1).join(' ') : ' '; - - for (var i = 0; i < ary.length; i++) { - out.push(stringify(ary[i], options)); - } - - if (out.length === 0) { - return '[]'; - } else { - return '[' + ws - + out.join(',' + (pretty ? ws : ' ')) - + (pretty ? ws.slice(0, -4) : ws) + - ']'; - } -}; - -// Convert an object to a string, such as {a: 1}. -// This function calls stringify() for each of its values, -// and does not output functions or prototype values. -function stringifyObject(obj, options, level) { - var out = []; - var pretty = options.pretty && (Object.keys(obj).length > 2 || - Object.keys(obj).some(function (k) { return typeof(obj[k]) === 'object' })); - var ws = pretty ? '\n' + new(Array)(level * 4 + 1).join(' ') : ' '; - - var keys = options.showHidden ? Object.keys(obj) : Object.getOwnPropertyNames(obj); - keys.forEach(function (k) { - if (Object.prototype.hasOwnProperty.call(obj, k) - && !(obj[k] instanceof Function && options.hideFunctions)) { - out.push(eyes.stylize(k, options.styles.key, options.styles) + ': ' + - stringify(obj[k], options)); - } - }); - - if (out.length === 0) { - return '{}'; - } else { - return "{" + ws - + out.join(',' + (pretty ? ws : ' ')) - + (pretty ? ws.slice(0, -4) : ws) + - "}"; - } -}; - -// A better `typeof` -function typeOf(value) { - var s = typeof(value), - types = [Object, Array, String, RegExp, Number, Function, Boolean, Date]; - - if (s === 'object' || s === 'function') { - if (value) { - types.forEach(function (t) { - if (value instanceof t) { s = t.name.toLowerCase() } - }); - } else { s = 'null' } - } - return s; -} - -function merge(/* variable args */) { - var objs = Array.prototype.slice.call(arguments); - var target = {}; - - objs.forEach(function (o) { - Object.keys(o).forEach(function (k) { - if (k === 'styles') { - if (! o.styles) { - target.styles = false; - } else { - target.styles = {} - for (var s in o.styles) { - target.styles[s] = o.styles[s]; - } - } - } else { - target[k] = o[k]; - } - }); - }); - return target; -} - diff --git a/node_modules/winston/node_modules/eyes/package.json b/node_modules/winston/node_modules/eyes/package.json deleted file mode 100644 index 2a0ce6b..0000000 --- a/node_modules/winston/node_modules/eyes/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "eyes", - "description": "a customizable value inspector", - "url": "http://github.com/cloudhead/eyes.js", - "keywords": [ - "inspector", - "debug", - "inspect", - "print" - ], - "author": { - "name": "Alexis Sellier", - "email": "self@cloudhead.net" - }, - "contributors": [ - { - "name": "Charlie Robbins", - "email": "charlie@nodejitsu.com" - } - ], - "licenses": [ - "MIT" - ], - "dependencies": {}, - "main": "./lib/eyes", - "version": "0.1.7", - "scripts": { - "test": "node test/*-test.js" - }, - "directories": { - "lib": "./lib", - "test": "./test" - }, - "engines": { - "node": "> 0.1.90" - }, - "_id": "eyes@0.1.7", - "devDependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "dist": { - "shasum": "fba341d9612c08bcc02bfcdd27433da0f45269d8" - }, - "_from": "eyes@0.1.x" -} diff --git a/node_modules/winston/node_modules/eyes/test/eyes-test.js b/node_modules/winston/node_modules/eyes/test/eyes-test.js deleted file mode 100644 index 1f9606a..0000000 --- a/node_modules/winston/node_modules/eyes/test/eyes-test.js +++ /dev/null @@ -1,56 +0,0 @@ -var util = require('util'); -var eyes = require('../lib/eyes'); - -eyes.inspect({ - number: 42, - string: "John Galt", - regexp: /[a-z]+/, - array: [99, 168, 'x', {}], - func: function () {}, - bool: false, - nil: null, - undef: undefined, - object: {attr: []} -}, "native types"); - -eyes.inspect({ - number: new(Number)(42), - string: new(String)("John Galt"), - regexp: new(RegExp)(/[a-z]+/), - array: new(Array)(99, 168, 'x', {}), - bool: new(Boolean)(false), - object: new(Object)({attr: []}), - date: new(Date) -}, "wrapped types"); - -var obj = {}; -obj.that = { self: obj }; -obj.self = obj; - -eyes.inspect(obj, "circular object"); -eyes.inspect({hello: 'moto'}, "small object"); -eyes.inspect({hello: new(Array)(6) }, "big object"); -eyes.inspect(["hello 'world'", 'hello "world"'], "quotes"); -eyes.inspect({ - recommendations: [{ - id: 'a7a6576c2c822c8e2bd81a27e41437d8', - key: [ 'spree', 3.764316258020699 ], - value: { - _id: 'a7a6576c2c822c8e2bd81a27e41437d8', - _rev: '1-2e2d2f7fd858c4a5984bcf809d22ed98', - type: 'domain', - domain: 'spree', - weight: 3.764316258020699, - product_id: 30 - } - }] -}, 'complex'); - -eyes.inspect([null], "null in array"); - -var inspect = eyes.inspector({ stream: null }); - -util.puts(inspect('something', "something")); -util.puts(inspect("something else")); - -util.puts(inspect(["no color"], null, { styles: false })); diff --git a/node_modules/winston/node_modules/loggly/.npmignore b/node_modules/winston/node_modules/loggly/.npmignore deleted file mode 100644 index 8f08029..0000000 --- a/node_modules/winston/node_modules/loggly/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -test/data -test/data/* -node_modules -npm-debug.log \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/README.md b/node_modules/winston/node_modules/loggly/README.md deleted file mode 100644 index 926cb63..0000000 --- a/node_modules/winston/node_modules/loggly/README.md +++ /dev/null @@ -1,227 +0,0 @@ -# node-loggly - -A client implementation for Loggly in node.js - -## Installation - -### Installing npm (node package manager) -``` bash - $ curl http://npmjs.org/install.sh | sh -``` - -### Installing node-loggly -``` bash - $ [sudo] npm install loggly -``` - -## Usage - -The node-loggly library is compliant with the [Loggly API][0]. Using node-loggly is easy for a variety of scenarios: logging, working with devices and inputs, searching, and facet searching. - -### Getting Started -Before we can do anything with Loggly, we have to create a client with valid credentials. We will authenticate for you automatically: - -``` js - var loggly = require('loggly'); - var config = { - subdomain: "your-subdomain", - auth: { - username: "your-username", - password: "your-password" - } - }; - var client = loggly.createClient(config); -``` - -### Logging -There are two ways to send log information to Loggly via node-loggly. The first is to simply call client.log with an appropriate input token: - -``` js - client.log('your-really-long-input-token', '127.0.0.1 - Theres no place like home', function (err, result) { - // Do something once you've logged - }); -``` - -Note that the callback in the above example is optional, if you prefer the 'fire and forget' method of logging: - -``` js - client.log('your-really-long-input-token', '127.0.0.1 - Theres no place like home'); -``` - -The second way to send log information to Loggly is to do so once you've retrieved an input directly from Loggly: - -``` js - client.getInput('your-input-name', function (err, input) { - input.log('127.0.0.1 - Theres no place like home'); - }); -``` - -Again the callback in the above example is optional and you can pass it if you'd like to. - -### Logging Shallow JSON Object Literals as a String -In addition to logging pure strings it is also possible to pass shallow JSON object literals (i.e. no nested objects) to client.log(..) or input.log(..) methods, which will get converted into the [Loggly recommended string representation][1]. So - -``` js - var source = { - foo: 1, - bar: 2, - buzz: 3 - }; - - input.log(source); -``` - -will be logged as: - -``` - foo=1,bar=2,buzz=3 -``` - -### Logging Objects to JSON Enabled Loggly Inputs -It is also possible to log complex objects using the new JSON capabilities of Loggly. To enable JSON functionality in the client simply add 'json: true' to the configuration: - -``` js - var config = { - subdomain: "your-subdomain", - auth: { - username: "your-username", - password: "your-password" - }, - json: true - }; -``` - -When the json flag is enabled, objects will be converted to JSON using JSON.stringify before being transmitted to Loggly. So - -``` js - var source = { - foo: 1, - bar: 2, - buzz: { - sheep: 'jumped', - times: 10 - } - }; - - input.log(source); -``` - -will be logged as: - -``` json - { "foo": 1, "bar": 2, "buzz": {"sheep": "jumped", "times": 10 }} -``` - -### Searching -[Searching][3] with node-loggly is easy. All you have to do is use the search() method defined on each Loggly client: - -``` js - var util = require('util'); - - client.search('404', function (err, results) { - // Inspect the result set - util.inspect(results.data); - }); -``` - -The search() exposes a chainable interface that allows you to set additional search parameters such as: ip, input name, rows, start, end, etc. - -``` js - var util = require('util'); - - client.search('404') - .meta({ ip: '127.0.0.1', inputname: test }) - .context({ rows: 10 }) - .run(function (err, results) { - // Inspect the result set - util.inspect(results.data); - }); -``` - -The context of the search (set using the `.context()` method) represents additional parameters in the Loggly API besides the search query itself. See the [Search API documentation][9] for a list of all options. - -Metadata set using the `.meta()` method is data that is set in the query parameter of your Loggly search, but `:` delimited. For more information about search queries in Loggly, check out the [Search Language Guide][4] on the [Loggly Wiki][5]. - -### Facet Searching -Loggly also exposes searches that can return counts of events over a time range. These are called [facets][6]. The valid facets are 'ip', 'date', and 'input'. Performing a facet search is very similar to a normal search: - -``` js - var util = require('util'); - - client.facet('ip', '404') - .context({ buckets: 10 }) - .run(function (err, results) { - // Inspect the result set - util.inspect(results.data); - }); -``` - -The chaining and options for the facet method(s) are the same as the search method above. - -### Working with Devices and Inputs -Loggly exposes several entities that are available through node-loggly: inputs and devices. For more information about these terms, checkout the [Loggly Jargon][7] on the wiki. There are several methods available in node-loggly to work with these entities: - -``` js - // - // Returns all inputs associated with your account - // - client.getInputs(function (err, inputs) { /* ... */ }); - - // - // Returns an input with the specified name - // - client.getInput('input-name', function (err, input) { /* ... */ }); - - // - // Returns all devices associated with your account - // - client.getDevices(function (err, devices) { /* ... */ }); -``` - -## Run Tests -All of the node-loggly tests are written in [vows][8], and cover all of the use cases described above. You will need to add your Loggly username, password, subdomain, and a two test inputs to test/data/test-config.json before running tests. When configuring the test inputs on Loggly, the first test input should be named 'test' using the HTTP service. The second input should be name 'test_json' using the HTTP service with the JSON logging option enabled: - -``` js - { - "subdomain": "your-subdomain", - "auth": { - "username": "your-username", - "password": "your-password" - }, - "inputs": { - "test": { - // - // Token and ID of your plain-text input. - // - "token": "your-really-long-token-you-got-when-you-created-an-http-input", - "id": 000 - }, - "test_json": { - // - // Token and ID of your JSON input. - // - "token": "your-really-long-token-you-got-when-you-created-an-http-input", - "id": 001 - }, - } - } -``` - -Once you have valid Loggly credentials you can run tests with [vows][8]: - -``` bash - $ npm test -``` - -#### Author: [Charlie Robbins](http://www.github.com/indexzero) -#### Contributors: [Marak Squires](http://github.com/marak), [hij1nx](http://github.com/hij1nx), [Kord Campbell](http://loggly.com), [Erik Hedenström](http://github.com/ehedenst), - -[0]: http://wiki.loggly.com/apidocumentation -[1]: http://wiki.loggly.com/loggingfromcode -[3]: http://wiki.loggly.com/retrieve_events#search_uri -[4]: http://wiki.loggly.com/searchguide -[5]: http://wiki.loggly.com/ -[6]: http://wiki.loggly.com/retrieve_events#facet_uris -[7]: http://wiki.loggly.com/loggingjargon -[8]: http://vowsjs.org -[9]: http://wiki.loggly.com/retrieve_events#optional diff --git a/node_modules/winston/node_modules/loggly/docs/docco.css b/node_modules/winston/node_modules/loggly/docs/docco.css deleted file mode 100644 index bd54134..0000000 --- a/node_modules/winston/node_modules/loggly/docs/docco.css +++ /dev/null @@ -1,194 +0,0 @@ -/*--------------------- Layout and Typography ----------------------------*/ -body { - font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; - font-size: 15px; - line-height: 22px; - color: #252519; - margin: 0; padding: 0; -} -a { - color: #261a3b; -} - a:visited { - color: #261a3b; - } -p { - margin: 0 0 15px 0; -} -h4, h5, h6 { - color: #333; - margin: 6px 0 6px 0; - font-size: 13px; -} - h2, h3 { - margin-bottom: 0; - color: #000; - } - h1 { - margin-top: 40px; - margin-bottom: 15px; - color: #000; - } -#container { - position: relative; -} -#background { - position: fixed; - top: 0; left: 525px; right: 0; bottom: 0; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - z-index: -1; -} -#jump_to, #jump_page { - background: white; - -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; - -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; - font: 10px Arial; - text-transform: uppercase; - cursor: pointer; - text-align: right; -} -#jump_to, #jump_wrapper { - position: fixed; - right: 0; top: 0; - padding: 5px 10px; -} - #jump_wrapper { - padding: 0; - display: none; - } - #jump_to:hover #jump_wrapper { - display: block; - } - #jump_page { - padding: 5px 0 3px; - margin: 0 0 25px 25px; - } - #jump_page .source { - display: block; - padding: 5px 10px; - text-decoration: none; - border-top: 1px solid #eee; - } - #jump_page .source:hover { - background: #f5f5ff; - } - #jump_page .source:first-child { - } -table td { - border: 0; - outline: 0; -} - td.docs, th.docs { - max-width: 450px; - min-width: 450px; - min-height: 5px; - padding: 10px 25px 1px 50px; - overflow-x: hidden; - vertical-align: top; - text-align: left; - } - .docs pre { - margin: 15px 0 15px; - padding-left: 15px; - } - .docs p tt, .docs p code { - background: #f8f8ff; - border: 1px solid #dedede; - font-size: 12px; - padding: 0 0.2em; - } - .pilwrap { - position: relative; - } - .pilcrow { - font: 12px Arial; - text-decoration: none; - color: #454545; - position: absolute; - top: 3px; left: -20px; - padding: 1px 2px; - opacity: 0; - -webkit-transition: opacity 0.2s linear; - } - td.docs:hover .pilcrow { - opacity: 1; - } - td.code, th.code { - padding: 14px 15px 16px 25px; - width: 100%; - vertical-align: top; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - } - pre, tt, code { - font-size: 12px; line-height: 18px; - font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; - margin: 0; padding: 0; - } - - -/*---------------------- Syntax Highlighting -----------------------------*/ -td.linenos { background-color: #f0f0f0; padding-right: 10px; } -span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } -body .hll { background-color: #ffffcc } -body .c { color: #408080; font-style: italic } /* Comment */ -body .err { border: 1px solid #FF0000 } /* Error */ -body .k { color: #954121 } /* Keyword */ -body .o { color: #666666 } /* Operator */ -body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ -body .cp { color: #BC7A00 } /* Comment.Preproc */ -body .c1 { color: #408080; font-style: italic } /* Comment.Single */ -body .cs { color: #408080; font-style: italic } /* Comment.Special */ -body .gd { color: #A00000 } /* Generic.Deleted */ -body .ge { font-style: italic } /* Generic.Emph */ -body .gr { color: #FF0000 } /* Generic.Error */ -body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -body .gi { color: #00A000 } /* Generic.Inserted */ -body .go { color: #808080 } /* Generic.Output */ -body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -body .gs { font-weight: bold } /* Generic.Strong */ -body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -body .gt { color: #0040D0 } /* Generic.Traceback */ -body .kc { color: #954121 } /* Keyword.Constant */ -body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ -body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ -body .kp { color: #954121 } /* Keyword.Pseudo */ -body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ -body .kt { color: #B00040 } /* Keyword.Type */ -body .m { color: #666666 } /* Literal.Number */ -body .s { color: #219161 } /* Literal.String */ -body .na { color: #7D9029 } /* Name.Attribute */ -body .nb { color: #954121 } /* Name.Builtin */ -body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ -body .no { color: #880000 } /* Name.Constant */ -body .nd { color: #AA22FF } /* Name.Decorator */ -body .ni { color: #999999; font-weight: bold } /* Name.Entity */ -body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -body .nf { color: #0000FF } /* Name.Function */ -body .nl { color: #A0A000 } /* Name.Label */ -body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -body .nt { color: #954121; font-weight: bold } /* Name.Tag */ -body .nv { color: #19469D } /* Name.Variable */ -body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -body .w { color: #bbbbbb } /* Text.Whitespace */ -body .mf { color: #666666 } /* Literal.Number.Float */ -body .mh { color: #666666 } /* Literal.Number.Hex */ -body .mi { color: #666666 } /* Literal.Number.Integer */ -body .mo { color: #666666 } /* Literal.Number.Oct */ -body .sb { color: #219161 } /* Literal.String.Backtick */ -body .sc { color: #219161 } /* Literal.String.Char */ -body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ -body .s2 { color: #219161 } /* Literal.String.Double */ -body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -body .sh { color: #219161 } /* Literal.String.Heredoc */ -body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -body .sx { color: #954121 } /* Literal.String.Other */ -body .sr { color: #BB6688 } /* Literal.String.Regex */ -body .s1 { color: #219161 } /* Literal.String.Single */ -body .ss { color: #19469D } /* Literal.String.Symbol */ -body .bp { color: #954121 } /* Name.Builtin.Pseudo */ -body .vc { color: #19469D } /* Name.Variable.Class */ -body .vg { color: #19469D } /* Name.Variable.Global */ -body .vi { color: #19469D } /* Name.Variable.Instance */ -body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/docs/loggly.html b/node_modules/winston/node_modules/loggly/docs/loggly.html deleted file mode 100644 index 7afcf68..0000000 --- a/node_modules/winston/node_modules/loggly/docs/loggly.html +++ /dev/null @@ -1,16 +0,0 @@ - loggly.js

        loggly.js

        /*
        - * loggly.js: Wrapper for node-loggly object
        - *
        - * (C) 2010 Nodejitsu Inc.
        - * MIT LICENSE
        - *
        - */
        -
        -var loggly = exports;

        Export node-loggly core client APIs

        loggly.createClient  = require('./loggly/core').createClient;
        -loggly.Loggly        = require('./loggly/core').Loggly;
        -loggly.Config        = require('./loggly/config').Config;

        Export Resources for node-loggly

        loggly.Input  = require('./loggly/input').Input;
        -loggly.Facet  = require('./loggly/facet').Facet;
        -loggly.Device = require('./loggly/device').Device;
        -loggly.Search = require('./loggly/search').Search;
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/docs/loggly/common.html b/node_modules/winston/node_modules/loggly/docs/loggly/common.html deleted file mode 100644 index 94336be..0000000 --- a/node_modules/winston/node_modules/loggly/docs/loggly/common.html +++ /dev/null @@ -1,126 +0,0 @@ - common.js

        common.js

        /*
        - * common.js: Common utility functions for requesting against Loggly APIs
        - *
        - * (C) 2010 Nodejitsu Inc.
        - * MIT LICENSE
        - *
        - */
        -
        -var request = require('request'),
        -    loggly = require('../loggly');
        -
        -var common = exports;

        Failure HTTP Response codes based -off Loggly specification.

        var failCodes = common.failCodes = {
        -  400: "Bad Request",
        -  401: "Unauthorized",
        -  403: "Forbidden",
        -  404: "Not Found",
        -  409: "Conflict / Duplicate",
        -  410: "Gone",
        -  500: "Internal Server Error",
        -  501: "Not Implemented",
        -  503: "Throttled"
        -};

        Success HTTP Response codes based -off Loggly specification.

        var successCodes = common.successCodes = {
        -  200: "OK",
        -  201: "Created", 
        -  202: "Accepted",
        -  203: "Non-authoritative information",
        -  204: "Deleted",
        -};

        Core method that actually sends requests to Loggly. -This method is designed to be flexible w.r.t. arguments -and continuation passing given the wide range of different -requests required to fully implement the Loggly API.

        - -

        Continuations: - 1. 'callback': The callback passed into every node-loggly method - 2. 'success': A callback that will only be called on successful requests. - This is used throughout node-loggly to conditionally - do post-request processing such as JSON parsing.

        - -

        Possible Arguments (1 & 2 are equivalent): - 1. common.loggly('some-fully-qualified-url', auth, callback, success) - 2. common.loggly('GET', 'some-fully-qualified-url', auth, callback, success) - 3. common.loggly('DELETE', 'some-fully-qualified-url', auth, callback, success) - 4. common.loggly({ method: 'POST', uri: 'some-url', body: { some: 'body'} }, callback, success)

        common.loggly = function () {
        -  var args = Array.prototype.slice.call(arguments),
        -      success = args.pop(),
        -      callback = args.pop(),
        -      requestBody, 
        -      headers,
        -      method, 
        -      auth, 
        -      uri;
        -  

        Now that we've popped off the two callbacks -We can make decisions about other arguments

          if (args.length == 1) {
        -    if (typeof args[0] === 'string') {

        If we got a string assume that it's the URI

              method = 'GET';
        -      uri    = args[0];
        -    }
        -    else {
        -      method      = args[0]['method'] || 'GET',
        -      uri         = args[0]['uri'];
        -      requestBody = args[0]['body'];
        -      auth        = args[0]['auth'];
        -      headers     = args[0]['headers'];
        -    }
        -  }
        -  else if (args.length == 2) {
        -    method = 'GET';
        -    uri    = args[0];
        -    auth   = args[1];
        -  }
        -  else {
        -    method = args[0];
        -    uri    = args[1];
        -    auth   = args[2];
        -  }
        -  
        -  function onError (err) {
        -    if (callback) {
        -      callback(err);
        -    }
        -  }
        -  
        -  var requestOptions = {
        -    uri: uri,
        -    method: method,
        -    headers: headers || {}
        -  };
        -  
        -  if (auth) {
        -    requestOptions.headers['authorization'] = 'Basic ' + new Buffer(auth.username + ':' + auth.password).toString('base64');
        -  }
        -  
        -  if (requestBody) {
        -    requestOptions.body = requestBody;
        -  }
        -  
        -  try {
        -    request(requestOptions, function (err, res, body) {
        -      if (err) {
        -        return onError(err);
        -      }
        -
        -      var statusCode = res.statusCode.toString();
        -      if (Object.keys(failCodes).indexOf(statusCode) !== -1) {
        -        return onError((new Error('Loggly Error (' + statusCode + '): ' + failCodes[statusCode])));
        -      }
        -
        -      success(res, body);
        -    });
        -  }
        -  catch (ex) {
        -    onError(ex);
        -  }
        -};

        function clone (obj) - Helper method for deep cloning pure JSON objects - i.e. JSON objects that are either literals or objects (no Arrays, etc)

        common.clone = function (obj) {
        -  var clone = {};
        -  for (var i in obj) {
        -    clone[i] = obj[i] instanceof Object ? common.clone(obj[i]) : obj[i];
        -  }
        -
        -  return clone;
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/docs/loggly/config.html b/node_modules/winston/node_modules/loggly/docs/loggly/config.html deleted file mode 100644 index 0f39f4a..0000000 --- a/node_modules/winston/node_modules/loggly/docs/loggly/config.html +++ /dev/null @@ -1,41 +0,0 @@ - config.js

        config.js

        /*
        - * config.js: Configuration information for your Loggly account.
        - *            This information is only used for require('loggly')./\.+/ methods
        - *
        - * (C) 2010 Nodejitsu Inc.
        - * MIT LICENSE
        - *
        - */

        function createConfig (defaults) - Creates a new instance of the configuration - object based on default values

        exports.createConfig = function (defaults) {
        -  return new Config(defaults);
        -};

        Config (defaults) - Constructor for the Config object

        var Config = exports.Config = function (defaults) {
        -  if (!defaults.subdomain) {
        -    throw new Error('Subdomain is required to create an instance of Config');
        -  }
        -  
        -  this.subdomain = defaults.subdomain;
        -  this.json = defaults.json || null;
        -  this.auth = defaults.auth || null;
        -};
        - 
        -Config.prototype = {
        -  get subdomain () {
        -   return this._subdomain; 
        -  },
        -
        -  set subdomain (value) {
        -    this._subdomain = value;
        -  },
        -  
        -  get logglyUrl () {
        -    return 'https://' + [this._subdomain, 'loggly', 'com'].join('.') + '/api';
        -  },
        -  
        -  get inputUrl () {
        -    return 'https://logs.loggly.com/inputs/';
        -  }
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/docs/loggly/core.html b/node_modules/winston/node_modules/loggly/docs/loggly/core.html deleted file mode 100644 index 7d1a4bf..0000000 --- a/node_modules/winston/node_modules/loggly/docs/loggly/core.html +++ /dev/null @@ -1,150 +0,0 @@ - core.js

        core.js

        /*
        - * core.js: Core functions for accessing Loggly
        - *
        - * (C) 2010 Nodejitsu Inc.
        - * MIT LICENSE
        - *
        - */
        -
        -var events = require('events'),
        -    qs = require('querystring'),
        -    config = require('./config'),
        -    common = require('./common'),
        -    Search = require('./search').Search,
        -    Facet = require('./facet').Facet,
        -    loggly = require('../loggly');

        function createClient (options) - Creates a new instance of a Loggly client.

        exports.createClient = function (options) {
        -  return new Loggly(config.createConfig(options));
        -};

        Loggly (config) - Constructor for the Loggly object

        var Loggly = exports.Loggly = function (config) {
        -  this.config = config;
        -};

        function log (callback) - logs args to input device

        Loggly.prototype.log = function (inputId, msg, callback) {
        -  var emitter = new (events.EventEmitter)(),
        -      message;
        -      
        -  if (msg instanceof Object) {
        -    message = this.config.json ? JSON.stringify(msg) : qs.unescape(qs.stringify(msg, ','));
        -  } else {
        -    message = this.config.json ? JSON.stringify({ message : msg }) : msg;
        -  }
        -
        -  var logOptions = {
        -    uri: this.config.inputUrl + inputId,
        -    method: 'POST', 
        -    body: message,
        -    headers: {
        -      'Content-Type': this.config.json ? 'application/json' : 'text/plain'
        -    }
        -  };
        -
        -  common.loggly(logOptions, callback, function (res, body) {
        -    try {
        -      var result = JSON.parse(body);
        -      if (callback) {
        -        callback(null, result);
        -      }
        -      
        -      emitter.emit('log', result);
        -    }
        -    catch (ex) {
        -      if (callback) {
        -        callback(new Error('Unspecified error from Loggly: ' + ex));
        -      }
        -    }
        -  }); 
        -  
        -  return emitter; 
        -};

        function search (query, callback) - Returns a new search object which can be chained - with options or called directly if @callback is passed - initially.

        - -

        Sample Usage:

        - -

        client.search('404') - .meta({ ip: '127.0.0.1' }) - .context({ rows: 100 }) - .run(function () { /* ... */ });

        Loggly.prototype.search = function (query, callback) {
        -  return new Search(query, this, callback);
        -};

        function facet (facet, query, [options], callback) - Performs a facet search against loggly with the - specified facet, query and options.

        Loggly.prototype.facet = function (facet, query, callback) {
        -  return new Facet(facet, query, this, callback);
        -};

        function getInputs ([raw], callback) - Returns a list of all inputs for the authenicated account

        Loggly.prototype.getInputs = function () {
        -  var self = this,
        -      args = Array.prototype.slice.call(arguments),
        -      callback = args.pop(),
        -      raw = args.length > 0 ? args[0] : false;
        -  
        -  common.loggly(this.logglyUrl('inputs'), this.config.auth, callback, function (res, body) {
        -    var inputs = [], 
        -        results = JSON.parse(body);
        -        
        -    if (!raw) {
        -      results.forEach(function (result) {
        -        inputs.push(new (loggly.Input)(self, result));
        -      });
        -      
        -      return callback(null, inputs);
        -    }
        -    
        -    callback(null, results);
        -  });
        -};

        function getInput (name, callback) - Returns the input with the specified name

        Loggly.prototype.getInput = function (name, callback) {
        -  var self = this;
        -  this.getInputs(true, function (err, results) {
        -    if (err) {
        -      return callback(err);
        -    }
        -    
        -    var matches = results.filter(function (r) { return r.name === name }),
        -        input = null;
        -        
        -    if (matches.length > 0) {
        -      input = new (loggly.Input)(self, matches[0]);
        -    }
        -    
        -    callback(null, input);
        -  });
        -};

        function addDevice (inputId, address, callback) - Adds the device at address to the input specified by inputId

        Loggly.prototype.addDeviceToInput = function (inputId, address, callback) {
        -  var addOptions = {
        -    uri: this.logglyUrl('devices'),
        -    auth: this.config.auth,
        -    method: 'POST', 
        -    headers: {
        -      'Content-Type': 'application/x-www-form-urlencoded'
        -    },
        -    body: qs.stringify({ 'input_id': inputId, 'ip': address }).replace('"', '')
        -  };
        -
        -  common.loggly(addOptions, callback, function (res, body) {
        -    callback(null, res);
        -  });
        -};

        function addDevice (inputId, callback) - Adds the calling device to the input

        Loggly.prototype.addDevice = function (inputId, callback) {

        Remark: This is not fully implemented yet

          callback(new Error('Not Implemented Yet...'));
        -  

        common.loggly(this.logglyUrl('inputs', inputId, 'adddevice'), this.config.auth, callback, function (res, body) { -});

        };

        function getDevices (callback) - Returns a list of all devices for the authenicated account

        Loggly.prototype.getDevices = function (callback) {
        -  var self = this;
        -  common.loggly(this.logglyUrl('devices'), this.config.auth, callback, function (res, body) {
        -    var results = JSON.parse(body),
        -        devices = [];
        -        
        -    results.forEach(function (result) {
        -      devices.push(new (loggly.Device)(self, result));
        -    });
        -    
        -    callback(null, devices);
        -  });
        -};

        function logglyUrl ([path, to, resource]) - Helper method that concats the string params into a url - to request against a loggly serverUrl.

        Loggly.prototype.logglyUrl = function (/* path, to, resource */) {
        -  var args = Array.prototype.slice.call(arguments);
        -  return [this.config.logglyUrl].concat(args).join('/');
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/docs/loggly/device.html b/node_modules/winston/node_modules/loggly/docs/loggly/device.html deleted file mode 100644 index 3cc7fc5..0000000 --- a/node_modules/winston/node_modules/loggly/docs/loggly/device.html +++ /dev/null @@ -1,26 +0,0 @@ - device.js

        device.js

        /*
        - * device.js: Instance of a single Loggly device
        - *
        - * (C) 2010 Nodejitsu Inc.
        - * MIT LICENSE
        - *
        - */
        - 
        -var Device = exports.Device = function (client, details) {
        -  if (!details) throw new Error("Device must be constructed with at least basic details.")
        -
        -  this.client = client;
        -  this._setProperties(details);
        -};
        -
        -Device.prototype.addToInput = function (inputId, callback) {
        -  this.client.addDeviceToInput(inputId, this.id, callback);
        -};
        -  

        Sets the properties for this instance -Parameters: details

        Device.prototype._setProperties = function (details) {

        Copy the properties to this instance

          var self = this;
        -  Object.keys(details).forEach(function (key) {
        -    self[key] = details[key];
        -  });
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/docs/loggly/facet.html b/node_modules/winston/node_modules/loggly/docs/loggly/facet.html deleted file mode 100644 index 39fe2b3..0000000 --- a/node_modules/winston/node_modules/loggly/docs/loggly/facet.html +++ /dev/null @@ -1,26 +0,0 @@ - facet.js

        facet.js

        /*
        - * facet.js: Chainable search functions for Loggly facet searches.
        - *
        - * (C) 2010 Nodejitsu Inc.
        - * MIT LICENSE
        - *
        - */
        -
        -var util = require('util'),
        -    Search = require('./search').Search;

        function Facet (facet, query, client, callback) - Chainable facet search object for Loggly API

        var Facet = exports.Facet = function (facet, query, client, callback) {
        -  if (['date', 'ip', 'input'].indexOf(facet) === -1) {
        -    var error = new Error('Cannot search with unknown facet: ' + facet); 
        -    
        -    if (callback) {
        -      return callback(error);
        -    }
        -    else {
        -      throw error;
        -    }
        -  }
        -  

        Set the baseUrl to be facet/:facet?

          this.baseUrl = ['facets', facet + '?'].join('/');
        -  

        Call the base constructor.

          Search.call(this, query, client, callback);
        -};

        Inherit from loggly.Search.

        util.inherits(Facet, Search);
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/docs/loggly/input.html b/node_modules/winston/node_modules/loggly/docs/loggly/input.html deleted file mode 100644 index 22bcac2..0000000 --- a/node_modules/winston/node_modules/loggly/docs/loggly/input.html +++ /dev/null @@ -1,32 +0,0 @@ - input.js

        input.js

        /*
        - * input.js: Instance of a single Loggly input
        - *
        - * (C) 2010 Nodejitsu Inc.
        - * MIT LICENSE
        - *
        - */
        - 
        -var Input = exports.Input = function (client, details) {
        -  if (!details) {
        -    throw new Error("Input must be constructed with at least basic details.");
        -  }
        -  
        -  this.client = client;
        -  this._setProperties(details);
        -};
        -
        -Input.prototype.log = function (msg, callback) {
        -  return this.client.log(this.input_token, msg, callback);
        -};
        -  
        -Input.prototype.addDevice = function (address, callback) {
        -  this.client.addDeviceToInput(this.id, address, callback);
        -};
        -  

        Sets the properties for this instance -Parameters: details

        Input.prototype._setProperties = function (details) {

        Copy the properties to this instance

          var self = this;
        -  Object.keys(details).forEach(function (key) {
        -    self[key] = details[key];
        -  });
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/docs/loggly/search.html b/node_modules/winston/node_modules/loggly/docs/loggly/search.html deleted file mode 100644 index 0a13c0e..0000000 --- a/node_modules/winston/node_modules/loggly/docs/loggly/search.html +++ /dev/null @@ -1,89 +0,0 @@ - search.js

        search.js

        /*
        - * search.js: chainable search functions for Loggly
        - *
        - * (C) 2010 Nodejitsu Inc.
        - * MIT LICENSE
        - *
        - */
        -
        -var qs = require('querystring'),
        -    timespan = require('timespan'),
        -    common = require('./common');

        function Search (query, client, callback) - Chainable search object for Loggly API

        var Search = exports.Search = function (query, client, callback) {
        -  this.query = query;
        -  this.client = client;
        -  
        -  if (!this.baseUrl) {
        -    this.baseUrl = 'search?';
        -  }
        -  

        If we're passed a callback, run immediately.

          if (callback) {
        -    this.callback = callback;
        -    this.run();
        -  }
        -};

        function meta (meta) - Sets the appropriate metadata for this search query: - e.g. ip, inputname

        Search.prototype.meta = function (meta) {
        -  this._meta = meta;
        -  return this;
        -};

        function context (context) - Sets the appropriate context for this search query: - e.g. rows, start, from, until, order, format, fields

        Search.prototype.context = function (context) {
        -  this._context = context;
        -  return this;
        -};

        function run (callback)

        - -

        @callback {function} Continuation to respond to when complete

        - -

        Runs the search query for for this instance with the query, metadata, -context, and other parameters that have been configured on it.

        Search.prototype.run = function (callback) {
        -  var rangeError;
        -  

        Trim the search query

          this.query.trim();
        -  

        Update the callback for this instance if it's passed

          this.callback = callback || this.callback;
        -  if (!this.callback) {
        -    throw new Error('Cannot run search without a callback function.');
        -  }
        -  

        If meta was passed, update the search query appropriately

          if (this._meta) {
        -    this.query += ' ' + qs.unescape(qs.stringify(this._meta, ' ', ':'));
        -  }

        Set the context for the query string

          this._context = this._context || {};
        -  this._context.q = this.query;
        -  this._checkRange();
        -
        -  var self = this, searchOptions = {
        -    uri: this.client.logglyUrl(this.baseUrl + qs.stringify(this._context)),
        -    auth: this.client.config.auth
        -  };
        -  
        -  common.loggly(searchOptions, this.callback, function (res, body) {
        -    self.callback(null, JSON.parse(body));
        -  });
        -  
        -  return this;
        -};

        function _checkRange ()

        - -

        Checks if the range that has been configured for this -instance is valid and updates if it is not.

        Search.prototype._checkRange = function () {
        -  if (!this._context || (!this._context.until && !this._context.from)) {
        -    return;
        -  }
        -  
        -  this._context.until = this._context.until || 'NOW';
        -  this._context.from  = this._context.from  || 'NOW-24HOURS';
        -  
        -  if (!timespan.parseDate(this._context.until)) {
        -    this._context.until = 'NOW';
        -  }
        -  
        -  if (!timespan.parseDate(this._context.from)) {
        -    this._context.from = 'NOW-24HOURS';
        -  }
        -  
        -  if (timespan.fromDates(this._context.from, this._context.until) < 0
        -    || this._context.until === this._context.from) {

        If the length of the timespan for this Search instance is -negative then set it to default values

            this._context.until = 'NOW';
        -    this._context.from = 'NOW-24HOURS';
        -  }
        -  
        -  return this;
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/lib/loggly.js b/node_modules/winston/node_modules/loggly/lib/loggly.js deleted file mode 100644 index e55d2c2..0000000 --- a/node_modules/winston/node_modules/loggly/lib/loggly.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * loggly.js: Wrapper for node-loggly object - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var loggly = exports; - -// -// Export node-loggly core client APIs -// -loggly.createClient = require('./loggly/core').createClient; -loggly.serialize = require('./loggly/common').serialize; -loggly.Loggly = require('./loggly/core').Loggly; -loggly.Config = require('./loggly/config').Config; - -// -// Export Resources for node-loggly -// -loggly.Input = require('./loggly/input').Input; -loggly.Facet = require('./loggly/facet').Facet; -loggly.Device = require('./loggly/device').Device; -loggly.Search = require('./loggly/search').Search; \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/lib/loggly/common.js b/node_modules/winston/node_modules/loggly/lib/loggly/common.js deleted file mode 100644 index dae938e..0000000 --- a/node_modules/winston/node_modules/loggly/lib/loggly/common.js +++ /dev/null @@ -1,204 +0,0 @@ -/* - * common.js: Common utility functions for requesting against Loggly APIs - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var util = require('util'), - request = require('request'), - loggly = require('../loggly'); - -var common = exports; - -// -// Failure HTTP Response codes based -// off Loggly specification. -// -var failCodes = common.failCodes = { - 400: "Bad Request", - 401: "Unauthorized", - 403: "Forbidden", - 404: "Not Found", - 409: "Conflict / Duplicate", - 410: "Gone", - 500: "Internal Server Error", - 501: "Not Implemented", - 503: "Throttled" -}; - -// -// Success HTTP Response codes based -// off Loggly specification. -// -var successCodes = common.successCodes = { - 200: "OK", - 201: "Created", - 202: "Accepted", - 203: "Non-authoritative information", - 204: "Deleted", -}; - -// -// Core method that actually sends requests to Loggly. -// This method is designed to be flexible w.r.t. arguments -// and continuation passing given the wide range of different -// requests required to fully implement the Loggly API. -// -// Continuations: -// 1. 'callback': The callback passed into every node-loggly method -// 2. 'success': A callback that will only be called on successful requests. -// This is used throughout node-loggly to conditionally -// do post-request processing such as JSON parsing. -// -// Possible Arguments (1 & 2 are equivalent): -// 1. common.loggly('some-fully-qualified-url', auth, callback, success) -// 2. common.loggly('GET', 'some-fully-qualified-url', auth, callback, success) -// 3. common.loggly('DELETE', 'some-fully-qualified-url', auth, callback, success) -// 4. common.loggly({ method: 'POST', uri: 'some-url', body: { some: 'body'} }, callback, success) -// -common.loggly = function () { - var args = Array.prototype.slice.call(arguments), - success = args.pop(), - callback = args.pop(), - requestBody, - headers, - method, - auth, - uri; - - // - // Now that we've popped off the two callbacks - // We can make decisions about other arguments - // - if (args.length == 1) { - if (typeof args[0] === 'string') { - // - // If we got a string assume that it's the URI - // - method = 'GET'; - uri = args[0]; - } - else { - method = args[0]['method'] || 'GET', - uri = args[0]['uri']; - requestBody = args[0]['body']; - auth = args[0]['auth']; - headers = args[0]['headers']; - } - } - else if (args.length == 2) { - method = 'GET'; - uri = args[0]; - auth = args[1]; - } - else { - method = args[0]; - uri = args[1]; - auth = args[2]; - } - - function onError (err) { - if (callback) { - callback(err); - } - } - - var requestOptions = { - uri: uri, - method: method, - headers: headers || {} - }; - - if (auth) { - requestOptions.headers['authorization'] = 'Basic ' + new Buffer(auth.username + ':' + auth.password).toString('base64'); - } - - if (requestBody) { - requestOptions.body = requestBody; - } - - try { - request(requestOptions, function (err, res, body) { - if (err) { - return onError(err); - } - - var statusCode = res.statusCode.toString(); - if (Object.keys(failCodes).indexOf(statusCode) !== -1) { - return onError((new Error('Loggly Error (' + statusCode + '): ' + failCodes[statusCode]))); - } - - success(res, body); - }); - } - catch (ex) { - onError(ex); - } -}; - -// -// ### function serialize (obj, key) -// #### @obj {Object|literal} Object to serialize -// #### @key {string} **Optional** Optional key represented by obj in a larger object -// Performs simple comma-separated, `key=value` serialization for Loggly when -// logging to non-JSON inputs. -// -common.serialize = function (obj, key) { - if (obj === null) { - obj = 'null'; - } - else if (obj === undefined) { - obj = 'undefined'; - } - else if (obj === false) { - obj = 'false'; - } - - if (typeof obj !== 'object') { - return key ? key + '=' + obj : obj; - } - - var msg = '', - keys = Object.keys(obj), - length = keys.length; - - for (var i = 0; i < length; i++) { - if (Array.isArray(obj[keys[i]])) { - msg += keys[i] + '=[' - - for (var j = 0, l = obj[keys[i]].length; j < l; j++) { - msg += common.serialize(obj[keys[i]][j]); - if (j < l - 1) { - msg += ', '; - } - } - - msg += ']'; - } - else { - msg += common.serialize(obj[keys[i]], keys[i]); - } - - if (i < length - 1) { - msg += ', '; - } - } - - return msg; -}; - -// -// function clone (obj) -// Helper method for deep cloning pure JSON objects -// i.e. JSON objects that are either literals or objects (no Arrays, etc) -// -common.clone = function (obj) { - var clone = {}; - for (var i in obj) { - clone[i] = obj[i] instanceof Object ? common.clone(obj[i]) : obj[i]; - } - - return clone; -}; \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/lib/loggly/config.js b/node_modules/winston/node_modules/loggly/lib/loggly/config.js deleted file mode 100644 index 2156ceb..0000000 --- a/node_modules/winston/node_modules/loggly/lib/loggly/config.js +++ /dev/null @@ -1,49 +0,0 @@ -/* - * config.js: Configuration information for your Loggly account. - * This information is only used for require('loggly')./\.+/ methods - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -// -// function createConfig (defaults) -// Creates a new instance of the configuration -// object based on default values -// -exports.createConfig = function (defaults) { - return new Config(defaults); -}; - -// -// Config (defaults) -// Constructor for the Config object -// -var Config = exports.Config = function (defaults) { - if (!defaults.subdomain) { - throw new Error('Subdomain is required to create an instance of Config'); - } - - this.subdomain = defaults.subdomain; - this.json = defaults.json || null; - this.auth = defaults.auth || null; -}; - -Config.prototype = { - get subdomain () { - return this._subdomain; - }, - - set subdomain (value) { - this._subdomain = value; - }, - - get logglyUrl () { - return 'https://' + [this._subdomain, 'loggly', 'com'].join('.') + '/api'; - }, - - get inputUrl () { - return 'https://logs.loggly.com/inputs/'; - } -}; diff --git a/node_modules/winston/node_modules/loggly/lib/loggly/core.js b/node_modules/winston/node_modules/loggly/lib/loggly/core.js deleted file mode 100644 index 9be1553..0000000 --- a/node_modules/winston/node_modules/loggly/lib/loggly/core.js +++ /dev/null @@ -1,211 +0,0 @@ -/* - * core.js: Core functions for accessing Loggly - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var events = require('events'), - qs = require('querystring'), - config = require('./config'), - common = require('./common'), - Search = require('./search').Search, - Facet = require('./facet').Facet, - loggly = require('../loggly'); - -// -// function createClient (options) -// Creates a new instance of a Loggly client. -// -exports.createClient = function (options) { - return new Loggly(config.createConfig(options)); -}; - -// -// Loggly (config) -// Constructor for the Loggly object -// -var Loggly = exports.Loggly = function (config) { - this.config = config; -}; - -// -// function log (callback) -// logs args to input device -// -Loggly.prototype.log = function (inputId, msg, callback) { - var emitter = new (events.EventEmitter)(), - message; - - if (msg instanceof Object) { - message = this.config.json ? JSON.stringify(msg) : common.serialize(msg); - } - else { - message = this.config.json ? JSON.stringify({ message : msg }) : msg; - } - - var logOptions = { - uri: this.config.inputUrl + inputId, - method: 'POST', - body: message, - headers: { - 'Content-Type': this.config.json ? 'application/json' : 'text/plain' - } - }; - - common.loggly(logOptions, callback, function (res, body) { - try { - var result = JSON.parse(body); - if (callback) { - callback(null, result); - } - - emitter.emit('log', result); - } - catch (ex) { - if (callback) { - callback(new Error('Unspecified error from Loggly: ' + ex)); - } - } - }); - - return emitter; -}; - -// -// function search (query, callback) -// Returns a new search object which can be chained -// with options or called directly if @callback is passed -// initially. -// -// Sample Usage: -// -// client.search('404') -// .meta({ ip: '127.0.0.1' }) -// .context({ rows: 100 }) -// .run(function () { /* ... */ }); -// -Loggly.prototype.search = function (query, callback) { - return new Search(query, this, callback); -}; - -// -// function facet (facet, query, [options], callback) -// Performs a facet search against loggly with the -// specified facet, query and options. -// -Loggly.prototype.facet = function (facet, query, callback) { - return new Facet(facet, query, this, callback); -}; - - -// -// function getInputs ([raw], callback) -// Returns a list of all inputs for the authenicated account -// -Loggly.prototype.getInputs = function () { - var self = this, - args = Array.prototype.slice.call(arguments), - callback = args.pop(), - raw = args.length > 0 ? args[0] : false; - - common.loggly(this.logglyUrl('inputs'), this.config.auth, callback, function (res, body) { - var inputs = [], - results = JSON.parse(body); - - if (!raw) { - results.forEach(function (result) { - inputs.push(new (loggly.Input)(self, result)); - }); - - return callback(null, inputs); - } - - callback(null, results); - }); -}; - -// -// function getInput (name, callback) -// Returns the input with the specified name -// -Loggly.prototype.getInput = function (name, callback) { - var self = this; - this.getInputs(true, function (err, results) { - if (err) { - return callback(err); - } - - var matches = results.filter(function (r) { return r.name === name }), - input = null; - - if (matches.length > 0) { - input = new (loggly.Input)(self, matches[0]); - } - - callback(null, input); - }); -}; - -// -// function addDevice (inputId, address, callback) -// Adds the device at address to the input specified by inputId -// -Loggly.prototype.addDeviceToInput = function (inputId, address, callback) { - var addOptions = { - uri: this.logglyUrl('devices'), - auth: this.config.auth, - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded' - }, - body: qs.stringify({ 'input_id': inputId, 'ip': address }).replace('"', '') - }; - - common.loggly(addOptions, callback, function (res, body) { - callback(null, res); - }); -}; - -// -// function addDevice (inputId, callback) -// Adds the calling device to the input -// -Loggly.prototype.addDevice = function (inputId, callback) { - // - // Remark: This is not fully implemented yet - // - callback(new Error('Not Implemented Yet...')); - - //common.loggly(this.logglyUrl('inputs', inputId, 'adddevice'), this.config.auth, callback, function (res, body) { - //}); -}; - -// -// function getDevices (callback) -// Returns a list of all devices for the authenicated account -// -Loggly.prototype.getDevices = function (callback) { - var self = this; - common.loggly(this.logglyUrl('devices'), this.config.auth, callback, function (res, body) { - var results = JSON.parse(body), - devices = []; - - results.forEach(function (result) { - devices.push(new (loggly.Device)(self, result)); - }); - - callback(null, devices); - }); -}; - -// -// function logglyUrl ([path, to, resource]) -// Helper method that concats the string params into a url -// to request against a loggly serverUrl. -// -Loggly.prototype.logglyUrl = function (/* path, to, resource */) { - var args = Array.prototype.slice.call(arguments); - return [this.config.logglyUrl].concat(args).join('/'); -}; \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/lib/loggly/device.js b/node_modules/winston/node_modules/loggly/lib/loggly/device.js deleted file mode 100644 index a06d74a..0000000 --- a/node_modules/winston/node_modules/loggly/lib/loggly/device.js +++ /dev/null @@ -1,30 +0,0 @@ -/* - * device.js: Instance of a single Loggly device - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var Device = exports.Device = function (client, details) { - if (!details) throw new Error("Device must be constructed with at least basic details.") - - this.client = client; - this._setProperties(details); -}; - -Device.prototype.addToInput = function (inputId, callback) { - this.client.addDeviceToInput(inputId, this.id, callback); -}; - -// -// Sets the properties for this instance -// Parameters: details -// -Device.prototype._setProperties = function (details) { - // Copy the properties to this instance - var self = this; - Object.keys(details).forEach(function (key) { - self[key] = details[key]; - }); -}; \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/lib/loggly/facet.js b/node_modules/winston/node_modules/loggly/lib/loggly/facet.js deleted file mode 100644 index a17abf9..0000000 --- a/node_modules/winston/node_modules/loggly/lib/loggly/facet.js +++ /dev/null @@ -1,42 +0,0 @@ -/* - * facet.js: Chainable search functions for Loggly facet searches. - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var util = require('util'), - Search = require('./search').Search; - -// -// function Facet (facet, query, client, callback) -// Chainable facet search object for Loggly API -// -var Facet = exports.Facet = function (facet, query, client, callback) { - if (['date', 'ip', 'input'].indexOf(facet) === -1) { - var error = new Error('Cannot search with unknown facet: ' + facet); - - if (callback) { - return callback(error); - } - else { - throw error; - } - } - - // - // Set the baseUrl to be facet/:facet? - // - this.baseUrl = ['facets', facet + '?'].join('/'); - - // - // Call the base constructor. - // - Search.call(this, query, client, callback); -}; - -// -// Inherit from `loggly.Search`. -// -util.inherits(Facet, Search); \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/lib/loggly/input.js b/node_modules/winston/node_modules/loggly/lib/loggly/input.js deleted file mode 100644 index 1e02b85..0000000 --- a/node_modules/winston/node_modules/loggly/lib/loggly/input.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * input.js: Instance of a single Loggly input - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var Input = exports.Input = function (client, details) { - if (!details) { - throw new Error("Input must be constructed with at least basic details."); - } - - this.client = client; - this._setProperties(details); -}; - -Input.prototype.log = function (msg, callback) { - return this.client.log(this.input_token, msg, callback); -}; - -Input.prototype.addDevice = function (address, callback) { - this.client.addDeviceToInput(this.id, address, callback); -}; - -// -// Sets the properties for this instance -// Parameters: details -// -Input.prototype._setProperties = function (details) { - // Copy the properties to this instance - var self = this; - Object.keys(details).forEach(function (key) { - self[key] = details[key]; - }); -}; \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/lib/loggly/search.js b/node_modules/winston/node_modules/loggly/lib/loggly/search.js deleted file mode 100644 index 09dd437..0000000 --- a/node_modules/winston/node_modules/loggly/lib/loggly/search.js +++ /dev/null @@ -1,130 +0,0 @@ -/* - * search.js: chainable search functions for Loggly - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var qs = require('querystring'), - timespan = require('timespan'), - common = require('./common'); - -// -// function Search (query, client, callback) -// Chainable search object for Loggly API -// -var Search = exports.Search = function (query, client, callback) { - this.query = query; - this.client = client; - - if (!this.baseUrl) { - this.baseUrl = 'search?'; - } - - // - // If we're passed a callback, run immediately. - // - if (callback) { - this.callback = callback; - this.run(); - } -}; - -// -// function meta (meta) -// Sets the appropriate metadata for this search query: -// e.g. ip, inputname -// -Search.prototype.meta = function (meta) { - this._meta = meta; - return this; -}; - -// -// function context (context) -// Sets the appropriate context for this search query: -// e.g. rows, start, from, until, order, format, fields -// -Search.prototype.context = function (context) { - this._context = context; - return this; -}; - -// -// ### function run (callback) -// #### @callback {function} Continuation to respond to when complete -// Runs the search query for for this instance with the query, metadata, -// context, and other parameters that have been configured on it. -// -Search.prototype.run = function (callback) { - var rangeError; - - // - // Trim the search query - // - this.query.trim(); - - // - // Update the callback for this instance if it's passed - // - this.callback = callback || this.callback; - if (!this.callback) { - throw new Error('Cannot run search without a callback function.'); - } - - // If meta was passed, update the search query appropriately - if (this._meta) { - this.query += ' ' + qs.unescape(qs.stringify(this._meta, ' ', ':')); - } - - // Set the context for the query string - this._context = this._context || {}; - this._context.q = this.query; - this._checkRange(); - - var self = this, searchOptions = { - uri: this.client.logglyUrl(this.baseUrl + qs.stringify(this._context)), - auth: this.client.config.auth - }; - - common.loggly(searchOptions, this.callback, function (res, body) { - self.callback(null, JSON.parse(body)); - }); - - return this; -}; - -// -// ### function _checkRange () -// Checks if the range that has been configured for this -// instance is valid and updates if it is not. -// -Search.prototype._checkRange = function () { - if (!this._context || (!this._context.until && !this._context.from)) { - return; - } - - this._context.until = this._context.until || 'NOW'; - this._context.from = this._context.from || 'NOW-24HOURS'; - - if (!timespan.parseDate(this._context.until)) { - this._context.until = 'NOW'; - } - - if (!timespan.parseDate(this._context.from)) { - this._context.from = 'NOW-24HOURS'; - } - - if (timespan.fromDates(this._context.from, this._context.until) < 0 - || this._context.until === this._context.from) { - // - // If the length of the timespan for this Search instance is - // negative then set it to default values - // - this._context.until = 'NOW'; - this._context.from = 'NOW-24HOURS'; - } - - return this; -}; \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/LICENSE b/node_modules/winston/node_modules/loggly/node_modules/request/LICENSE deleted file mode 100644 index a4a9aee..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/LICENSE +++ /dev/null @@ -1,55 +0,0 @@ -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of this License; and - -You must cause any modified files to carry prominent notices stating that You changed the files; and - -You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - -If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/README.md b/node_modules/winston/node_modules/loggly/node_modules/request/README.md deleted file mode 100644 index 639d1a4..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/README.md +++ /dev/null @@ -1,287 +0,0 @@ -# Request -- Simplified HTTP request method - -## Install - -
        -  npm install request
        -
        - -Or from source: - -
        -  git clone git://github.com/mikeal/request.git 
        -  cd request
        -  npm link
        -
        - -## Super simple to use - -Request is designed to be the simplest way possible to make http calls. It support HTTPS and follows redirects by default. - -```javascript -var request = require('request'); -request('http://www.google.com', function (error, response, body) { - if (!error && response.statusCode == 200) { - console.log(body) // Print the google web page. - } -}) -``` - -## Streaming - -You can stream any response to a file stream. - -```javascript -request('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png')) -``` - -You can also stream a file to a PUT or POST request. This method will also check the file extension against a mapping of file extensions to content-types, in this case `application/json`, and use the proper content-type in the PUT request if one is not already provided in the headers. - -```javascript -fs.createReadStream('file.json').pipe(request.put('http://mysite.com/obj.json')) -``` - -Request can also pipe to itself. When doing so the content-type and content-length will be preserved in the PUT headers. - -```javascript -request.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img.png')) -``` - -Now let's get fancy. - -```javascript -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - if (req.method === 'PUT') { - req.pipe(request.put('http://mysite.com/doodle.png')) - } else if (req.method === 'GET' || req.method === 'HEAD') { - request.get('http://mysite.com/doodle.png').pipe(resp) - } - } -}) -``` - -You can also pipe() from a http.ServerRequest instance and to a http.ServerResponse instance. The HTTP method and headers will be sent as well as the entity-body data. Which means that, if you don't really care about security, you can do: - -```javascript -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - var x = request('http://mysite.com/doodle.png') - req.pipe(x) - x.pipe(resp) - } -}) -``` - -And since pipe() returns the destination stream in node 0.5.x you can do one line proxying :) - -```javascript -req.pipe(request('http://mysite.com/doodle.png')).pipe(resp) -``` - -Also, none of this new functionality conflicts with requests previous features, it just expands them. - -```javascript -var r = request.defaults({'proxy':'http://localproxy.com'}) - -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - r.get('http://google.com/doodle.png').pipe(resp) - } -}) -``` - -You can still use intermediate proxies, the requests will still follow HTTP forwards, etc. - -## OAuth Signing - -```javascript -// Twitter OAuth -var qs = require('querystring') - , oauth = - { callback: 'http://mysite.com/callback/' - , consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - } - , url = 'https://api.twitter.com/oauth/request_token' - ; -request.post({url:url, oauth:oauth}, function (e, r, body) { - // Assume by some stretch of magic you aquired the verifier - var access_token = qs.parse(body) - , oauth = - { consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - , token: access_token.oauth_token - , verifier: VERIFIER - , token_secret: access_token.oauth_token_secret - } - , url = 'https://api.twitter.com/oauth/access_token' - ; - request.post({url:url, oauth:oauth}, function (e, r, body) { - var perm_token = qs.parse(body) - , oauth = - { consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - , token: perm_token.oauth_token - , token_secret: perm_token.oauth_token_secret - } - , url = 'https://api.twitter.com/1/users/show.json?' - , params = - { screen_name: perm_token.screen_name - , user_id: perm_token.user_id - } - ; - url += qs.stringify(params) - request.get({url:url, oauth:oauth, json:true}, function (e, r, user) { - console.log(user) - }) - }) -}) -``` - - - -### request(options, callback) - -The first argument can be either a url or an options object. The only required option is uri, all others are optional. - -* `uri` || `url` - fully qualified uri or a parsed url object from url.parse() -* `qs` - object containing querystring values to be appended to the uri -* `method` - http method, defaults to GET -* `headers` - http headers, defaults to {} -* `body` - entity body for POST and PUT requests. Must be buffer or string. -* `form` - sets `body` but to querystring representation of value and adds `Content-type: application/x-www-form-urlencoded; charset=utf-8` header. -* `json` - sets `body` but to JSON representation of value and adds `Content-type: application/json` header. -* `multipart` - (experimental) array of objects which contains their own headers and `body` attribute. Sends `multipart/related` request. See example below. -* `followRedirect` - follow HTTP 3xx responses as redirects. defaults to true. -* `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects. defaults to false. -* `maxRedirects` - the maximum number of redirects to follow, defaults to 10. -* `encoding` - Encoding to be used on `setEncoding` of response data. If set to `null`, the body is returned as a Buffer. -* `pool` - A hash object containing the agents for these requests. If omitted this request will use the global pool which is set to node's default maxSockets. -* `pool.maxSockets` - Integer containing the maximum amount of sockets in the pool. -* `timeout` - Integer containing the number of milliseconds to wait for a request to respond before aborting the request -* `proxy` - An HTTP proxy to be used. Support proxy Auth with Basic Auth the same way it's supported with the `url` parameter by embedding the auth info in the uri. -* `oauth` - Options for OAuth HMAC-SHA1 signing, see documentation above. -* `strictSSL` - Set to `true` to require that SSL certificates be valid. Note: to use your own certificate authority, you need to specify an agent that was created with that ca as an option. -* `jar` - Set to `false` if you don't want cookies to be remembered for future use or define your custom cookie jar (see examples section) - - -The callback argument gets 3 arguments. The first is an error when applicable (usually from the http.Client option not the http.ClientRequest object). The second in an http.ClientResponse object. The third is the response body String or Buffer. - -## Convenience methods - -There are also shorthand methods for different HTTP METHODs and some other conveniences. - -### request.defaults(options) - -This method returns a wrapper around the normal request API that defaults to whatever options you pass in to it. - -### request.put - -Same as request() but defaults to `method: "PUT"`. - -```javascript -request.put(url) -``` - -### request.post - -Same as request() but defaults to `method: "POST"`. - -```javascript -request.post(url) -``` - -### request.head - -Same as request() but defaults to `method: "HEAD"`. - -```javascript -request.head(url) -``` - -### request.del - -Same as request() but defaults to `method: "DELETE"`. - -```javascript -request.del(url) -``` - -### request.get - -Alias to normal request method for uniformity. - -```javascript -request.get(url) -``` -### request.cookie - -Function that creates a new cookie. - -```javascript -request.cookie('cookie_string_here') -``` -### request.jar - -Function that creates a new cookie jar. - -```javascript -request.jar() -``` - - -## Examples: - -```javascript - var request = require('request') - , rand = Math.floor(Math.random()*100000000).toString() - ; - request( - { method: 'PUT' - , uri: 'http://mikeal.iriscouch.com/testjs/' + rand - , multipart: - [ { 'content-type': 'application/json' - , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) - } - , { body: 'I am an attachment' } - ] - } - , function (error, response, body) { - if(response.statusCode == 201){ - console.log('document saved as: http://mikeal.iriscouch.com/testjs/'+ rand) - } else { - console.log('error: '+ response.statusCode) - console.log(body) - } - } - ) -``` -Cookies are enabled by default (so they can be used in subsequent requests). To disable cookies set jar to false (either in defaults or in the options sent). - -```javascript -var request = request.defaults({jar: false}) -request('http://www.google.com', function () { - request('http://images.google.com') -}) -``` - -If you to use a custom cookie jar (instead of letting request use its own global cookie jar) you do so by setting the jar default or by specifying it as an option: - -```javascript -var j = request.jar() -var request = request.defaults({jar:j}) -request('http://www.google.com', function () { - request('http://images.google.com') -}) -``` -OR - -```javascript -var j = request.jar() -var cookie = request.cookie('your_cookie_here') -j.add(cookie) -request({url: 'http://www.google.com', jar: j}, function () { - request('http://images.google.com') -}) -``` diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/forever.js b/node_modules/winston/node_modules/loggly/node_modules/request/forever.js deleted file mode 100644 index ac853c0..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/forever.js +++ /dev/null @@ -1,103 +0,0 @@ -module.exports = ForeverAgent -ForeverAgent.SSL = ForeverAgentSSL - -var util = require('util') - , Agent = require('http').Agent - , net = require('net') - , tls = require('tls') - , AgentSSL = require('https').Agent - -function ForeverAgent(options) { - var self = this - self.options = options || {} - self.requests = {} - self.sockets = {} - self.freeSockets = {} - self.maxSockets = self.options.maxSockets || Agent.defaultMaxSockets - self.minSockets = self.options.minSockets || ForeverAgent.defaultMinSockets - self.on('free', function(socket, host, port) { - var name = host + ':' + port - if (self.requests[name] && self.requests[name].length) { - self.requests[name].shift().onSocket(socket) - } else if (self.sockets[name].length < self.minSockets) { - if (!self.freeSockets[name]) self.freeSockets[name] = [] - self.freeSockets[name].push(socket) - - // if an error happens while we don't use the socket anyway, meh, throw the socket away - function onIdleError() { - socket.destroy() - } - socket._onIdleError = onIdleError - socket.on('error', onIdleError) - } else { - // If there are no pending requests just destroy the - // socket and it will get removed from the pool. This - // gets us out of timeout issues and allows us to - // default to Connection:keep-alive. - socket.destroy(); - } - }) - -} -util.inherits(ForeverAgent, Agent) - -ForeverAgent.defaultMinSockets = 5 - - -ForeverAgent.prototype.createConnection = net.createConnection -ForeverAgent.prototype.addRequestNoreuse = Agent.prototype.addRequest -ForeverAgent.prototype.addRequest = function(req, host, port) { - var name = host + ':' + port - if (this.freeSockets[name] && this.freeSockets[name].length > 0 && !req.useChunkedEncodingByDefault) { - var idleSocket = this.freeSockets[name].pop() - idleSocket.removeListener('error', idleSocket._onIdleError) - delete idleSocket._onIdleError - req._reusedSocket = true - req.onSocket(idleSocket) - } else { - this.addRequestNoreuse(req, host, port) - } -} - -ForeverAgent.prototype.removeSocket = function(s, name, host, port) { - if (this.sockets[name]) { - var index = this.sockets[name].indexOf(s); - if (index !== -1) { - this.sockets[name].splice(index, 1); - } - } else if (this.sockets[name] && this.sockets[name].length === 0) { - // don't leak - delete this.sockets[name]; - delete this.requests[name]; - } - - if (this.freeSockets[name]) { - var index = this.freeSockets[name].indexOf(s) - if (index !== -1) { - this.freeSockets[name].splice(index, 1) - if (this.freeSockets[name].length === 0) { - delete this.freeSockets[name] - } - } - } - - if (this.requests[name] && this.requests[name].length) { - // If we have pending requests and a socket gets closed a new one - // needs to be created to take over in the pool for the one that closed. - this.createSocket(name, host, port).emit('free'); - } -} - -function ForeverAgentSSL (options) { - ForeverAgent.call(this, options) -} -util.inherits(ForeverAgentSSL, ForeverAgent) - -ForeverAgentSSL.prototype.createConnection = createConnectionSSL -ForeverAgentSSL.prototype.addRequestNoreuse = AgentSSL.prototype.addRequest - -function createConnectionSSL (port, host, options) { - options.port = port - options.host = host - return tls.connect(options) -} diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/main.js b/node_modules/winston/node_modules/loggly/node_modules/request/main.js deleted file mode 100644 index 0bec255..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/main.js +++ /dev/null @@ -1,913 +0,0 @@ -// Copyright 2010-2012 Mikeal Rogers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -var http = require('http') - , https = false - , tls = false - , url = require('url') - , util = require('util') - , stream = require('stream') - , qs = require('querystring') - , mimetypes = require('./mimetypes') - , oauth = require('./oauth') - , uuid = require('./uuid') - , ForeverAgent = require('./forever') - , Cookie = require('./vendor/cookie') - , CookieJar = require('./vendor/cookie/jar') - , cookieJar = new CookieJar - , tunnel = require('./tunnel') - ; - -if (process.logging) { - var log = process.logging('request') -} - -try { - https = require('https') -} catch (e) {} - -try { - tls = require('tls') -} catch (e) {} - -function toBase64 (str) { - return (new Buffer(str || "", "ascii")).toString("base64") -} - -// Hacky fix for pre-0.4.4 https -if (https && !https.Agent) { - https.Agent = function (options) { - http.Agent.call(this, options) - } - util.inherits(https.Agent, http.Agent) - https.Agent.prototype._getConnection = function(host, port, cb) { - var s = tls.connect(port, host, this.options, function() { - // do other checks here? - if (cb) cb() - }) - return s - } -} - -function isReadStream (rs) { - if (rs.readable && rs.path && rs.mode) { - return true - } -} - -function copy (obj) { - var o = {} - Object.keys(obj).forEach(function (i) { - o[i] = obj[i] - }) - return o -} - -var isUrl = /^https?:/ - -var globalPool = {} - -function Request (options) { - stream.Stream.call(this) - this.readable = true - this.writable = true - - if (typeof options === 'string') { - options = {uri:options} - } - - var reserved = Object.keys(Request.prototype) - for (var i in options) { - if (reserved.indexOf(i) === -1) { - this[i] = options[i] - } else { - if (typeof options[i] === 'function') { - delete options[i] - } - } - } - options = copy(options) - - this.init(options) -} -util.inherits(Request, stream.Stream) -Request.prototype.init = function (options) { - var self = this - - if (!options) options = {} - - if (!self.pool) self.pool = globalPool - self.dests = [] - self.__isRequestRequest = true - - // Protect against double callback - if (!self._callback && self.callback) { - self._callback = self.callback - self.callback = function () { - if (self._callbackCalled) return // Print a warning maybe? - self._callback.apply(self, arguments) - self._callbackCalled = true - } - self.on('error', self.callback.bind()) - self.on('complete', self.callback.bind(self, null)) - } - - if (self.url) { - // People use this property instead all the time so why not just support it. - self.uri = self.url - delete self.url - } - - if (!self.uri) { - throw new Error("options.uri is a required argument") - } else { - if (typeof self.uri == "string") self.uri = url.parse(self.uri) - } - if (self.proxy) { - if (typeof self.proxy == 'string') self.proxy = url.parse(self.proxy) - - // do the HTTP CONNECT dance using koichik/node-tunnel - if (http.globalAgent && self.uri.protocol === "https:") { - self.tunnel = true - var tunnelFn = self.proxy.protocol === "http:" - ? tunnel.httpsOverHttp : tunnel.httpsOverHttps - - var tunnelOptions = { proxy: { host: self.proxy.hostname - , port: +self.proxy.port - , proxyAuth: self.proxy.auth } - , ca: this.ca } - - self.agent = tunnelFn(tunnelOptions) - self.tunnel = true - } - } - - self._redirectsFollowed = self._redirectsFollowed || 0 - self.maxRedirects = (self.maxRedirects !== undefined) ? self.maxRedirects : 10 - self.followRedirect = (self.followRedirect !== undefined) ? self.followRedirect : true - self.followAllRedirects = (self.followAllRedirects !== undefined) ? self.followAllRedirects : false; - if (self.followRedirect || self.followAllRedirects) - self.redirects = self.redirects || [] - - self.headers = self.headers ? copy(self.headers) : {} - - self.setHost = false - if (!self.headers.host) { - self.headers.host = self.uri.hostname - if (self.uri.port) { - if ( !(self.uri.port === 80 && self.uri.protocol === 'http:') && - !(self.uri.port === 443 && self.uri.protocol === 'https:') ) - self.headers.host += (':'+self.uri.port) - } - self.setHost = true - } - - self.jar(self._jar || options.jar) - - if (!self.uri.pathname) {self.uri.pathname = '/'} - if (!self.uri.port) { - if (self.uri.protocol == 'http:') {self.uri.port = 80} - else if (self.uri.protocol == 'https:') {self.uri.port = 443} - } - - if (self.proxy && !self.tunnel) { - self.port = self.proxy.port - self.host = self.proxy.hostname - } else { - self.port = self.uri.port - self.host = self.uri.hostname - } - - self.clientErrorHandler = function (error) { - if (self._aborted) return - - if (self.setHost) delete self.headers.host - if (self.req._reusedSocket && error.code === 'ECONNRESET' - && self.agent.addRequestNoreuse) { - self.agent = { addRequest: self.agent.addRequestNoreuse.bind(self.agent) } - self.start() - self.req.end() - return - } - if (self.timeout && self.timeoutTimer) { - clearTimeout(self.timeoutTimer) - self.timeoutTimer = null - } - self.emit('error', error) - } - - if (options.form) { - self.form(options.form) - } - - if (options.oauth) { - self.oauth(options.oauth) - } - - if (self.uri.auth && !self.headers.authorization) { - self.headers.authorization = "Basic " + toBase64(self.uri.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':')) - } - if (self.proxy && self.proxy.auth && !self.headers['proxy-authorization'] && !self.tunnel) { - self.headers['proxy-authorization'] = "Basic " + toBase64(self.proxy.auth.split(':').map(function(item){ return qs.unescape(item)}).join(':')) - } - - if (options.qs) self.qs(options.qs) - - if (self.uri.path) { - self.path = self.uri.path - } else { - self.path = self.uri.pathname + (self.uri.search || "") - } - - if (self.path.length === 0) self.path = '/' - - if (self.proxy && !self.tunnel) self.path = (self.uri.protocol + '//' + self.uri.host + self.path) - - if (options.json) { - self.json(options.json) - } else if (options.multipart) { - self.multipart(options.multipart) - } - - if (self.body) { - var length = 0 - if (!Buffer.isBuffer(self.body)) { - if (Array.isArray(self.body)) { - for (var i = 0; i < self.body.length; i++) { - length += self.body[i].length - } - } else { - self.body = new Buffer(self.body) - length = self.body.length - } - } else { - length = self.body.length - } - if (length) { - self.headers['content-length'] = length - } else { - throw new Error('Argument error, options.body.') - } - } - - var protocol = self.proxy && !self.tunnel ? self.proxy.protocol : self.uri.protocol - , defaultModules = {'http:':http, 'https:':https} - , httpModules = self.httpModules || {} - ; - self.httpModule = httpModules[protocol] || defaultModules[protocol] - - if (!self.httpModule) throw new Error("Invalid protocol") - - if (options.ca) self.ca = options.ca - - if (!self.agent) { - if (options.agentOptions) self.agentOptions = options.agentOptions - - if (options.agentClass) { - self.agentClass = options.agentClass - } else if (options.forever) { - self.agentClass = protocol === 'http:' ? ForeverAgent : ForeverAgent.SSL - } else { - self.agentClass = self.httpModule.Agent - } - } - - if (self.pool === false) { - self.agent = false - } else { - self.agent = self.agent || self.getAgent() - if (self.maxSockets) { - // Don't use our pooling if node has the refactored client - self.agent.maxSockets = self.maxSockets - } - if (self.pool.maxSockets) { - // Don't use our pooling if node has the refactored client - self.agent.maxSockets = self.pool.maxSockets - } - } - - self.once('pipe', function (src) { - if (self.ntick) throw new Error("You cannot pipe to this stream after the first nextTick() after creation of the request stream.") - self.src = src - if (isReadStream(src)) { - if (!self.headers['content-type'] && !self.headers['Content-Type']) - self.headers['content-type'] = mimetypes.lookup(src.path.slice(src.path.lastIndexOf('.')+1)) - } else { - if (src.headers) { - for (var i in src.headers) { - if (!self.headers[i]) { - self.headers[i] = src.headers[i] - } - } - } - if (src.method && !self.method) { - self.method = src.method - } - } - - self.on('pipe', function () { - console.error("You have already piped to this stream. Pipeing twice is likely to break the request.") - }) - }) - - process.nextTick(function () { - if (self._aborted) return - - if (self.body) { - if (Array.isArray(self.body)) { - self.body.forEach(function(part) { - self.write(part) - }) - } else { - self.write(self.body) - } - self.end() - } else if (self.requestBodyStream) { - console.warn("options.requestBodyStream is deprecated, please pass the request object to stream.pipe.") - self.requestBodyStream.pipe(self) - } else if (!self.src) { - self.headers['content-length'] = 0 - self.end() - } - self.ntick = true - }) -} - -Request.prototype.getAgent = function () { - var Agent = this.agentClass - var options = {} - if (this.agentOptions) { - for (var i in this.agentOptions) { - options[i] = this.agentOptions[i] - } - } - if (this.ca) options.ca = this.ca - - var poolKey = '' - - // different types of agents are in different pools - if (Agent !== this.httpModule.Agent) { - poolKey += Agent.name - } - - if (!this.httpModule.globalAgent) { - // node 0.4.x - options.host = this.host - options.port = this.port - if (poolKey) poolKey += ':' - poolKey += this.host + ':' + this.port - } - - if (options.ca) { - if (poolKey) poolKey += ':' - poolKey += options.ca - } - - if (!poolKey && Agent === this.httpModule.Agent && this.httpModule.globalAgent) { - // not doing anything special. Use the globalAgent - return this.httpModule.globalAgent - } - - // already generated an agent for this setting - if (this.pool[poolKey]) return this.pool[poolKey] - - return this.pool[poolKey] = new Agent(options) -} - -Request.prototype.start = function () { - var self = this - - if (self._aborted) return - - self._started = true - self.method = self.method || 'GET' - self.href = self.uri.href - if (log) log('%method %href', self) - self.req = self.httpModule.request(self, function (response) { - if (self._aborted) return - if (self._paused) response.pause() - - self.response = response - response.request = self - response.toJSON = toJSON - - if (self.httpModule === https && - self.strictSSL && - !response.client.authorized) { - var sslErr = response.client.authorizationError - self.emit('error', new Error('SSL Error: '+ sslErr)) - return - } - - if (self.setHost) delete self.headers.host - if (self.timeout && self.timeoutTimer) { - clearTimeout(self.timeoutTimer) - self.timeoutTimer = null - } - - if (response.headers['set-cookie'] && (!self._disableCookies)) { - response.headers['set-cookie'].forEach(function(cookie) { - if (self._jar) self._jar.add(new Cookie(cookie)) - else cookieJar.add(new Cookie(cookie)) - }) - } - - if (response.statusCode >= 300 && response.statusCode < 400 && - (self.followAllRedirects || - (self.followRedirect && (self.method !== 'PUT' && self.method !== 'POST' && self.method !== 'DELETE'))) && - response.headers.location) { - if (self._redirectsFollowed >= self.maxRedirects) { - self.emit('error', new Error("Exceeded maxRedirects. Probably stuck in a redirect loop.")) - return - } - self._redirectsFollowed += 1 - - if (!isUrl.test(response.headers.location)) { - response.headers.location = url.resolve(self.uri.href, response.headers.location) - } - self.uri = response.headers.location - self.redirects.push( - { statusCode : response.statusCode - , redirectUri: response.headers.location - } - ) - if (self.followAllRedirects) self.method = 'GET' - // self.method = 'GET'; // Force all redirects to use GET || commented out fixes #215 - delete self.req - delete self.agent - delete self._started - delete self.body - if (self.headers) { - delete self.headers.host - } - if (log) log('Redirect to %uri', self) - self.init() - return // Ignore the rest of the response - } else { - self._redirectsFollowed = self._redirectsFollowed || 0 - // Be a good stream and emit end when the response is finished. - // Hack to emit end on close because of a core bug that never fires end - response.on('close', function () { - if (!self._ended) self.response.emit('end') - }) - - if (self.encoding) { - if (self.dests.length !== 0) { - console.error("Ingoring encoding parameter as this stream is being piped to another stream which makes the encoding option invalid.") - } else { - response.setEncoding(self.encoding) - } - } - - self.dests.forEach(function (dest) { - self.pipeDest(dest) - }) - - response.on("data", function (chunk) { - self._destdata = true - self.emit("data", chunk) - }) - response.on("end", function (chunk) { - self._ended = true - self.emit("end", chunk) - }) - response.on("close", function () {self.emit("close")}) - - self.emit('response', response) - - if (self.callback) { - var buffer = [] - var bodyLen = 0 - self.on("data", function (chunk) { - buffer.push(chunk) - bodyLen += chunk.length - }) - self.on("end", function () { - if (self._aborted) return - - if (buffer.length && Buffer.isBuffer(buffer[0])) { - var body = new Buffer(bodyLen) - var i = 0 - buffer.forEach(function (chunk) { - chunk.copy(body, i, 0, chunk.length) - i += chunk.length - }) - if (self.encoding === null) { - response.body = body - } else { - response.body = body.toString() - } - } else if (buffer.length) { - response.body = buffer.join('') - } - - if (self._json) { - try { - response.body = JSON.parse(response.body) - } catch (e) {} - } - - self.emit('complete', response, response.body) - }) - } - } - }) - - if (self.timeout && !self.timeoutTimer) { - self.timeoutTimer = setTimeout(function() { - self.req.abort() - var e = new Error("ETIMEDOUT") - e.code = "ETIMEDOUT" - self.emit("error", e) - }, self.timeout) - - // Set additional timeout on socket - in case if remote - // server freeze after sending headers - if (self.req.setTimeout) { // only works on node 0.6+ - self.req.setTimeout(self.timeout, function(){ - if (self.req) { - self.req.abort() - var e = new Error("ESOCKETTIMEDOUT") - e.code = "ESOCKETTIMEDOUT" - self.emit("error", e) - } - }) - } - } - - self.req.on('error', self.clientErrorHandler) - - self.emit('request', self.req) -} - -Request.prototype.abort = function() { - this._aborted = true; - - if (this.req) { - this.req.abort() - } - else if (this.response) { - this.response.abort() - } - - this.emit("abort") -} - -Request.prototype.pipeDest = function (dest) { - var response = this.response - // Called after the response is received - if (dest.headers) { - dest.headers['content-type'] = response.headers['content-type'] - if (response.headers['content-length']) { - dest.headers['content-length'] = response.headers['content-length'] - } - } - if (dest.setHeader) { - for (var i in response.headers) { - dest.setHeader(i, response.headers[i]) - } - dest.statusCode = response.statusCode - } - if (this.pipefilter) this.pipefilter(response, dest) -} - -// Composable API -Request.prototype.setHeader = function (name, value, clobber) { - if (clobber === undefined) clobber = true - if (clobber || !this.headers.hasOwnProperty(name)) this.headers[name] = value - else this.headers[name] += ',' + value - return this -} -Request.prototype.setHeaders = function (headers) { - for (i in headers) {this.setHeader(i, headers[i])} - return this -} -Request.prototype.qs = function (q, clobber) { - var base - if (!clobber && this.uri.query) base = qs.parse(this.uri.query) - else base = {} - - for (var i in q) { - base[i] = q[i] - } - - this.uri = url.parse(this.uri.href.split('?')[0] + '?' + qs.stringify(base)) - this.url = this.uri - - return this -} -Request.prototype.form = function (form) { - this.headers['content-type'] = 'application/x-www-form-urlencoded; charset=utf-8' - this.body = qs.stringify(form).toString('utf8') - return this -} -Request.prototype.multipart = function (multipart) { - var self = this - self.body = [] - - if (!self.headers['content-type']) { - self.headers['content-type'] = 'multipart/related; boundary=frontier'; - } else { - self.headers['content-type'] = self.headers['content-type'].split(';')[0] + '; boundary=frontier'; - } - - if (!multipart.forEach) throw new Error('Argument error, options.multipart.') - - multipart.forEach(function (part) { - var body = part.body - if(!body) throw Error('Body attribute missing in multipart.') - delete part.body - var preamble = '--frontier\r\n' - Object.keys(part).forEach(function(key){ - preamble += key + ': ' + part[key] + '\r\n' - }) - preamble += '\r\n' - self.body.push(new Buffer(preamble)) - self.body.push(new Buffer(body)) - self.body.push(new Buffer('\r\n')) - }) - self.body.push(new Buffer('--frontier--')) - return self -} -Request.prototype.json = function (val) { - this.setHeader('content-type', 'application/json') - this.setHeader('accept', 'application/json') - this._json = true - if (typeof val === 'boolean') { - if (typeof this.body === 'object') this.body = JSON.stringify(this.body) - } else { - this.body = JSON.stringify(val) - } - return this -} -Request.prototype.oauth = function (_oauth) { - var form - if (this.headers['content-type'] && - this.headers['content-type'].slice(0, 'application/x-www-form-urlencoded'.length) === - 'application/x-www-form-urlencoded' - ) { - form = qs.parse(this.body) - } - if (this.uri.query) { - form = qs.parse(this.uri.query) - } - if (!form) form = {} - var oa = {} - for (var i in form) oa[i] = form[i] - for (var i in _oauth) oa['oauth_'+i] = _oauth[i] - if (!oa.oauth_version) oa.oauth_version = '1.0' - if (!oa.oauth_timestamp) oa.oauth_timestamp = Math.floor( (new Date()).getTime() / 1000 ).toString() - if (!oa.oauth_nonce) oa.oauth_nonce = uuid().replace(/-/g, '') - - oa.oauth_signature_method = 'HMAC-SHA1' - - var consumer_secret = oa.oauth_consumer_secret - delete oa.oauth_consumer_secret - var token_secret = oa.oauth_token_secret - delete oa.oauth_token_secret - - var baseurl = this.uri.protocol + '//' + this.uri.host + this.uri.pathname - var signature = oauth.hmacsign(this.method, baseurl, oa, consumer_secret, token_secret) - - // oa.oauth_signature = signature - for (var i in form) { - if ( i.slice(0, 'oauth_') in _oauth) { - // skip - } else { - delete oa['oauth_'+i] - } - } - this.headers.Authorization = - 'OAuth '+Object.keys(oa).sort().map(function (i) {return i+'="'+oauth.rfc3986(oa[i])+'"'}).join(',') - this.headers.Authorization += ',oauth_signature="'+oauth.rfc3986(signature)+'"' - return this -} -Request.prototype.jar = function (jar) { - var cookies - - if (this._redirectsFollowed === 0) { - this.originalCookieHeader = this.headers.cookie - } - - if (jar === false) { - // disable cookies - cookies = false; - this._disableCookies = true; - } else if (jar) { - // fetch cookie from the user defined cookie jar - cookies = jar.get({ url: this.uri.href }) - } else { - // fetch cookie from the global cookie jar - cookies = cookieJar.get({ url: this.uri.href }) - } - - if (cookies && cookies.length) { - var cookieString = cookies.map(function (c) { - return c.name + "=" + c.value - }).join("; ") - - if (this.originalCookieHeader) { - // Don't overwrite existing Cookie header - this.headers.cookie = this.originalCookieHeader + '; ' + cookieString - } else { - this.headers.cookie = cookieString - } - } - this._jar = jar - return this -} - - -// Stream API -Request.prototype.pipe = function (dest, opts) { - if (this.response) { - if (this._destdata) { - throw new Error("You cannot pipe after data has been emitted from the response.") - } else if (this._ended) { - throw new Error("You cannot pipe after the response has been ended.") - } else { - stream.Stream.prototype.pipe.call(this, dest, opts) - this.pipeDest(dest) - return dest - } - } else { - this.dests.push(dest) - stream.Stream.prototype.pipe.call(this, dest, opts) - return dest - } -} -Request.prototype.write = function () { - if (!this._started) this.start() - this.req.write.apply(this.req, arguments) -} -Request.prototype.end = function (chunk) { - if (chunk) this.write(chunk) - if (!this._started) this.start() - this.req.end() -} -Request.prototype.pause = function () { - if (!this.response) this._paused = true - else this.response.pause.apply(this.response, arguments) -} -Request.prototype.resume = function () { - if (!this.response) this._paused = false - else this.response.resume.apply(this.response, arguments) -} -Request.prototype.destroy = function () { - if (!this._ended) this.end() -} - -// organize params for post, put, head, del -function initParams(uri, options, callback) { - if ((typeof options === 'function') && !callback) callback = options; - if (typeof options === 'object') { - options.uri = uri; - } else if (typeof uri === 'string') { - options = {uri:uri}; - } else { - options = uri; - uri = options.uri; - } - return { uri: uri, options: options, callback: callback }; -} - -function request (uri, options, callback) { - if (typeof uri === 'undefined') throw new Error('undefined is not a valid uri or options object.') - if ((typeof options === 'function') && !callback) callback = options; - if (typeof options === 'object') { - options.uri = uri; - } else if (typeof uri === 'string') { - options = {uri:uri}; - } else { - options = uri; - } - - if (callback) options.callback = callback; - var r = new Request(options) - return r -} - -module.exports = request - -request.defaults = function (options) { - var def = function (method) { - var d = function (uri, opts, callback) { - var params = initParams(uri, opts, callback); - for (var i in options) { - if (params.options[i] === undefined) params.options[i] = options[i] - } - return method(params.uri, params.options, params.callback) - } - return d - } - var de = def(request) - de.get = def(request.get) - de.post = def(request.post) - de.put = def(request.put) - de.head = def(request.head) - de.del = def(request.del) - de.cookie = def(request.cookie) - de.jar = def(request.jar) - return de -} - -request.forever = function (agentOptions, optionsArg) { - var options = {} - if (optionsArg) { - for (option in optionsArg) { - options[option] = optionsArg[option] - } - } - if (agentOptions) options.agentOptions = agentOptions - options.forever = true - return request.defaults(options) -} - -request.get = request -request.post = function (uri, options, callback) { - var params = initParams(uri, options, callback); - params.options.method = 'POST'; - return request(params.uri || null, params.options, params.callback) -} -request.put = function (uri, options, callback) { - var params = initParams(uri, options, callback); - params.options.method = 'PUT' - return request(params.uri || null, params.options, params.callback) -} -request.head = function (uri, options, callback) { - var params = initParams(uri, options, callback); - params.options.method = 'HEAD' - if (params.options.body || - params.options.requestBodyStream || - (params.options.json && typeof params.options.json !== 'boolean') || - params.options.multipart) { - throw new Error("HTTP HEAD requests MUST NOT include a request body.") - } - return request(params.uri || null, params.options, params.callback) -} -request.del = function (uri, options, callback) { - var params = initParams(uri, options, callback); - params.options.method = 'DELETE' - return request(params.uri || null, params.options, params.callback) -} -request.jar = function () { - return new CookieJar -} -request.cookie = function (str) { - if (str && str.uri) str = str.uri - if (typeof str !== 'string') throw new Error("The cookie function only accepts STRING as param") - return new Cookie(str) -} - -// Safe toJSON - -function getSafe (self, uuid) { - if (typeof self === 'object' || typeof self === 'function') var safe = {} - if (Array.isArray(self)) var safe = [] - - var recurse = [] - - Object.defineProperty(self, uuid, {}) - - var attrs = Object.keys(self).filter(function (i) { - if (i === uuid) return false - if ( (typeof self[i] !== 'object' && typeof self[i] !== 'function') || self[i] === null) return true - return !(Object.getOwnPropertyDescriptor(self[i], uuid)) - }) - - - for (var i=0;i= 0.3.6" - ], - "main": "./main", - "scripts": { - "test": "node tests/run.js" - }, - "_id": "request@2.9.200", - "dependencies": {}, - "devDependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "dist": { - "shasum": "a32580916645eb6785b63fac5e016a1f9082821a" - }, - "_from": "request@2.9.x" -} diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/googledoodle.png b/node_modules/winston/node_modules/loggly/node_modules/request/tests/googledoodle.png deleted file mode 100644 index f80c9c5..0000000 Binary files a/node_modules/winston/node_modules/loggly/node_modules/request/tests/googledoodle.png and /dev/null differ diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/run.js b/node_modules/winston/node_modules/loggly/node_modules/request/tests/run.js deleted file mode 100644 index 6011846..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/run.js +++ /dev/null @@ -1,37 +0,0 @@ -var spawn = require('child_process').spawn - , exitCode = 0 - ; - -var tests = [ - 'test-body.js' - , 'test-cookie.js' - , 'test-cookiejar.js' - , 'test-defaults.js' - , 'test-errors.js' - , 'test-headers.js' - , 'test-httpModule.js' - , 'test-https.js' - , 'test-https-strict.js' - , 'test-oauth.js' - , 'test-pipes.js' - , 'test-proxy.js' - , 'test-qs.js' - , 'test-redirect.js' - , 'test-timeout.js' - , 'test-tunnel.js' -] - -var next = function () { - if (tests.length === 0) process.exit(exitCode); - - var file = tests.shift() - console.log(file) - var proc = spawn('node', [ 'tests/' + file ]) - proc.stdout.pipe(process.stdout) - proc.stderr.pipe(process.stderr) - proc.on('exit', function (code) { - exitCode += code || 0 - next() - }) -} -next() diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/server.js b/node_modules/winston/node_modules/loggly/node_modules/request/tests/server.js deleted file mode 100644 index 921f512..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/server.js +++ /dev/null @@ -1,82 +0,0 @@ -var fs = require('fs') - , http = require('http') - , path = require('path') - , https = require('https') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - ; - -exports.createServer = function (port) { - port = port || 6767 - var s = http.createServer(function (req, resp) { - s.emit(req.url, req, resp); - }) - s.port = port - s.url = 'http://localhost:'+port - return s; -} - -exports.createSSLServer = function(port, opts) { - port = port || 16767 - - var options = { 'key' : path.join(__dirname, 'ssl', 'test.key') - , 'cert': path.join(__dirname, 'ssl', 'test.crt') - } - if (opts) { - for (var i in opts) options[i] = opts[i] - } - - for (var i in options) { - options[i] = fs.readFileSync(options[i]) - } - - var s = https.createServer(options, function (req, resp) { - s.emit(req.url, req, resp); - }) - s.port = port - s.url = 'https://localhost:'+port - return s; -} - -exports.createPostStream = function (text) { - var postStream = new stream.Stream(); - postStream.writeable = true; - postStream.readable = true; - setTimeout(function () {postStream.emit('data', new Buffer(text)); postStream.emit('end')}, 0); - return postStream; -} -exports.createPostValidator = function (text) { - var l = function (req, resp) { - var r = ''; - req.on('data', function (chunk) {r += chunk}) - req.on('end', function () { - if (r !== text) console.log(r, text); - assert.equal(r, text) - resp.writeHead(200, {'content-type':'text/plain'}) - resp.write('OK') - resp.end() - }) - } - return l; -} -exports.createGetResponse = function (text, contentType) { - var l = function (req, resp) { - contentType = contentType || 'text/plain' - resp.writeHead(200, {'content-type':contentType}) - resp.write(text) - resp.end() - } - return l; -} -exports.createChunkResponse = function (chunks, contentType) { - var l = function (req, resp) { - contentType = contentType || 'text/plain' - resp.writeHead(200, {'content-type':contentType}) - chunks.forEach(function (chunk) { - resp.write(chunk) - }) - resp.end() - } - return l; -} diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/squid.conf b/node_modules/winston/node_modules/loggly/node_modules/request/tests/squid.conf deleted file mode 100644 index 0d4a3b6..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/squid.conf +++ /dev/null @@ -1,77 +0,0 @@ -# -# Recommended minimum configuration: -# -acl manager proto cache_object -acl localhost src 127.0.0.1/32 ::1 -acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1 - -# Example rule allowing access from your local networks. -# Adapt to list your (internal) IP networks from where browsing -# should be allowed -acl localnet src 10.0.0.0/8 # RFC1918 possible internal network -acl localnet src 172.16.0.0/12 # RFC1918 possible internal network -acl localnet src 192.168.0.0/16 # RFC1918 possible internal network -acl localnet src fc00::/7 # RFC 4193 local private network range -acl localnet src fe80::/10 # RFC 4291 link-local (directly plugged) machines - -acl SSL_ports port 443 -acl Safe_ports port 80 # http -acl Safe_ports port 21 # ftp -acl Safe_ports port 443 # https -acl Safe_ports port 70 # gopher -acl Safe_ports port 210 # wais -acl Safe_ports port 1025-65535 # unregistered ports -acl Safe_ports port 280 # http-mgmt -acl Safe_ports port 488 # gss-http -acl Safe_ports port 591 # filemaker -acl Safe_ports port 777 # multiling http -acl CONNECT method CONNECT - -# -# Recommended minimum Access Permission configuration: -# -# Only allow cachemgr access from localhost -http_access allow manager localhost -http_access deny manager - -# Deny requests to certain unsafe ports -http_access deny !Safe_ports - -# Deny CONNECT to other than secure SSL ports -#http_access deny CONNECT !SSL_ports - -# We strongly recommend the following be uncommented to protect innocent -# web applications running on the proxy server who think the only -# one who can access services on "localhost" is a local user -#http_access deny to_localhost - -# -# INSERT YOUR OWN RULE(S) HERE TO ALLOW ACCESS FROM YOUR CLIENTS -# - -# Example rule allowing access from your local networks. -# Adapt localnet in the ACL section to list your (internal) IP networks -# from where browsing should be allowed -http_access allow localnet -http_access allow localhost - -# And finally deny all other access to this proxy -http_access deny all - -# Squid normally listens to port 3128 -http_port 3128 - -# We recommend you to use at least the following line. -hierarchy_stoplist cgi-bin ? - -# Uncomment and adjust the following to add a disk cache directory. -#cache_dir ufs /usr/local/var/cache 100 16 256 - -# Leave coredumps in the first cache dir -coredump_dir /usr/local/var/cache - -# Add any of your own refresh_pattern entries above these. -refresh_pattern ^ftp: 1440 20% 10080 -refresh_pattern ^gopher: 1440 0% 1440 -refresh_pattern -i (/cgi-bin/|\?) 0 0% 0 -refresh_pattern . 0 20% 4320 diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.cnf b/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.cnf deleted file mode 100644 index 425a889..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.cnf +++ /dev/null @@ -1,20 +0,0 @@ -[ req ] -default_bits = 1024 -days = 3650 -distinguished_name = req_distinguished_name -attributes = req_attributes -prompt = no -output_password = password - -[ req_distinguished_name ] -C = US -ST = CA -L = Oakland -O = request -OU = request Certificate Authority -CN = requestCA -emailAddress = mikeal@mikealrogers.com - -[ req_attributes ] -challengePassword = password challenge - diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.crl b/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.crl deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.crt b/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.crt deleted file mode 100644 index b4524e4..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.crt +++ /dev/null @@ -1,17 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICvTCCAiYCCQDn+P/MSbDsWjANBgkqhkiG9w0BAQUFADCBojELMAkGA1UEBhMC -VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMRAwDgYDVQQKEwdyZXF1 -ZXN0MSYwJAYDVQQLEx1yZXF1ZXN0IENlcnRpZmljYXRlIEF1dGhvcml0eTESMBAG -A1UEAxMJcmVxdWVzdENBMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlrZWFscm9n -ZXJzLmNvbTAeFw0xMjAzMDEyMjUwNTZaFw0yMjAyMjcyMjUwNTZaMIGiMQswCQYD -VQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNVBAcTB09ha2xhbmQxEDAOBgNVBAoT -B3JlcXVlc3QxJjAkBgNVBAsTHXJlcXVlc3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5 -MRIwEAYDVQQDEwlyZXF1ZXN0Q0ExJjAkBgkqhkiG9w0BCQEWF21pa2VhbEBtaWtl -YWxyb2dlcnMuY29tMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC7t9pQUAK4 -5XJYTI6NrF0n3G2HZsfN+rPYSVzzL8SuVyb1tHXos+vbPm3NKI4E8X1yVAXU8CjJ -5SqXnp4DAypAhaseho81cbhk7LXUhFz78OvAa+OD+xTAEAnNQ8tGUr4VGyplEjfD -xsBVuqV2j8GPNTftr+drOCFlqfAgMrBn4wIDAQABMA0GCSqGSIb3DQEBBQUAA4GB -ADVdTlVAL45R+PACNS7Gs4o81CwSclukBu4FJbxrkd4xGQmurgfRrYYKjtqiopQm -D7ysRamS3HMN9/VKq2T7r3z1PMHPAy7zM4uoXbbaTKwlnX4j/8pGPn8Ca3qHXYlo -88L/OOPc6Di7i7qckS3HFbXQCTiULtxWmy97oEuTwrAj ------END CERTIFICATE----- diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.csr b/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.csr deleted file mode 100644 index e48c56e..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.csr +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIICBjCCAW8CAQAwgaIxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEQMA4GA1UE -BxMHT2FrbGFuZDEQMA4GA1UEChMHcmVxdWVzdDEmMCQGA1UECxMdcmVxdWVzdCBD -ZXJ0aWZpY2F0ZSBBdXRob3JpdHkxEjAQBgNVBAMTCXJlcXVlc3RDQTEmMCQGCSqG -SIb3DQEJARYXbWlrZWFsQG1pa2VhbHJvZ2Vycy5jb20wgZ8wDQYJKoZIhvcNAQEB -BQADgY0AMIGJAoGBALu32lBQArjlclhMjo2sXSfcbYdmx836s9hJXPMvxK5XJvW0 -deiz69s+bc0ojgTxfXJUBdTwKMnlKpeengMDKkCFqx6GjzVxuGTstdSEXPvw68Br -44P7FMAQCc1Dy0ZSvhUbKmUSN8PGwFW6pXaPwY81N+2v52s4IWWp8CAysGfjAgMB -AAGgIzAhBgkqhkiG9w0BCQcxFBMScGFzc3dvcmQgY2hhbGxlbmdlMA0GCSqGSIb3 -DQEBBQUAA4GBAGJO7grHeVHXetjHEK8urIxdnvfB2qeZeObz4GPKIkqUurjr0rfj -bA3EK1kDMR5aeQWR8RunixdM16Q6Ry0lEdLVWkdSwRN9dmirIHT9cypqnD/FYOia -SdezZ0lUzXgmJIwRYRwB1KSMMocIf52ll/xC2bEGg7/ZAEuAyAgcZV3X ------END CERTIFICATE REQUEST----- diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.key b/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.key deleted file mode 100644 index a53e7f7..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.key +++ /dev/null @@ -1,18 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,C8B5887048377F02 - -nyD5ZH0Wup2uWsDvurq5mKDaDrf8lvNn9w0SH/ZkVnfR1/bkwqrFriqJWvZNUG+q -nS0iBYczsWLJnbub9a1zLOTENWUKVD5uqbC3aGHhnoUTNSa27DONgP8gHOn6JgR+ -GAKo01HCSTiVT4LjkwN337QKHnMP2fTzg+IoC/CigvMcq09hRLwU1/guq0GJKGwH -gTxYNuYmQC4Tjh8vdS4liF+Ve/P3qPR2CehZrIOkDT8PHJBGQJRo4xGUIB7Tpk38 -VCk+UZ0JCS2coY8VkY/9tqFJp/ZnnQQVmaNbdRqg7ECKL+bXnNo7yjzmazPZmPe3 -/ShbE0+CTt7LrjCaQAxWbeDzqfo1lQfgN1LulTm8MCXpQaJpv7v1VhIhQ7afjMYb -4thW/ypHPiYS2YJCAkAVlua9Oxzzh1qJoh8Df19iHtpd79Q77X/qf+1JvITlMu0U -gi7yEatmQcmYNws1mtTC1q2DXrO90c+NZ0LK/Alse6NRL/xiUdjug2iHeTf/idOR -Gg/5dSZbnnlj1E5zjSMDkzg6EHAFmHV4jYGSAFLEQgp4V3ZhMVoWZrvvSHgKV/Qh -FqrAK4INr1G2+/QTd09AIRzfy3/j6yD4A9iNaOsEf9Ua7Qh6RcALRCAZTWR5QtEf -dX+iSNJ4E85qXs0PqwkMDkoaxIJ+tmIRJY7y8oeylV8cfGAi8Soubt/i3SlR8IHC -uDMas/2OnwafK3N7ODeE1i7r7wkzQkSHaEz0TrF8XRnP25jAICCSLiMdAAjKfxVb -EvzsFSuAy3Jt6bU3hSLY9o4YVYKE+68ITMv9yNjvTsEiW+T+IbN34w== ------END RSA PRIVATE KEY----- diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.srl b/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.srl deleted file mode 100644 index 17128db..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/ca.srl +++ /dev/null @@ -1 +0,0 @@ -ADF62016AA40C9C3 diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.cnf b/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.cnf deleted file mode 100644 index cd1fd1e..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.cnf +++ /dev/null @@ -1,19 +0,0 @@ -[ req ] -default_bits = 1024 -days = 3650 -distinguished_name = req_distinguished_name -attributes = req_attributes -prompt = no - -[ req_distinguished_name ] -C = US -ST = CA -L = Oakland -O = request -OU = testing -CN = testing.request.mikealrogers.com -emailAddress = mikeal@mikealrogers.com - -[ req_attributes ] -challengePassword = password challenge - diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.crt b/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.crt deleted file mode 100644 index efe96ce..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.crt +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICejCCAeMCCQCt9iAWqkDJwzANBgkqhkiG9w0BAQUFADCBojELMAkGA1UEBhMC -VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMRAwDgYDVQQKEwdyZXF1 -ZXN0MSYwJAYDVQQLEx1yZXF1ZXN0IENlcnRpZmljYXRlIEF1dGhvcml0eTESMBAG -A1UEAxMJcmVxdWVzdENBMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlrZWFscm9n -ZXJzLmNvbTAeFw0xMjAzMDEyMjUwNTZaFw0yMjAyMjcyMjUwNTZaMIGjMQswCQYD -VQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNVBAcTB09ha2xhbmQxEDAOBgNVBAoT -B3JlcXVlc3QxEDAOBgNVBAsTB3Rlc3RpbmcxKTAnBgNVBAMTIHRlc3RpbmcucmVx -dWVzdC5taWtlYWxyb2dlcnMuY29tMSYwJAYJKoZIhvcNAQkBFhdtaWtlYWxAbWlr -ZWFscm9nZXJzLmNvbTBcMA0GCSqGSIb3DQEBAQUAA0sAMEgCQQDgVl0jMumvOpmM -20W5v9yhGgZj8hPhEQF/N7yCBVBn/rWGYm70IHC8T/pR5c0LkWc5gdnCJEvKWQjh -DBKxZD8FAgMBAAEwDQYJKoZIhvcNAQEFBQADgYEABShRkNgFbgs4vUWW9R9deNJj -7HJoiTmvkmoOC7QzcYkjdgHbOxsSq3rBnwxsVjY9PAtPwBn0GRspOeG7KzKRgySB -kb22LyrCFKbEOfKO/+CJc80ioK9zEPVjGsFMyAB+ftYRqM+s/4cQlTg/m89l01wC -yapjN3RxZbInGhWR+jA= ------END CERTIFICATE----- diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.csr b/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.csr deleted file mode 100644 index a8e7595..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.csr +++ /dev/null @@ -1,11 +0,0 @@ ------BEGIN CERTIFICATE REQUEST----- -MIIBgjCCASwCAQAwgaMxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEQMA4GA1UE -BxMHT2FrbGFuZDEQMA4GA1UEChMHcmVxdWVzdDEQMA4GA1UECxMHdGVzdGluZzEp -MCcGA1UEAxMgdGVzdGluZy5yZXF1ZXN0Lm1pa2VhbHJvZ2Vycy5jb20xJjAkBgkq -hkiG9w0BCQEWF21pa2VhbEBtaWtlYWxyb2dlcnMuY29tMFwwDQYJKoZIhvcNAQEB -BQADSwAwSAJBAOBWXSMy6a86mYzbRbm/3KEaBmPyE+ERAX83vIIFUGf+tYZibvQg -cLxP+lHlzQuRZzmB2cIkS8pZCOEMErFkPwUCAwEAAaAjMCEGCSqGSIb3DQEJBzEU -ExJwYXNzd29yZCBjaGFsbGVuZ2UwDQYJKoZIhvcNAQEFBQADQQBD3E5WekQzCEJw -7yOcqvtPYIxGaX8gRKkYfLPoj3pm3GF5SGqtJKhylKfi89szHXgktnQgzff9FN+A -HidVJ/3u ------END CERTIFICATE REQUEST----- diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.js b/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.js deleted file mode 100644 index 05e21c1..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.js +++ /dev/null @@ -1,28 +0,0 @@ -var fs = require("fs") -var https = require("https") -var options = { key: fs.readFileSync("./server.key") - , cert: fs.readFileSync("./server.crt") } - -var server = https.createServer(options, function (req, res) { - res.writeHead(200) - res.end() - server.close() -}) -server.listen(1337) - -var ca = fs.readFileSync("./ca.crt") -var agent = new https.Agent({ host: "localhost", port: 1337, ca: ca }) - -https.request({ host: "localhost" - , method: "HEAD" - , port: 1337 - , headers: { host: "testing.request.mikealrogers.com" } - , agent: agent - , ca: [ ca ] - , path: "/" }, function (res) { - if (res.client.authorized) { - console.log("node test: OK") - } else { - throw new Error(res.client.authorizationError) - } -}).end() diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.key b/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.key deleted file mode 100644 index 72d8698..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/ca/server.key +++ /dev/null @@ -1,9 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIBOwIBAAJBAOBWXSMy6a86mYzbRbm/3KEaBmPyE+ERAX83vIIFUGf+tYZibvQg -cLxP+lHlzQuRZzmB2cIkS8pZCOEMErFkPwUCAwEAAQJAK+r8ZM2sze8s7FRo/ApB -iRBtO9fCaIdJwbwJnXKo4RKwZDt1l2mm+fzZ+/QaQNjY1oTROkIIXmnwRvZWfYlW -gQIhAPKYsG+YSBN9o8Sdp1DMyZ/rUifKX3OE6q9tINkgajDVAiEA7Ltqh01+cnt0 -JEnud/8HHcuehUBLMofeg0G+gCnSbXECIQCqDvkXsWNNLnS/3lgsnvH0Baz4sbeJ -rjIpuVEeg8eM5QIgbu0+9JmOV6ybdmmiMV4yAncoF35R/iKGVHDZCAsQzDECIQDZ -0jGz22tlo5YMcYSqrdD3U4sds1pwiAaWFRbCunoUJw== ------END RSA PRIVATE KEY----- diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/npm-ca.crt b/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/npm-ca.crt deleted file mode 100644 index fde2fe9..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/npm-ca.crt +++ /dev/null @@ -1,16 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIChzCCAfACCQDauvz/KHp8ejANBgkqhkiG9w0BAQUFADCBhzELMAkGA1UEBhMC -VVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMQwwCgYDVQQKEwNucG0x -IjAgBgNVBAsTGW5wbSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxDjAMBgNVBAMTBW5w -bUNBMRcwFQYJKoZIhvcNAQkBFghpQGl6cy5tZTAeFw0xMTA5MDUwMTQ3MTdaFw0y -MTA5MDIwMTQ3MTdaMIGHMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNV -BAcTB09ha2xhbmQxDDAKBgNVBAoTA25wbTEiMCAGA1UECxMZbnBtIENlcnRpZmlj -YXRlIEF1dGhvcml0eTEOMAwGA1UEAxMFbnBtQ0ExFzAVBgkqhkiG9w0BCQEWCGlA -aXpzLm1lMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLI4tIqPpRW+ACw9GE -OgBlJZwK5f8nnKCLK629Pv5yJpQKs3DENExAyOgDcyaF0HD0zk8zTp+ZsLaNdKOz -Gn2U181KGprGKAXP6DU6ByOJDWmTlY6+Ad1laYT0m64fERSpHw/hjD3D+iX4aMOl -y0HdbT5m1ZGh6SJz3ZqxavhHLQIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAC4ySDbC -l7W1WpLmtLGEQ/yuMLUf6Jy/vr+CRp4h+UzL+IQpCv8FfxsYE7dhf/bmWTEupBkv -yNL18lipt2jSvR3v6oAHAReotvdjqhxddpe5Holns6EQd1/xEZ7sB1YhQKJtvUrl -ZNufy1Jf1r0ldEGeA+0ISck7s+xSh9rQD2Op ------END CERTIFICATE----- diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/test.crt b/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/test.crt deleted file mode 100644 index b357f86..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/test.crt +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICQzCCAawCCQCO/XWtRFck1jANBgkqhkiG9w0BAQUFADBmMQswCQYDVQQGEwJU -SDEQMA4GA1UECBMHQmFuZ2tvazEOMAwGA1UEBxMFU2lsb20xGzAZBgNVBAoTElRo -ZSBSZXF1ZXN0IE1vZHVsZTEYMBYGA1UEAxMPcmVxdWVzdC5leGFtcGxlMB4XDTEx -MTIwMzAyMjkyM1oXDTIxMTEzMDAyMjkyM1owZjELMAkGA1UEBhMCVEgxEDAOBgNV -BAgTB0Jhbmdrb2sxDjAMBgNVBAcTBVNpbG9tMRswGQYDVQQKExJUaGUgUmVxdWVz -dCBNb2R1bGUxGDAWBgNVBAMTD3JlcXVlc3QuZXhhbXBsZTCBnzANBgkqhkiG9w0B -AQEFAAOBjQAwgYkCgYEAwmctddZqlA48+NXs0yOy92DijcQV1jf87zMiYAIlNUto -wghVbTWgJU5r0pdKrD16AptnWJTzKanhItEX8XCCPgsNkq1afgTtJP7rNkwu3xcj -eIMkhJg/ay4ZnkbnhYdsii5VTU5prix6AqWRAhbkBgoA+iVyHyof8wvZyKBoFTMC -AwEAATANBgkqhkiG9w0BAQUFAAOBgQB6BybMJbpeiABgihDfEVBcAjDoQ8gUMgwV -l4NulugfKTDmArqnR9aPd4ET5jX5dkMP4bwCHYsvrcYDeWEQy7x5WWuylOdKhua4 -L4cEi2uDCjqEErIG3cc1MCOk6Cl6Ld6tkIzQSf953qfdEACRytOeUqLNQcrXrqeE -c7U8F6MWLQ== ------END CERTIFICATE----- diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/test.key b/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/test.key deleted file mode 100644 index b85810d..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/ssl/test.key +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXgIBAAKBgQDCZy111mqUDjz41ezTI7L3YOKNxBXWN/zvMyJgAiU1S2jCCFVt -NaAlTmvSl0qsPXoCm2dYlPMpqeEi0RfxcII+Cw2SrVp+BO0k/us2TC7fFyN4gySE -mD9rLhmeRueFh2yKLlVNTmmuLHoCpZECFuQGCgD6JXIfKh/zC9nIoGgVMwIDAQAB -AoGBALXFwfUf8vHTSmGlrdZS2AGFPvEtuvldyoxi9K5u8xmdFCvxnOcLsF2RsTHt -Mu5QYWhUpNJoG+IGLTPf7RJdj/kNtEs7xXqWy4jR36kt5z5MJzqiK+QIgiO9UFWZ -fjUb6oeDnTIJA9YFBdYi97MDuL89iU/UK3LkJN3hd4rciSbpAkEA+MCkowF5kSFb -rkOTBYBXZfiAG78itDXN6DXmqb9XYY+YBh3BiQM28oxCeQYyFy6pk/nstnd4TXk6 -V/ryA2g5NwJBAMgRKTY9KvxJWbESeMEFe2iBIV0c26/72Amgi7ZKUCLukLfD4tLF -+WSZdmTbbqI1079YtwaiOVfiLm45Q/3B0eUCQAaQ/0eWSGE+Yi8tdXoVszjr4GXb -G81qBi91DMu6U1It+jNfIba+MPsiHLcZJMVb4/oWBNukN7bD1nhwFWdlnu0CQQCf -Is9WHkdvz2RxbZDxb8verz/7kXXJQJhx5+rZf7jIYFxqX3yvTNv3wf2jcctJaWlZ -fVZwB193YSivcgt778xlAkEAprYUz3jczjF5r2hrgbizPzPDR94tM5BTO3ki2v3w -kbf+j2g7FNAx6kZiVN8XwfLc8xEeUGiPKwtq3ddPDFh17w== ------END RSA PRIVATE KEY----- diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-body.js b/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-body.js deleted file mode 100644 index 9d2e188..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-body.js +++ /dev/null @@ -1,95 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetBuffer : - { resp : server.createGetResponse(new Buffer("TESTING!")) - , encoding: null - , expectBody: new Buffer("TESTING!") - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--frontier\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--frontier\r\n\r\n' + - 'Oh hi.' + - '\r\n--frontier--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - test.uri = s.url + '/' + i - request(test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) - diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-cookie.js b/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-cookie.js deleted file mode 100644 index 6c6a7a7..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-cookie.js +++ /dev/null @@ -1,29 +0,0 @@ -var Cookie = require('../vendor/cookie') - , assert = require('assert'); - -var str = 'Sid="s543qactge.wKE61E01Bs%2BKhzmxrwrnug="; Path=/; httpOnly; Expires=Sat, 04 Dec 2010 23:27:28 GMT'; -var cookie = new Cookie(str); - -// test .toString() -assert.equal(cookie.toString(), str); - -// test .path -assert.equal(cookie.path, '/'); - -// test .httpOnly -assert.equal(cookie.httpOnly, true); - -// test .name -assert.equal(cookie.name, 'Sid'); - -// test .value -assert.equal(cookie.value, '"s543qactge.wKE61E01Bs%2BKhzmxrwrnug="'); - -// test .expires -assert.equal(cookie.expires instanceof Date, true); - -// test .path default -var cookie = new Cookie('foo=bar', { url: 'http://foo.com/bar' }); -assert.equal(cookie.path, '/bar'); - -console.log('All tests passed'); diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-cookiejar.js b/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-cookiejar.js deleted file mode 100644 index 76fcd71..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-cookiejar.js +++ /dev/null @@ -1,90 +0,0 @@ -var Cookie = require('../vendor/cookie') - , Jar = require('../vendor/cookie/jar') - , assert = require('assert'); - -function expires(ms) { - return new Date(Date.now() + ms).toUTCString(); -} - -// test .get() expiration -(function() { - var jar = new Jar; - var cookie = new Cookie('sid=1234; path=/; expires=' + expires(1000)); - jar.add(cookie); - setTimeout(function(){ - var cookies = jar.get({ url: 'http://foo.com/foo' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], cookie); - setTimeout(function(){ - var cookies = jar.get({ url: 'http://foo.com/foo' }); - assert.equal(cookies.length, 0); - }, 1000); - }, 5); -})(); - -// test .get() path support -(function() { - var jar = new Jar; - var a = new Cookie('sid=1234; path=/'); - var b = new Cookie('sid=1111; path=/foo/bar'); - var c = new Cookie('sid=2222; path=/'); - jar.add(a); - jar.add(b); - jar.add(c); - - // should remove the duplicates - assert.equal(jar.cookies.length, 2); - - // same name, same path, latter prevails - var cookies = jar.get({ url: 'http://foo.com/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], c); - - // same name, diff path, path specifity prevails, latter prevails - var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], b); - - var jar = new Jar; - var a = new Cookie('sid=1111; path=/foo/bar'); - var b = new Cookie('sid=1234; path=/'); - jar.add(a); - jar.add(b); - - var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], a); - - var cookies = jar.get({ url: 'http://foo.com/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], b); - - var jar = new Jar; - var a = new Cookie('sid=1111; path=/foo/bar'); - var b = new Cookie('sid=3333; path=/foo/bar'); - var c = new Cookie('pid=3333; path=/foo/bar'); - var d = new Cookie('sid=2222; path=/foo/'); - var e = new Cookie('sid=1234; path=/'); - jar.add(a); - jar.add(b); - jar.add(c); - jar.add(d); - jar.add(e); - - var cookies = jar.get({ url: 'http://foo.com/foo/bar' }); - assert.equal(cookies.length, 2); - assert.equal(cookies[0], b); - assert.equal(cookies[1], c); - - var cookies = jar.get({ url: 'http://foo.com/foo/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], d); - - var cookies = jar.get({ url: 'http://foo.com/' }); - assert.equal(cookies.length, 1); - assert.equal(cookies[0], e); -})(); - -setTimeout(function() { - console.log('All tests passed'); -}, 1200); diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-defaults.js b/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-defaults.js deleted file mode 100644 index 6c8b58f..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-defaults.js +++ /dev/null @@ -1,68 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); - -s.listen(s.port, function () { - var counter = 0; - s.on('/get', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.method, 'GET') - resp.writeHead(200, {'Content-Type': 'text/plain'}); - resp.end('TESTING!'); - }); - - // test get(string, function) - request.defaults({headers:{foo:"bar"}})(s.url + '/get', function (e, r, b){ - if (e) throw e; - assert.deepEqual("TESTING!", b); - counter += 1; - }); - - s.on('/post', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.headers['content-type'], 'application/json'); - assert.equal(req.method, 'POST') - resp.writeHead(200, {'Content-Type': 'application/json'}); - resp.end(JSON.stringify({foo:'bar'})); - }); - - // test post(string, object, function) - request.defaults({headers:{foo:"bar"}}).post(s.url + '/post', {json: true}, function (e, r, b){ - if (e) throw e; - assert.deepEqual('bar', b.foo); - counter += 1; - }); - - s.on('/del', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.method, 'DELETE') - resp.writeHead(200, {'Content-Type': 'application/json'}); - resp.end(JSON.stringify({foo:'bar'})); - }); - - // test .del(string, function) - request.defaults({headers:{foo:"bar"}, json:true}).del(s.url + '/del', function (e, r, b){ - if (e) throw e; - assert.deepEqual('bar', b.foo); - counter += 1; - }); - - s.on('/head', function (req, resp) { - assert.equal(req.headers.foo, 'bar'); - assert.equal(req.method, 'HEAD') - resp.writeHead(200, {'Content-Type': 'text/plain'}); - resp.end(); - }); - - // test head.(object, function) - request.defaults({headers:{foo:"bar"}}).head({uri: s.url + '/head'}, function (e, r, b){ - if (e) throw e; - counter += 1; - console.log(counter.toString() + " tests passed.") - s.close() - }); - -}) diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-errors.js b/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-errors.js deleted file mode 100644 index 1986a59..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-errors.js +++ /dev/null @@ -1,37 +0,0 @@ -var server = require('./server') - , events = require('events') - , assert = require('assert') - , request = require('../main.js') - ; - -var local = 'http://localhost:8888/asdf' - -try { - request({uri:local, body:{}}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Argument error, options.body.') -} - -try { - request({uri:local, multipart: 'foo'}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Argument error, options.multipart.') -} - -try { - request({uri:local, multipart: [{}]}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Body attribute missing in multipart.') -} - -try { - request(local, {multipart: [{}]}) - assert.fail("Should have throw") -} catch(e) { - assert.equal(e.message, 'Body attribute missing in multipart.') -} - -console.log("All tests passed.") diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-headers.js b/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-headers.js deleted file mode 100644 index 31fe3f4..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-headers.js +++ /dev/null @@ -1,52 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , Cookie = require('../vendor/cookie') - , Jar = require('../vendor/cookie/jar') - , s = server.createServer() - -s.listen(s.port, function () { - var serverUri = 'http://localhost:' + s.port - , numTests = 0 - , numOutstandingTests = 0 - - function createTest(requestObj, serverAssertFn) { - var testNumber = numTests; - numTests += 1; - numOutstandingTests += 1; - s.on('/' + testNumber, function (req, res) { - serverAssertFn(req, res); - res.writeHead(200); - res.end(); - }); - requestObj.url = serverUri + '/' + testNumber - request(requestObj, function (err, res, body) { - assert.ok(!err) - assert.equal(res.statusCode, 200) - numOutstandingTests -= 1 - if (numOutstandingTests === 0) { - console.log(numTests + ' tests passed.') - s.close() - } - }) - } - - // Issue #125: headers.cookie shouldn't be replaced when a cookie jar isn't specified - createTest({headers: {cookie: 'foo=bar'}}, function (req, res) { - assert.ok(req.headers.cookie) - assert.equal(req.headers.cookie, 'foo=bar') - }) - - // Issue #125: headers.cookie + cookie jar - var jar = new Jar() - jar.add(new Cookie('quux=baz')); - createTest({jar: jar, headers: {cookie: 'foo=bar'}}, function (req, res) { - assert.ok(req.headers.cookie) - assert.equal(req.headers.cookie, 'foo=bar; quux=baz') - }) - - // There should be no cookie header when neither headers.cookie nor a cookie jar is specified - createTest({}, function (req, res) { - assert.ok(!req.headers.cookie) - }) -}) diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-httpModule.js b/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-httpModule.js deleted file mode 100644 index 1866de2..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-httpModule.js +++ /dev/null @@ -1,94 +0,0 @@ -var http = require('http') - , https = require('https') - , server = require('./server') - , assert = require('assert') - , request = require('../main.js') - - -var faux_requests_made = {'http':0, 'https':0} -function wrap_request(name, module) { - // Just like the http or https module, but note when a request is made. - var wrapped = {} - Object.keys(module).forEach(function(key) { - var value = module[key]; - - if(key != 'request') - wrapped[key] = value; - else - wrapped[key] = function(options, callback) { - faux_requests_made[name] += 1 - return value.apply(this, arguments) - } - }) - - return wrapped; -} - - -var faux_http = wrap_request('http', http) - , faux_https = wrap_request('https', https) - , plain_server = server.createServer() - , https_server = server.createSSLServer() - - -plain_server.listen(plain_server.port, function() { - plain_server.on('/plain', function (req, res) { - res.writeHead(200) - res.end('plain') - }) - plain_server.on('/to_https', function (req, res) { - res.writeHead(301, {'location':'https://localhost:'+https_server.port + '/https'}) - res.end() - }) - - https_server.listen(https_server.port, function() { - https_server.on('/https', function (req, res) { - res.writeHead(200) - res.end('https') - }) - https_server.on('/to_plain', function (req, res) { - res.writeHead(302, {'location':'http://localhost:'+plain_server.port + '/plain'}) - res.end() - }) - - run_tests() - run_tests({}) - run_tests({'http:':faux_http}) - run_tests({'https:':faux_https}) - run_tests({'http:':faux_http, 'https:':faux_https}) - }) -}) - -function run_tests(httpModules) { - var to_https = 'http://localhost:'+plain_server.port+'/to_https' - var to_plain = 'https://localhost:'+https_server.port+'/to_plain' - - request(to_https, {'httpModules':httpModules}, function (er, res, body) { - assert.ok(!er, 'Bounce to SSL worked') - assert.equal(body, 'https', 'Received HTTPS server body') - done() - }) - - request(to_plain, {'httpModules':httpModules}, function (er, res, body) { - assert.ok(!er, 'Bounce to plaintext server worked') - assert.equal(body, 'plain', 'Received HTTPS server body') - done() - }) -} - - -var passed = 0; -function done() { - passed += 1 - var expected = 10 - - if(passed == expected) { - plain_server.close() - https_server.close() - - assert.equal(faux_requests_made.http, 4, 'Wrapped http module called appropriately') - assert.equal(faux_requests_made.https, 4, 'Wrapped https module called appropriately') - - console.log((expected+2) + ' tests passed.') - } -} diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-https-strict.js b/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-https-strict.js deleted file mode 100644 index f53fc14..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-https-strict.js +++ /dev/null @@ -1,97 +0,0 @@ -// a test where we validate the siguature of the keys -// otherwise exactly the same as the ssl test - -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , fs = require('fs') - , path = require('path') - , opts = { key: path.resolve(__dirname, 'ssl/ca/server.key') - , cert: path.resolve(__dirname, 'ssl/ca/server.crt') } - , s = server.createSSLServer(null, opts) - , caFile = path.resolve(__dirname, 'ssl/ca/ca.crt') - , ca = fs.readFileSync(caFile) - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--frontier\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--frontier\r\n\r\n' + - 'Oh hi.' + - '\r\n--frontier--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - test.uri = s.url + '/' + i - test.strictSSL = true - test.ca = ca - test.headers = { host: 'testing.request.mikealrogers.com' } - request(test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-https.js b/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-https.js deleted file mode 100644 index df7330b..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-https.js +++ /dev/null @@ -1,86 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - -var s = server.createSSLServer(); - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--frontier\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--frontier\r\n\r\n' + - 'Oh hi.' + - '\r\n--frontier--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - test.uri = s.url + '/' + i - request(test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-oauth.js b/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-oauth.js deleted file mode 100644 index 72ca923..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-oauth.js +++ /dev/null @@ -1,117 +0,0 @@ -var hmacsign = require('../oauth').hmacsign - , assert = require('assert') - , qs = require('querystring') - , request = require('../main') - ; - -function getsignature (r) { - var sign - r.headers.Authorization.slice('OAuth '.length).replace(/,\ /g, ',').split(',').forEach(function (v) { - if (v.slice(0, 'oauth_signature="'.length) === 'oauth_signature="') sign = v.slice('oauth_signature="'.length, -1) - }) - return decodeURIComponent(sign) -} - -// Tests from Twitter documentation https://dev.twitter.com/docs/auth/oauth - -var reqsign = hmacsign('POST', 'https://api.twitter.com/oauth/request_token', - { oauth_callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11' - , oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g' - , oauth_nonce: 'QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk' - , oauth_signature_method: 'HMAC-SHA1' - , oauth_timestamp: '1272323042' - , oauth_version: '1.0' - }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98") - -console.log(reqsign) -console.log('8wUi7m5HFQy76nowoCThusfgB+Q=') -assert.equal(reqsign, '8wUi7m5HFQy76nowoCThusfgB+Q=') - -var accsign = hmacsign('POST', 'https://api.twitter.com/oauth/access_token', - { oauth_consumer_key: 'GDdmIQH6jhtmLUypg82g' - , oauth_nonce: '9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8' - , oauth_signature_method: 'HMAC-SHA1' - , oauth_token: '8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc' - , oauth_timestamp: '1272323047' - , oauth_verifier: 'pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY' - , oauth_version: '1.0' - }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "x6qpRnlEmW9JbQn4PQVVeVG8ZLPEx6A0TOebgwcuA") - -console.log(accsign) -console.log('PUw/dHA4fnlJYM6RhXk5IU/0fCc=') -assert.equal(accsign, 'PUw/dHA4fnlJYM6RhXk5IU/0fCc=') - -var upsign = hmacsign('POST', 'http://api.twitter.com/1/statuses/update.json', - { oauth_consumer_key: "GDdmIQH6jhtmLUypg82g" - , oauth_nonce: "oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y" - , oauth_signature_method: "HMAC-SHA1" - , oauth_token: "819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw" - , oauth_timestamp: "1272325550" - , oauth_version: "1.0" - , status: 'setting up my twitter 私のさえずりを設定する' - }, "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98", "J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA") - -console.log(upsign) -console.log('yOahq5m0YjDDjfjxHaXEsW9D+X0=') -assert.equal(upsign, 'yOahq5m0YjDDjfjxHaXEsW9D+X0=') - - -var rsign = request.post( - { url: 'https://api.twitter.com/oauth/request_token' - , oauth: - { callback: 'http://localhost:3005/the_dance/process_callback?service_provider_id=11' - , consumer_key: 'GDdmIQH6jhtmLUypg82g' - , nonce: 'QP70eNmVz8jvdPevU3oJD2AfF7R7odC2XJcn4XlZJqk' - , timestamp: '1272323042' - , version: '1.0' - , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" - } - }) - -setTimeout(function () { - console.log(getsignature(rsign)) - assert.equal(reqsign, getsignature(rsign)) -}) - -var raccsign = request.post( - { url: 'https://api.twitter.com/oauth/access_token' - , oauth: - { consumer_key: 'GDdmIQH6jhtmLUypg82g' - , nonce: '9zWH6qe0qG7Lc1telCn7FhUbLyVdjEaL3MO5uHxn8' - , signature_method: 'HMAC-SHA1' - , token: '8ldIZyxQeVrFZXFOZH5tAwj6vzJYuLQpl0WUEYtWc' - , timestamp: '1272323047' - , verifier: 'pDNg57prOHapMbhv25RNf75lVRd6JDsni1AJJIDYoTY' - , version: '1.0' - , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" - , token_secret: "x6qpRnlEmW9JbQn4PQVVeVG8ZLPEx6A0TOebgwcuA" - } - }) - -setTimeout(function () { - console.log(getsignature(raccsign)) - assert.equal(accsign, getsignature(raccsign)) -}, 1) - -var rupsign = request.post( - { url: 'http://api.twitter.com/1/statuses/update.json' - , oauth: - { consumer_key: "GDdmIQH6jhtmLUypg82g" - , nonce: "oElnnMTQIZvqvlfXM56aBLAf5noGD0AQR3Fmi7Q6Y" - , signature_method: "HMAC-SHA1" - , token: "819797-Jxq8aYUDRmykzVKrgoLhXSq67TEa5ruc4GJC2rWimw" - , timestamp: "1272325550" - , version: "1.0" - , consumer_secret: "MCD8BKwGdgPHvAuvgvz4EQpqDAtx89grbuNMRd7Eh98" - , token_secret: "J6zix3FfA9LofH0awS24M3HcBYXO5nI1iYe8EfBA" - } - , form: {status: 'setting up my twitter 私のさえずりを設定する'} - }) -setTimeout(function () { - console.log(getsignature(rupsign)) - assert.equal(upsign, getsignature(rupsign)) -}, 1) - - - - diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-params.js b/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-params.js deleted file mode 100644 index 8354f6d..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-params.js +++ /dev/null @@ -1,92 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); - -var tests = - { testGet : - { resp : server.createGetResponse("TESTING!") - , expectBody: "TESTING!" - } - , testGetChunkBreak : - { resp : server.createChunkResponse( - [ new Buffer([239]) - , new Buffer([163]) - , new Buffer([191]) - , new Buffer([206]) - , new Buffer([169]) - , new Buffer([226]) - , new Buffer([152]) - , new Buffer([131]) - ]) - , expectBody: "Ω☃" - } - , testGetBuffer : - { resp : server.createGetResponse(new Buffer("TESTING!")) - , encoding: null - , expectBody: new Buffer("TESTING!") - } - , testGetJSON : - { resp : server.createGetResponse('{"test":true}', 'application/json') - , json : true - , expectBody: {"test":true} - } - , testPutString : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : "PUTTINGDATA" - } - , testPutBuffer : - { resp : server.createPostValidator("PUTTINGDATA") - , method : "PUT" - , body : new Buffer("PUTTINGDATA") - } - , testPutJSON : - { resp : server.createPostValidator(JSON.stringify({foo: 'bar'})) - , method: "PUT" - , json: {foo: 'bar'} - } - , testPutMultipart : - { resp: server.createPostValidator( - '--frontier\r\n' + - 'content-type: text/html\r\n' + - '\r\n' + - 'Oh hi.' + - '\r\n--frontier\r\n\r\n' + - 'Oh hi.' + - '\r\n--frontier--' - ) - , method: "PUT" - , multipart: - [ {'content-type': 'text/html', 'body': 'Oh hi.'} - , {'body': 'Oh hi.'} - ] - } - } - -s.listen(s.port, function () { - - var counter = 0 - - for (i in tests) { - (function () { - var test = tests[i] - s.on('/'+i, test.resp) - //test.uri = s.url + '/' + i - request(s.url + '/' + i, test, function (err, resp, body) { - if (err) throw err - if (test.expectBody) { - assert.deepEqual(test.expectBody, body) - } - counter = counter - 1; - if (counter === 0) { - console.log(Object.keys(tests).length+" tests passed.") - s.close() - } - }) - counter++ - })() - } -}) diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-pipes.js b/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-pipes.js deleted file mode 100644 index 1869874..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-pipes.js +++ /dev/null @@ -1,202 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , fs = require('fs') - , request = require('../main.js') - , path = require('path') - , util = require('util') - ; - -var s = server.createServer(3453); - -function ValidationStream(str) { - this.str = str - this.buf = '' - this.on('data', function (data) { - this.buf += data - }) - this.on('end', function () { - assert.equal(this.str, this.buf) - }) - this.writable = true -} -util.inherits(ValidationStream, stream.Stream) -ValidationStream.prototype.write = function (chunk) { - this.emit('data', chunk) -} -ValidationStream.prototype.end = function (chunk) { - if (chunk) emit('data', chunk) - this.emit('end') -} - -s.listen(s.port, function () { - counter = 0; - - var check = function () { - counter = counter - 1 - if (counter === 0) { - console.log('All tests passed.') - setTimeout(function () { - process.exit(); - }, 500) - } - } - - // Test pipeing to a request object - s.once('/push', server.createPostValidator("mydata")); - - var mydata = new stream.Stream(); - mydata.readable = true - - counter++ - var r1 = request.put({url:'http://localhost:3453/push'}, function () { - check(); - }) - mydata.pipe(r1) - - mydata.emit('data', 'mydata'); - mydata.emit('end'); - - - // Test pipeing from a request object. - s.once('/pull', server.createGetResponse("mypulldata")); - - var mypulldata = new stream.Stream(); - mypulldata.writable = true - - counter++ - request({url:'http://localhost:3453/pull'}).pipe(mypulldata) - - var d = ''; - - mypulldata.write = function (chunk) { - d += chunk; - } - mypulldata.end = function () { - assert.equal(d, 'mypulldata'); - check(); - }; - - - s.on('/cat', function (req, resp) { - if (req.method === "GET") { - resp.writeHead(200, {'content-type':'text/plain-test', 'content-length':4}); - resp.end('asdf') - } else if (req.method === "PUT") { - assert.equal(req.headers['content-type'], 'text/plain-test'); - assert.equal(req.headers['content-length'], 4) - var validate = ''; - - req.on('data', function (chunk) {validate += chunk}) - req.on('end', function () { - resp.writeHead(201); - resp.end(); - assert.equal(validate, 'asdf'); - check(); - }) - } - }) - s.on('/pushjs', function (req, resp) { - if (req.method === "PUT") { - assert.equal(req.headers['content-type'], 'text/javascript'); - check(); - } - }) - s.on('/catresp', function (req, resp) { - request.get('http://localhost:3453/cat').pipe(resp) - }) - s.on('/doodle', function (req, resp) { - if (req.headers['x-oneline-proxy']) { - resp.setHeader('x-oneline-proxy', 'yup') - } - resp.writeHead('200', {'content-type':'image/png'}) - fs.createReadStream(path.join(__dirname, 'googledoodle.png')).pipe(resp) - }) - s.on('/onelineproxy', function (req, resp) { - var x = request('http://localhost:3453/doodle') - req.pipe(x) - x.pipe(resp) - }) - - counter++ - fs.createReadStream(__filename).pipe(request.put('http://localhost:3453/pushjs')) - - counter++ - request.get('http://localhost:3453/cat').pipe(request.put('http://localhost:3453/cat')) - - counter++ - request.get('http://localhost:3453/catresp', function (e, resp, body) { - assert.equal(resp.headers['content-type'], 'text/plain-test'); - assert.equal(resp.headers['content-length'], 4) - check(); - }) - - var doodleWrite = fs.createWriteStream(path.join(__dirname, 'test.png')) - - counter++ - request.get('http://localhost:3453/doodle').pipe(doodleWrite) - - doodleWrite.on('close', function () { - assert.deepEqual(fs.readFileSync(path.join(__dirname, 'googledoodle.png')), fs.readFileSync(path.join(__dirname, 'test.png'))) - check() - }) - - process.on('exit', function () { - fs.unlinkSync(path.join(__dirname, 'test.png')) - }) - - counter++ - request.get({uri:'http://localhost:3453/onelineproxy', headers:{'x-oneline-proxy':'nope'}}, function (err, resp, body) { - assert.equal(resp.headers['x-oneline-proxy'], 'yup') - check() - }) - - s.on('/afterresponse', function (req, resp) { - resp.write('d') - resp.end() - }) - - counter++ - var afterresp = request.post('http://localhost:3453/afterresponse').on('response', function () { - var v = new ValidationStream('d') - afterresp.pipe(v) - v.on('end', check) - }) - - s.on('/forward1', function (req, resp) { - resp.writeHead(302, {location:'/forward2'}) - resp.end() - }) - s.on('/forward2', function (req, resp) { - resp.writeHead('200', {'content-type':'image/png'}) - resp.write('d') - resp.end() - }) - - counter++ - var validateForward = new ValidationStream('d') - validateForward.on('end', check) - request.get('http://localhost:3453/forward1').pipe(validateForward) - - // Test pipe options - s.once('/opts', server.createGetResponse('opts response')); - - var optsStream = new stream.Stream(); - optsStream.writable = true - - var optsData = ''; - optsStream.write = function (buf) { - optsData += buf; - if (optsData === 'opts response') { - setTimeout(check, 10); - } - } - - optsStream.end = function () { - assert.fail('end called') - }; - - counter++ - request({url:'http://localhost:3453/opts'}).pipe(optsStream, { end : false }) -}) diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-proxy.js b/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-proxy.js deleted file mode 100644 index 647157c..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-proxy.js +++ /dev/null @@ -1,39 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , fs = require('fs') - , request = require('../main.js') - , path = require('path') - , util = require('util') - ; - -var port = 6768 - , called = false - , proxiedHost = 'google.com' - ; - -var s = server.createServer(port) -s.listen(port, function () { - s.on('http://google.com/', function (req, res) { - called = true - assert.equal(req.headers.host, proxiedHost) - res.writeHeader(200) - res.end() - }) - request ({ - url: 'http://'+proxiedHost, - proxy: 'http://localhost:'+port - /* - //should behave as if these arguments where passed: - url: 'http://localhost:'+port, - headers: {host: proxiedHost} - //*/ - }, function (err, res, body) { - s.close() - }) -}) - -process.on('exit', function () { - assert.ok(called, 'the request must be made to the proxy server') -}) diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-qs.js b/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-qs.js deleted file mode 100644 index 1aac22b..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-qs.js +++ /dev/null @@ -1,28 +0,0 @@ -var request = request = require('../main.js') - , assert = require('assert') - ; - - -// Test adding a querystring -var req1 = request.get({ uri: 'http://www.google.com', qs: { q : 'search' }}) -setTimeout(function() { - assert.equal('/?q=search', req1.path) -}, 1) - -// Test replacing a querystring value -var req2 = request.get({ uri: 'http://www.google.com?q=abc', qs: { q : 'search' }}) -setTimeout(function() { - assert.equal('/?q=search', req2.path) -}, 1) - -// Test appending a querystring value to the ones present in the uri -var req3 = request.get({ uri: 'http://www.google.com?x=y', qs: { q : 'search' }}) -setTimeout(function() { - assert.equal('/?x=y&q=search', req3.path) -}, 1) - -// Test leaving a querystring alone -var req4 = request.get({ uri: 'http://www.google.com?x=y'}) -setTimeout(function() { - assert.equal('/?x=y', req4.path) -}, 1) diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-redirect.js b/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-redirect.js deleted file mode 100644 index b84844a..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-redirect.js +++ /dev/null @@ -1,154 +0,0 @@ -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , Cookie = require('../vendor/cookie') - , Jar = require('../vendor/cookie/jar') - -var s = server.createServer() - -s.listen(s.port, function () { - var server = 'http://localhost:' + s.port; - var hits = {} - var passed = 0; - - bouncer(301, 'temp') - bouncer(302, 'perm') - bouncer(302, 'nope') - - function bouncer(code, label) { - var landing = label+'_landing'; - - s.on('/'+label, function (req, res) { - hits[label] = true; - res.writeHead(code, { - 'location':server + '/'+landing, - 'set-cookie': 'ham=eggs' - }) - res.end() - }) - - s.on('/'+landing, function (req, res) { - if (req.method !== 'GET') { // We should only accept GET redirects - console.error("Got a non-GET request to the redirect destination URL"); - res.writeHead(400); - res.end(); - return; - } - // Make sure the cookie doesn't get included twice, see #139: - // Make sure cookies are set properly after redirect - assert.equal(req.headers.cookie, 'foo=bar; quux=baz; ham=eggs'); - hits[landing] = true; - res.writeHead(200) - res.end(landing) - }) - } - - // Permanent bounce - var jar = new Jar() - jar.add(new Cookie('quux=baz')) - request({uri: server+'/perm', jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - if (er) throw er - if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode) - assert.ok(hits.perm, 'Original request is to /perm') - assert.ok(hits.perm_landing, 'Forward to permanent landing URL') - assert.equal(body, 'perm_landing', 'Got permanent landing content') - passed += 1 - done() - }) - - // Temporary bounce - request({uri: server+'/temp', jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - if (er) throw er - if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode) - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(hits.temp_landing, 'Forward to temporary landing URL') - assert.equal(body, 'temp_landing', 'Got temporary landing content') - passed += 1 - done() - }) - - // Prevent bouncing. - request({uri:server+'/nope', jar: jar, headers: {cookie: 'foo=bar'}, followRedirect:false}, function (er, res, body) { - if (er) throw er - if (res.statusCode !== 302) throw new Error('Status is not 302: '+res.statusCode) - assert.ok(hits.nope, 'Original request to /nope') - assert.ok(!hits.nope_landing, 'No chasing the redirect') - assert.equal(res.statusCode, 302, 'Response is the bounce itself') - passed += 1 - done() - }) - - // Should not follow post redirects by default - request.post(server+'/temp', { jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - if (er) throw er - if (res.statusCode !== 301) throw new Error('Status is not 301: '+res.statusCode) - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect when post') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - done() - }) - - // Should follow post redirects when followAllRedirects true - request.post({uri:server+'/temp', followAllRedirects:true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - if (er) throw er - if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode) - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(hits.temp_landing, 'Forward to temporary landing URL') - assert.equal(body, 'temp_landing', 'Got temporary landing content') - passed += 1 - done() - }) - - request.post({uri:server+'/temp', followAllRedirects:false, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - if (er) throw er - if (res.statusCode !== 301) throw new Error('Status is not 301: '+res.statusCode) - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - done() - }) - - // Should not follow delete redirects by default - request.del(server+'/temp', { jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - if (er) throw er - if (res.statusCode < 301) throw new Error('Status is not a redirect.') - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect when delete') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - done() - }) - - // Should not follow delete redirects even if followRedirect is set to true - request.del(server+'/temp', { followRedirect: true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - if (er) throw er - if (res.statusCode !== 301) throw new Error('Status is not 301: '+res.statusCode) - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(!hits.temp_landing, 'No chasing the redirect when delete') - assert.equal(res.statusCode, 301, 'Response is the bounce itself') - passed += 1 - done() - }) - - // Should follow delete redirects when followAllRedirects true - request.del(server+'/temp', {followAllRedirects:true, jar: jar, headers: {cookie: 'foo=bar'}}, function (er, res, body) { - if (er) throw er - if (res.statusCode !== 200) throw new Error('Status is not 200: '+res.statusCode) - assert.ok(hits.temp, 'Original request is to /temp') - assert.ok(hits.temp_landing, 'Forward to temporary landing URL') - assert.equal(body, 'temp_landing', 'Got temporary landing content') - passed += 1 - done() - }) - - var reqs_done = 0; - function done() { - reqs_done += 1; - if(reqs_done == 9) { - console.log(passed + ' tests passed.') - s.close() - } - } -}) diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-timeout.js b/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-timeout.js deleted file mode 100644 index 673f8ad..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-timeout.js +++ /dev/null @@ -1,87 +0,0 @@ -var server = require('./server') - , events = require('events') - , stream = require('stream') - , assert = require('assert') - , request = require('../main.js') - ; - -var s = server.createServer(); -var expectedBody = "waited"; -var remainingTests = 5; - -s.listen(s.port, function () { - // Request that waits for 200ms - s.on('/timeout', function (req, resp) { - setTimeout(function(){ - resp.writeHead(200, {'content-type':'text/plain'}) - resp.write(expectedBody) - resp.end() - }, 200); - }); - - // Scenario that should timeout - var shouldTimeout = { - url: s.url + "/timeout", - timeout:100 - } - - - request(shouldTimeout, function (err, resp, body) { - assert.equal(err.code, "ETIMEDOUT"); - checkDone(); - }) - - - // Scenario that shouldn't timeout - var shouldntTimeout = { - url: s.url + "/timeout", - timeout:300 - } - - request(shouldntTimeout, function (err, resp, body) { - assert.equal(err, null); - assert.equal(expectedBody, body) - checkDone(); - }) - - // Scenario with no timeout set, so shouldn't timeout - var noTimeout = { - url: s.url + "/timeout" - } - - request(noTimeout, function (err, resp, body) { - assert.equal(err); - assert.equal(expectedBody, body) - checkDone(); - }) - - // Scenario with a negative timeout value, should be treated a zero or the minimum delay - var negativeTimeout = { - url: s.url + "/timeout", - timeout:-1000 - } - - request(negativeTimeout, function (err, resp, body) { - assert.equal(err.code, "ETIMEDOUT"); - checkDone(); - }) - - // Scenario with a float timeout value, should be rounded by setTimeout anyway - var floatTimeout = { - url: s.url + "/timeout", - timeout: 100.76 - } - - request(floatTimeout, function (err, resp, body) { - assert.equal(err.code, "ETIMEDOUT"); - checkDone(); - }) - - function checkDone() { - if(--remainingTests == 0) { - s.close(); - console.log("All tests passed."); - } - } -}) - diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-toJSON.js b/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-toJSON.js deleted file mode 100644 index c81dfb5..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-toJSON.js +++ /dev/null @@ -1,14 +0,0 @@ -var request = require('../main') - , http = require('http') - , assert = require('assert') - ; - -var s = http.createServer(function (req, resp) { - resp.statusCode = 200 - resp.end('asdf') -}).listen(8080, function () { - var r = request('http://localhost:8080', function (e, resp) { - assert(JSON.parse(JSON.stringify(r)).response.statusCode, 200) - s.close() - }) -}) \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-tunnel.js b/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-tunnel.js deleted file mode 100644 index 58131b9..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tests/test-tunnel.js +++ /dev/null @@ -1,61 +0,0 @@ -// test that we can tunnel a https request over an http proxy -// keeping all the CA and whatnot intact. -// -// Note: this requires that squid is installed. -// If the proxy fails to start, we'll just log a warning and assume success. - -var server = require('./server') - , assert = require('assert') - , request = require('../main.js') - , fs = require('fs') - , path = require('path') - , caFile = path.resolve(__dirname, 'ssl/npm-ca.crt') - , ca = fs.readFileSync(caFile) - , child_process = require('child_process') - , sqConf = path.resolve(__dirname, 'squid.conf') - , sqArgs = ['-f', sqConf, '-N', '-d', '5'] - , proxy = 'http://localhost:3128' - , hadError = null - -var squid = child_process.spawn('squid', sqArgs); -var ready = false - -squid.stderr.on('data', function (c) { - console.error('SQUIDERR ' + c.toString().trim().split('\n') - .join('\nSQUIDERR ')) - ready = c.toString().match(/ready to serve requests/i) -}) - -squid.stdout.on('data', function (c) { - console.error('SQUIDOUT ' + c.toString().trim().split('\n') - .join('\nSQUIDOUT ')) -}) - -squid.on('exit', function (c) { - console.error('exit '+c) - if (c && !ready) { - console.error('squid must be installed to run this test.') - c = null - hadError = null - process.exit(0) - return - } - - if (c) { - hadError = hadError || new Error('Squid exited with '+c) - } - if (hadError) throw hadError -}) - -setTimeout(function F () { - if (!ready) return setTimeout(F, 100) - request({ uri: 'https://registry.npmjs.org/request/' - , proxy: 'http://localhost:3128' - , ca: ca - , json: true }, function (er, body) { - hadError = er - console.log(er || typeof body) - if (!er) console.log("ok") - squid.kill('SIGKILL') - }) -}, 100) diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/tunnel.js b/node_modules/winston/node_modules/loggly/node_modules/request/tunnel.js deleted file mode 100644 index 453786c..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/tunnel.js +++ /dev/null @@ -1,229 +0,0 @@ -'use strict'; - -var net = require('net'); -var tls = require('tls'); -var http = require('http'); -var https = require('https'); -var events = require('events'); -var assert = require('assert'); -var util = require('util'); - - -exports.httpOverHttp = httpOverHttp; -exports.httpsOverHttp = httpsOverHttp; -exports.httpOverHttps = httpOverHttps; -exports.httpsOverHttps = httpsOverHttps; - - -function httpOverHttp(options) { - var agent = new TunnelingAgent(options); - agent.request = http.request; - return agent; -} - -function httpsOverHttp(options) { - var agent = new TunnelingAgent(options); - agent.request = http.request; - agent.createSocket = createSecureSocket; - return agent; -} - -function httpOverHttps(options) { - var agent = new TunnelingAgent(options); - agent.request = https.request; - return agent; -} - -function httpsOverHttps(options) { - var agent = new TunnelingAgent(options); - agent.request = https.request; - agent.createSocket = createSecureSocket; - return agent; -} - - -function TunnelingAgent(options) { - var self = this; - self.options = options || {}; - self.proxyOptions = self.options.proxy || {}; - self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets; - self.requests = []; - self.sockets = []; - - self.on('free', function onFree(socket, host, port) { - for (var i = 0, len = self.requests.length; i < len; ++i) { - var pending = self.requests[i]; - if (pending.host === host && pending.port === port) { - // Detect the request to connect same origin server, - // reuse the connection. - self.requests.splice(i, 1); - pending.request.onSocket(socket); - return; - } - } - socket.destroy(); - self.removeSocket(socket); - }); -} -util.inherits(TunnelingAgent, events.EventEmitter); - -TunnelingAgent.prototype.addRequest = function addRequest(req, host, port) { - var self = this; - - if (self.sockets.length >= this.maxSockets) { - // We are over limit so we'll add it to the queue. - self.requests.push({host: host, port: port, request: req}); - return; - } - - // If we are under maxSockets create a new one. - self.createSocket({host: host, port: port, request: req}, function(socket) { - socket.on('free', onFree); - socket.on('close', onCloseOrRemove); - socket.on('agentRemove', onCloseOrRemove); - req.onSocket(socket); - - function onFree() { - self.emit('free', socket, host, port); - } - - function onCloseOrRemove(err) { - self.removeSocket(); - socket.removeListener('free', onFree); - socket.removeListener('close', onCloseOrRemove); - socket.removeListener('agentRemove', onCloseOrRemove); - } - }); -}; - -TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { - var self = this; - var placeholder = {}; - self.sockets.push(placeholder); - - var connectOptions = mergeOptions({}, self.proxyOptions, { - method: 'CONNECT', - path: options.host + ':' + options.port, - agent: false - }); - if (connectOptions.proxyAuth) { - connectOptions.headers = connectOptions.headers || {}; - connectOptions.headers['Proxy-Authorization'] = 'Basic ' + - new Buffer(connectOptions.proxyAuth).toString('base64'); - } - - debug('making CONNECT request'); - var connectReq = self.request(connectOptions); - connectReq.useChunkedEncodingByDefault = false; // for v0.6 - connectReq.once('response', onResponse); // for v0.6 - connectReq.once('upgrade', onUpgrade); // for v0.6 - connectReq.once('connect', onConnect); // for v0.7 or later - connectReq.once('error', onError); - connectReq.end(); - - function onResponse(res) { - // Very hacky. This is necessary to avoid http-parser leaks. - res.upgrade = true; - } - - function onUpgrade(res, socket, head) { - // Hacky. - process.nextTick(function() { - onConnect(res, socket, head); - }); - } - - function onConnect(res, socket, head) { - connectReq.removeAllListeners(); - socket.removeAllListeners(); - - if (res.statusCode === 200) { - assert.equal(head.length, 0); - debug('tunneling connection has established'); - self.sockets[self.sockets.indexOf(placeholder)] = socket; - cb(socket); - } else { - debug('tunneling socket could not be established, statusCode=%d', - res.statusCode); - var error = new Error('tunneling socket could not be established, ' + - 'sutatusCode=' + res.statusCode); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - } - } - - function onError(cause) { - connectReq.removeAllListeners(); - - debug('tunneling socket could not be established, cause=%s\n', - cause.message, cause.stack); - var error = new Error('tunneling socket could not be established, ' + - 'cause=' + cause.message); - error.code = 'ECONNRESET'; - options.request.emit('error', error); - self.removeSocket(placeholder); - } -}; - -TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { - var pos = this.sockets.indexOf(socket) - if (pos === -1) { - return; - } - this.sockets.splice(pos, 1); - - var pending = this.requests.shift(); - if (pending) { - // If we have pending requests and a socket gets closed a new one - // needs to be created to take over in the pool for the one that closed. - this.createSocket(pending, function(socket) { - pending.request.onSocket(socket); - }); - } -}; - -function createSecureSocket(options, cb) { - var self = this; - TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { - // 0 is dummy port for v0.6 - var secureSocket = tls.connect(0, mergeOptions({}, self.options, { - socket: socket - })); - cb(secureSocket); - }); -} - - -function mergeOptions(target) { - for (var i = 1, len = arguments.length; i < len; ++i) { - var overrides = arguments[i]; - if (typeof overrides === 'object') { - var keys = Object.keys(overrides); - for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { - var k = keys[j]; - if (overrides[k] !== undefined) { - target[k] = overrides[k]; - } - } - } - } - return target; -} - - -var debug; -if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { - debug = function() { - var args = Array.prototype.slice.call(arguments); - if (typeof args[0] === 'string') { - args[0] = 'TUNNEL: ' + args[0]; - } else { - args.unshift('TUNNEL:'); - } - console.error.apply(console, args); - } -} else { - debug = function() {}; -} -exports.debug = debug; // for test diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/uuid.js b/node_modules/winston/node_modules/loggly/node_modules/request/uuid.js deleted file mode 100644 index 1d83bd5..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/uuid.js +++ /dev/null @@ -1,19 +0,0 @@ -module.exports = function () { - var s = [], itoh = '0123456789ABCDEF'; - - // Make array of random hex digits. The UUID only has 32 digits in it, but we - // allocate an extra items to make room for the '-'s we'll be inserting. - for (var i = 0; i <36; i++) s[i] = Math.floor(Math.random()*0x10); - - // Conform to RFC-4122, section 4.4 - s[14] = 4; // Set 4 high bits of time_high field to version - s[19] = (s[19] & 0x3) | 0x8; // Specify 2 high bits of clock sequence - - // Convert to hex chars - for (var i = 0; i <36; i++) s[i] = itoh[s[i]]; - - // Insert '-'s - s[8] = s[13] = s[18] = s[23] = '-'; - - return s.join(''); -} diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/vendor/cookie/index.js b/node_modules/winston/node_modules/loggly/node_modules/request/vendor/cookie/index.js deleted file mode 100644 index ff44b3e..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/vendor/cookie/index.js +++ /dev/null @@ -1,65 +0,0 @@ -/*! - * Tobi - Cookie - * Copyright(c) 2010 LearnBoost - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var url = require('url'); - -/** - * Initialize a new `Cookie` with the given cookie `str` and `req`. - * - * @param {String} str - * @param {IncomingRequest} req - * @api private - */ - -var Cookie = exports = module.exports = function Cookie(str, req) { - this.str = str; - - // Map the key/val pairs - str.split(/ *; */).reduce(function(obj, pair){ - var p = pair.indexOf('='); - var key = p > 0 ? pair.substring(0, p).trim() : pair.trim(); - var lowerCasedKey = key.toLowerCase(); - var value = p > 0 ? pair.substring(p + 1).trim() : true; - - if (!obj.name) { - // First key is the name - obj.name = key; - obj.value = value; - } - else if (lowerCasedKey === 'httponly') { - obj.httpOnly = value; - } - else { - obj[lowerCasedKey] = value; - } - return obj; - }, this); - - // Expires - this.expires = this.expires - ? new Date(this.expires) - : Infinity; - - // Default or trim path - this.path = this.path - ? this.path.trim(): req - ? url.parse(req.url).pathname: '/'; -}; - -/** - * Return the original cookie string. - * - * @return {String} - * @api public - */ - -Cookie.prototype.toString = function(){ - return this.str; -}; diff --git a/node_modules/winston/node_modules/loggly/node_modules/request/vendor/cookie/jar.js b/node_modules/winston/node_modules/loggly/node_modules/request/vendor/cookie/jar.js deleted file mode 100644 index 34920e0..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/request/vendor/cookie/jar.js +++ /dev/null @@ -1,72 +0,0 @@ -/*! -* Tobi - CookieJar -* Copyright(c) 2010 LearnBoost -* MIT Licensed -*/ - -/** -* Module dependencies. -*/ - -var url = require('url'); - -/** -* Initialize a new `CookieJar`. -* -* @api private -*/ - -var CookieJar = exports = module.exports = function CookieJar() { - this.cookies = []; -}; - -/** -* Add the given `cookie` to the jar. -* -* @param {Cookie} cookie -* @api private -*/ - -CookieJar.prototype.add = function(cookie){ - this.cookies = this.cookies.filter(function(c){ - // Avoid duplication (same path, same name) - return !(c.name == cookie.name && c.path == cookie.path); - }); - this.cookies.push(cookie); -}; - -/** -* Get cookies for the given `req`. -* -* @param {IncomingRequest} req -* @return {Array} -* @api private -*/ - -CookieJar.prototype.get = function(req){ - var path = url.parse(req.url).pathname - , now = new Date - , specificity = {}; - return this.cookies.filter(function(cookie){ - if (0 == path.indexOf(cookie.path) && now < cookie.expires - && cookie.path.length > (specificity[cookie.name] || 0)) - return specificity[cookie.name] = cookie.path.length; - }); -}; - -/** -* Return Cookie string for the given `req`. -* -* @param {IncomingRequest} req -* @return {String} -* @api private -*/ - -CookieJar.prototype.cookieString = function(req){ - var cookies = this.get(req); - if (cookies.length) { - return cookies.map(function(cookie){ - return cookie.name + '=' + cookie.value; - }).join('; '); - } -}; diff --git a/node_modules/winston/node_modules/loggly/node_modules/timespan/.npmignore b/node_modules/winston/node_modules/loggly/node_modules/timespan/.npmignore deleted file mode 100644 index e3bc275..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/timespan/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules/ -node_modules/* -npm-debug.log \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/node_modules/timespan/CHANGELOG.md b/node_modules/winston/node_modules/loggly/node_modules/timespan/CHANGELOG.md deleted file mode 100644 index 1effdd2..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/timespan/CHANGELOG.md +++ /dev/null @@ -1,15 +0,0 @@ -#VERSION HISTORY - -##2.0 -* [Breaking] Refactored this to work in node.js. Backwards compatibility to existing browser API coming in future 2.x releases. (indexzero) - -## 1.2 -* Added TimeSpan.FromDates Constructor to take two dates - and create a TimeSpan from the difference. (mstum) - -## 1.1 -* Changed naming to follow JavaScript standards (mstum) -* Added Documentation (mstum) - -## 1.0 -* Initial Revision (mstum) diff --git a/node_modules/winston/node_modules/loggly/node_modules/timespan/LICENSE b/node_modules/winston/node_modules/loggly/node_modules/timespan/LICENSE deleted file mode 100644 index 071d8fb..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/timespan/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010 Michael Stum, Charlie Robbins - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/node_modules/timespan/README.md b/node_modules/winston/node_modules/loggly/node_modules/timespan/README.md deleted file mode 100644 index 2bb9904..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/timespan/README.md +++ /dev/null @@ -1,199 +0,0 @@ -# timespan - -A simple implementation of TimeSpans in Javascript. - -## Installation in node.js - -### Installing npm (node package manager) -``` bash - $ curl http://npmjs.org/install.sh | sh -``` - -### Installing timespan -``` bash - [sudo] npm install timespan -``` - -## Usage -You have two options when creating a new TimeSpan object: either explicitly instantiate it using the TimeSpan constructor function or use a helper method to create from a specific length of time. - -### Using the new constructor - -``` js - var timespan = require('timespan'); - var ts = new timespan.TimeSpan(); -``` - -The constructor takes 5 parameters, all which are optional and which can be used to initialize the TimeSpan to a given value. These parameters are: `milliseconds`, `seconds`, `minutes`, `hours`, `days`. - -``` js - // - // Initializes the TimeSpan to 4 Minutes, 16 Seconds and 0 Milliseconds. - // - var ts = new TimeSpan(0,16,4) - - // - // Initializes the TimeSpan to 3 hours, 4 minutes, 10 seconds and 0 msecs. - // - var ts = new TimeSpan(0,10,64,2); -``` - -### Using Construction Helper Method(s) -You can initialize a new TimeSpan by calling one of these Functions: - -``` js - timespan.FromSeconds(/* seconds */); - timespan.FromMinutes(/* minutes */); - timespan.FromHours(/* hours */); - timespan.FromDays(/* hours */); - - // - // This behaves differently, see below - // - timespan.FromDates(start, end); -``` - -The first four helper methods take a single numeric parameter and create a new TimeSpan instance. e.g. `timespan.FromSeconds(45)` is equivalent to `new TimeSpan(0,45)`. If the parameter is invalid/not a number, it will just be treated as 0 no error will be thrown. - -`timespan.FromDates()` is different as it takes two dates. The TimeSpan will be the difference between these dates. - -If the second date is earlier than the first date, the TimeSpan will have a negative value. You can pass in "true" as the third parameter to force the TimeSpan to be positive always. - -``` js - var date1 = new Date(2010, 3, 1, 10, 10, 5, 0); - var date2 = new Date(2010, 3, 1, 10, 10, 10, 0); - var ts = TimeSpan.FromDates(date2, date1); - var ts2 = TimeSpan.FromDates(date2, date1, true); - - // - // -5, because we put the later date first - // - console.log(ts.totalSeconds()); - - // - // 5, because we passed true as third parameter - // - console.log(ts2.totalSeconds()); -``` - - -### Adding / Subtracting TimeSpans -There are several functions to add or subtract time: - -``` js - ts.addMilliseconds() - ts.addSeconds() - ts.addMinutes() - ts.addHours() - ts.addDays() - ts.subtractMilliseconds() - ts.subtractSeconds() - ts.subtractMinutes() - ts.subtractHours() - ts.subtractDays() -``` - -All these functions take a single numeric parameter. If the parameter is invalid, not a number, or missing it will be ignored and no Error is thrown. - -``` js - var ts = new TimeSpan(); - ts.addSeconds(30); - ts.addMinutes(2); - ts.subtractSeconds(60); - - // - // ts will now be a timespan of 1 minute and 30 seconds - // -``` - -The parameter can be negative to negate the operation `ts.addSeconds(-30)` is equivalent to `ts.subtractSeconds(30)`. - -### Interacting with Other TimeSpan instances -These are the functions that interact with another TimeSpan: - -``` js - ts.add() - ts.subtract() - ts.equals() -``` - -add and subtract add/subtract the other TimeSpan to the current one: - -``` js - var ts = TimeSpan.FromSeconds(30); - var ts2 = TimeSpan.FromMinutes(2); - ts.add(ts2); - - // - // ts is now a TimeSpan of 2 Minutes, 30 Seconds - // ts2 is unchanged - // -``` - -equals checks if two TimeSpans have the same time: - -``` js - var ts = TimeSpan.FromSeconds(30); - var ts2 = TimeSpan.FromSeconds(30); - var eq = ts.equals(ts2); // true - ts2.addSeconds(1); - var eq2 = ts.equals(ts2); // false -``` - -### Retrieving the Value of a TimeSpan -There are two sets of functions to retreive the function of the TimeSpan: those that deal with the full value in various measurements and another that gets the individual components. - -#### Retrieve the full value - -``` js - ts.totalMilliseconds() - ts.totalSeconds() - ts.totalMinutes() - ts.totalHours() - ts.totalDays() -``` - -These functions convert the value to the given format and return it. The result can be a floating point number. These functions take a single parameter roundDown which can be set to true to round the value down to an Integer. - -``` js - var ts = TimeSpan.fromSeconds(90); - console.log(ts.totalMilliseconds()); // 90000 - console.log(ts.totalSeconds()); // 90 - console.log(ts.totalMinutes()); // 1.5 - console.log(ts.totalMinutes(true)); // 1 -``` - -#### Retrieve a component of the TimeSpan - -``` js - ts.milliseconds - ts.seconds - ts.minutes - ts.hours - ts.days -``` - -These functions return a component of the TimeSpan that could be used to represent a clock. - -``` js - var ts = TimeSpan.FromSeconds(90); - console.log(ts.seconds()); // 30 - console.log(ts.minutes()); // 1 -``` - -Basically these value never "overflow" - seconds will only return 0 to 59, hours only 0 to 23 etc. Days could grow infinitely. All of these functions automatically round down the result: - -``` js - var ts = TimeSpan.FromDays(2); - ts.addHours(12); - console.log(ts.days()); // 2 - console.log(ts.hours()); // 12 -``` - -## Remark about Backwards Compatibility -Version 0.2.x was designed to work with [node.js][0] and backwards compatibility to the browser-based usage was not considered a high priority. This will be fixed in future versions, but for now if you need to use this in the browser, you can find the 0.1.x code under `/browser`. - -#### Author: [Michael Stum](http://www.stum.de) -#### Contributors: [Charlie Robbins](http://github.com/indexzero) - -[0]: http://nodejs.org \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/node_modules/timespan/browser/TimeSpan-1.2.js b/node_modules/winston/node_modules/loggly/node_modules/timespan/browser/TimeSpan-1.2.js deleted file mode 100644 index bc8149d..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/timespan/browser/TimeSpan-1.2.js +++ /dev/null @@ -1,226 +0,0 @@ -/*! -* JavaScript TimeSpan Library -* -* Copyright (c) 2010 Michael Stum, http://www.Stum.de/ -* -* Permission is hereby granted, free of charge, to any person obtaining -* a copy of this software and associated documentation files (the -* "Software"), to deal in the Software without restriction, including -* without limitation the rights to use, copy, modify, merge, publish, -* distribute, sublicense, and/or sell copies of the Software, and to -* permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice shall be -* included in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -/*global window: false */ -"use strict"; -(function () { - // Constructor function, all parameters are optional - var TimeSpan = window.TimeSpan = function (milliseconds, seconds, minutes, hours, days) { - var version = "1.2", - // Millisecond-constants - msecPerSecond = 1000, - msecPerMinute = 60000, - msecPerHour = 3600000, - msecPerDay = 86400000, - // Internally we store the TimeSpan as Milliseconds - msecs = 0, - - // Helper functions - isNumeric = function (input) { - return !isNaN(parseFloat(input)) && isFinite(input); - }; - - // Constructor Logic - if (isNumeric(days)) { - msecs += (days * msecPerDay); - } - if (isNumeric(hours)) { - msecs += (hours * msecPerHour); - } - if (isNumeric(minutes)) { - msecs += (minutes * msecPerMinute); - } - if (isNumeric(seconds)) { - msecs += (seconds * msecPerSecond); - } - if (isNumeric(milliseconds)) { - msecs += milliseconds; - } - - // Addition Functions - this.addMilliseconds = function (milliseconds) { - if (!isNumeric(milliseconds)) { - return; - } - msecs += milliseconds; - }; - this.addSeconds = function (seconds) { - if (!isNumeric(seconds)) { - return; - } - msecs += (seconds * msecPerSecond); - }; - this.addMinutes = function (minutes) { - if (!isNumeric(minutes)) { - return; - } - msecs += (minutes * msecPerMinute); - }; - this.addHours = function (hours) { - if (!isNumeric(hours)) { - return; - } - msecs += (hours * msecPerHour); - }; - this.addDays = function (days) { - if (!isNumeric(days)) { - return; - } - msecs += (days * msecPerDay); - }; - - // Subtraction Functions - this.subtractMilliseconds = function (milliseconds) { - if (!isNumeric(milliseconds)) { - return; - } - msecs -= milliseconds; - }; - this.subtractSeconds = function (seconds) { - if (!isNumeric(seconds)) { - return; - } - msecs -= (seconds * msecPerSecond); - }; - this.subtractMinutes = function (minutes) { - if (!isNumeric(minutes)) { - return; - } - msecs -= (minutes * msecPerMinute); - }; - this.subtractHours = function (hours) { - if (!isNumeric(hours)) { - return; - } - msecs -= (hours * msecPerHour); - }; - this.subtractDays = function (days) { - if (!isNumeric(days)) { - return; - } - msecs -= (days * msecPerDay); - }; - - // Functions to interact with other TimeSpans - this.isTimeSpan = true; - this.add = function (otherTimeSpan) { - if (!otherTimeSpan.isTimeSpan) { - return; - } - msecs += otherTimeSpan.totalMilliseconds(); - }; - this.subtract = function (otherTimeSpan) { - if (!otherTimeSpan.isTimeSpan) { - return; - } - msecs -= otherTimeSpan.totalMilliseconds(); - }; - this.equals = function (otherTimeSpan) { - if (!otherTimeSpan.isTimeSpan) { - return; - } - return msecs === otherTimeSpan.totalMilliseconds(); - }; - - // Getters - this.totalMilliseconds = function (roundDown) { - var result = msecs; - if (roundDown === true) { - result = Math.floor(result); - } - return result; - }; - this.totalSeconds = function (roundDown) { - var result = msecs / msecPerSecond; - if (roundDown === true) { - result = Math.floor(result); - } - return result; - }; - this.totalMinutes = function (roundDown) { - var result = msecs / msecPerMinute; - if (roundDown === true) { - result = Math.floor(result); - } - return result; - }; - this.totalHours = function (roundDown) { - var result = msecs / msecPerHour; - if (roundDown === true) { - result = Math.floor(result); - } - return result; - }; - this.totalDays = function (roundDown) { - var result = msecs / msecPerDay; - if (roundDown === true) { - result = Math.floor(result); - } - return result; - }; - // Return a Fraction of the TimeSpan - this.milliseconds = function () { - return msecs % 1000; - }; - this.seconds = function () { - return Math.floor(msecs / msecPerSecond) % 60; - }; - this.minutes = function () { - return Math.floor(msecs / msecPerMinute) % 60; - }; - this.hours = function () { - return Math.floor(msecs / msecPerHour) % 24; - }; - this.days = function () { - return Math.floor(msecs / msecPerDay); - }; - - // Misc. Functions - this.getVersion = function () { - return version; - }; - }; - - // "Static Constructors" - TimeSpan.FromSeconds = function (seconds) { - return new TimeSpan(0, seconds, 0, 0, 0); - }; - TimeSpan.FromMinutes = function (minutes) { - return new TimeSpan(0, 0, minutes, 0, 0); - }; - TimeSpan.FromHours = function (hours) { - return new TimeSpan(0, 0, 0, hours, 0); - }; - TimeSpan.FromDays = function (days) { - return new TimeSpan(0, 0, 0, 0, days); - }; - TimeSpan.FromDates = function (firstDate, secondDate, forcePositive) { - var differenceMsecs = secondDate.valueOf() - firstDate.valueOf(); - if(forcePositive === true) { - differenceMsecs = Math.abs(differenceMsecs); - } - return new TimeSpan(differenceMsecs, 0, 0, 0, 0); - }; -}()); \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/node_modules/timespan/browser/TimeSpan-1.2.min.js b/node_modules/winston/node_modules/loggly/node_modules/timespan/browser/TimeSpan-1.2.min.js deleted file mode 100644 index 0326cbb..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/timespan/browser/TimeSpan-1.2.min.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(function(){var a=window.TimeSpan=function(g,i,h,j,k){var l="1.2",d=1e3,c=6e4,e=3.6e6,f=8.64e7,a=0,b=function(a){return !isNaN(parseFloat(a))&&isFinite(a)};if(b(k))a+=k*f;if(b(j))a+=j*e;if(b(h))a+=h*c;if(b(i))a+=i*d;if(b(g))a+=g;this.addMilliseconds=function(c){if(!b(c))return;a+=c};this.addSeconds=function(c){if(!b(c))return;a+=c*d};this.addMinutes=function(d){if(!b(d))return;a+=d*c};this.addHours=function(c){if(!b(c))return;a+=c*e};this.addDays=function(c){if(!b(c))return;a+=c*f};this.subtractMilliseconds=function(c){if(!b(c))return;a-=c};this.subtractSeconds=function(c){if(!b(c))return;a-=c*d};this.subtractMinutes=function(d){if(!b(d))return;a-=d*c};this.subtractHours=function(c){if(!b(c))return;a-=c*e};this.subtractDays=function(c){if(!b(c))return;a-=c*f};this.isTimeSpan=true;this.add=function(b){if(!b.isTimeSpan)return;a+=b.totalMilliseconds()};this.subtract=function(b){if(!b.isTimeSpan)return;a-=b.totalMilliseconds()};this.equals=function(b){if(!b.isTimeSpan)return;return a===b.totalMilliseconds()};this.totalMilliseconds=function(c){var b=a;if(c===true)b=Math.floor(b);return b};this.totalSeconds=function(c){var b=a/d;if(c===true)b=Math.floor(b);return b};this.totalMinutes=function(d){var b=a/c;if(d===true)b=Math.floor(b);return b};this.totalHours=function(c){var b=a/e;if(c===true)b=Math.floor(b);return b};this.totalDays=function(c){var b=a/f;if(c===true)b=Math.floor(b);return b};this.milliseconds=function(){return a%1e3};this.seconds=function(){return Math.floor(a/d)%60};this.minutes=function(){return Math.floor(a/c)%60};this.hours=function(){return Math.floor(a/e)%24};this.days=function(){return Math.floor(a/f)};this.getVersion=function(){return l}};a.FromSeconds=function(b){return new a(0,b,0,0,0)};a.FromMinutes=function(b){return new a(0,0,b,0,0)};a.FromHours=function(b){return new a(0,0,0,b,0)};a.FromDays=function(b){return new a(0,0,0,0,b)};a.FromDates=function(e,d,c){var b=d.valueOf()-e.valueOf();if(c===true)b=Math.abs(b);return new a(b,0,0,0,0)}})() \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/node_modules/timespan/docs/docco.css b/node_modules/winston/node_modules/loggly/node_modules/timespan/docs/docco.css deleted file mode 100644 index bd54134..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/timespan/docs/docco.css +++ /dev/null @@ -1,194 +0,0 @@ -/*--------------------- Layout and Typography ----------------------------*/ -body { - font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; - font-size: 15px; - line-height: 22px; - color: #252519; - margin: 0; padding: 0; -} -a { - color: #261a3b; -} - a:visited { - color: #261a3b; - } -p { - margin: 0 0 15px 0; -} -h4, h5, h6 { - color: #333; - margin: 6px 0 6px 0; - font-size: 13px; -} - h2, h3 { - margin-bottom: 0; - color: #000; - } - h1 { - margin-top: 40px; - margin-bottom: 15px; - color: #000; - } -#container { - position: relative; -} -#background { - position: fixed; - top: 0; left: 525px; right: 0; bottom: 0; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - z-index: -1; -} -#jump_to, #jump_page { - background: white; - -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; - -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; - font: 10px Arial; - text-transform: uppercase; - cursor: pointer; - text-align: right; -} -#jump_to, #jump_wrapper { - position: fixed; - right: 0; top: 0; - padding: 5px 10px; -} - #jump_wrapper { - padding: 0; - display: none; - } - #jump_to:hover #jump_wrapper { - display: block; - } - #jump_page { - padding: 5px 0 3px; - margin: 0 0 25px 25px; - } - #jump_page .source { - display: block; - padding: 5px 10px; - text-decoration: none; - border-top: 1px solid #eee; - } - #jump_page .source:hover { - background: #f5f5ff; - } - #jump_page .source:first-child { - } -table td { - border: 0; - outline: 0; -} - td.docs, th.docs { - max-width: 450px; - min-width: 450px; - min-height: 5px; - padding: 10px 25px 1px 50px; - overflow-x: hidden; - vertical-align: top; - text-align: left; - } - .docs pre { - margin: 15px 0 15px; - padding-left: 15px; - } - .docs p tt, .docs p code { - background: #f8f8ff; - border: 1px solid #dedede; - font-size: 12px; - padding: 0 0.2em; - } - .pilwrap { - position: relative; - } - .pilcrow { - font: 12px Arial; - text-decoration: none; - color: #454545; - position: absolute; - top: 3px; left: -20px; - padding: 1px 2px; - opacity: 0; - -webkit-transition: opacity 0.2s linear; - } - td.docs:hover .pilcrow { - opacity: 1; - } - td.code, th.code { - padding: 14px 15px 16px 25px; - width: 100%; - vertical-align: top; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - } - pre, tt, code { - font-size: 12px; line-height: 18px; - font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; - margin: 0; padding: 0; - } - - -/*---------------------- Syntax Highlighting -----------------------------*/ -td.linenos { background-color: #f0f0f0; padding-right: 10px; } -span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } -body .hll { background-color: #ffffcc } -body .c { color: #408080; font-style: italic } /* Comment */ -body .err { border: 1px solid #FF0000 } /* Error */ -body .k { color: #954121 } /* Keyword */ -body .o { color: #666666 } /* Operator */ -body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ -body .cp { color: #BC7A00 } /* Comment.Preproc */ -body .c1 { color: #408080; font-style: italic } /* Comment.Single */ -body .cs { color: #408080; font-style: italic } /* Comment.Special */ -body .gd { color: #A00000 } /* Generic.Deleted */ -body .ge { font-style: italic } /* Generic.Emph */ -body .gr { color: #FF0000 } /* Generic.Error */ -body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -body .gi { color: #00A000 } /* Generic.Inserted */ -body .go { color: #808080 } /* Generic.Output */ -body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -body .gs { font-weight: bold } /* Generic.Strong */ -body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -body .gt { color: #0040D0 } /* Generic.Traceback */ -body .kc { color: #954121 } /* Keyword.Constant */ -body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ -body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ -body .kp { color: #954121 } /* Keyword.Pseudo */ -body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ -body .kt { color: #B00040 } /* Keyword.Type */ -body .m { color: #666666 } /* Literal.Number */ -body .s { color: #219161 } /* Literal.String */ -body .na { color: #7D9029 } /* Name.Attribute */ -body .nb { color: #954121 } /* Name.Builtin */ -body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ -body .no { color: #880000 } /* Name.Constant */ -body .nd { color: #AA22FF } /* Name.Decorator */ -body .ni { color: #999999; font-weight: bold } /* Name.Entity */ -body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -body .nf { color: #0000FF } /* Name.Function */ -body .nl { color: #A0A000 } /* Name.Label */ -body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -body .nt { color: #954121; font-weight: bold } /* Name.Tag */ -body .nv { color: #19469D } /* Name.Variable */ -body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -body .w { color: #bbbbbb } /* Text.Whitespace */ -body .mf { color: #666666 } /* Literal.Number.Float */ -body .mh { color: #666666 } /* Literal.Number.Hex */ -body .mi { color: #666666 } /* Literal.Number.Integer */ -body .mo { color: #666666 } /* Literal.Number.Oct */ -body .sb { color: #219161 } /* Literal.String.Backtick */ -body .sc { color: #219161 } /* Literal.String.Char */ -body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ -body .s2 { color: #219161 } /* Literal.String.Double */ -body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -body .sh { color: #219161 } /* Literal.String.Heredoc */ -body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -body .sx { color: #954121 } /* Literal.String.Other */ -body .sr { color: #BB6688 } /* Literal.String.Regex */ -body .s1 { color: #219161 } /* Literal.String.Single */ -body .ss { color: #19469D } /* Literal.String.Symbol */ -body .bp { color: #954121 } /* Name.Builtin.Pseudo */ -body .vc { color: #19469D } /* Name.Variable.Class */ -body .vg { color: #19469D } /* Name.Variable.Global */ -body .vi { color: #19469D } /* Name.Variable.Instance */ -body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/node_modules/timespan/docs/time-span.html b/node_modules/winston/node_modules/loggly/node_modules/timespan/docs/time-span.html deleted file mode 100644 index 9eb2cc9..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/timespan/docs/time-span.html +++ /dev/null @@ -1,692 +0,0 @@ - time-span.js

        time-span.js

        /*
        -* JavaScript TimeSpan Library
        -*
        -* Copyright (c) 2010 Michael Stum, Charlie Robbins
        -* 
        -* Permission is hereby granted, free of charge, to any person obtaining
        -* a copy of this software and associated documentation files (the
        -* "Software"), to deal in the Software without restriction, including
        -* without limitation the rights to use, copy, modify, merge, publish,
        -* distribute, sublicense, and/or sell copies of the Software, and to
        -* permit persons to whom the Software is furnished to do so, subject to
        -* the following conditions:
        -* 
        -* The above copyright notice and this permission notice shall be
        -* included in all copies or substantial portions of the Software.
        -* 
        -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
        -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
        -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
        -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
        -* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
        -* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
        -* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
        -*/

        Time constants

        var msecPerSecond = 1000,
        -    msecPerMinute = 60000,
        -    msecPerHour = 3600000,
        -    msecPerDay = 86400000;

        Timespan Parsers

        var timeSpanWithDays = /^(\d+):(\d+):(\d+):(\d+)(\.\d+)?/,
        -    timeSpanNoDays = /^(\d+):(\d+):(\d+)(\.\d+)?/;

        function TimeSpan (milliseconds, seconds, minutes, hours, days)

        - -

        @milliseconds {Number} Number of milliseconds for this instance.

        - -

        @seconds {Number} Number of seconds for this instance.

        - -

        @minutes {Number} Number of minutes for this instance.

        - -

        @hours {Number} Number of hours for this instance.

        - -

        @days {Number} Number of days for this instance.

        - -

        Constructor function for the TimeSpan object which represents a length -of positive or negative milliseconds componentized into milliseconds, -seconds, hours, and days.

        var TimeSpan = exports.TimeSpan = function (milliseconds, seconds, minutes, hours, days) {
        -  this.msecs = 0;
        -  
        -  if (isNumeric(days)) {
        -    this.msecs += (days * msecPerDay);
        -  }
        -  
        -  if (isNumeric(hours)) {
        -    this.msecs += (hours * msecPerHour);
        -  }
        -  
        -  if (isNumeric(minutes)) {
        -    this.msecs += (minutes * msecPerMinute);
        -  }
        -  
        -  if (isNumeric(seconds)) {
        -    this.msecs += (seconds * msecPerSecond);
        -  }
        -  
        -  if (isNumeric(milliseconds)) {
        -    this.msecs += milliseconds;
        -  }
        -};

        Factory methods

        - -

        Helper methods for creating new TimeSpan objects -from various criteria: milliseconds, seconds, minutes, -hours, days, strings and other TimeSpan instances.

        function fromMilliseconds (milliseconds)

        - -

        @milliseconds {Number} Amount of milliseconds for the new TimeSpan instance.

        - -

        Creates a new TimeSpan instance with the specified milliseconds.

        exports.fromMilliseconds = function (milliseconds) {
        -  if (!isNumeric(milliseconds)) {
        -    return;
        -  }
        -  
        -  return new TimeSpan(milliseconds, 0, 0, 0, 0);
        -}

        function fromSeconds (seconds)

        - -

        @milliseconds {Number} Amount of seconds for the new TimeSpan instance.

        - -

        Creates a new TimeSpan instance with the specified seconds.

        exports.fromSeconds = function (seconds) {
        -  if (!isNumeric(seconds)) {
        -    return;
        -  }
        -  
        -  return new TimeSpan(0, seconds, 0, 0, 0);
        -};

        function fromMinutes (milliseconds)

        - -

        @milliseconds {Number} Amount of minutes for the new TimeSpan instance.

        - -

        Creates a new TimeSpan instance with the specified minutes.

        exports.fromMinutes = function (minutes) {
        -  if (!isNumeric(minutes)) {
        -    return;
        -  }
        -  
        -  return new TimeSpan(0, 0, minutes, 0, 0);
        -};

        function fromHours (hours)

        - -

        @milliseconds {Number} Amount of hours for the new TimeSpan instance.

        - -

        Creates a new TimeSpan instance with the specified hours.

        exports.fromHours = function (hours) {
        -  if (!isNumeric(hours)) {
        -    return;
        -  }
        -  
        -  return new TimeSpan(0, 0, 0, hours, 0);
        -};

        function fromDays (days)

        - -

        @milliseconds {Number} Amount of days for the new TimeSpan instance.

        - -

        Creates a new TimeSpan instance with the specified days.

        exports.fromDays = function (days) {
        -  if (!isNumeric(days)) {
        -    return;
        -  }
        -  
        -  return new TimeSpan(0, 0, 0, 0, days);
        -};

        function parse (str)

        - -

        @str {string} Timespan string to parse.

        - -

        Creates a new TimeSpan instance from the specified -string, str.

        exports.parse = function (str) {
        -  var match, milliseconds;
        -  
        -  function parseMilliseconds (value) {
        -    return value ? parseFloat('0' + value) * 1000 : 0;
        -  }
        -  

        If we match against a full TimeSpan:

          if ((match = str.match(timeSpanWithDays))) {
        -    return new TimeSpan(parseMilliseconds(match[5]), match[4], match[3], match[2], match[1]);
        -  }
        -  

        If we match against a partial TimeSpan:

          if ((match = str.match(timeSpanNoDays))) {
        -    return new TimeSpan(parseMilliseconds(match[4]), match[3], match[2], match[1], 0);
        -  }
        -  
        -  return null;
        -};
        -
        -var months  = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];

        List of default singular time modifiers and associated -computation algoritm. Assumes in order, smallest to greatest -performing carry forward additiona / subtraction for each -Date-Time component.

        var parsers = {
        -  'milliseconds': {
        -    exp: /(\d+)milli[second]?[s]?/i,
        -    get: function (date) { return date.getMilliseconds(date) },
        -    set: function (val, date) { date.setMilliseconds(val) },
        -    compute: function (delta, date, computed) {
        -      var round = delta > 0 ? Math.floor : Math.ceil;
        -      if (delta) {
        -        computed.seconds += round.call(null, delta / 1000);
        -        computed.milliseconds += delta % 1000;
        -      }
        -      
        -      if (Math.abs(computed.milliseconds) >= 1000) {
        -        computed.seconds += round.call(null, computed.milliseconds / 1000)
        -        computed.milliseconds = computed.milliseconds % 1000;
        -      }
        -
        -      return computed;
        -    }
        -  },
        -  'seconds': {
        -    exp: /(\d+)second[s]?/i,
        -    get: function (date) { return date.getSeconds(date) },
        -    set: function (val, date) { date.setSeconds(val) },
        -    compute: function (delta, date, computed) {
        -      var round = delta > 0 ? Math.floor : Math.ceil;
        -      if (delta) {
        -        computed.minutes += round.call(null, delta / 60);
        -        computed.seconds += delta % 60;
        -      }
        -      
        -      if (Math.abs(computed.seconds) >= 60) {
        -        computed.minutes += round.call(null, computed.seconds / 60);
        -        computed.seconds = computed.seconds % 60; 
        -      }
        -      
        -      return computed;
        -    }
        -  },
        -  'minutes': {
        -    exp: /(\d+)minute[s]?/i,
        -    get: function (date) { return date.getMinutes(date) },
        -    set: function (val, date) { date.setMinutes(val) },
        -    compute: function (delta, date, computed) {
        -      var round = delta > 0 ? Math.floor : Math.ceil;
        -      if (delta) { 
        -        computed.hours += round.call(null, delta / 60);
        -        computed.minutes += delta % 60;
        -      }
        -      
        -      if (Math.abs(computed.minutes) >= 60) {
        -        computed.hours += round.call(null, computed.minutes / 60);
        -        computed.minutes = computed.minutes % 60; 
        -      }
        -      
        -      return computed;
        -    }
        -  },
        -  'hours': {
        -    exp: /(\d+)hour[s]?/i,
        -    get: function (date) { return date.getHours(date) },
        -    set: function (val, date) { date.setHours(val) },
        -    compute: function (delta, date, computed) {
        -      var round = delta > 0 ? Math.floor : Math.ceil;
        -      if (delta) { 
        -        computed.days += round.call(null, delta / 24);
        -        computed.hours += delta % 24;
        -      }
        -      
        -      if (Math.abs(computed.hours) >= 24) {
        -        computed.days += round.call(null, computed.hours / 24);
        -        computed.hours = computed.hours % 24;
        -      }
        -      
        -      return computed;
        -    }
        -  },
        -  'days': {
        -    exp: /(\d+)day[s]?/i,
        -    get: function (date) { return date.getDate(date) },
        -    set: function (val, date) { date.setDate(val) },
        -    compute: function (delta, date, computed) {
        -      var sign     = delta >= 0 ? 1 : -1,
        -          opsign   = delta >= 0 ? -1 : 1,
        -          clean    = 0,
        -          original = delta,
        -          month    = computed.months,
        -          days     = months[month];
        -      
        -      if (delta) {          
        -        while (Math.abs(delta) >= days) {
        -          month += sign * 1;
        -          computed.months += sign * 1;
        -          delta += opsign * days;
        -        
        -          if (month < 0) { month = 11 }
        -          else if (month > 11) { month = 0 }
        -        
        -          days = months[month];
        -        }
        -      
        -        computed.days += (sign * delta);
        -      }
        -      
        -      if (computed.days < 0) {
        -        clean = -1;
        -      }
        -      else if (computed.days > months[computed.months]) {
        -        clean = 1;
        -      }
        -      
        -      if (clean !== 0) {
        -        computed.months += clean;
        -        if (computed.months < 0) { computed.months = 11 }
        -        else if (computed.months > 11) { computed.months = 0 }
        -        computed.days = months[computed.months] + computed.days;
        -      }
        -            
        -      return computed;
        -    }
        -  },
        -  'months': {
        -    exp: /(\d+)month[s]?/i,
        -    get: function (date) { return date.getMonth(date) },
        -    set: function (val, date) { date.setMonth(val) },
        -    compute: function (delta, date, computed) {
        -      var round = delta > 0 ? Math.floor : Math.ceil;
        -      if (delta) { 
        -        computed.years += round.call(null, delta / 12);
        -        computed.months += delta % 12;
        -      }
        -      
        -      if (computed.months > 11) {
        -        computed.years += Math.floor((computed.months + 1) / 12);
        -        computed.months = ((computed.months + 1) % 12) - 1;
        -      }
        -      
        -      return computed;
        -    }
        -  },
        -  'years': {
        -    exp: /(\d+)year[s]?/i,
        -    get: function (date) { return date.getFullYear(date) },
        -    set: function (val, date) { date.setFullYear(val) },
        -    compute: function (delta, date, computed) {
        -      if (delta) { 
        -        computed.years += delta;
        -      }
        -      
        -      return computed;
        -    }
        -  }
        -};

        Compute the list of parser names for -later use.

        var parserNames = Object.keys(parsers);

        function parseDate (str)

        - -

        @str {string} String to parse into a date

        - -

        Parses the specified liberal Date-Time string according to -ISO8601 and:

        - -
          -
        1. 2010-04-03T12:34:15Z+12MINUTES
        2. -
        3. NOW-4HOURS
        4. -
        - -

        Valid modifiers for the more liberal Date-Time string(s):

        - -
        YEAR, YEARS
        -MONTH, MONTHS
        -DAY, DAYS
        -HOUR, HOURS
        -MINUTE, MINUTES
        -SECOND, SECONDS
        -MILLI, MILLIS, MILLISECOND, MILLISECONDS
        -
        exports.parseDate = function (str) {
        -  var simple = Date.parse(str),
        -      iso = '^([^Z]+)',
        -      zulu = 'Z([\\+|\\-])?',
        -      diff = {},
        -      base,
        -      sign,
        -      complex,
        -      inspect,
        -      dateTime,
        -      modifiers;
        -
        -  if (/now/i.test(str)) {
        -    iso = '^(NOW)';
        -    zulu = zulu.replace(/Z/, 'NOW');
        -  }

        If Date string supplied actually conforms -to UTC Time (ISO8601), return a new Date.

          if (!isNaN(simple)) {
        -    return new Date(simple);
        -  }
        -  

        Create the RegExp for the end component -of the target str to parse.

          parserNames.forEach(function (group) {
        -    zulu += '(\\d+[a-zA-Z]+)?';
        -  });
        -  

        Parse the ISO8601 component, and the end -component from the target str.

          dateTime = str.match(new RegExp(iso, 'i'));
        -  modifiers = str.match(new RegExp(zulu, 'i'));
        -  

        If there was no match on either part then -it must be a bad value.

          if (!dateTime || !modifiers) {
        -    return null;
        -  }
        -    

        Create a new Date object from the ISO8601 -component of the target str.

          base = /now/i.test(dateTime[1]) ? Date.now() : Date.parse(dateTime[1]);
        -  complex = new Date(base);
        -  sign = modifiers[1] === '+' ? 1 : -1;
        -  

        Parse the individual component spans (months, years, etc) -from the modifier strings that we parsed from the end -of the target str.

          modifiers.slice(2).filter(Boolean).forEach(function (modifier) {
        -    parserNames.forEach(function (name) {
        -      var match;
        -      if (!(match = modifier.match(parsers[name].exp))) {
        -        return;
        -      }
        -      
        -      diff[name] = sign * parseInt(match[1], 10);
        -    })
        -  });
        -  

        Compute the total diff by iteratively computing -the partial components from smallest to largest.

          var computed = {
        -    milliseconds: complex.getMilliseconds(),
        -    seconds: complex.getSeconds(),
        -    minutes: complex.getMinutes(),
        -    hours: complex.getHours(),
        -    days: complex.getDate(),
        -    months: complex.getMonth(),
        -    years: complex.getFullYear()
        -  };
        -  
        -  parserNames.forEach(function (name) {    
        -    computed = parsers[name].compute(diff[name], complex, computed);
        -  });
        -  
        -  return new Date(
        -    Date.UTC(
        -      computed.years,
        -      computed.months,
        -      computed.days,
        -      computed.hours,
        -      computed.minutes,
        -      computed.seconds,
        -      computed.milliseconds
        -    )
        -  );
        -};

        function fromDates (start, end, abs)

        - -

        @start {Date} Start date of the TimeSpan instance to return

        - -

        @end {Date} End date of the TimeSpan instance to return

        - -

        @abs {boolean} Value indicating to return an absolute value

        - -

        Returns a new TimeSpan instance representing the difference between -the start and end Dates.

        exports.fromDates = function (start, end, abs) {
        -  if (!start instanceof Date) {
        -    start = exports.parseDate(start);
        -  }
        -  
        -  if (!end instanceof Date) {
        -    end = exports.parseDate(end);
        -  }
        -  
        -  var differenceMsecs = end.valueOf() - start.valueOf();
        -  if (abs) {
        -    differenceMsecs = Math.abs(differenceMsecs);
        -  }
        -
        -  return new TimeSpan(differenceMsecs, 0, 0, 0, 0);
        -};

        Module Helpers

        - -

        Module-level helpers for various utilities such as: -instanceOf, parsability, and cloning.

        function test (str)

        - -

        @str {string} String value to test if it is a TimeSpan

        - -

        Returns a value indicating if the specified string, str, -is a parsable TimeSpan value.

        exports.test = function (str) {
        -  return timeSpanWithDays.test(str) || timeSpanNoDays.test(str);
        -};

        function instanceOf (timeSpan)

        - -

        @timeSpan {Object} Object to check TimeSpan quality.

        - -

        Returns a value indicating if the specified timeSpan is -in fact a TimeSpan instance.

        exports.instanceOf = function (timeSpan) {
        -  return timeSpan instanceof TimeSpan;
        -};

        function clone (timeSpan)

        - -

        @timeSpan {TimeSpan} TimeSpan object to clone.

        - -

        Returns a new TimeSpan instance with the same value -as the timeSpan object supplied.

        exports.clone = function (timeSpan) {
        -  if (!(timeSpan instanceof TimeSpan)) {
        -    return;
        -  }
        -  
        -  return exports.fromMilliseconds(timeSpan.totalMilliseconds());
        -};

        Addition

        - -

        Methods for adding TimeSpan instances, -milliseconds, seconds, hours, and days to other -TimeSpan instances.

        function add (timeSpan)

        - -

        @timeSpan {TimeSpan} TimeSpan to add to this instance

        - -

        Adds the specified timeSpan to this instance.

        TimeSpan.prototype.add = function (timeSpan) {
        -  if (!(timeSpan instanceof TimeSpan)) {
        -    return;
        -  }
        -  
        -  this.msecs += timeSpan.totalMilliseconds();
        -};

        function addMilliseconds (milliseconds)

        - -

        @milliseconds {Number} Number of milliseconds to add.

        - -

        Adds the specified milliseconds to this instance.

        TimeSpan.prototype.addMilliseconds = function (milliseconds) {
        -  if (!isNumeric(milliseconds)) {
        -    return;
        -  }
        -  
        -  this.msecs += milliseconds;
        -};

        function addSeconds (seconds)

        - -

        @seconds {Number} Number of seconds to add.

        - -

        Adds the specified seconds to this instance.

        TimeSpan.prototype.addSeconds = function (seconds) {
        -  if (!isNumeric(seconds)) {
        -    return;
        -  }
        -  
        -  this.msecs += (seconds * msecPerSecond);
        -};

        function addMinutes (minutes)

        - -

        @minutes {Number} Number of minutes to add.

        - -

        Adds the specified minutes to this instance.

        TimeSpan.prototype.addMinutes = function (minutes) {
        -  if (!isNumeric(minutes)) {
        -    return;
        -  }
        -  
        -  this.msecs += (minutes * msecPerMinute);
        -};

        function addHours (hours)

        - -

        @hours {Number} Number of hours to add.

        - -

        Adds the specified hours to this instance.

        TimeSpan.prototype.addHours = function (hours) {
        -  if (!isNumeric(hours)) {
        -    return;
        -  }
        -  
        -  this.msecs += (hours * msecPerHour);
        -};

        function addDays (days)

        - -

        @days {Number} Number of days to add.

        - -

        Adds the specified days to this instance.

        TimeSpan.prototype.addDays = function (days) {
        -  if (!isNumeric(days)) {
        -    return;
        -  }
        -  
        -  this.msecs += (days * msecPerDay);
        -};

        Subtraction

        - -

        Methods for subtracting TimeSpan instances, -milliseconds, seconds, hours, and days from other -TimeSpan instances.

        function subtract (timeSpan)

        - -

        @timeSpan {TimeSpan} TimeSpan to subtract from this instance.

        - -

        Subtracts the specified timeSpan from this instance.

        TimeSpan.prototype.subtract = function (timeSpan) {
        -  if (!(timeSpan instanceof TimeSpan)) {
        -    return;
        -  }
        -  
        -  this.msecs -= timeSpan.totalMilliseconds();
        -};

        function subtractMilliseconds (milliseconds)

        - -

        @milliseconds {Number} Number of milliseconds to subtract.

        - -

        Subtracts the specified milliseconds from this instance.

        TimeSpan.prototype.subtractMilliseconds = function (milliseconds) {
        -  if (!isNumeric(milliseconds)) {
        -    return;
        -  }
        -  
        -  this.msecs -= milliseconds;
        -};

        function subtractSeconds (seconds)

        - -

        @seconds {Number} Number of seconds to subtract.

        - -

        Subtracts the specified seconds from this instance.

        TimeSpan.prototype.subtractSeconds = function (seconds) {
        -  if (!isNumeric(seconds)) {
        -    return;
        -  }
        -  
        -  this.msecs -= (seconds * msecPerSecond);
        -};

        function subtractMinutes (minutes)

        - -

        @minutes {Number} Number of minutes to subtract.

        - -

        Subtracts the specified minutes from this instance.

        TimeSpan.prototype.subtractMinutes = function (minutes) {
        -  if (!isNumeric(minutes)) {
        -    return;
        -  }
        -  
        -  this.msecs -= (minutes * msecPerMinute);
        -};

        function subtractHours (hours)

        - -

        @hours {Number} Number of hours to subtract.

        - -

        Subtracts the specified hours from this instance.

        TimeSpan.prototype.subtractHours = function (hours) {
        -  if (!isNumeric(hours)) {
        -    return;
        -  }
        -  
        -  this.msecs -= (hours * msecPerHour);
        -};

        function subtractDays (days)

        - -

        @days {Number} Number of days to subtract.

        - -

        Subtracts the specified days from this instance.

        TimeSpan.prototype.subtractDays = function (days) {
        -  if (!isNumeric(days)) {
        -    return;
        -  }
        -  
        -  this.msecs -= (days * msecPerDay);
        -};

        Getters

        - -

        Methods for retrieving components of a TimeSpan -instance: milliseconds, seconds, minutes, hours, and days.

        function totalMilliseconds (roundDown)

        - -

        @roundDown {boolean} Value indicating if the value should be rounded down.

        - -

        Returns the total number of milliseconds for this instance, rounding down -to the nearest integer if roundDown is set.

        TimeSpan.prototype.totalMilliseconds = function (roundDown) {
        -  var result = this.msecs;
        -  if (roundDown === true) {
        -    result = Math.floor(result);
        -  }
        -  
        -  return result;
        -};

        function totalSeconds (roundDown)

        - -

        @roundDown {boolean} Value indicating if the value should be rounded down.

        - -

        Returns the total number of seconds for this instance, rounding down -to the nearest integer if roundDown is set.

        TimeSpan.prototype.totalSeconds = function (roundDown) {
        -  var result = this.msecs / msecPerSecond;
        -  if (roundDown === true) {
        -    result = Math.floor(result);
        -  }
        -  
        -  return result;
        -};

        function totalMinutes (roundDown)

        - -

        @roundDown {boolean} Value indicating if the value should be rounded down.

        - -

        Returns the total number of minutes for this instance, rounding down -to the nearest integer if roundDown is set.

        TimeSpan.prototype.totalMinutes = function (roundDown) {
        -  var result = this.msecs / msecPerMinute;
        -  if (roundDown === true) {
        -    result = Math.floor(result);
        -  }
        -  
        -  return result;
        -};

        function totalHours (roundDown)

        - -

        @roundDown {boolean} Value indicating if the value should be rounded down.

        - -

        Returns the total number of hours for this instance, rounding down -to the nearest integer if roundDown is set.

        TimeSpan.prototype.totalHours = function (roundDown) {
        -  var result = this.msecs / msecPerHour;
        -  if (roundDown === true) {
        -    result = Math.floor(result);
        -  }
        -  
        -  return result;
        -};

        function totalDays (roundDown)

        - -

        @roundDown {boolean} Value indicating if the value should be rounded down.

        - -

        Returns the total number of days for this instance, rounding down -to the nearest integer if roundDown is set.

        TimeSpan.prototype.totalDays = function (roundDown) {
        -  var result = this.msecs / msecPerDay;
        -  if (roundDown === true) {
        -    result = Math.floor(result);
        -  }
        -  
        -  return result;
        -};

        @milliseconds

        - -

        Returns the length of this TimeSpan instance in milliseconds.

        TimeSpan.prototype.__defineGetter__('milliseconds', function () {
        -  return this.msecs % 1000;
        -});

        @seconds

        - -

        Returns the length of this TimeSpan instance in seconds.

        TimeSpan.prototype.__defineGetter__('seconds', function () {
        -  return Math.floor(this.msecs / msecPerSecond) % 60;
        -});

        @minutes

        - -

        Returns the length of this TimeSpan instance in minutes.

        TimeSpan.prototype.__defineGetter__('minutes', function () {
        -  return Math.floor(this.msecs / msecPerMinute) % 60;
        -});

        @hours

        - -

        Returns the length of this TimeSpan instance in hours.

        TimeSpan.prototype.__defineGetter__('hours', function () {
        -  return Math.floor(this.msecs / msecPerHour) % 24;
        -});

        @days

        - -

        Returns the length of this TimeSpan instance in days.

        TimeSpan.prototype.__defineGetter__('days', function () {
        -  return Math.floor(this.msecs / msecPerDay);
        -});

        Instance Helpers

        - -

        Various help methods for performing utilities -such as equality and serialization

        function equals (timeSpan)

        - -

        @timeSpan {TimeSpan} TimeSpan instance to assert equal

        - -

        Returns a value indicating if the specified timeSpan is equal -in milliseconds to this instance.

        TimeSpan.prototype.equals = function (timeSpan) {
        -  if (!(timeSpan instanceof TimeSpan)) {
        -    return;
        -  }
        -  
        -  return this.msecs === timeSpan.totalMilliseconds();
        -};

        function toString ()

        - -

        Returns a string representation of this TimeSpan -instance according to current format.

        TimeSpan.prototype.toString = function () {
        -  if (!this.format) {
        -    return this._format();
        -  };
        -  
        -  return this.format(this);
        -};

        @private function _format ()

        - -

        Returns the default string representation of this instance.

        TimeSpan.prototype._format = function () {
        -  return [
        -    this.days,
        -    this.hours,
        -    this.minutes,
        -    this.seconds + '.' + this.milliseconds
        -  ].join(':')
        -};

        @private function isNumeric (input)

        - -

        @input {Number} Value to check numeric quality of.

        - -

        Returns a value indicating the numeric quality of the -specified input.

        function isNumeric (input) {
        -  return input && !isNaN(parseFloat(input)) && isFinite(input);
        -};
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/node_modules/timespan/lib/time-span.js b/node_modules/winston/node_modules/loggly/node_modules/timespan/lib/time-span.js deleted file mode 100644 index 23a9cc8..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/timespan/lib/time-span.js +++ /dev/null @@ -1,827 +0,0 @@ -/* -* JavaScript TimeSpan Library -* -* Copyright (c) 2010 Michael Stum, Charlie Robbins -* -* Permission is hereby granted, free of charge, to any person obtaining -* a copy of this software and associated documentation files (the -* "Software"), to deal in the Software without restriction, including -* without limitation the rights to use, copy, modify, merge, publish, -* distribute, sublicense, and/or sell copies of the Software, and to -* permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice shall be -* included in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -// -// ### Time constants -// -var msecPerSecond = 1000, - msecPerMinute = 60000, - msecPerHour = 3600000, - msecPerDay = 86400000; - -// -// ### Timespan Parsers -// -var timeSpanWithDays = /^(\d+):(\d+):(\d+):(\d+)(\.\d+)?/, - timeSpanNoDays = /^(\d+):(\d+):(\d+)(\.\d+)?/; - -// -// ### function TimeSpan (milliseconds, seconds, minutes, hours, days) -// #### @milliseconds {Number} Number of milliseconds for this instance. -// #### @seconds {Number} Number of seconds for this instance. -// #### @minutes {Number} Number of minutes for this instance. -// #### @hours {Number} Number of hours for this instance. -// #### @days {Number} Number of days for this instance. -// Constructor function for the `TimeSpan` object which represents a length -// of positive or negative milliseconds componentized into milliseconds, -// seconds, hours, and days. -// -var TimeSpan = exports.TimeSpan = function (milliseconds, seconds, minutes, hours, days) { - this.msecs = 0; - - if (isNumeric(days)) { - this.msecs += (days * msecPerDay); - } - - if (isNumeric(hours)) { - this.msecs += (hours * msecPerHour); - } - - if (isNumeric(minutes)) { - this.msecs += (minutes * msecPerMinute); - } - - if (isNumeric(seconds)) { - this.msecs += (seconds * msecPerSecond); - } - - if (isNumeric(milliseconds)) { - this.msecs += milliseconds; - } -}; - -// -// ## Factory methods -// Helper methods for creating new TimeSpan objects -// from various criteria: milliseconds, seconds, minutes, -// hours, days, strings and other `TimeSpan` instances. -// - -// -// ### function fromMilliseconds (milliseconds) -// #### @milliseconds {Number} Amount of milliseconds for the new TimeSpan instance. -// Creates a new `TimeSpan` instance with the specified `milliseconds`. -// -exports.fromMilliseconds = function (milliseconds) { - if (!isNumeric(milliseconds)) { return } - return new TimeSpan(milliseconds, 0, 0, 0, 0); -} - -// -// ### function fromSeconds (seconds) -// #### @milliseconds {Number} Amount of seconds for the new TimeSpan instance. -// Creates a new `TimeSpan` instance with the specified `seconds`. -// -exports.fromSeconds = function (seconds) { - if (!isNumeric(seconds)) { return } - return new TimeSpan(0, seconds, 0, 0, 0); -}; - -// -// ### function fromMinutes (milliseconds) -// #### @milliseconds {Number} Amount of minutes for the new TimeSpan instance. -// Creates a new `TimeSpan` instance with the specified `minutes`. -// -exports.fromMinutes = function (minutes) { - if (!isNumeric(minutes)) { return } - return new TimeSpan(0, 0, minutes, 0, 0); -}; - -// -// ### function fromHours (hours) -// #### @milliseconds {Number} Amount of hours for the new TimeSpan instance. -// Creates a new `TimeSpan` instance with the specified `hours`. -// -exports.fromHours = function (hours) { - if (!isNumeric(hours)) { return } - return new TimeSpan(0, 0, 0, hours, 0); -}; - -// -// ### function fromDays (days) -// #### @milliseconds {Number} Amount of days for the new TimeSpan instance. -// Creates a new `TimeSpan` instance with the specified `days`. -// -exports.fromDays = function (days) { - if (!isNumeric(days)) { return } - return new TimeSpan(0, 0, 0, 0, days); -}; - -// -// ### function parse (str) -// #### @str {string} Timespan string to parse. -// Creates a new `TimeSpan` instance from the specified -// string, `str`. -// -exports.parse = function (str) { - var match, milliseconds; - - function parseMilliseconds (value) { - return value ? parseFloat('0' + value) * 1000 : 0; - } - - // If we match against a full TimeSpan: - // [days]:[hours]:[minutes]:[seconds].[milliseconds]? - if ((match = str.match(timeSpanWithDays))) { - return new TimeSpan(parseMilliseconds(match[5]), match[4], match[3], match[2], match[1]); - } - - // If we match against a partial TimeSpan: - // [hours]:[minutes]:[seconds].[milliseconds]? - if ((match = str.match(timeSpanNoDays))) { - return new TimeSpan(parseMilliseconds(match[4]), match[3], match[2], match[1], 0); - } - - return null; -}; - -// -// List of default singular time modifiers and associated -// computation algoritm. Assumes in order, smallest to greatest -// performing carry forward additiona / subtraction for each -// Date-Time component. -// -var parsers = { - 'milliseconds': { - exp: /(\d+)milli(?:second)?[s]?/i, - compute: function (delta, computed) { - return _compute(delta, computed, { - current: 'milliseconds', - next: 'seconds', - max: 1000 - }); - } - }, - 'seconds': { - exp: /(\d+)second[s]?/i, - compute: function (delta, computed) { - return _compute(delta, computed, { - current: 'seconds', - next: 'minutes', - max: 60 - }); - } - }, - 'minutes': { - exp: /(\d+)minute[s]?/i, - compute: function (delta, computed) { - return _compute(delta, computed, { - current: 'minutes', - next: 'hours', - max: 60 - }); - } - }, - 'hours': { - exp: /(\d+)hour[s]?/i, - compute: function (delta, computed) { - return _compute(delta, computed, { - current: 'hours', - next: 'days', - max: 24 - }); - } - }, - 'days': { - exp: /(\d+)day[s]?/i, - compute: function (delta, computed) { - var days = monthDays(computed.months, computed.years), - sign = delta >= 0 ? 1 : -1, - opsign = delta >= 0 ? -1 : 1, - clean = 0; - - function update (months) { - if (months < 0) { - computed.years -= 1; - return 11; - } - else if (months > 11) { - computed.years += 1; - return 0 - } - - return months; - } - - if (delta) { - while (Math.abs(delta) >= days) { - computed.months += sign * 1; - computed.months = update(computed.months); - delta += opsign * days; - days = monthDays(computed.months, computed.years); - } - - computed.days += (opsign * delta); - } - - if (computed.days < 0) { clean = -1 } - else if (computed.days > months[computed.months]) { clean = 1 } - - if (clean === -1 || clean === 1) { - computed.months += clean; - computed.months = update(computed.months); - computed.days = months[computed.months] + computed.days; - } - - return computed; - } - }, - 'months': { - exp: /(\d+)month[s]?/i, - compute: function (delta, computed) { - var round = delta > 0 ? Math.floor : Math.ceil; - if (delta) { - computed.years += round.call(null, delta / 12); - computed.months += delta % 12; - } - - if (computed.months > 11) { - computed.years += Math.floor((computed.months + 1) / 12); - computed.months = ((computed.months + 1) % 12) - 1; - } - - return computed; - } - }, - 'years': { - exp: /(\d+)year[s]?/i, - compute: function (delta, computed) { - if (delta) { computed.years += delta; } - return computed; - } - } -}; - -// -// Compute the list of parser names for -// later use. -// -var parserNames = Object.keys(parsers); - -// -// ### function parseDate (str) -// #### @str {string} String to parse into a date -// Parses the specified liberal Date-Time string according to -// ISO8601 **and**: -// -// 1. `2010-04-03T12:34:15Z+12MINUTES` -// 2. `NOW-4HOURS` -// -// Valid modifiers for the more liberal Date-Time string(s): -// -// YEAR, YEARS -// MONTH, MONTHS -// DAY, DAYS -// HOUR, HOURS -// MINUTE, MINUTES -// SECOND, SECONDS -// MILLI, MILLIS, MILLISECOND, MILLISECONDS -// -exports.parseDate = function (str) { - var dateTime = Date.parse(str), - iso = '^([^Z]+)', - zulu = 'Z([\\+|\\-])?', - diff = {}, - computed, - modifiers, - sign; - - // - // If Date string supplied actually conforms - // to UTC Time (ISO8601), return a new Date. - // - if (!isNaN(dateTime)) { - return new Date(dateTime); - } - - // - // Create the `RegExp` for the end component - // of the target `str` to parse. - // - parserNames.forEach(function (group) { - zulu += '(\\d+[a-zA-Z]+)?'; - }); - - if (/^NOW/i.test(str)) { - // - // If the target `str` is a liberal `NOW-*`, - // then set the base `dateTime` appropriately. - // - dateTime = Date.now(); - zulu = zulu.replace(/Z/, 'NOW'); - } - else { - // - // Parse the `ISO8601` component, and the end - // component from the target `str`. - // - dateTime = str.match(new RegExp(iso, 'i')); - dateTime = Date.parse(dateTime[1]); - } - - // - // If there was no match on either part then - // it must be a bad value. - // - if (!dateTime || !(modifiers = str.match(new RegExp(zulu, 'i')))) { - return null; - } - - // - // Create a new `Date` object from the `ISO8601` - // component of the target `str`. - // - dateTime = new Date(dateTime); - sign = modifiers[1] === '+' ? 1 : -1; - - // - // Create an Object-literal for consistently accessing - // the various components of the computed Date. - // - var computed = { - milliseconds: dateTime.getMilliseconds(), - seconds: dateTime.getSeconds(), - minutes: dateTime.getMinutes(), - hours: dateTime.getHours(), - days: dateTime.getDate(), - months: dateTime.getMonth(), - years: dateTime.getFullYear() - }; - - // - // Parse the individual component spans (months, years, etc) - // from the modifier strings that we parsed from the end - // of the target `str`. - // - modifiers.slice(2).filter(Boolean).forEach(function (modifier) { - parserNames.forEach(function (name) { - var match; - if (!(match = modifier.match(parsers[name].exp))) { - return; - } - - diff[name] = sign * parseInt(match[1], 10); - }) - }); - - // - // Compute the total `diff` by iteratively computing - // the partial components from smallest to largest. - // - parserNames.forEach(function (name) { - computed = parsers[name].compute(diff[name], computed); - }); - - return new Date( - Date.UTC( - computed.years, - computed.months, - computed.days, - computed.hours, - computed.minutes, - computed.seconds, - computed.milliseconds - ) - ); -}; - -// -// ### function fromDates (start, end, abs) -// #### @start {Date} Start date of the `TimeSpan` instance to return -// #### @end {Date} End date of the `TimeSpan` instance to return -// #### @abs {boolean} Value indicating to return an absolute value -// Returns a new `TimeSpan` instance representing the difference between -// the `start` and `end` Dates. -// -exports.fromDates = function (start, end, abs) { - if (typeof start === 'string') { - start = exports.parseDate(start); - } - - if (typeof end === 'string') { - end = exports.parseDate(end); - } - - if (!(start instanceof Date && end instanceof Date)) { - return null; - } - - var differenceMsecs = end.valueOf() - start.valueOf(); - if (abs) { - differenceMsecs = Math.abs(differenceMsecs); - } - - return new TimeSpan(differenceMsecs, 0, 0, 0, 0); -}; - -// -// ## Module Helpers -// Module-level helpers for various utilities such as: -// instanceOf, parsability, and cloning. -// - -// -// ### function test (str) -// #### @str {string} String value to test if it is a TimeSpan -// Returns a value indicating if the specified string, `str`, -// is a parsable `TimeSpan` value. -// -exports.test = function (str) { - return timeSpanWithDays.test(str) || timeSpanNoDays.test(str); -}; - -// -// ### function instanceOf (timeSpan) -// #### @timeSpan {Object} Object to check TimeSpan quality. -// Returns a value indicating if the specified `timeSpan` is -// in fact a `TimeSpan` instance. -// -exports.instanceOf = function (timeSpan) { - return timeSpan instanceof TimeSpan; -}; - -// -// ### function clone (timeSpan) -// #### @timeSpan {TimeSpan} TimeSpan object to clone. -// Returns a new `TimeSpan` instance with the same value -// as the `timeSpan` object supplied. -// -exports.clone = function (timeSpan) { - if (!(timeSpan instanceof TimeSpan)) { return } - return exports.fromMilliseconds(timeSpan.totalMilliseconds()); -}; - -// -// ## Addition -// Methods for adding `TimeSpan` instances, -// milliseconds, seconds, hours, and days to other -// `TimeSpan` instances. -// - -// -// ### function add (timeSpan) -// #### @timeSpan {TimeSpan} TimeSpan to add to this instance -// Adds the specified `timeSpan` to this instance. -// -TimeSpan.prototype.add = function (timeSpan) { - if (!(timeSpan instanceof TimeSpan)) { return } - this.msecs += timeSpan.totalMilliseconds(); -}; - -// -// ### function addMilliseconds (milliseconds) -// #### @milliseconds {Number} Number of milliseconds to add. -// Adds the specified `milliseconds` to this instance. -// -TimeSpan.prototype.addMilliseconds = function (milliseconds) { - if (!isNumeric(milliseconds)) { return } - this.msecs += milliseconds; -}; - -// -// ### function addSeconds (seconds) -// #### @seconds {Number} Number of seconds to add. -// Adds the specified `seconds` to this instance. -// -TimeSpan.prototype.addSeconds = function (seconds) { - if (!isNumeric(seconds)) { return } - - this.msecs += (seconds * msecPerSecond); -}; - -// -// ### function addMinutes (minutes) -// #### @minutes {Number} Number of minutes to add. -// Adds the specified `minutes` to this instance. -// -TimeSpan.prototype.addMinutes = function (minutes) { - if (!isNumeric(minutes)) { return } - this.msecs += (minutes * msecPerMinute); -}; - -// -// ### function addHours (hours) -// #### @hours {Number} Number of hours to add. -// Adds the specified `hours` to this instance. -// -TimeSpan.prototype.addHours = function (hours) { - if (!isNumeric(hours)) { return } - this.msecs += (hours * msecPerHour); -}; - -// -// ### function addDays (days) -// #### @days {Number} Number of days to add. -// Adds the specified `days` to this instance. -// -TimeSpan.prototype.addDays = function (days) { - if (!isNumeric(days)) { return } - this.msecs += (days * msecPerDay); -}; - -// -// ## Subtraction -// Methods for subtracting `TimeSpan` instances, -// milliseconds, seconds, hours, and days from other -// `TimeSpan` instances. -// - -// -// ### function subtract (timeSpan) -// #### @timeSpan {TimeSpan} TimeSpan to subtract from this instance. -// Subtracts the specified `timeSpan` from this instance. -// -TimeSpan.prototype.subtract = function (timeSpan) { - if (!(timeSpan instanceof TimeSpan)) { return } - this.msecs -= timeSpan.totalMilliseconds(); -}; - -// -// ### function subtractMilliseconds (milliseconds) -// #### @milliseconds {Number} Number of milliseconds to subtract. -// Subtracts the specified `milliseconds` from this instance. -// -TimeSpan.prototype.subtractMilliseconds = function (milliseconds) { - if (!isNumeric(milliseconds)) { return } - this.msecs -= milliseconds; -}; - -// -// ### function subtractSeconds (seconds) -// #### @seconds {Number} Number of seconds to subtract. -// Subtracts the specified `seconds` from this instance. -// -TimeSpan.prototype.subtractSeconds = function (seconds) { - if (!isNumeric(seconds)) { return } - this.msecs -= (seconds * msecPerSecond); -}; - -// -// ### function subtractMinutes (minutes) -// #### @minutes {Number} Number of minutes to subtract. -// Subtracts the specified `minutes` from this instance. -// -TimeSpan.prototype.subtractMinutes = function (minutes) { - if (!isNumeric(minutes)) { return } - this.msecs -= (minutes * msecPerMinute); -}; - -// -// ### function subtractHours (hours) -// #### @hours {Number} Number of hours to subtract. -// Subtracts the specified `hours` from this instance. -// -TimeSpan.prototype.subtractHours = function (hours) { - if (!isNumeric(hours)) { return } - this.msecs -= (hours * msecPerHour); -}; - -// -// ### function subtractDays (days) -// #### @days {Number} Number of days to subtract. -// Subtracts the specified `days` from this instance. -// -TimeSpan.prototype.subtractDays = function (days) { - if (!isNumeric(days)) { return } - this.msecs -= (days * msecPerDay); -}; - -// -// ## Getters -// Methods for retrieving components of a `TimeSpan` -// instance: milliseconds, seconds, minutes, hours, and days. -// - -// -// ### function totalMilliseconds (roundDown) -// #### @roundDown {boolean} Value indicating if the value should be rounded down. -// Returns the total number of milliseconds for this instance, rounding down -// to the nearest integer if `roundDown` is set. -// -TimeSpan.prototype.totalMilliseconds = function (roundDown) { - var result = this.msecs; - if (roundDown === true) { - result = Math.floor(result); - } - - return result; -}; - -// -// ### function totalSeconds (roundDown) -// #### @roundDown {boolean} Value indicating if the value should be rounded down. -// Returns the total number of seconds for this instance, rounding down -// to the nearest integer if `roundDown` is set. -// -TimeSpan.prototype.totalSeconds = function (roundDown) { - var result = this.msecs / msecPerSecond; - if (roundDown === true) { - result = Math.floor(result); - } - - return result; -}; - -// -// ### function totalMinutes (roundDown) -// #### @roundDown {boolean} Value indicating if the value should be rounded down. -// Returns the total number of minutes for this instance, rounding down -// to the nearest integer if `roundDown` is set. -// -TimeSpan.prototype.totalMinutes = function (roundDown) { - var result = this.msecs / msecPerMinute; - if (roundDown === true) { - result = Math.floor(result); - } - - return result; -}; - -// -// ### function totalHours (roundDown) -// #### @roundDown {boolean} Value indicating if the value should be rounded down. -// Returns the total number of hours for this instance, rounding down -// to the nearest integer if `roundDown` is set. -// -TimeSpan.prototype.totalHours = function (roundDown) { - var result = this.msecs / msecPerHour; - if (roundDown === true) { - result = Math.floor(result); - } - - return result; -}; - -// -// ### function totalDays (roundDown) -// #### @roundDown {boolean} Value indicating if the value should be rounded down. -// Returns the total number of days for this instance, rounding down -// to the nearest integer if `roundDown` is set. -// -TimeSpan.prototype.totalDays = function (roundDown) { - var result = this.msecs / msecPerDay; - if (roundDown === true) { - result = Math.floor(result); - } - - return result; -}; - -// -// ### @milliseconds -// Returns the length of this `TimeSpan` instance in milliseconds. -// -TimeSpan.prototype.__defineGetter__('milliseconds', function () { - return this.msecs % 1000; -}); - -// -// ### @seconds -// Returns the length of this `TimeSpan` instance in seconds. -// -TimeSpan.prototype.__defineGetter__('seconds', function () { - return Math.floor(this.msecs / msecPerSecond) % 60; -}); - -// -// ### @minutes -// Returns the length of this `TimeSpan` instance in minutes. -// -TimeSpan.prototype.__defineGetter__('minutes', function () { - return Math.floor(this.msecs / msecPerMinute) % 60; -}); - -// -// ### @hours -// Returns the length of this `TimeSpan` instance in hours. -// -TimeSpan.prototype.__defineGetter__('hours', function () { - return Math.floor(this.msecs / msecPerHour) % 24; -}); - -// -// ### @days -// Returns the length of this `TimeSpan` instance in days. -// -TimeSpan.prototype.__defineGetter__('days', function () { - return Math.floor(this.msecs / msecPerDay); -}); - -// -// ## Instance Helpers -// Various help methods for performing utilities -// such as equality and serialization -// - -// -// ### function equals (timeSpan) -// #### @timeSpan {TimeSpan} TimeSpan instance to assert equal -// Returns a value indicating if the specified `timeSpan` is equal -// in milliseconds to this instance. -// -TimeSpan.prototype.equals = function (timeSpan) { - if (!(timeSpan instanceof TimeSpan)) { return } - return this.msecs === timeSpan.totalMilliseconds(); -}; - -// -// ### function toString () -// Returns a string representation of this `TimeSpan` -// instance according to current `format`. -// -TimeSpan.prototype.toString = function () { - if (!this.format) { return this._format() } - return this.format(this); -}; - -// -// ### @private function _format () -// Returns the default string representation of this instance. -// -TimeSpan.prototype._format = function () { - return [ - this.days, - this.hours, - this.minutes, - this.seconds + '.' + this.milliseconds - ].join(':') -}; - -// -// ### @private function isNumeric (input) -// #### @input {Number} Value to check numeric quality of. -// Returns a value indicating the numeric quality of the -// specified `input`. -// -function isNumeric (input) { - return input && !isNaN(parseFloat(input)) && isFinite(input); -}; - -// -// ### @private function _compute (delta, date, computed, options) -// #### @delta {Number} Channge in this component of the date -// #### @computed {Object} Currently computed date. -// #### @options {Object} Options for the computation -// Performs carry forward addition or subtraction for the -// `options.current` component of the `computed` date, carrying -// it forward to `options.next` depending on the maximum value, -// `options.max`. -// -function _compute (delta, computed, options) { - var current = options.current, - next = options.next, - max = options.max, - round = delta > 0 ? Math.floor : Math.ceil; - - if (delta) { - computed[next] += round.call(null, delta / max); - computed[current] += delta % max; - } - - if (Math.abs(computed[current]) >= max) { - computed[next] += round.call(null, computed[current] / max) - computed[current] = computed[current] % max; - } - - return computed; -} - - -// -// ### @private monthDays (month, year) -// #### @month {Number} Month to get days for. -// #### @year {Number} Year of the month to get days for. -// Returns the number of days in the specified `month` observing -// leap years. -// -var months = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; -function monthDays (month, year) { - if (((year % 100 !== 0 && year % 4 === 0) - || year % 400 === 0) && month === 1) { - return 29; - } - - return months[month]; -} \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/node_modules/timespan/package.json b/node_modules/winston/node_modules/loggly/node_modules/timespan/package.json deleted file mode 100644 index 4e0278c..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/timespan/package.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "name": "timespan", - "description": "A JavaScript TimeSpan library for node.js (and soon the browser)", - "version": "2.2.0", - "author": { - "name": "Michael Stum", - "email": "blog@stum.de" - }, - "contributors": [ - { - "name": "Charlie Robbins", - "email": "charlie.robbins@gmail.com" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/indexzero/timespan.git" - }, - "keywords": [ - "time", - "dates", - "utilities", - "timespan" - ], - "devDependencies": { - "vows": ">= 0.5.2" - }, - "main": "./lib/time-span.js", - "scripts": { - "test": "vows test/*-test.js --spec" - }, - "engines": { - "node": ">= 0.2.0" - }, - "_id": "timespan@2.2.0", - "dependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "dist": { - "shasum": "5694ee81655d4ca21495411c041d00ecffff715d" - }, - "_from": "timespan@2.x.x" -} diff --git a/node_modules/winston/node_modules/loggly/node_modules/timespan/test/date-parser-test.js b/node_modules/winston/node_modules/loggly/node_modules/timespan/test/date-parser-test.js deleted file mode 100644 index 6f08973..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/timespan/test/date-parser-test.js +++ /dev/null @@ -1,72 +0,0 @@ -/* - * time-span-test.js: Tests for the TimeSpan module. - * - * (C) Charlie Robbins - * MIT LICENSE - * - */ - -var vows = require('vows'), - assert = require('assert'), - timeSpan = require('../lib/time-span'); - -vows.describe('time-span/date-time').addBatch({ - "When using the TimeSpan module": { - "the parseDate() method": { - "when passed a TimeSpan string using ISO8601 with explicit time modifiers": { - "which do not carry over": { - "should return the correct value": function () { - var target = new Date(Date.parse('2010-04-03T10:04:15Z')), - parsed = timeSpan.parseDate('2010-04-03T12:34:15Z-2HOURS30MINUTES'); - - assert.equal(target.toString(), parsed.toString()); - } - }, - "which carry under": { - "should return the correct value": function () { - var target = new Date(Date.parse('2010-03-29T12:34:15Z')), - parsed = timeSpan.parseDate('2010-04-01T12:34:15Z-72HOURS'); - - assert.equal(target.toString(), parsed.toString()); - } - }, - "which carry under a leap year": { - "should return the correct value": function () { - var target = new Date(Date.parse('2007-03-31T12:00:00Z')), - parsed = timeSpan.parseDate('2010-03-31T12:00:00Z-1096DAYS'); - - assert.equal(target.toString(), parsed.toString()); - } - }, - "which carry over": { - "should return the correct value": function () { - var target = new Date(Date.parse('2013-04-03T12:34:15Z')), - parsed = timeSpan.parseDate('2010-04-03T12:34:15Z+2YEARS365DAYS'); - - assert.equal(target.toString(), parsed.toString()); - } - } - }, - "when passed a TimeSpan string using NOW with explicit time modifiers": { - "which do not carry over": { - "should return the correct value": function () { - var now = new Date(Date.now()), - parsed = timeSpan.parseDate('NOW-2HOURS'); - - now.setHours(now.getHours() - 2 - (now.getTimezoneOffset() / 60)); - assert.equal(now.getHours(), parsed.getHours()); - } - }, - "which carry under": { - "should return the correct value": function () { - var now = new Date(Date.now()), - parsed = timeSpan.parseDate('NOW-72HOURS'); - - now.setHours(now.getHours() - 72 - (now.getTimezoneOffset() / 60)); - assert.equal(now.getHours(), parsed.getHours()); - } - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/node_modules/timespan/test/helpers.js b/node_modules/winston/node_modules/loggly/node_modules/timespan/test/helpers.js deleted file mode 100644 index 4a1b84a..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/timespan/test/helpers.js +++ /dev/null @@ -1,36 +0,0 @@ -/* - * helpers.js: Tests helpers for the TimeSpan module. - * - * (C) Charlie Robbins - * MIT LICENSE - * - */ - -var assert = require('assert'), - timeSpan = require('../lib/time-span') - -function capitalize(str) { - return str.charAt(0).toUpperCase() + str.slice(1); -} - -var helpers = exports, - components = ['milliseconds', 'seconds', 'minutes', 'hours', 'days']; - -// -// Tests all of the factory methods for the `TimeSpan` object: -// `fromMilliseconds`, `fromSeconds`, etc. -// -exports.testFactories = function (num) { - var context = {}; - - components.forEach(function (component) { - var method = 'from' + capitalize(component); - - context['the ' + method + '() method'] = function () { - var value = timeSpan[method](num); - assert.equal(value[component], num); - } - }); - - return context; -}; \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/node_modules/timespan/test/time-span-test.js b/node_modules/winston/node_modules/loggly/node_modules/timespan/test/time-span-test.js deleted file mode 100644 index 66a7be5..0000000 --- a/node_modules/winston/node_modules/loggly/node_modules/timespan/test/time-span-test.js +++ /dev/null @@ -1,68 +0,0 @@ -/* - * time-span-test.js: Tests for the TimeSpan module. - * - * (C) Charlie Robbins - * MIT LICENSE - * - */ - -var vows = require('vows'), - assert = require('assert'), - timeSpan = require('../lib/time-span'), - helpers = require('./helpers'); - -vows.describe('time-span').addBatch({ - "When using the TimeSpan module": { - "the parse() method": { - "when passed a TimeSpan string with no days": { - "should return a valid TimeSpan object": function () { - var ts = timeSpan.parse("04:03:02.10"); - assert.equal(ts.hours, 4); - assert.equal(ts.minutes, 3); - assert.equal(ts.seconds, 2); - assert.equal(ts.milliseconds, 100); - } - }, - "when passed a TimeSpan string with days": { - "should return a valid TimeSpan object": function () { - var ts = timeSpan.parse("01:04:03:02.10"); - assert.equal(ts.days, 1); - assert.equal(ts.hours, 4); - assert.equal(ts.minutes, 3); - assert.equal(ts.seconds, 2); - assert.equal(ts.milliseconds, 100); - } - } - }, - "the test() method": { - "when passed a TimeSpan string with no days": { - "should return true": function () { - assert.isTrue(timeSpan.test("04:03:02.10")); - } - }, - "when passed a TimeSpan string with days": { - "should return true": function () { - assert.isTrue(timeSpan.test("01:04:03:02.10")); - } - }, - "when passed an invalid TimeSpan string": { - "should return false": function () { - assert.isFalse(timeSpan.test('xx:00:invalid')); - } - } - }, - "the fromDates() method": { - "with two Date values": function () { - var diff = 1000 * 60 * 60 * 12, - end = new Date(), - start = new Date(end.getTime() - diff); - - assert.equal(12, timeSpan.fromDates(start, end).hours); - }, - "with two string values": function () { - assert.equal(2, timeSpan.fromDates('NOW-4DAYS', 'NOW-2DAYS').days); - } - }, - "the factory methods": helpers.testFactories(10) - } -}).export(module); \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/package.json b/node_modules/winston/node_modules/loggly/package.json deleted file mode 100644 index ee45e59..0000000 --- a/node_modules/winston/node_modules/loggly/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "loggly", - "description": "A client implementation for Loggly cloud Logging-as-a-Service API", - "version": "0.3.11", - "author": { - "name": "Charlie Robbins", - "email": "charlie.robbins@gmail.com" - }, - "contributors": [ - { - "name": "Marak Squires", - "email": "marak.squires@gmail.com" - }, - { - "name": "hij1nx", - "email": "hij1nx@me.com" - }, - { - "name": "Kord Campbell", - "email": "kordless@loggly.com" - }, - { - "name": "Erik Hedenstrom", - "email": "erik@hedenstroem.com" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/nodejitsu/node-loggly.git" - }, - "keywords": [ - "cloud computing", - "api", - "logging", - "loggly" - ], - "dependencies": { - "request": "2.9.x", - "timespan": "2.x.x" - }, - "devDependencies": { - "vows": "0.6.x" - }, - "main": "./lib/loggly", - "scripts": { - "test": "vows test/*-test.js --spec" - }, - "engines": { - "node": ">= 0.4.0" - }, - "_id": "loggly@0.3.11", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "dist": { - "shasum": "9931494be7e1c46b9516b9bc518ab348b2298fa7" - }, - "_from": "loggly@0.3.x >=0.3.7" -} diff --git a/node_modules/winston/node_modules/loggly/test/common-test.js b/node_modules/winston/node_modules/loggly/test/common-test.js deleted file mode 100644 index 51c6b4a..0000000 --- a/node_modules/winston/node_modules/loggly/test/common-test.js +++ /dev/null @@ -1,32 +0,0 @@ -/* - * common-test.js: Tests for Loggly `common` utility module - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - common = require('../lib/loggly/common'); - -vows.describe('node-loggly/common').addBatch({ - "When using the common module": { - "the clone() method": { - topic: function () { - this.obj = { - name: 'common', - deep: { - first: 'first', - second: 'second' - } - }; - return common.clone(this.obj); - }, - "should return a deep clone of the object": function (clone) { - assert.isFalse(this.obj.deep === clone.deep); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/test/device-test.js b/node_modules/winston/node_modules/loggly/test/device-test.js deleted file mode 100644 index 8124180..0000000 --- a/node_modules/winston/node_modules/loggly/test/device-test.js +++ /dev/null @@ -1,41 +0,0 @@ -/* - * device-test.js: Tests for Loggly device requests - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - helpers = require('./helpers'); - -var options = {}, - config = helpers.loadConfig(), - loggly = require('../lib/loggly').createClient(config); - -vows.describe('node-loggly/devices').addBatch({ - "When using the node-loggly client": { - "the getDevices() method": { - topic: function () { - loggly.getDevices(this.callback); - }, - "should return a list of valid devices": function (err, devices) { - assert.isNull(err); - devices.forEach(function (device) { - helpers.assertDevice(device); - }); - } - }, - "the addDeviceToInput() method": { - topic: function () { - loggly.addDeviceToInput(config.inputs.test.id, '127.0.0.1', this.callback); - }, - "should respond with 200 status code": function (err, res) { - assert.isNull(err); - assert.equal(res.statusCode, 200); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/test/helpers.js b/node_modules/winston/node_modules/loggly/test/helpers.js deleted file mode 100644 index b8ed45c..0000000 --- a/node_modules/winston/node_modules/loggly/test/helpers.js +++ /dev/null @@ -1,79 +0,0 @@ -/* - * helpers.js: Test helpers for node-loggly - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var fs = require('fs'), - util = require('util'), - path = require('path'), - vows = require('vows'), - assert = require('assert'), - loggly = require('../lib/loggly'); - -var helpers = exports; - -helpers.validConfig = function (config) { - return config - && config.subdomain !== 'test-subdomain' - && config.auth - && config.auth.username !== 'test-username' - && config.auth.password !== 'test-password' - && config.inputs - && config.inputs.test - && config.inputs.test_json; -}; - -helpers.loadConfig = function () { - try { - var configFile = path.join(__dirname, 'data', 'test-config.json'), - stats = fs.statSync(configFile) - config = JSON.parse(fs.readFileSync(configFile).toString()); - - if (!helpers.validConfig(config)) { - util.puts('Config file test-config.json must be updated with valid data before running tests'); - process.exit(0); - } - - helpers.config = config || {} - return config || {}; - } - catch (ex) { - util.puts('Error parsing test-config.json'); - ex.stack.split('\n').forEach(function (line) { - console.log(line); - }); - - process.exit(0); - } -}; - -helpers.assertInput = function (input) { - assert.instanceOf(input, loggly.Input); - assert.isNotNull(input.id); - assert.isNotNull(input.name); - assert.isNotNull(input.service); - assert.isNotNull(input.create); - assert.isNotNull(input.discover); - assert.isNotNull(input.discoverTime); - assert.isNotNull(input.description); -}; - -helpers.assertDevice = function (device) { - assert.instanceOf(device, loggly.Device); - assert.isNotNull(device.id); - assert.isNotNull(device.input); - assert.isNotNull(device.ipAddress); - assert.isNotNull(device.launched); - assert.isNotNull(device.resourceUri); -}; - -helpers.assertSearch = function (err, results) { - assert.isNull(err); - assert.isObject(results); - assert.isTrue(typeof results.data !== 'undefined'); - assert.isTrue(typeof results.numFound !== 'undefined'); - assert.isTrue(typeof results.context !== 'undefined'); -}; diff --git a/node_modules/winston/node_modules/loggly/test/input-test.js b/node_modules/winston/node_modules/loggly/test/input-test.js deleted file mode 100644 index 06cd763..0000000 --- a/node_modules/winston/node_modules/loggly/test/input-test.js +++ /dev/null @@ -1,197 +0,0 @@ -/* - * input-test.js: Tests for Loggly input requests - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - helpers = require('./helpers'); - -var options = {}, - testContext = {}, - config = helpers.loadConfig(), - loggly = require('../lib/loggly').createClient(config), - logglyJSON = require('../lib/loggly').createClient(config); - -logglyJSON.config.json = true; - -vows.describe('node-loggly/inputs').addBatch({ - "When using the node-loggly client": { - "the getInputs() method": { - topic: function () { - loggly.getInputs(this.callback); - }, - "should return a list of valid inputs": function (err, inputs) { - assert.isNull(err); - inputs.forEach(function (input) { - helpers.assertInput(input); - }); - } - }, - "the getInput method": { - "when called with a plaintext input": { - topic: function () { - loggly.getInput('test', this.callback); - }, - "should return a valid input": function (err, input) { - assert.isNull(err); - helpers.assertInput(input); - }, - "of the format 'text'": function (err, input) { - assert.isNull(err); - assert.equal(input.format, 'text'); - }, - "that matches the first input in the test configuration": function (err, input) { - assert.equal(config.inputs.test.token,input.input_token); - assert.equal(config.inputs.test.id,input.id); - testContext.input = input; - } - }, - "when called with a json input": { - topic: function () { - logglyJSON.getInput('test_json', this.callback); - }, - "should return a valid input": function (err, input) { - assert.isNull(err); - helpers.assertInput(input); - }, - "of the format 'json'": function (err, input) { - assert.isNull(err); - assert.equal(input.format, 'json'); - }, - "that matches the second input in the test configuration": function (err, input) { - assert.equal(config.inputs.test_json.token,input.input_token); - assert.equal(config.inputs.test_json.id,input.id); - testContext.inputJSON = input; - } - } - } - } -}).addBatch({ - "When using the node-loggly client": { - "the log() method": { - "to a 'text' input": { - "when passed a callback": { - topic: function () { - loggly.log( - config.inputs.test.token, - 'this is a test logging message from /test/input-test.js', - this.callback); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - }, - "when not passed a callback": { - topic: function () { - var emitter = loggly.log(config.inputs.test.token, 'this is a test logging message from /test/input-test.js'); - emitter.on('log', this.callback.bind(null, null)); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - } - }, - "to a 'json' input": { - "when passed a callback": { - topic: function () { - logglyJSON.log( - config.inputs.test_json.token, - { - timestamp: new Date().getTime(), - message: 'this is a test logging message from /test/input-test.js' - }, - this.callback); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - }, - "when not passed a callback": { - topic: function () { - var emitter = logglyJSON.log( - config.inputs.test_json.token, - { - timestamp: new Date().getTime(), - message: 'this is a test logging message from /test/input-test.js' - } - ); - emitter.on('log', this.callback.bind(null, null)); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - } - } - } - } -}).addBatch({ - "When using an instance of an input": { - "the log() method of the 'text' instance": { - "when passed a callback": { - topic: function () { - testContext.input.log('this is a test logging message from /test/input-test.js', this.callback); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - }, - "when not passed a callback": { - topic: function () { - var emitter = testContext.input.log('this is a test logging message from /test/input-test.js'); - emitter.on('log', this.callback.bind(null, null)); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - } - }, - "the log() method of the 'json' instance": { - "when passed a callback": { - topic: function () { - testContext.inputJSON.log( - { - timestamp: new Date().getTime(), - message: 'this is a test logging message from /test/input-test.js' - }, - this.callback); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - }, - "when not passed a callback": { - topic: function () { - var emitter = testContext.inputJSON.log({ - timestamp: new Date().getTime(), - message: 'this is a test logging message from /test/input-test.js' - }); - emitter.on('log', this.callback.bind(null, null)); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/test/log-test.js b/node_modules/winston/node_modules/loggly/test/log-test.js deleted file mode 100644 index 876db63..0000000 --- a/node_modules/winston/node_modules/loggly/test/log-test.js +++ /dev/null @@ -1,84 +0,0 @@ -/* - * log-test.js: Tests for vanilla logging with no authentication. - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - helpers = require('./helpers'); - -var config = helpers.loadConfig(), - loggly = require('../lib/loggly').createClient({ subdomain: config.subdomain }), - logglyJSON = require('../lib/loggly').createClient({ subdomain: config.subdomain, json: true }); - -vows.describe('node-loggly/inputs (no auth)').addBatch({ - "When using the node-loggly client without authentication": { - "the log() method": { - "to a 'text' input": { - "when passed a callback": { - topic: function () { - loggly.log( - config.inputs.test.token, - 'this is a test logging message from /test/input-test.js', - this.callback); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - }, - "when not passed a callback": { - topic: function () { - var emitter = loggly.log(config.inputs.test.token, 'this is a test logging message from /test/input-test.js'); - emitter.on('log', this.callback.bind(null, null)); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - } - }, - "to a 'json' input": { - "when passed a callback": { - topic: function () { - logglyJSON.log( - config.inputs.test_json.token, - { - timestamp: new Date().getTime(), - message: 'this is a test logging message from /test/input-test.js' - }, - this.callback); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - }, - "when not passed a callback": { - topic: function () { - var emitter = logglyJSON.log( - config.inputs.test_json.token, - { - timestamp: new Date().getTime(), - message: 'this is a test logging message from /test/input-test.js' - } - ); - emitter.on('log', this.callback.bind(null, null)); - }, - "should log messages to loggly": function (err, result) { - assert.isNull(err); - assert.isObject(result); - assert.equal(result.response, 'ok'); - } - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/winston/node_modules/loggly/test/search-test.js b/node_modules/winston/node_modules/loggly/test/search-test.js deleted file mode 100644 index dac9da7..0000000 --- a/node_modules/winston/node_modules/loggly/test/search-test.js +++ /dev/null @@ -1,84 +0,0 @@ -/* - * input-test.js: Tests for Loggly input requests - * - * (C) 2010 Nodejitsu Inc. - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - helpers = require('./helpers'); - -var options = {}, - testContext = {}, - config = helpers.loadConfig(), - loggly = require('../lib/loggly').createClient(config); - -vows.describe('node-loggly/search').addBatch({ - "When using the node-loggly client": { - "the search() method": { - "when searching without chaining": { - topic: function () { - loggly.search('logging message', this.callback); - }, - "should return a set of valid search results": function (err, results) { - helpers.assertSearch(err, results); - } - }, - "when searching with chaining": { - topic: function () { - loggly.search('logging message') - .meta({ inputname: 'test' }) - .run(this.callback); - }, - "should return a set of valid search results": function (err, results) { - helpers.assertSearch(err, results); - } - } - }, - "the facet() method": { - "when searching by ip": { - topic: function () { - loggly.facet('ip', 'test', this.callback); - }, - "should return a set of valid search results": function (err, results) { - helpers.assertSearch(err, results); - } - }, - "when using chained searches": { - topic: function () { - loggly.facet('ip', 'test') - .context({ from: 'NOW-1MONTH' }) - .run(this.callback); - }, - "should return a set of valid search results": function (err, results) { - helpers.assertSearch(err, results); - } - } - }, - "the _checkRange() method": { - "with invalid options set": { - "should correct them": function () { - var search = loggly.search('logging message') - .context({ from: 'NOW', until: '1DAY' }) - ._checkRange(); - - assert.equal(search._context.from, 'NOW-24HOURS'); - assert.equal(search._context.until, 'NOW'); - } - }, - "with valid options set": { - "should not modify them": function () { - var search = loggly.search('logging message') - .context({ from: 'NOW-2MONTHS', until: 'NOW' }) - ._checkRange(); - - assert.equal(search._context.from, 'NOW-2MONTHS'); - assert.equal(search._context.until, 'NOW'); - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/winston/node_modules/pkginfo/.npmignore b/node_modules/winston/node_modules/pkginfo/.npmignore deleted file mode 100644 index 9303c34..0000000 --- a/node_modules/winston/node_modules/pkginfo/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -node_modules/ -npm-debug.log \ No newline at end of file diff --git a/node_modules/winston/node_modules/pkginfo/README.md b/node_modules/winston/node_modules/pkginfo/README.md deleted file mode 100644 index 07ba942..0000000 --- a/node_modules/winston/node_modules/pkginfo/README.md +++ /dev/null @@ -1,85 +0,0 @@ -# node-pkginfo - -An easy way to expose properties on a module from a package.json - -## Installation - -### Installing npm (node package manager) -``` - curl http://npmjs.org/install.sh | sh -``` - -### Installing pkginfo -``` - [sudo] npm install pkginfo -``` - -## Motivation -How often when writing node.js modules have you written the following line(s) of code? - -* Hard code your version string into your code - -``` js - exports.version = '0.1.0'; -``` - -* Programmatically expose the version from the package.json - -``` js - exports.version = JSON.parse(fs.readFileSync('/path/to/package.json', 'utf8')).version; -``` - -In other words, how often have you wanted to expose basic information from your package.json onto your module programmatically? **WELL NOW YOU CAN!** - -## Usage - -Using `pkginfo` is idiot-proof, just require and invoke it. - -``` js - var pkginfo = require('pkginfo')(module); - - console.dir(module.exports); -``` - -By invoking the `pkginfo` module all of the properties in your `package.json` file will be automatically exposed on the callee module (i.e. the parent module of `pkginfo`). - -Here's a sample of the output: - -``` - { name: 'simple-app', - description: 'A test fixture for pkginfo', - version: '0.1.0', - author: 'Charlie Robbins ', - keywords: [ 'test', 'fixture' ], - main: './index.js', - scripts: { test: 'vows test/*-test.js --spec' }, - engines: { node: '>= 0.4.0' } } -``` - -### Expose specific properties -If you don't want to expose **all** properties on from your `package.json` on your module then simple pass those properties to the `pkginfo` function: - -``` js - var pkginfo = require('pkginfo')(module, 'version', 'author'); - - console.dir(module.exports); -``` - -``` - { version: '0.1.0', - author: 'Charlie Robbins ' } -``` - -If you're looking for further usage see the [examples][0] included in this repository. - -## Run Tests -Tests are written in [vows][1] and give complete coverage of all APIs. - -``` - vows test/*-test.js --spec -``` - -[0]: https://github.com/indexzero/node-pkginfo/tree/master/examples -[1]: http://vowsjs.org - -#### Author: [Charlie Robbins](http://nodejitsu.com) \ No newline at end of file diff --git a/node_modules/winston/node_modules/pkginfo/docs/docco.css b/node_modules/winston/node_modules/pkginfo/docs/docco.css deleted file mode 100644 index bd54134..0000000 --- a/node_modules/winston/node_modules/pkginfo/docs/docco.css +++ /dev/null @@ -1,194 +0,0 @@ -/*--------------------- Layout and Typography ----------------------------*/ -body { - font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, FreeSerif, serif; - font-size: 15px; - line-height: 22px; - color: #252519; - margin: 0; padding: 0; -} -a { - color: #261a3b; -} - a:visited { - color: #261a3b; - } -p { - margin: 0 0 15px 0; -} -h4, h5, h6 { - color: #333; - margin: 6px 0 6px 0; - font-size: 13px; -} - h2, h3 { - margin-bottom: 0; - color: #000; - } - h1 { - margin-top: 40px; - margin-bottom: 15px; - color: #000; - } -#container { - position: relative; -} -#background { - position: fixed; - top: 0; left: 525px; right: 0; bottom: 0; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - z-index: -1; -} -#jump_to, #jump_page { - background: white; - -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; - -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; - font: 10px Arial; - text-transform: uppercase; - cursor: pointer; - text-align: right; -} -#jump_to, #jump_wrapper { - position: fixed; - right: 0; top: 0; - padding: 5px 10px; -} - #jump_wrapper { - padding: 0; - display: none; - } - #jump_to:hover #jump_wrapper { - display: block; - } - #jump_page { - padding: 5px 0 3px; - margin: 0 0 25px 25px; - } - #jump_page .source { - display: block; - padding: 5px 10px; - text-decoration: none; - border-top: 1px solid #eee; - } - #jump_page .source:hover { - background: #f5f5ff; - } - #jump_page .source:first-child { - } -table td { - border: 0; - outline: 0; -} - td.docs, th.docs { - max-width: 450px; - min-width: 450px; - min-height: 5px; - padding: 10px 25px 1px 50px; - overflow-x: hidden; - vertical-align: top; - text-align: left; - } - .docs pre { - margin: 15px 0 15px; - padding-left: 15px; - } - .docs p tt, .docs p code { - background: #f8f8ff; - border: 1px solid #dedede; - font-size: 12px; - padding: 0 0.2em; - } - .pilwrap { - position: relative; - } - .pilcrow { - font: 12px Arial; - text-decoration: none; - color: #454545; - position: absolute; - top: 3px; left: -20px; - padding: 1px 2px; - opacity: 0; - -webkit-transition: opacity 0.2s linear; - } - td.docs:hover .pilcrow { - opacity: 1; - } - td.code, th.code { - padding: 14px 15px 16px 25px; - width: 100%; - vertical-align: top; - background: #f5f5ff; - border-left: 1px solid #e5e5ee; - } - pre, tt, code { - font-size: 12px; line-height: 18px; - font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; - margin: 0; padding: 0; - } - - -/*---------------------- Syntax Highlighting -----------------------------*/ -td.linenos { background-color: #f0f0f0; padding-right: 10px; } -span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } -body .hll { background-color: #ffffcc } -body .c { color: #408080; font-style: italic } /* Comment */ -body .err { border: 1px solid #FF0000 } /* Error */ -body .k { color: #954121 } /* Keyword */ -body .o { color: #666666 } /* Operator */ -body .cm { color: #408080; font-style: italic } /* Comment.Multiline */ -body .cp { color: #BC7A00 } /* Comment.Preproc */ -body .c1 { color: #408080; font-style: italic } /* Comment.Single */ -body .cs { color: #408080; font-style: italic } /* Comment.Special */ -body .gd { color: #A00000 } /* Generic.Deleted */ -body .ge { font-style: italic } /* Generic.Emph */ -body .gr { color: #FF0000 } /* Generic.Error */ -body .gh { color: #000080; font-weight: bold } /* Generic.Heading */ -body .gi { color: #00A000 } /* Generic.Inserted */ -body .go { color: #808080 } /* Generic.Output */ -body .gp { color: #000080; font-weight: bold } /* Generic.Prompt */ -body .gs { font-weight: bold } /* Generic.Strong */ -body .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ -body .gt { color: #0040D0 } /* Generic.Traceback */ -body .kc { color: #954121 } /* Keyword.Constant */ -body .kd { color: #954121; font-weight: bold } /* Keyword.Declaration */ -body .kn { color: #954121; font-weight: bold } /* Keyword.Namespace */ -body .kp { color: #954121 } /* Keyword.Pseudo */ -body .kr { color: #954121; font-weight: bold } /* Keyword.Reserved */ -body .kt { color: #B00040 } /* Keyword.Type */ -body .m { color: #666666 } /* Literal.Number */ -body .s { color: #219161 } /* Literal.String */ -body .na { color: #7D9029 } /* Name.Attribute */ -body .nb { color: #954121 } /* Name.Builtin */ -body .nc { color: #0000FF; font-weight: bold } /* Name.Class */ -body .no { color: #880000 } /* Name.Constant */ -body .nd { color: #AA22FF } /* Name.Decorator */ -body .ni { color: #999999; font-weight: bold } /* Name.Entity */ -body .ne { color: #D2413A; font-weight: bold } /* Name.Exception */ -body .nf { color: #0000FF } /* Name.Function */ -body .nl { color: #A0A000 } /* Name.Label */ -body .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */ -body .nt { color: #954121; font-weight: bold } /* Name.Tag */ -body .nv { color: #19469D } /* Name.Variable */ -body .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */ -body .w { color: #bbbbbb } /* Text.Whitespace */ -body .mf { color: #666666 } /* Literal.Number.Float */ -body .mh { color: #666666 } /* Literal.Number.Hex */ -body .mi { color: #666666 } /* Literal.Number.Integer */ -body .mo { color: #666666 } /* Literal.Number.Oct */ -body .sb { color: #219161 } /* Literal.String.Backtick */ -body .sc { color: #219161 } /* Literal.String.Char */ -body .sd { color: #219161; font-style: italic } /* Literal.String.Doc */ -body .s2 { color: #219161 } /* Literal.String.Double */ -body .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */ -body .sh { color: #219161 } /* Literal.String.Heredoc */ -body .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */ -body .sx { color: #954121 } /* Literal.String.Other */ -body .sr { color: #BB6688 } /* Literal.String.Regex */ -body .s1 { color: #219161 } /* Literal.String.Single */ -body .ss { color: #19469D } /* Literal.String.Symbol */ -body .bp { color: #954121 } /* Name.Builtin.Pseudo */ -body .vc { color: #19469D } /* Name.Variable.Class */ -body .vg { color: #19469D } /* Name.Variable.Global */ -body .vi { color: #19469D } /* Name.Variable.Instance */ -body .il { color: #666666 } /* Literal.Number.Integer.Long */ \ No newline at end of file diff --git a/node_modules/winston/node_modules/pkginfo/docs/pkginfo.html b/node_modules/winston/node_modules/pkginfo/docs/pkginfo.html deleted file mode 100644 index bf615fa..0000000 --- a/node_modules/winston/node_modules/pkginfo/docs/pkginfo.html +++ /dev/null @@ -1,101 +0,0 @@ - pkginfo.js

        pkginfo.js

        /*
        - * pkginfo.js: Top-level include for the pkginfo module
        - *
        - * (C) 2011, Charlie Robbins
        - *
        - */
        - 
        -var fs = require('fs'),
        -    path = require('path');

        function pkginfo ([options, 'property', 'property' ..])

        - -

        @pmodule {Module} Parent module to read from.

        - -

        @options {Object|Array|string} Optional Options used when exposing properties.

        - -

        @arguments {string...} Optional Specified properties to expose.

        - -

        Exposes properties from the package.json file for the parent module on -it's exports. Valid usage:

        - -

        require('pkginfo')()

        - -

        require('pkginfo')('version', 'author');

        - -

        require('pkginfo')(['version', 'author']);

        - -

        require('pkginfo')({ include: ['version', 'author'] });

        var pkginfo = module.exports = function (pmodule, options) {
        -  var args = [].slice.call(arguments, 2).filter(function (arg) {
        -    return typeof arg === 'string';
        -  });
        -  

        Parse variable arguments

          if (Array.isArray(options)) {

        If the options passed in is an Array assume that -it is the Array of properties to expose from the -on the package.json file on the parent module.

            options = { include: options };
        -  }
        -  else if (typeof options === 'string') {

        Otherwise if the first argument is a string, then -assume that it is the first property to expose from -the package.json file on the parent module.

            options = { include: [options] };
        -  }
        -  

        Setup default options

          options = options || { include: [] };
        -  
        -  if (args.length > 0) {

        If additional string arguments have been passed in -then add them to the properties to expose on the -parent module.

            options.include = options.include.concat(args);
        -  }
        -  
        -  var pkg = pkginfo.read(pmodule, options.dir).package;
        -  Object.keys(pkg).forEach(function (key) {
        -    if (options.include.length > 0 && !~options.include.indexOf(key)) {
        -      return;
        -    }
        -    
        -    if (!pmodule.exports[key]) {
        -      pmodule.exports[key] = pkg[key];
        -    }
        -  });
        -  
        -  return pkginfo;
        -};

        function find (dir)

        - -

        @pmodule {Module} Parent module to read from.

        - -

        @dir {string} Optional Directory to start search from.

        - -

        Searches up the directory tree from dir until it finds a directory -which contains a package.json file.

        pkginfo.find = function (pmodule, dir) {
        -  dir = dir || pmodule.filename;
        -  dir = path.dirname(dir); 
        -  
        -  var files = fs.readdirSync(dir);
        -  
        -  if (~files.indexOf('package.json')) {
        -    return path.join(dir, 'package.json');
        -  }
        -  
        -  if (dir === '/') {
        -    throw new Error('Could not find package.json up from: ' + dir);
        -  }
        -  
        -  return pkginfo.find(dir);
        -};

        function read (pmodule, dir)

        - -

        @pmodule {Module} Parent module to read from.

        - -

        @dir {string} Optional Directory to start search from.

        - -

        Searches up the directory tree from dir until it finds a directory -which contains a package.json file and returns the package information.

        pkginfo.read = function (pmodule, dir) { 
        -  dir = pkginfo.find(pmodule, dir);
        -  
        -  var data = fs.readFileSync(dir).toString();
        -      
        -  return {
        -    dir: dir, 
        -    package: JSON.parse(data)
        -  };
        -};

        Call pkginfo on this module and expose version.

        pkginfo(module, {
        -  dir: __dirname,
        -  include: ['version'],
        -  target: pkginfo
        -});
        -
        -
        \ No newline at end of file diff --git a/node_modules/winston/node_modules/pkginfo/examples/all-properties.js b/node_modules/winston/node_modules/pkginfo/examples/all-properties.js deleted file mode 100644 index fd1d831..0000000 --- a/node_modules/winston/node_modules/pkginfo/examples/all-properties.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * all-properties.js: Sample of including all properties from a package.json file - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/winston/node_modules/pkginfo/examples/array-argument.js b/node_modules/winston/node_modules/pkginfo/examples/array-argument.js deleted file mode 100644 index b1b6848..0000000 --- a/node_modules/winston/node_modules/pkginfo/examples/array-argument.js +++ /dev/null @@ -1,20 +0,0 @@ -/* - * array-argument.js: Sample of including specific properties from a package.json file - * using Array argument syntax. - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, ['version', 'author']); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/winston/node_modules/pkginfo/examples/multiple-properties.js b/node_modules/winston/node_modules/pkginfo/examples/multiple-properties.js deleted file mode 100644 index b4b5fd6..0000000 --- a/node_modules/winston/node_modules/pkginfo/examples/multiple-properties.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * multiple-properties.js: Sample of including multiple properties from a package.json file - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, 'version', 'author'); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/winston/node_modules/pkginfo/examples/object-argument.js b/node_modules/winston/node_modules/pkginfo/examples/object-argument.js deleted file mode 100644 index 28420c8..0000000 --- a/node_modules/winston/node_modules/pkginfo/examples/object-argument.js +++ /dev/null @@ -1,22 +0,0 @@ -/* - * object-argument.js: Sample of including specific properties from a package.json file - * using Object argument syntax. - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, { - include: ['version', 'author'] - }); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/winston/node_modules/pkginfo/examples/package.json b/node_modules/winston/node_modules/pkginfo/examples/package.json deleted file mode 100644 index 1f2f01c..0000000 --- a/node_modules/winston/node_modules/pkginfo/examples/package.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "name": "simple-app", - "description": "A test fixture for pkginfo", - "version": "0.1.0", - "author": "Charlie Robbins ", - "keywords": ["test", "fixture"], - "main": "./index.js", - "scripts": { "test": "vows test/*-test.js --spec" }, - "engines": { "node": ">= 0.4.0" } -} diff --git a/node_modules/winston/node_modules/pkginfo/examples/single-property.js b/node_modules/winston/node_modules/pkginfo/examples/single-property.js deleted file mode 100644 index 4f44561..0000000 --- a/node_modules/winston/node_modules/pkginfo/examples/single-property.js +++ /dev/null @@ -1,19 +0,0 @@ -/* - * single-property.js: Sample of including a single specific properties from a package.json file - * - * (C) 2011, Charlie Robbins - * - */ - -var util = require('util'), - pkginfo = require('../lib/pkginfo')(module, 'version'); - -exports.someFunction = function () { - console.log('some of your custom logic here'); -}; - -console.log('Inspecting module:'); -console.dir(module.exports); - -console.log('\nAll exports exposed:'); -console.error(Object.keys(module.exports)); \ No newline at end of file diff --git a/node_modules/winston/node_modules/pkginfo/lib/pkginfo.js b/node_modules/winston/node_modules/pkginfo/lib/pkginfo.js deleted file mode 100644 index a4a6227..0000000 --- a/node_modules/winston/node_modules/pkginfo/lib/pkginfo.js +++ /dev/null @@ -1,132 +0,0 @@ -/* - * pkginfo.js: Top-level include for the pkginfo module - * - * (C) 2011, Charlie Robbins - * - */ - -var fs = require('fs'), - path = require('path'); - -// -// ### function pkginfo ([options, 'property', 'property' ..]) -// #### @pmodule {Module} Parent module to read from. -// #### @options {Object|Array|string} **Optional** Options used when exposing properties. -// #### @arguments {string...} **Optional** Specified properties to expose. -// Exposes properties from the package.json file for the parent module on -// it's exports. Valid usage: -// -// `require('pkginfo')()` -// -// `require('pkginfo')('version', 'author');` -// -// `require('pkginfo')(['version', 'author']);` -// -// `require('pkginfo')({ include: ['version', 'author'] });` -// -var pkginfo = module.exports = function (pmodule, options) { - var args = [].slice.call(arguments, 2).filter(function (arg) { - return typeof arg === 'string'; - }); - - // - // **Parse variable arguments** - // - if (Array.isArray(options)) { - // - // If the options passed in is an Array assume that - // it is the Array of properties to expose from the - // on the package.json file on the parent module. - // - options = { include: options }; - } - else if (typeof options === 'string') { - // - // Otherwise if the first argument is a string, then - // assume that it is the first property to expose from - // the package.json file on the parent module. - // - options = { include: [options] }; - } - - // - // **Setup default options** - // - options = options || { include: [] }; - - if (args.length > 0) { - // - // If additional string arguments have been passed in - // then add them to the properties to expose on the - // parent module. - // - options.include = options.include.concat(args); - } - - var pkg = pkginfo.read(pmodule, options.dir).package; - Object.keys(pkg).forEach(function (key) { - if (options.include.length > 0 && !~options.include.indexOf(key)) { - return; - } - - if (!pmodule.exports[key]) { - pmodule.exports[key] = pkg[key]; - } - }); - - return pkginfo; -}; - -// -// ### function find (dir) -// #### @pmodule {Module} Parent module to read from. -// #### @dir {string} **Optional** Directory to start search from. -// Searches up the directory tree from `dir` until it finds a directory -// which contains a `package.json` file. -// -pkginfo.find = function (pmodule, dir) { - dir = dir || pmodule.filename; - dir = path.dirname(dir); - - var files = fs.readdirSync(dir); - - if (~files.indexOf('package.json')) { - return path.join(dir, 'package.json'); - } - - if (dir === '/') { - throw new Error('Could not find package.json up from: ' + dir); - } - else if (!dir || dir === '.') { - throw new Error('Cannot find package.json from unspecified directory'); - } - - return pkginfo.find(pmodule, dir); -}; - -// -// ### function read (pmodule, dir) -// #### @pmodule {Module} Parent module to read from. -// #### @dir {string} **Optional** Directory to start search from. -// Searches up the directory tree from `dir` until it finds a directory -// which contains a `package.json` file and returns the package information. -// -pkginfo.read = function (pmodule, dir) { - dir = pkginfo.find(pmodule, dir); - - var data = fs.readFileSync(dir).toString(); - - return { - dir: dir, - package: JSON.parse(data) - }; -}; - -// -// Call `pkginfo` on this module and expose version. -// -pkginfo(module, { - dir: __dirname, - include: ['version'], - target: pkginfo -}); \ No newline at end of file diff --git a/node_modules/winston/node_modules/pkginfo/package.json b/node_modules/winston/node_modules/pkginfo/package.json deleted file mode 100644 index 1fc3f6b..0000000 --- a/node_modules/winston/node_modules/pkginfo/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "pkginfo", - "version": "0.2.3", - "description": "An easy way to expose properties on a module from a package.json", - "author": { - "name": "Charlie Robbins", - "email": "charlie.robbins@gmail.com" - }, - "repository": { - "type": "git", - "url": "git://github.com/indexzero/node-pkginfo.git" - }, - "keywords": [ - "info", - "tools", - "package.json" - ], - "devDependencies": { - "vows": "0.6.x" - }, - "main": "./lib/pkginfo", - "scripts": { - "test": "vows test/*-test.js --spec" - }, - "engines": { - "node": ">= 0.4.0" - }, - "_id": "pkginfo@0.2.3", - "dependencies": {}, - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "dist": { - "shasum": "2656d70ae36b242f4fa6c7eb3d9087ee438e00be" - }, - "_from": "pkginfo@0.2.x" -} diff --git a/node_modules/winston/node_modules/pkginfo/test/pkginfo-test.js b/node_modules/winston/node_modules/pkginfo/test/pkginfo-test.js deleted file mode 100644 index 3156c00..0000000 --- a/node_modules/winston/node_modules/pkginfo/test/pkginfo-test.js +++ /dev/null @@ -1,69 +0,0 @@ -/* - * pkginfo-test.js: Tests for the pkginfo module. - * - * (C) 2011, Charlie Robbins - * - */ - -var assert = require('assert'), - exec = require('child_process').exec, - fs = require('fs'), - path = require('path'), - vows = require('vows'), - pkginfo = require('../lib/pkginfo'); - -function assertProperties (source, target) { - assert.lengthOf(source, target.length + 1); - target.forEach(function (prop) { - assert.isTrue(!!~source.indexOf(prop)); - }); -} - -function testExposes (options) { - return { - topic: function () { - exec('node ' + path.join(__dirname, '..', 'examples', options.script), this.callback); - }, - "should expose that property correctly": function (err, stdout, stderr) { - assert.isNull(err); - - var exposed = stderr.match(/'(\w+)'/ig).map(function (p) { - return p.substring(1, p.length - 1); - }); - - return !options.assert - ? assertProperties(exposed, options.properties) - : options.assert(exposed); - } - } -} - -vows.describe('pkginfo').addBatch({ - "When using the pkginfo module": { - "and passed a single `string` argument": testExposes({ - script: 'single-property.js', - properties: ['version'] - }), - "and passed multiple `string` arguments": testExposes({ - script: 'multiple-properties.js', - properties: ['version', 'author'] - }), - "and passed an `object` argument": testExposes({ - script: 'object-argument.js', - properties: ['version', 'author'] - }), - "and passed an `array` argument": testExposes({ - script: 'array-argument.js', - properties: ['version', 'author'] - }), - "and passed no arguments": testExposes({ - script: 'all-properties.js', - assert: function (exposed) { - var pkg = fs.readFileSync(path.join(__dirname, '..', 'examples', 'package.json')).toString(), - keys = Object.keys(JSON.parse(pkg)); - - assertProperties(exposed, keys); - } - }) - } -}).export(module); diff --git a/node_modules/winston/node_modules/stack-trace/.npmignore b/node_modules/winston/node_modules/stack-trace/.npmignore deleted file mode 100644 index 3f31ac2..0000000 --- a/node_modules/winston/node_modules/stack-trace/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -*.un~ -/node_modules diff --git a/node_modules/winston/node_modules/stack-trace/License b/node_modules/winston/node_modules/stack-trace/License deleted file mode 100644 index 11ec094..0000000 --- a/node_modules/winston/node_modules/stack-trace/License +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011 Felix Geisendörfer (felix@debuggable.com) - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. diff --git a/node_modules/winston/node_modules/stack-trace/Makefile b/node_modules/winston/node_modules/stack-trace/Makefile deleted file mode 100644 index a7ce31d..0000000 --- a/node_modules/winston/node_modules/stack-trace/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -SHELL := /bin/bash - -test: - @./test/run.js - -release: - git push - git push --tags - npm publish . - -.PHONY: test diff --git a/node_modules/winston/node_modules/stack-trace/Readme.md b/node_modules/winston/node_modules/stack-trace/Readme.md deleted file mode 100644 index fcd1b97..0000000 --- a/node_modules/winston/node_modules/stack-trace/Readme.md +++ /dev/null @@ -1,98 +0,0 @@ -# stack-trace - -Get v8 stack traces as an array of CallSite objects. - -## Install - -``` bash -npm install stack-trace -``` - -## Usage - -The stack-trace module makes it easy for you to capture the current stack: - -``` javascript -var stackTrace = require('stack-trace'); -var trace = stackTrace.get(); - -require('assert').strictEqual(trace[0].getFileName(), __filename); -``` - -However, sometimes you have already popped the stack you are interested in, -and all you have left is an `Error` object. This module can help: - -``` javascript -var stackTrace = require('stack-trace'); -var err = new Error('something went wrong'); -var trace = stackTrace.parse(err); - -require('assert').strictEqual(trace[0].getFileName(), __filename); -``` - -Please note that parsing the `Error#stack` property is not perfect, only -certain properties can be retrieved with it as noted in the API docs below. - -## Long stack traces - -stack-trace works great with [long-stack-traces][], when parsing an `err.stack` -that has crossed the event loop boundary, a `CallSite` object returning -`'----------------------------------------'` for `getFileName()` is created. -All other methods of the event loop boundary call site return `null`. - -[long-stack-traces]: https://github.com/tlrobinson/long-stack-traces - -## API - -### stackTrace.get([belowFn]) - -Returns an array of `CallSite` objects, where element `0` is the current call -site. - -When passing a function on the current stack as the `belowFn` parameter, the -returned array will only include `CallSite` objects below this function. - -### stackTrace.parse(err) - -Parses the `err.stack` property of an `Error` object into an array compatible -with those returned by `stackTrace.get()`. However, only the following methods -are implemented on the returned `CallSite` objects. - -* getTypeName -* getFunctionName -* getMethodName -* getFileName -* getLineNumber -* getColumnNumber -* isNative - -Note: Except `getFunctionName()`, all of the above methods return exactly the -same values as you would get from `stackTrace.get()`. `getFunctionName()` -is sometimes a little different, but still useful. - -### CallSite - -The official v8 CallSite object API can be found [here][v8stackapi]. A quick -excerpt: - -> A CallSite object defines the following methods: -> -> * **getThis**: returns the value of this -> * **getTypeName**: returns the type of this as a string. This is the name of the function stored in the constructor field of this, if available, otherwise the object's [[Class]] internal property. -> * **getFunction**: returns the current function -> * **getFunctionName**: returns the name of the current function, typically its name property. If a name property is not available an attempt will be made to try to infer a name from the function's context. -> * **getMethodName**: returns the name of the property of this or one of its prototypes that holds the current function -> * **getFileName**: if this function was defined in a script returns the name of the script -> * **getLineNumber**: if this function was defined in a script returns the current line number -> * **getColumnNumber**: if this function was defined in a script returns the current column number -> * **getEvalOrigin**: if this function was created using a call to eval returns a CallSite object representing the location where eval was called -> * **isToplevel**: is this a toplevel invocation, that is, is this the global object? -> * **isEval**: does this call take place in code defined by a call to eval? -> * **isNative**: is this call in native V8 code? -> * **isConstructor**: is this a constructor call? - -[v8stackapi]: http://code.google.com/p/v8/wiki/JavaScriptStackTraceApi - -## License - -stack-trace is licensed under the MIT license. diff --git a/node_modules/winston/node_modules/stack-trace/lib/stack-trace.js b/node_modules/winston/node_modules/stack-trace/lib/stack-trace.js deleted file mode 100644 index 085ff40..0000000 --- a/node_modules/winston/node_modules/stack-trace/lib/stack-trace.js +++ /dev/null @@ -1,111 +0,0 @@ -exports.get = function(belowFn) { - var oldLimit = Error.stackTraceLimit; - Error.stackTraceLimit = Infinity; - - var dummyObject = {}; - Error.captureStackTrace(dummyObject, belowFn || exports.get); - - var v8Handler = Error.prepareStackTrace; - Error.prepareStackTrace = function(dummyObject, v8StackTrace) { - return v8StackTrace; - }; - - var v8StackTrace = dummyObject.stack; - Error.prepareStackTrace = v8Handler; - Error.stackTraceLimit = oldLimit; - - return v8StackTrace; -}; - -exports.parse = function(err) { - if (!err.stack) { - return []; - } - - var self = this; - var lines = err.stack.split('\n').slice(1); - - return lines - .map(function(line) { - if (line.match(/^\s*[-]{4,}$/)) { - return self._createParsedCallSite({ - fileName: line, - lineNumber: null, - functionName: null, - typeName: null, - methodName: null, - columnNumber: null, - 'native': null, - }); - } - - var lineMatch = line.match(/at (?:([^\s]+)\s+)?\(?(?:(.+?):(\d+):(\d+)|([^)]+))\)?/); - if (!lineMatch) { - return; - } - - var object = null; - var method = null; - var functionName = null; - var typeName = null; - var methodName = null; - var isNative = (lineMatch[5] === 'native'); - - if (lineMatch[1]) { - var methodMatch = lineMatch[1].match(/([^\.]+)(?:\.(.+))?/); - object = methodMatch[1]; - method = methodMatch[2]; - functionName = lineMatch[1]; - typeName = 'Object'; - } - - if (method) { - typeName = object; - methodName = method; - } - - if (method === '') { - methodName = null; - functionName = ''; - } - - var properties = { - fileName: lineMatch[2] || null, - lineNumber: parseInt(lineMatch[3], 10) || null, - functionName: functionName, - typeName: typeName, - methodName: methodName, - columnNumber: parseInt(lineMatch[4], 10) || null, - 'native': isNative, - }; - - return self._createParsedCallSite(properties); - }) - .filter(function(callSite) { - return !!callSite; - }); -}; - -exports._createParsedCallSite = function(properties) { - var methods = {}; - for (var property in properties) { - var prefix = 'get'; - if (property === 'native') { - prefix = 'is'; - } - var method = prefix + property.substr(0, 1).toUpperCase() + property.substr(1); - - (function(property) { - methods[method] = function() { - return properties[property]; - } - })(property); - } - - var callSite = Object.create(methods); - for (var property in properties) { - callSite[property] = properties[property]; - } - - return callSite; -}; diff --git a/node_modules/winston/node_modules/stack-trace/package.json b/node_modules/winston/node_modules/stack-trace/package.json deleted file mode 100644 index 87f694d..0000000 --- a/node_modules/winston/node_modules/stack-trace/package.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "author": { - "name": "Felix Geisendörfer", - "email": "felix@debuggable.com", - "url": "http://debuggable.com/" - }, - "name": "stack-trace", - "description": "Get v8 stack traces as an array of CallSite objects.", - "version": "0.0.6", - "homepage": "https://github.com/felixge/node-stack-trace", - "repository": { - "type": "git", - "url": "git://github.com/felixge/node-stack-trace.git" - }, - "main": "./lib/stack-trace", - "engines": { - "node": "*" - }, - "dependencies": {}, - "devDependencies": { - "far": "0.0.3", - "long-stack-traces": "0.1.2" - }, - "_id": "stack-trace@0.0.6", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "dist": { - "shasum": "264ccac023e8ef5e86acd1970e6fe62c90ad3183" - }, - "_from": "stack-trace@0.0.x" -} diff --git a/node_modules/winston/node_modules/stack-trace/test/common.js b/node_modules/winston/node_modules/stack-trace/test/common.js deleted file mode 100644 index 2985c2f..0000000 --- a/node_modules/winston/node_modules/stack-trace/test/common.js +++ /dev/null @@ -1,10 +0,0 @@ -var common = exports; - -var path = require('path'); -var root = path.dirname(__dirname); - -common.dir = { - lib: root + '/lib', -}; - -common.assert = require('assert'); diff --git a/node_modules/winston/node_modules/stack-trace/test/integration/test-get.js b/node_modules/winston/node_modules/stack-trace/test/integration/test-get.js deleted file mode 100644 index 53b2e61..0000000 --- a/node_modules/winston/node_modules/stack-trace/test/integration/test-get.js +++ /dev/null @@ -1,49 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var stackTrace = require(common.dir.lib + '/stack-trace'); - -(function testBasic() { - var trace = stackTrace.get(); - - assert.strictEqual(trace[0].getFunction(), testBasic); - assert.strictEqual(trace[0].getFunctionName(), 'testBasic'); - assert.strictEqual(trace[0].getFileName(), __filename); -})(); - -(function testWrapper() { - (function testBelowFn() { - var trace = stackTrace.get(testBelowFn); - assert.strictEqual(trace[0].getFunction(), testWrapper); - assert.strictEqual(trace[0].getFunctionName(), 'testWrapper'); - })(); -})(); - - -(function deep1() { - (function deep2() { - (function deep3() { - (function deep4() { - (function deep5() { - (function deep6() { - (function deep7() { - (function deep8() { - (function deep9() { - (function deep10() { - (function deep10() { - var trace = stackTrace.get(); - var hasFirstCallSite = trace.some(function(callSite) { - return callSite.getFunctionName() === 'deep1'; - }); - - assert.ok(hasFirstCallSite); - })(); - })(); - })(); - })(); - })(); - })(); - })(); - })(); - })(); - })(); -})(); diff --git a/node_modules/winston/node_modules/stack-trace/test/integration/test-long-stack-trace.js b/node_modules/winston/node_modules/stack-trace/test/integration/test-long-stack-trace.js deleted file mode 100644 index 6106c4a..0000000 --- a/node_modules/winston/node_modules/stack-trace/test/integration/test-long-stack-trace.js +++ /dev/null @@ -1,14 +0,0 @@ -var common = require('../common'); - -require('long-stack-traces'); -var assert = common.assert; -var stackTrace = require(common.dir.lib + '/stack-trace'); - -function badFn() { - var err = new Error('oh no'); - var trace = stackTrace.parse(err); - - assert.ok(trace[2].getFileName().match(/-----/)); -}; - -setTimeout(badFn, 10); diff --git a/node_modules/winston/node_modules/stack-trace/test/integration/test-parse.js b/node_modules/winston/node_modules/stack-trace/test/integration/test-parse.js deleted file mode 100644 index 4171a68..0000000 --- a/node_modules/winston/node_modules/stack-trace/test/integration/test-parse.js +++ /dev/null @@ -1,135 +0,0 @@ -var common = require('../common'); -var assert = common.assert; -var stackTrace = require(common.dir.lib + '/stack-trace'); - -(function testBasic() { - var err = new Error('something went wrong'); - var trace = stackTrace.parse(err); - - assert.strictEqual(trace[0].getFileName(), __filename); - assert.strictEqual(trace[0].getFunctionName(), 'testBasic'); -})(); - -(function testWrapper() { - (function testBelowFn() { - var err = new Error('something went wrong'); - var trace = stackTrace.parse(err); - assert.strictEqual(trace[0].getFunctionName(), 'testBelowFn'); - assert.strictEqual(trace[1].getFunctionName(), 'testWrapper'); - })(); -})(); - -(function testNoStack() { - var err = {stack: undefined}; - var trace = stackTrace.parse(err); - - assert.deepEqual(trace, []); -})(); - - -(function testCorruptStack() { - var err = {}; - err.stack = -'AssertionError: true == false\n' + -' fuck' + -' at Test.run (/Users/felix/code/node-fast-or-slow/lib/test.js:45:10)\n' + -'oh no' + -' at TestCase.run (/Users/felix/code/node-fast-or-slow/lib/test_case.js:61:8)\n'; - - var trace = stackTrace.parse(err); - assert.equal(trace.length, 2); -})(); - -(function testCompareRealWithParsedStackTrace() { - var realTrace = stackTrace.get(); var err = new Error('something went wrong'); - var parsedTrace = stackTrace.parse(err); - - realTrace.forEach(function(real, i) { - var parsed = parsedTrace[i]; - - function compare(method, exceptions) { - var realValue = real[method](); - var parsedValue = parsed[method](); - - if (exceptions && exceptions[i]) { - realValue = exceptions[i]; - } - - var realJson = JSON.stringify(realValue); - var parsedJson = JSON.stringify(parsedValue); - - var message = - method + ': ' + realJson + ' != ' + parsedJson + ' (#' + i + ')'; - - assert.strictEqual(realValue, parsedValue, message); - } - - compare('getFileName'); - compare('getFunctionName', { - 3: 'Object..js', - 5: 'Function._load', - 6: 'Array.0', - 7: 'EventEmitter._tickCallback', - }); - compare('getTypeName'); - compare('getMethodName'); - compare('getLineNumber'); - compare('getColumnNumber', { - 0: 47 - }); - compare('isNative'); - }); -})(); - -(function testStackWithNativeCall() { - var err = {}; - err.stack = -'AssertionError: true == false\n' + -' at Test.fn (/Users/felix/code/node-fast-or-slow/test/fast/example/test-example.js:6:10)\n' + -' at Test.run (/Users/felix/code/node-fast-or-slow/lib/test.js:45:10)\n' + -' at TestCase.runNext (/Users/felix/code/node-fast-or-slow/lib/test_case.js:73:8)\n' + -' at TestCase.run (/Users/felix/code/node-fast-or-slow/lib/test_case.js:61:8)\n' + -' at Array.0 (native)\n' + -' at EventEmitter._tickCallback (node.js:126:26)'; - - var trace = stackTrace.parse(err); - var nativeCallSite = trace[4]; - - assert.strictEqual(nativeCallSite.getFileName(), null); - assert.strictEqual(nativeCallSite.getFunctionName(), 'Array.0'); - assert.strictEqual(nativeCallSite.getTypeName(), 'Array'); - assert.strictEqual(nativeCallSite.getMethodName(), '0'); - assert.strictEqual(nativeCallSite.getLineNumber(), null); - assert.strictEqual(nativeCallSite.getColumnNumber(), null); - assert.strictEqual(nativeCallSite.isNative(), true); -})(); - -(function testStackWithFileOnly() { - var err = {}; - err.stack = -'AssertionError: true == false\n' + -' at /Users/felix/code/node-fast-or-slow/lib/test_case.js:80:10'; - - var trace = stackTrace.parse(err); - var callSite = trace[0]; - - assert.strictEqual(callSite.getFileName(), '/Users/felix/code/node-fast-or-slow/lib/test_case.js'); - assert.strictEqual(callSite.getFunctionName(), null); - assert.strictEqual(callSite.getTypeName(), null); - assert.strictEqual(callSite.getMethodName(), null); - assert.strictEqual(callSite.getLineNumber(), 80); - assert.strictEqual(callSite.getColumnNumber(), 10); - assert.strictEqual(callSite.isNative(), false); -})(); - -(function testStackWithMultilineMessage() { - var err = {}; - err.stack = -'AssertionError: true == false\nAnd some more shit\n' + -' at /Users/felix/code/node-fast-or-slow/lib/test_case.js:80:10'; - - var trace = stackTrace.parse(err); - var callSite = trace[0]; - - assert.strictEqual(callSite.getFileName(), '/Users/felix/code/node-fast-or-slow/lib/test_case.js'); -})(); diff --git a/node_modules/winston/node_modules/stack-trace/test/run.js b/node_modules/winston/node_modules/stack-trace/test/run.js deleted file mode 100755 index 0bb8e82..0000000 --- a/node_modules/winston/node_modules/stack-trace/test/run.js +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env node -var far = require('far').create(); - -far.add(__dirname); -far.include(/test-.*\.js$/); - -far.execute(); diff --git a/node_modules/winston/package.json b/node_modules/winston/package.json deleted file mode 100644 index 349a7e3..0000000 --- a/node_modules/winston/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "winston", - "description": "A multi-transport async logging library for Node.js", - "version": "0.5.11", - "author": { - "name": "Charlie Robbins", - "email": "charlie.robbins@gmail.com" - }, - "contributors": [ - { - "name": "Matthew Bergman", - "email": "mzbphoto@gmail.com" - }, - { - "name": "Marak Squires", - "email": "marak@nodejitsu.com" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/flatiron/winston.git" - }, - "keywords": [ - "logging", - "sysadmin", - "tools" - ], - "dependencies": { - "async": "0.1.x", - "colors": "0.x.x", - "eyes": "0.1.x", - "loggly": "0.3.x >=0.3.7", - "pkginfo": "0.2.x", - "stack-trace": "0.0.x" - }, - "devDependencies": { - "vows": "0.6.x" - }, - "main": "./lib/winston", - "scripts": { - "test": "vows --spec --isolate" - }, - "engines": { - "node": ">= 0.4.0" - }, - "_id": "winston@0.5.11", - "optionalDependencies": {}, - "_engineSupported": true, - "_npmVersion": "1.1.12", - "_nodeVersion": "v0.6.14", - "_defaultsLoaded": true, - "dist": { - "shasum": "747bb5e699121cf187d12224a16804285585564f" - }, - "_from": "winston@*" -} diff --git a/node_modules/winston/test/cli-test.js b/node_modules/winston/test/cli-test.js deleted file mode 100644 index 365fba3..0000000 --- a/node_modules/winston/test/cli-test.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * cli-test.js: Tests for the cli levels available in winston. - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -vows.describe('winston/logger/cli').addBatch({ - "When an instance of winston.Logger": { - topic: function () { - return new winston.Logger({ - transports: [ - new winston.transports.Console() - ] - }) - }, - "the cli() method": { - "should set the appropriate values on the logger": function (logger) { - logger.cli(); - assert.isTrue(logger.padLevels); - assert.isTrue(logger.transports.console.colorize); - assert.isFalse(logger.transports.console.timestamp); - Object.keys(winston.config.cli.levels).forEach(function (level) { - assert.isNumber(logger.levels[level]); - }); - - Object.keys(winston.config.cli.colors).forEach(function (color) { - assert.isString(winston.config.allColors[color]); - }); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/winston/test/container-test.js b/node_modules/winston/test/container-test.js deleted file mode 100644 index 2fcc26a..0000000 --- a/node_modules/winston/test/container-test.js +++ /dev/null @@ -1,99 +0,0 @@ -/* - * container-test.js: Tests for the Container object - * - * (C) 2011 Charlie Robbins - * MIT LICENSE - * - */ - -var assert = require('assert'), - fs = require('fs'), - http = require('http'), - path = require('path'), - vows = require('vows'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -vows.describe('winston/container').addBatch({ - "An instance of winston.Container": { - topic: new winston.Container(), - "the add() method": { - topic: function (container) { - return container.add('default-test'); - }, - "should correctly instantiate a Logger": function (logger) { - assert.instanceOf(logger, winston.Logger); - }, - "the get() method": { - topic: function (logger, container) { - this.callback.apply(this, arguments); - }, - "should respond with the logger previously created": function (existing, container) { - var logger = container.get('default-test'); - assert.isTrue(existing === logger); - } - }, - "the has() method": { - topic: function (logger, container) { - this.callback.apply(this, arguments); - }, - "should indicate `default-test` logger exists": function (existing, container) { - assert.isTrue(container.has('default-test')); - }, - "should indicate `not-has` logger doesnt exists": function (existing, container) { - assert.isFalse(container.has('not-has')); - } - }, - "the close() method": { - topic: function (logger, container) { - this.callback.apply(this, arguments); - }, - "should remove the specified logger": function (logger, container) { - container.close('default-test'); - assert.isTrue(!container.loggers['default-test']); - } - } - } - }, - "An instance of winston.Container with explicit transports": { - topic: function () { - this.port = 9412; - this.transports = [ - new winston.transports.Webhook({ - port: this.port - }) - ]; - - this.container = new winston.Container({ - transports: this.transports - }); - - return null; - }, - "the get() method": { - topic: function (container) { - var server = http.createServer(function (req, res) { - res.end(); - }); - - server.listen(this.port, this.callback.bind(this, null)); - }, - "should add the logger correctly": function () { - this.someLogger = this.container.get('some-logger'); - assert.isObject(this.someLogger.transports); - assert.instanceOf(this.someLogger.transports['webhook'], winston.transports.Webhook); - assert.strictEqual(this.someLogger.transports['webhook'], this.transports[0]); - }, - "a second call to get()": { - "should respond with the same transport object": function () { - this.someOtherLogger = this.container.get('some-other-logger'); - - assert.isObject(this.someOtherLogger.transports); - assert.instanceOf(this.someOtherLogger.transports['webhook'], winston.transports.Webhook); - assert.strictEqual(this.someOtherLogger.transports['webhook'], this.transports[0]); - assert.strictEqual(this.someOtherLogger.transports['webhook'], this.someLogger.transports['webhook']); - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/winston/test/custom-timestamp-test.js b/node_modules/winston/test/custom-timestamp-test.js deleted file mode 100644 index c9753e2..0000000 --- a/node_modules/winston/test/custom-timestamp-test.js +++ /dev/null @@ -1,62 +0,0 @@ -/* - * custom-timestamp-test.js: Test function as timestamp option for transport `{ timestamp: function () {} }` - * - * (C) 2011 Charlie Robbins, Tom Shinnick - * MIT LICENSE - * - */ - -var assert = require('assert'), - events = require('events'), - fs = require('fs'), - path = require('path'), - vows = require('vows'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -function assertTimestamp (basename, options) { - var filename = path.join(__dirname, 'fixtures', 'logs', basename + '.log'); - - try { fs.unlinkSync(filename) } - catch (ex) { } - - return { - topic: function () { - options.filename = filename; - var transport = new (winston.transports.File)(options); - - // We must wait until transport file has emitted the 'flush' - // event to be sure the file has been created and written - transport.once('flush', this.callback.bind(this, null, filename)); - transport.log('info', 'When a fake tree falls in the forest...', null, function () {}); - }, - "should log with the appropriate timestamp": function (_, filename) { - var data = fs.readFileSync(filename, 'utf8'); - assert.isNotNull(data.match(options.pattern)); - } - } -} - -vows.describe('winston/transport/timestamp').addBatch({ - "When timestamp option is used": { - "with file transport": { - "with value set to false": assertTimestamp('noTimestamp', { - pattern: /^info\:/, - json: false, - timestamp: false - }), - "with value set to true ": assertTimestamp('defaultTimestamp', { - pattern: /^\d\d? \w{3}/, - json: false, - timestamp: true - }), - "and function value": assertTimestamp('customTimestamp', { - pattern: /^\d{8}\./, - json: false, - timestamp: function () { - return '20110803.171657'; - } - }) - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/winston/test/exception-test.js b/node_modules/winston/test/exception-test.js deleted file mode 100644 index 6bc8aec..0000000 --- a/node_modules/winston/test/exception-test.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * exception-test.js: Tests for exception data gathering in winston. - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -vows.describe('winston/exception').addBatch({ - "When using the winston exception module": { - "the getProcessInfo() method": { - topic: winston.exception.getProcessInfo(), - "should respond with the appropriate data": function (info) { - helpers.assertProcessInfo(info); - } - }, - "the getOsInfo() method": { - topic: winston.exception.getOsInfo(), - "should respond with the appropriate data": function (info) { - helpers.assertOsInfo(info); - } - }, - "the getTrace() method": { - topic: winston.exception.getTrace(new Error()), - "should have the appropriate info": function (trace) { - helpers.assertTrace(trace); - } - }, - "the getAllInfo() method": { - topic: winston.exception.getAllInfo(new Error()), - "should have the appropriate info": function (info) { - assert.isObject(info); - assert.isArray(info.stack); - helpers.assertProcessInfo(info.process); - helpers.assertOsInfo(info.os); - helpers.assertTrace(info.trace); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/winston/test/fixtures/.gitkeep b/node_modules/winston/test/fixtures/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/winston/test/fixtures/keys/agent2-cert.pem b/node_modules/winston/test/fixtures/keys/agent2-cert.pem deleted file mode 100644 index 8e4354d..0000000 --- a/node_modules/winston/test/fixtures/keys/agent2-cert.pem +++ /dev/null @@ -1,13 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIB7DCCAZYCCQC7gs0MDNn6MTANBgkqhkiG9w0BAQUFADB9MQswCQYDVQQGEwJV -UzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYDVQQKEwZKb3llbnQxEDAO -BgNVBAsTB05vZGUuanMxDzANBgNVBAMTBmFnZW50MjEgMB4GCSqGSIb3DQEJARYR -cnlAdGlueWNsb3Vkcy5vcmcwHhcNMTEwMzE0MTgyOTEyWhcNMzgwNzI5MTgyOTEy -WjB9MQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExCzAJBgNVBAcTAlNGMQ8wDQYD -VQQKEwZKb3llbnQxEDAOBgNVBAsTB05vZGUuanMxDzANBgNVBAMTBmFnZW50MjEg -MB4GCSqGSIb3DQEJARYRcnlAdGlueWNsb3Vkcy5vcmcwXDANBgkqhkiG9w0BAQEF -AANLADBIAkEAyXb8FrRdKbhrKLgLSsn61i1C7w7fVVVd7OQsmV/7p9WB2lWFiDlC -WKGU9SiIz/A6wNZDUAuc2E+VwtpCT561AQIDAQABMA0GCSqGSIb3DQEBBQUAA0EA -C8HzpuNhFLCI3A5KkBS5zHAQax6TFUOhbpBCR0aTDbJ6F1liDTK1lmU/BjvPoj+9 -1LHwrmh29rK8kBPEjmymCQ== ------END CERTIFICATE----- diff --git a/node_modules/winston/test/fixtures/keys/agent2-key.pem b/node_modules/winston/test/fixtures/keys/agent2-key.pem deleted file mode 100644 index 522903c..0000000 --- a/node_modules/winston/test/fixtures/keys/agent2-key.pem +++ /dev/null @@ -1,9 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIBOgIBAAJBAMl2/Ba0XSm4ayi4C0rJ+tYtQu8O31VVXezkLJlf+6fVgdpVhYg5 -QlihlPUoiM/wOsDWQ1ALnNhPlcLaQk+etQECAwEAAQJBAMT6Bf34+UHKY1ObpsbH -9u2jsVblFq1rWvs8GPMY6oertzvwm3DpuSUp7PTgOB1nLTLYtCERbQ4ovtN8tn3p -OHUCIQDzIEGsoCr5vlxXvy2zJwu+fxYuhTZWMVuo1397L0VyhwIhANQh+yzqUgaf -WRtSB4T2W7ADtJI35ET61jKBty3CqJY3AiAIwju7dVW3A5WeD6Qc1SZGKZvp9yCb -AFI2BfVwwaY11wIgXF3PeGcvACMyMWsuSv7aPXHfliswAbkWuzcwA4TW01ECIGWa -cgsDvVFxmfM5NPSuT/UDTa6R5BFISB5ea0N0AR3I ------END RSA PRIVATE KEY----- diff --git a/node_modules/winston/test/fixtures/logs/.gitkeep b/node_modules/winston/test/fixtures/logs/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/node_modules/winston/test/fixtures/scripts/default-exceptions.js b/node_modules/winston/test/fixtures/scripts/default-exceptions.js deleted file mode 100644 index ab26aa5..0000000 --- a/node_modules/winston/test/fixtures/scripts/default-exceptions.js +++ /dev/null @@ -1,21 +0,0 @@ -/* - * default-exceptions.js: A test fixture for logging exceptions with the default winston logger. - * - * (C) 2011 Charlie Robbins - * MIT LICENCE - * - */ - -var path = require('path'), - winston = require('../../../lib/winston'); - -winston.handleExceptions([ - new (winston.transports.File)({ - filename: path.join(__dirname, '..', 'logs', 'default-exception.log'), - handleExceptions: true - }) -]); - -setTimeout(function () { - throw new Error('OH NOES! It failed!'); -}, 1000); \ No newline at end of file diff --git a/node_modules/winston/test/fixtures/scripts/exit-on-error.js b/node_modules/winston/test/fixtures/scripts/exit-on-error.js deleted file mode 100644 index fa3dd65..0000000 --- a/node_modules/winston/test/fixtures/scripts/exit-on-error.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * default-exceptions.js: A test fixture for logging exceptions with the default winston logger. - * - * (C) 2011 Charlie Robbins - * MIT LICENCE - * - */ - -var path = require('path'), - winston = require('../../../lib/winston'); - -winston.exitOnError = function (err) { - return err.message !== 'Ignore this error'; -}; - -winston.handleExceptions([ - new (winston.transports.File)({ - filename: path.join(__dirname, '..', 'logs', 'exit-on-error.log'), - handleExceptions: true - }) -]); - -setTimeout(function () { - throw new Error('Ignore this error'); -}, 1000); \ No newline at end of file diff --git a/node_modules/winston/test/fixtures/scripts/log-exceptions.js b/node_modules/winston/test/fixtures/scripts/log-exceptions.js deleted file mode 100644 index 43ce7eb..0000000 --- a/node_modules/winston/test/fixtures/scripts/log-exceptions.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * log-exceptions.js: A test fixture for logging exceptions in winston. - * - * (C) 2011 Charlie Robbins - * MIT LICENCE - * - */ - -var path = require('path'), - winston = require('../../../lib/winston'); - -var logger = new (winston.Logger)({ - transports: [ - new (winston.transports.File)({ - filename: path.join(__dirname, '..', 'logs', 'exception.log'), - handleExceptions: true - }) - ] -}); - -logger.handleExceptions(); - -setTimeout(function () { - throw new Error('OH NOES! It failed!'); -}, 1000); \ No newline at end of file diff --git a/node_modules/winston/test/fixtures/scripts/unhandle-exceptions.js b/node_modules/winston/test/fixtures/scripts/unhandle-exceptions.js deleted file mode 100644 index 5d722a7..0000000 --- a/node_modules/winston/test/fixtures/scripts/unhandle-exceptions.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * unhandle-exceptions.js: A test fixture for using `.unhandleExceptions()` winston. - * - * (C) 2011 Charlie Robbins - * MIT LICENCE - * - */ - -var path = require('path'), - winston = require('../../../lib/winston'); - -var logger = new (winston.Logger)({ - transports: [ - new (winston.transports.File)({ - filename: path.join(__dirname, '..', 'logs', 'unhandle-exception.log'), - handleExceptions: true - }) - ] -}); - -logger.handleExceptions(); -logger.unhandleExceptions(); - -setTimeout(function () { - throw new Error('OH NOES! It failed!'); -}, 1000); \ No newline at end of file diff --git a/node_modules/winston/test/helpers.js b/node_modules/winston/test/helpers.js deleted file mode 100644 index f961f85..0000000 --- a/node_modules/winston/test/helpers.js +++ /dev/null @@ -1,179 +0,0 @@ -/* - * helpers.js: Test helpers for winston - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var assert = require('assert'), - fs = require('fs'), - path = require('path'), - spawn = require('child_process').spawn, - util = require('util'), - loggly = require('loggly'), - vows = require('vows'), - winston = require('../lib/winston'); - -var helpers = exports; - -helpers.loadConfig = function (dir) { - try { - if (helpers.config) return helpers.config; - var configFile = path.join(dir || __dirname, 'fixtures', 'test-config.json'), - stats = fs.statSync(configFile), - config = JSON.parse(fs.readFileSync(configFile).toString()); - - helpers.config = config; - return config; - } - catch (ex) { - console.error('test/fixtures/test-config.json must be created with valid data before running tests'); - return false; - } -}; - -helpers.size = function (obj) { - var size = 0, key; - for (key in obj) { - if (obj.hasOwnProperty(key)) { - size++; - } - } - - return size; -}; - -helpers.tryUnlink = function (file) { - try { fs.unlinkSync(file) } - catch (ex) { } -}; - -helpers.assertProcessInfo = function (info) { - assert.isNumber(info.pid); - assert.isNumber(info.uid); - assert.isNumber(info.gid); - assert.isString(info.cwd); - assert.isString(info.execPath); - assert.isString(info.version); - assert.isArray(info.argv); - assert.isObject(info.memoryUsage); -}; - -helpers.assertOsInfo = function (info) { - assert.isArray(info.loadavg); - assert.isNumber(info.uptime); -}; - -helpers.assertTrace = function (trace) { - trace.forEach(function (site) { - assert.isTrue(!site.column || typeof site.column === 'number'); - assert.isTrue(!site.line || typeof site.line === 'number'); - assert.isTrue(!site.file || typeof site.file === 'string'); - assert.isTrue(!site.method || typeof site.method === 'string'); - assert.isTrue(!site.function || typeof site.function === 'string'); - assert.isTrue(typeof site.native === 'boolean'); - }); -}; - -helpers.assertLogger = function (logger, level) { - assert.instanceOf(logger, winston.Logger); - assert.isFunction(logger.log); - assert.isFunction(logger.add); - assert.isFunction(logger.remove); - assert.equal(logger.level, level || "info"); - Object.keys(logger.levels).forEach(function (method) { - assert.isFunction(logger[method]); - }); -}; - -helpers.assertConsole = function (transport) { - assert.instanceOf(transport, winston.transports.Console); - assert.isFunction(transport.log); -}; - -helpers.assertFile = function (transport) { - assert.instanceOf(transport, winston.transports.File); - assert.isFunction(transport.log); -} - -helpers.assertLoggly = function (transport) { - assert.instanceOf(transport, winston.transports.Loggly); - assert.isFunction(transport.log); -}; - -helpers.assertWebhook = function (transport) { - assert.instanceOf(transport, winston.transports.Webhook); - assert.isFunction(transport.log); -}; - -helpers.assertCouchdb = function (transport) { - assert.instanceOf(transport, winston.transports.Couchdb); - assert.isFunction(transport.log); -}; - -helpers.assertHandleExceptions = function (options) { - return { - topic: function () { - var that = this, - child = spawn('node', [options.script]); - - helpers.tryUnlink(options.logfile); - child.on('exit', function () { - fs.readFile(options.logfile, that.callback); - }); - }, - "should save the error information to the specified file": function (err, data) { - assert.isTrue(!err); - data = JSON.parse(data); - - assert.isObject(data); - helpers.assertProcessInfo(data.process); - helpers.assertOsInfo(data.os); - helpers.assertTrace(data.trace); - } - } -} - -helpers.testNpmLevels = function (transport, assertMsg, assertFn) { - return helpers.testLevels(winston.config.npm.levels, transport, assertMsg, assertFn); -}; - -helpers.testSyslogLevels = function (transport, assertMsg, assertFn) { - return helpers.testLevels(winston.config.syslog.levels, transport, assertMsg, assertFn); -}; - -helpers.testLevels = function (levels, transport, assertMsg, assertFn) { - var tests = {}; - - Object.keys(levels).forEach(function (level) { - var test = { - topic: function () { - transport.log(level, 'test message', {}, this.callback.bind(this, null)); - } - }; - - test[assertMsg] = assertFn; - tests['with the ' + level + ' level'] = test; - }); - - var metadatatest = { - topic: function () { - transport.log('info', 'test message', { metadata: true }, this.callback.bind(this, null)); - } - }; - - metadatatest[assertMsg] = assertFn; - tests['when passed metadata'] = metadatatest; - - var primmetadatatest = { - topic: function () { - transport.log('info', 'test message', 'metadata', this.callback.bind(this, null)); - } - }; - - primmetadatatest[assertMsg] = assertFn; - tests['when passed primitive metadata'] = primmetadatatest; - - return tests; -}; diff --git a/node_modules/winston/test/log-exception-test.js b/node_modules/winston/test/log-exception-test.js deleted file mode 100644 index b077a0a..0000000 --- a/node_modules/winston/test/log-exception-test.js +++ /dev/null @@ -1,58 +0,0 @@ -/* - * exception-test.js: Tests for exception data gathering in winston. - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var assert = require('assert'), - path = require('path'), - spawn = require('child_process').spawn, - vows = require('vows'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -vows.describe('winston/logger/exceptions').addBatch({ - "When using winston": { - "the handleException() method": { - "with a custom winston.Logger instance": helpers.assertHandleExceptions({ - script: path.join(__dirname, 'fixtures', 'scripts', 'log-exceptions.js'), - logfile: path.join(__dirname, 'fixtures', 'logs', 'exception.log') - }), - "with the default winston logger": helpers.assertHandleExceptions({ - script: path.join(__dirname, 'fixtures', 'scripts', 'default-exceptions.js'), - logfile: path.join(__dirname, 'fixtures', 'logs', 'default-exception.log') - }), - "when a custom exitOnError function is set": { - topic: function () { - var that = this, - scriptDir = path.join(__dirname, 'fixtures', 'scripts'); - - that.child = spawn('node', [path.join(scriptDir, 'exit-on-error.js')]); - setTimeout(this.callback.bind(this), 1500); - }, - "should not exit the process": function () { - assert.isFalse(this.child.killed); - this.child.kill(); - } - } - }, - "the unhandleException() method": { - topic: function () { - var that = this, - child = spawn('node', [path.join(__dirname, 'fixtures', 'scripts', 'unhandle-exceptions.js')]), - exception = path.join(__dirname, 'fixtures', 'logs', 'unhandle-exception.log'); - - helpers.tryUnlink(exception); - child.on('exit', function () { - path.exists(exception, that.callback.bind(this, null)); - }); - }, - "should not write to the specified error file": function (err, exists) { - assert.isTrue(!err); - assert.isFalse(exists); - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/winston/test/log-rewriter-test.js b/node_modules/winston/test/log-rewriter-test.js deleted file mode 100644 index 4753fcc..0000000 --- a/node_modules/winston/test/log-rewriter-test.js +++ /dev/null @@ -1,98 +0,0 @@ -/* - * log-rewriter-test.js: Tests for rewriting metadata in winston. - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var assert = require('assert'), - vows = require('vows'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -vows.describe('winston/logger/rewriter').addBatch({ - "An instance of winston.Logger": { - topic: new (winston.Logger)({transports: [ - new (winston.transports.Console)({ level: 'info' }) - ]}), - "the addRewriter() method": { - topic: function(logger) { - logger.addRewriter(function(level, msg, meta) { - meta.level = level; - meta.msg = msg; - meta.foo = 'bar'; - return meta; - }); - return logger; - }, - "should add the rewriter": function(logger) { - assert.equal(helpers.size(logger.rewriters), 1); - }, - "the log() method": { - topic: function(logger) { - logger.once('logging', this.callback); - logger.log('info', 'test message', {"a": "b"}); - }, - "should run the rewriter": function(transport, level, msg, meta) { - assert.equal(meta.a, 'b'); - assert.equal(meta.level, 'info'); - assert.equal(meta.msg, 'test message'); - assert.equal(meta.foo, 'bar'); - } - } - } - } -}).addBatch({ - "An instance of winston.Logger with explicit rewriter": { - topic: new (winston.Logger)({transports: [ - new (winston.transports.Console)({ level: 'info'}) - ], rewriters: [ - function(level, msg, meta) { - meta.level = level; - meta.msg = msg; - meta.foo = 'bar'; - return meta; - } - ]}), - "should add the rewriter": function(logger) { - assert.equal(helpers.size(logger.rewriters), 1); - }, - "the log() method": { - topic: function(logger) { - logger.once('logging', this.callback); - logger.log('info', 'test message', {"a": "b"}); - }, - "should run the rewriter": function(transport, level, msg, meta) { - assert.equal(meta.a, 'b'); - assert.equal(meta.level, 'info'); - assert.equal(meta.msg, 'test message'); - assert.equal(meta.foo, 'bar'); - } - } - } -}).addBatch({ - "An instance of winston.Logger with rewriters": { - topic: new (winston.Logger)({transports: [ - new (winston.transports.Console)({ level: 'info' }) - ], rewriters: [ - function(level, msg, meta) { - meta.numbers.push(1); - return meta; - }, - function(level, msg, meta) { - meta.numbers.push(2); - return meta; - } - ]}), - "the log() method": { - topic: function(logger) { - logger.once('logging', this.callback); - logger.log('info', 'test message', {"numbers": [0]}); - }, - "should run the rewriters in correct order": function(transport, level, msg, meta) { - assert.deepEqual(meta.numbers, [0, 1, 2]); - } - } - } -}).export(module); diff --git a/node_modules/winston/test/logger-test.js b/node_modules/winston/test/logger-test.js deleted file mode 100644 index 0105825..0000000 --- a/node_modules/winston/test/logger-test.js +++ /dev/null @@ -1,199 +0,0 @@ -/* - * logger-test.js: Tests for instances of the winston Logger - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -vows.describe('winton/logger').addBatch({ - "An instance of winston.Logger": { - topic: new (winston.Logger)({ transports: [new (winston.transports.Console)({ level: 'info' })] }), - "should have the correct methods / properties defined": function (logger) { - helpers.assertLogger(logger); - }, - "the add() with an unsupported transport": { - "should throw an error": function () { - assert.throws(function () { logger.add('unsupported') }, Error); - } - } - } -}).addBatch({ - "An instance of winston.Logger with no transports": { - topic: new (winston.Logger)({ emitErrs: true }), - "the log() method should throw an error": function (logger) { - assert.throws(function () { logger.log('anything') }, Error); - }, - "the extend() method called on an empty object": { - topic: function (logger) { - var empty = {}; - logger.extend(empty); - return empty; - }, - "should define the appropriate methods": function (extended) { - ['log', 'profile', 'startTimer'].concat(Object.keys(winston.config.npm.levels)).forEach(function (method) { - assert.isFunction(extended[method]); - }); - } - }, - "the add() method with a supported transport": { - topic: function (logger) { - return logger.add(winston.transports.Console); - }, - "should add the console Transport onto transports": function (logger) { - assert.equal(helpers.size(logger.transports), 1); - helpers.assertConsole(logger.transports.console); - }, - "should throw an error when the same Transport is added": function (logger) { - assert.throws(function () { logger.add(winston.transports.Console) }, Error); - }, - "the log() method": { - topic: function (logger) { - logger.once('logging', this.callback); - logger.log('info', 'test message'); - }, - "should emit the 'log' event with the appropriate transport": function (transport, ign) { - helpers.assertConsole(transport); - } - }, - "the profile() method": { - "when passed a callback": { - topic: function (logger) { - var that = this; - logger.profile('test1'); - setTimeout(function () { - logger.profile('test1', function (err, level, msg, meta) { - that.callback(err, level, msg, meta, logger); - }); - }, 1000); - }, - "should respond with the appropriate profile message": function (err, level, msg, meta, logger) { - assert.isNull(err); - assert.equal(level, 'info'); - assert.match(meta.duration, /(\d+)ms/); - assert.isTrue(typeof logger.profilers['test'] === 'undefined'); - } - }, - "when not passed a callback": { - topic: function (logger) { - var that = this; - logger.profile('test2'); - logger.once('logging', that.callback.bind(null, null)); - setTimeout(function () { - logger.profile('test2'); - }, 1000); - }, - "should respond with the appropriate profile message": function (err, transport, level, msg, meta) { - assert.isNull(err); - assert.equal(level, 'info'); - assert.match(meta.duration, /(\d+)ms/); - } - } - }, - "the startTimer() method": { - "when passed a callback": { - topic: function (logger) { - var that = this; - var timer = logger.startTimer() - setTimeout(function () { - timer.done('test', function (err, level, msg, meta) { - that.callback(err, level, msg, meta, logger); - }); - }, 1000); - }, - "should respond with the appropriate message": function (err, level, msg, meta, logger) { - assert.isNull(err); - assert.equal(level, 'info'); - assert.match(meta.duration, /(\d+)ms/); - } - }, - "when not passed a callback": { - topic: function (logger) { - var that = this; - var timer = logger.startTimer() - logger.once('logging', that.callback.bind(null, null)); - setTimeout(function () { - timer.done(); - }, 1000); - }, - "should respond with the appropriate message": function (err, transport, level, msg, meta) { - assert.isNull(err); - assert.equal(level, 'info'); - assert.match(meta.duration, /(\d+)ms/); - - var duration = parseInt(meta.duration); - assert.isNumber(duration); - assert.isTrue(duration > 900 && duration < 1100); - } - } - }, - "and adding an additional transport": { - topic: function (logger) { - return logger.add(winston.transports.File, { - filename: path.join(__dirname, 'fixtures', 'logs', 'testfile2.log') - }); - }, - "should be able to add multiple transports": function (logger) { - assert.equal(helpers.size(logger.transports), 2); - helpers.assertConsole(logger.transports.console); - helpers.assertFile(logger.transports.file); - } - } - } - } -}).addBatch({ - "The winston logger": { - topic: new (winston.Logger)({ - transports: [ - new (winston.transports.Console)(), - new (winston.transports.File)({ filename: path.join(__dirname, 'fixtures', 'logs', 'filelog.log' )}) - ] - }), - "should return have two transports": function (logger) { - assert.equal(helpers.size(logger.transports), 2); - }, - "the remove() with an unadded transport": { - "should throw an Error": function (logger) { - assert.throws(function () { logger.remove(winston.transports.Loggly) }, Error); - } - }, - "the remove() method with an added transport": { - topic: function (logger) { - return logger.remove(winston.transports.Console); - }, - "should remove the Console transport from transports": function (logger) { - assert.equal(helpers.size(logger.transports), 1); - helpers.assertFile(logger.transports.file); - }, - "and removing an additional transport": { - topic: function (logger) { - return logger.remove(winston.transports.File); - }, - "should remove File transport from transports": function (logger) { - assert.equal(helpers.size(logger.transports), 0); - } - } - } - } -}).addBatch({ - "The winston logger": { - topic: new (winston.Logger)({ - transports: [ - new (winston.transports.Console)(), - new (winston.transports.File)({ filename: path.join(__dirname, 'fixtures', 'logs', 'filelog.log' )}) - ] - }), - "the clear() method": { - "should remove all transports": function (logger) { - logger.clear(); - assert.equal(helpers.size(logger.transports), 0); - } - } - } -}).export(module); diff --git a/node_modules/winston/test/transports/console-test.js b/node_modules/winston/test/transports/console-test.js deleted file mode 100644 index 07f5a6e..0000000 --- a/node_modules/winston/test/transports/console-test.js +++ /dev/null @@ -1,39 +0,0 @@ -/* - * console-test.js: Tests for instances of the Console transport - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - winston = require('../../lib/winston'), - helpers = require('../helpers'); - -var npmTransport = new (winston.transports.Console)(), - syslogTransport = new (winston.transports.Console)({ levels: winston.config.syslog.levels }); - -vows.describe('winston/transports/console').addBatch({ - "An instance of the Console Transport": { - "with npm levels": { - "should have the proper methods defined": function () { - helpers.assertConsole(npmTransport); - }, - "the log() method": helpers.testNpmLevels(npmTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - }, - "with syslog levels": { - "should have the proper methods defined": function () { - helpers.assertConsole(syslogTransport); - }, - "the log() method": helpers.testSyslogLevels(syslogTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/winston/test/transports/couchdb-test.js b/node_modules/winston/test/transports/couchdb-test.js deleted file mode 100644 index d0057e8..0000000 --- a/node_modules/winston/test/transports/couchdb-test.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * couchdb-test.js: Tests for instances of the Couchdb transport - * - * (C) 2011 Max Ogden - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - fs = require('fs'), - http = require('http'), - assert = require('assert'), - winston = require('../../lib/winston'), - helpers = require('../helpers'); - -var couchdbTransport = new (winston.transports.Couchdb)({ - "host": "localhost", - "port": 4567, - "db": "logs" -}); - -var server = http.createServer(function (req, res) { - res.end(); -}); - -server.listen(4567); - -vows.describe('winston/transports/couchdb').addBatch({ - "An instance of the Couchdb Transport": { - "when passed valid options": { - "should have the proper methods defined": function () { - helpers.assertCouchdb(couchdbTransport); - }, - "the log() method": helpers.testNpmLevels(couchdbTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - } - } -}).addBatch({ - "When the tests are over": { - "the server should cleanup": function () { - server.close(); - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/winston/test/transports/file-maxfiles-test.js b/node_modules/winston/test/transports/file-maxfiles-test.js deleted file mode 100644 index a9fa89e..0000000 --- a/node_modules/winston/test/transports/file-maxfiles-test.js +++ /dev/null @@ -1,102 +0,0 @@ -/* - * file-maxfiles-test.js: Tests for instances of the File transport setting the max file size, - * and setting a number for max files created. - * maxSize * maxFiles = total storage used by winston. - * - * (C) 2011 Daniel Aristizabal - * MIT LICENSE - * - */ - -var assert = require('assert'), - exec = require('child_process').exec, - fs = require('fs'), - path = require('path'), - vows = require('vows'), - winston = require('../../lib/winston'), - helpers = require('../helpers'); - -var maxfilesTransport = new winston.transports.File({ - timestamp: false, - json: false, - filename: path.join(__dirname, '..', 'fixtures', 'logs', 'testmaxfiles.log'), - maxsize: 4096, - maxFiles: 3 -}); - -vows.describe('winston/transports/file/maxfiles').addBatch({ - "An instance of the File Transport": { - "when passed a valid filename": { - topic: maxfilesTransport, - "should be a valid transporter": function (transportTest) { - helpers.assertFile(transportTest); - }, - "should set the maxFiles option correctly": function (transportTest) { - assert.isNumber(transportTest.maxFiles); - } - }, - "when delete old test files": { - topic: function () { - exec('rm -rf ' + path.join(__dirname, '..', 'fixtures', 'logs', 'testmaxfiles*'), this.callback); - }, - "and when passed more files than the maxFiles": { - topic: function () { - var that = this, - created = 0; - - function data(ch) { - return new Array(1018).join(String.fromCharCode(65 + ch)); - }; - - function logKbytes(kbytes, txt) { - // - // With no timestamp and at the info level, - // winston adds exactly 7 characters: - // [info](4)[ :](2)[\n](1) - // - for (var i = 0; i < kbytes; i++) { - maxfilesTransport.log('info', data(txt), null, function () { }); - } - } - - maxfilesTransport.on('logged', function () { - if (++created === 6) { - return that.callback(); - } - - logKbytes(4, created); - }); - - logKbytes(4, created); - }, - "should be only 3 files called 5.log, 4.log and 3.log": function () { - for (var num = 0; num < 6; num++) { - var file = !num ? 'testmaxfiles.log' : 'testmaxfiles' + num + '.log', - fullpath = path.join(__dirname, '..', 'fixtures', 'logs', file); - - // There should be no files with that name - if (num >= 0 && num < 3) { - return assert.throws(function () { - fs.statSync(file); - }, Error); - } - - // The other files should be exist - assert.doesNotThrow(function () { - fs.statSync(file); - }, Error); - } - }, - "should have the correct content": function () { - ['D', 'E', 'F'].forEach(function (name, inx) { - var counter = inx + 3, - logsDir = path.join(__dirname, '..', 'fixtures', 'logs'), - content = fs.readFileSync(path.join(logsDir, 'testmaxfiles' + counter + '.log'), 'utf-8'); - // The content minus the 7 characters added by winston - assert.lengthOf(content.match(new RegExp(name, 'g')), 4068); - }); - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/winston/test/transports/file-maxsize-test.js b/node_modules/winston/test/transports/file-maxsize-test.js deleted file mode 100644 index 7d20e08..0000000 --- a/node_modules/winston/test/transports/file-maxsize-test.js +++ /dev/null @@ -1,82 +0,0 @@ -/* - * file-test.js: Tests for instances of the File transport - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var assert = require('assert'), - exec = require('child_process').exec, - fs = require('fs'), - path = require('path'), - vows = require('vows'), - winston = require('../../lib/winston'), - helpers = require('../helpers'); - -var maxsizeTransport = new winston.transports.File({ - timestamp: false, - json: false, - filename: path.join(__dirname, '..', 'fixtures', 'logs', 'testmaxsize.log'), - maxsize: 4096 -}); - -vows.describe('winston/transports/file/maxsize').addBatch({ - "An instance of the File Transport": { - "when passed a valid filename": { - "the log() method": { - topic: function () { - exec('rm -rf ' + path.join(__dirname, '..', 'fixtures', 'logs', 'testmaxsize*'), this.callback); - }, - "when passed more than the maxsize": { - topic: function () { - var that = this, - data = new Array(1018).join('-'); - - // - // Setup a list of files which we will later stat. - // - that.files = []; - - function logKbytes (kbytes) { - // - // With no timestamp and at the info level, - // winston adds exactly 7 characters: - // [info](4)[ :](2)[\n](1) - // - for (var i = 0; i < kbytes; i++) { - maxsizeTransport.log('info', data, null, function () { }); - } - } - - maxsizeTransport.on('open', function (file) { - var match = file.match(/(\d+)\.log$/), - count = match ? match[1] : 0; - - that.files.push(file); - - if (that.files.length === 5) { - return that.callback(); - } - - logKbytes(4); - }); - - logKbytes(4); - }, - "should create multiple files correctly": function () { - this.files.forEach(function (file) { - try { - var stats = fs.statSync(file); - assert.equal(stats.size, 4096); - } - catch (ex) { - assert.isNull(ex); - } - }); - } - } - } - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/winston/test/transports/file-test.js b/node_modules/winston/test/transports/file-test.js deleted file mode 100644 index c287794..0000000 --- a/node_modules/winston/test/transports/file-test.js +++ /dev/null @@ -1,50 +0,0 @@ -/* - * file-test.js: Tests for instances of the File transport - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - fs = require('fs'), - assert = require('assert'), - winston = require('../../lib/winston'), - helpers = require('../helpers'); - -var stream = fs.createWriteStream(path.join(__dirname, '..', 'fixtures', 'logs', 'testfile.log')), - fileTransport = new (winston.transports.File)({ filename: path.join(__dirname, '..', 'fixtures', 'logs', 'testfilename.log') }), - streamTransport = new (winston.transports.File)({ stream: stream }); - -vows.describe('winston/transports/file').addBatch({ - "An instance of the File Transport": { - "when passed a valid filename": { - "should have the proper methods defined": function () { - helpers.assertFile(fileTransport); - }, - "the log() method": helpers.testNpmLevels(fileTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - }, - "when passed a valid file stream": { - "should have the proper methods defined": function () { - helpers.assertFile(streamTransport); - }, - "the log() method": helpers.testNpmLevels(streamTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - } - } -}).addBatch({ - "These tests have a non-deterministic end": { - topic: function () { - setTimeout(this.callback, 200); - }, - "and this should be fixed before releasing": function () { - assert.isTrue(true); - } - } -}).export(module); \ No newline at end of file diff --git a/node_modules/winston/test/transports/loggly-test.js b/node_modules/winston/test/transports/loggly-test.js deleted file mode 100644 index 8271b90..0000000 --- a/node_modules/winston/test/transports/loggly-test.js +++ /dev/null @@ -1,61 +0,0 @@ -/* - * loggly-test.js: Tests for instances of the Loggly transport - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - assert = require('assert'), - winston = require('../../lib/winston'), - helpers = require('../helpers'); - -var config = helpers.loadConfig(); - -if (!config) { - return; -} - -var tokenTransport = new (winston.transports.Loggly)({ - subdomain: config.transports.loggly.subdomain, - inputToken: config.transports.loggly.inputToken - }), - nameTransport = new (winston.transports.Loggly)({ - subdomain: config.transports.loggly.subdomain, - inputName: config.transports.loggly.inputName, - auth: config.transports.loggly.auth - }); - -vows.describe('winston/transports/loggly').addBatch({ - "An instance of the Loggly Transport": { - "when passed an input token": { - "should have the proper methods defined": function () { - helpers.assertLoggly(tokenTransport); - }, - "the log() method": helpers.testNpmLevels(tokenTransport, "should log messages to loggly", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }), - "the log() method with no metadata": { - topic: function () { - tokenTransport.log('info', 'test-message', null, this.callback.bind(null, null)); - }, - "should respond immediately": function () { - assert.isTrue(true); - } - } - }, - "when passed an input name": { - "should have the proper methods defined": function () { - helpers.assertLoggly(nameTransport); - }, - "the log() method": helpers.testNpmLevels(nameTransport, "should log messages to loggly", function (ign, err, result) { - assert.isNull(err); - assert.isTrue(result === true || result.response === 'ok'); - }) - } - } -}).export(module); - diff --git a/node_modules/winston/test/transports/webhook-test.js b/node_modules/winston/test/transports/webhook-test.js deleted file mode 100644 index e106374..0000000 --- a/node_modules/winston/test/transports/webhook-test.js +++ /dev/null @@ -1,119 +0,0 @@ -/* - * webhook-test.js: Tests for instances of the Webhook transport - * - * (C) 2011 Marak Squires - * MIT LICENSE - * - */ - -var path = require('path'), - vows = require('vows'), - fs = require('fs'), - http = require('http'), - https = require('https'), - assert = require('assert'), - winston = require('../../lib/winston'), - helpers = require('../helpers'); - -var webhookTransport = new (winston.transports.Webhook)({ - "host": "localhost", - "port": 8080, - "path": "/winston-test" -}); - -var httpsWebhookTransport = new (winston.transports.Webhook)({ - "host": "localhost", - "port": 8081, - "path": "/winston-test", - "ssl": true -}); - -var authWebhookTransport = new (winston.transports.Webhook)({ - "host": "localhost", - "port": 8080, - "path": "/winston-auth-test", - "auth": { - "username": "winston", - "password": "churchill" - } -}); - -var requestsAuthenticated = true; - -var server = http.createServer(function (req, res) { - if (req.url == '/winston-auth-test') { - // - // Test if request has been correctly authenticated - // - // Strip 'Basic' from Authorization header - var signature = req.headers['authorization'].substr(6); - requestsAuthenticated = requestsAuthenticated && - new Buffer(signature, 'base64').toString('utf8') == 'winston:churchill'; - } - res.end(); -}); - -server.listen(8080); - - -var httpsServer = https.createServer({ - cert: fs.readFileSync(path.join(__dirname, '..', 'fixtures', 'keys', 'agent2-cert.pem')), - key: fs.readFileSync(path.join(__dirname, '..', 'fixtures', 'keys', 'agent2-key.pem')) -}, function (req, res) { - res.end(); -}); - -httpsServer.listen(8081); - -vows.describe('winston/transports/webhook').addBatch({ - "An instance of the Webhook Transport": { - "when passed valid options": { - "should have the proper methods defined": function () { - helpers.assertWebhook(webhookTransport); - }, - "the log() method": helpers.testNpmLevels(webhookTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - } - }, - "An https instance of the Webhook Transport": { - "when passed valid options": { - "should have the proper methods defined": function () { - helpers.assertWebhook(httpsWebhookTransport); - }, - "the log() method": helpers.testNpmLevels(httpsWebhookTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - } - }, - "An http Basic Auth instance of the Webhook Transport": { - "when passed valid options": { - "should have the proper methods defined": function () { - helpers.assertWebhook(authWebhookTransport); - }, - "the log() method": helpers.testNpmLevels(authWebhookTransport, "should respond with true", function (ign, err, logged) { - assert.isNull(err); - assert.isTrue(logged); - }) - } - } -}).addBatch({ - "When the tests are over": { - topic: function () { - // - // Delay destruction of the server since the - // WebHook transport responds before the request - // has actually be completed. - // - setTimeout(this.callback, 1000); - }, - "the server should cleanup": function () { - server.close(); - }, - "requests have been correctly authenticated": function () { - assert.ok(requestsAuthenticated); - } - } -}).export(module); diff --git a/node_modules/winston/test/winston-test.js b/node_modules/winston/test/winston-test.js deleted file mode 100644 index e790cb9..0000000 --- a/node_modules/winston/test/winston-test.js +++ /dev/null @@ -1,100 +0,0 @@ -/* - * logger-test.js: Tests for instances of the winston Logger - * - * (C) 2010 Charlie Robbins - * MIT LICENSE - * - */ - -var fs = require('fs'), - path = require('path'), - vows = require('vows'), - http = require('http'), - assert = require('assert'), - winston = require('../lib/winston'), - helpers = require('./helpers'); - -vows.describe('winston').addBatch({ - "The winston module": { - topic: function () { - winston.default.transports.console.level = 'silly'; - return null; - }, - "should have the correct methods defined": function () { - assert.isObject(winston.transports); - assert.isFunction(winston.Transport); - assert.isTrue(!winston.transports.Transport); - assert.isFunction(winston.transports.Console); - assert.isFunction(winston.transports.File); - assert.isFunction(winston.transports.Loggly); - assert.isFunction(winston.transports.Webhook); - assert.isObject(winston.default.transports.console); - assert.isFalse(winston.emitErrs); - assert.isObject(winston.config); - ['Logger', 'add', 'remove', 'extend'] - .concat(Object.keys(winston.config.npm.levels)) - .forEach(function (key) { - assert.isFunction(winston[key]); - }); - }, - "it should": { - topic: function () { - fs.readFile(path.join(__dirname, '..', 'package.json'), this.callback); - }, - "have the correct version set": function (err, data) { - assert.isNull(err); - data = JSON.parse(data.toString()); - assert.equal(winston.version, data.version); - } - }, - "the log() method": helpers.testNpmLevels(winston, "should respond without an error", function (err) { - assert.isNull(err); - }), - "the extend() method called on an empty object": { - topic: function (logger) { - var empty = {}; - winston.extend(empty); - return empty; - }, - "should define the appropriate methods": function (extended) { - ['log', 'profile', 'startTimer'].concat(Object.keys(winston.config.npm.levels)).forEach(function (method) { - assert.isFunction(extended[method]); - }); - } - } - } -}).addBatch({ - "The winston module": { - "the setLevels() method": { - topic: function () { - winston.setLevels(winston.config.syslog.levels); - return null; - }, - "should have the proper methods defined": function () { - assert.isObject(winston.transports); - assert.isFunction(winston.transports.Console); - assert.isFunction(winston.transports.Loggly); - assert.isFunction(winston.transports.Webhook); - assert.isObject(winston.default.transports.console); - assert.isFalse(winston.emitErrs); - assert.isObject(winston.config); - - var newLevels = Object.keys(winston.config.syslog.levels); - ['Logger', 'add', 'remove', 'extend'] - .concat(newLevels) - .forEach(function (key) { - assert.isFunction(winston[key]); - }); - - - Object.keys(winston.config.npm.levels) - .filter(function (key) { - return newLevels.indexOf(key) === -1; - }) - .forEach(function (key) { - assert.isTrue(typeof winston[key] === 'undefined'); - }); - } - } - } -}).export(module); diff --git a/package.json b/package.json index e82b446..1e92f51 100644 --- a/package.json +++ b/package.json @@ -4,13 +4,15 @@ "private": true, "dependencies": { "union": "git://github.com/flatiron/union.git", - "flatiron": "0.1.16", + "flatiron": "*", + "director": "*", "connect": "git://github.com/senchalabs/connect.git", "winston": "*", - "passport": "*", + "passport": "git://github.com/distracteddev/passport.git", "passport-local": "*", "marked": "*", - "highlight": "*" + "highlight": "*", + "resourceful": "git://github.com/distracteddev/resourceful.git" }, "devDependencies": { "api-easy": "0.3.4",