Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

No se levanta el proceso en entorno de desarrollo

  • Loading branch information...
commit 2f7263de310e1b7ffcaab4dcd893978064cbdaf6 1 parent 0a44ae4
matiasrege matiasrege authored
19 .classpath
... ... @@ -0,0 +1,19 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<classpath>
  3 + <classpathentry kind="src" path="newrelic/src"/>
  4 + <classpathentry kind="lib" path="newrelic/lib/commons-lang-2.6.jar"/>
  5 + <classpathentry kind="lib" path="newrelic/lib/commons-logging-1.0.3.jar"/>
  6 + <classpathentry kind="lib" path="newrelic/lib/guava-r05.jar"/>
  7 + <classpathentry kind="lib" path="newrelic/lib/newrelic.jar"/>
  8 + <classpathentry kind="lib" path="newrelic/lib/slf4j-api-1.6.1.jar"/>
  9 + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  10 + <classpathentry kind="lib" path="newrelic/lib/mina-core-2.0.4.jar"/>
  11 + <classpathentry kind="lib" path="newrelic/lib/mina-filter-compression-2.0.4.jar"/>
  12 + <classpathentry kind="lib" path="newrelic/lib/mina-integration-beans-2.0.4.jar"/>
  13 + <classpathentry kind="lib" path="newrelic/lib/mina-integration-jmx-2.0.4.jar"/>
  14 + <classpathentry kind="lib" path="newrelic/lib/mina-integration-ognl-2.0.4.jar"/>
  15 + <classpathentry kind="lib" path="newrelic/lib/mina-integration-xbean-2.0.4.jar"/>
  16 + <classpathentry kind="lib" path="newrelic/lib/mina-statemachine-2.0.4.jar"/>
  17 + <classpathentry kind="lib" path="newrelic/lib/mina-transport-apr-2.0.4.jar"/>
  18 + <classpathentry kind="output" path="newrelic/bin"/>
  19 +</classpath>
17 .project
... ... @@ -0,0 +1,17 @@
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<projectDescription>
  3 + <name>newrelic-node</name>
  4 + <comment></comment>
  5 + <projects>
  6 + </projects>
  7 + <buildSpec>
  8 + <buildCommand>
  9 + <name>org.eclipse.jdt.core.javabuilder</name>
  10 + <arguments>
  11 + </arguments>
  12 + </buildCommand>
  13 + </buildSpec>
  14 + <natures>
  15 + <nature>org.eclipse.jdt.core.javanature</nature>
  16 + </natures>
  17 +</projectDescription>
7 newrelic/.settings/org.eclipse.jdt.core.prefs
... ... @@ -0,0 +1,7 @@
  1 +eclipse.preferences.version=1
  2 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
  3 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
  4 +org.eclipse.jdt.core.compiler.compliance=1.5
  5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
  6 +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
  7 +org.eclipse.jdt.core.compiler.source=1.5
92 node_modules/mocha/lib/reporters/markdown.js
... ... @@ -0,0 +1,92 @@
  1 +/**
  2 + * Module dependencies.
  3 + */
  4 +
  5 +var Base = require('./base')
  6 + , utils = require('../utils');
  7 +
  8 +/**
  9 + * Expose `Markdown`.
  10 + */
  11 +
  12 +exports = module.exports = Markdown;
  13 +
  14 +/**
  15 + * Initialize a new `Markdown` reporter.
  16 + *
  17 + * @param {Runner} runner
  18 + * @api public
  19 + */
  20 +
  21 +function Markdown(runner) {
  22 + Base.call(this, runner);
  23 +
  24 + var self = this
  25 + , stats = this.stats
  26 + , total = runner.total
  27 + , level = 0
  28 + , buf = '';
  29 +
  30 + function title(str) {
  31 + return Array(level).join('#') + ' ' + str;
  32 + }
  33 +
  34 + function indent() {
  35 + return Array(level).join(' ');
  36 + }
  37 +
  38 + function mapTOC(suite, obj) {
  39 + var ret = obj;
  40 + obj = obj[suite.title] = obj[suite.title] || { suite: suite };
  41 + suite.suites.forEach(function(suite){
  42 + mapTOC(suite, obj);
  43 + });
  44 + return ret;
  45 + }
  46 +
  47 + function stringifyTOC(obj, level) {
  48 + ++level;
  49 + var buf = '';
  50 + var link;
  51 + for (var key in obj) {
  52 + if ('suite' == key) continue;
  53 + if (key) link = ' - [' + key + '](#' + utils.slug(obj[key].suite.fullTitle()) + ')\n';
  54 + if (key) buf += Array(level).join(' ') + link;
  55 + buf += stringifyTOC(obj[key], level);
  56 + }
  57 + --level;
  58 + return buf;
  59 + }
  60 +
  61 + function generateTOC(suite) {
  62 + var obj = mapTOC(suite, {});
  63 + return stringifyTOC(obj, 0);
  64 + }
  65 +
  66 + generateTOC(runner.suite);
  67 +
  68 + runner.on('suite', function(suite){
  69 + ++level;
  70 + var slug = utils.slug(suite.fullTitle());
  71 + buf += '<a name="' + slug + '" />' + '\n';
  72 + buf += title(suite.title) + '\n';
  73 + });
  74 +
  75 + runner.on('suite end', function(suite){
  76 + --level;
  77 + });
  78 +
  79 + runner.on('pass', function(test){
  80 + var code = utils.clean(test.fn.toString());
  81 + buf += test.title + '.\n';
  82 + buf += '\n```js\n';
  83 + buf += code + '\n';
  84 + buf += '```\n\n';
  85 + });
  86 +
  87 + runner.on('end', function(){
  88 + process.stdout.write('# TOC\n');
  89 + process.stdout.write(generateTOC(runner.suite));
  90 + process.stdout.write(buf);
  91 + });
  92 +}
38 node_modules/mocha/lib/reporters/min.js
... ... @@ -0,0 +1,38 @@
  1 +
  2 +/**
  3 + * Module dependencies.
  4 + */
  5 +
  6 +var Base = require('./base');
  7 +
  8 +/**
  9 + * Expose `Min`.
  10 + */
  11 +
  12 +exports = module.exports = Min;
  13 +
  14 +/**
  15 + * Initialize a new `Min` minimal test reporter (best used with --watch).
  16 + *
  17 + * @param {Runner} runner
  18 + * @api public
  19 + */
  20 +
  21 +function Min(runner) {
  22 + Base.call(this, runner);
  23 +
  24 + runner.on('start', function(){
  25 + // clear screen
  26 + process.stdout.write('\u001b[2J');
  27 + // set cursor position
  28 + process.stdout.write('\u001b[1;3H');
  29 + });
  30 +
  31 + runner.on('end', this.epilogue.bind(this));
  32 +}
  33 +
  34 +/**
  35 + * Inherit from `Base.prototype`.
  36 + */
  37 +
  38 +Min.prototype.__proto__ = Base.prototype;
259 node_modules/mocha/lib/reporters/nyan.js
... ... @@ -0,0 +1,259 @@
  1 +
  2 +/**
  3 + * Module dependencies.
  4 + */
  5 +
  6 +var Base = require('./base')
  7 + , color = Base.color;
  8 +
  9 +/**
  10 + * Expose `Dot`.
  11 + */
  12 +
  13 +exports = module.exports = NyanCat;
  14 +
  15 +/**
  16 + * Initialize a new `Dot` matrix test reporter.
  17 + *
  18 + * @param {Runner} runner
  19 + * @api public
  20 + */
  21 +
  22 +function NyanCat(runner) {
  23 + Base.call(this, runner);
  24 +
  25 + var self = this
  26 + , stats = this.stats
  27 + , width = Base.window.width * .75 | 0
  28 + , rainbowColors = this.rainbowColors = self.generateColors()
  29 + , colorIndex = this.colorIndex = 0
  30 + , numerOfLines = this.numberOfLines = 4
  31 + , trajectories = this.trajectories = [[], [], [], []]
  32 + , nyanCatWidth = this.nyanCatWidth = 11
  33 + , trajectoryWidthMax = this.trajectoryWidthMax = (width - nyanCatWidth)
  34 + , scoreboardWidth = this.scoreboardWidth = 5
  35 + , tick = this.tick = 0
  36 + , n = 0;
  37 +
  38 + runner.on('start', function(){
  39 + Base.cursor.hide();
  40 + self.draw('start');
  41 + });
  42 +
  43 + runner.on('pending', function(test){
  44 + self.draw('pending');
  45 + });
  46 +
  47 + runner.on('pass', function(test){
  48 + self.draw('pass');
  49 + });
  50 +
  51 + runner.on('fail', function(test, err){
  52 + self.draw('fail');
  53 + });
  54 +
  55 + runner.on('end', function(){
  56 + Base.cursor.show();
  57 + for (var i = 0; i < self.numberOfLines; i++) write('\n');
  58 + self.epilogue();
  59 + });
  60 +}
  61 +
  62 +/**
  63 + * Draw the nyan cat with runner `status`.
  64 + *
  65 + * @param {String} status
  66 + * @api private
  67 + */
  68 +
  69 +NyanCat.prototype.draw = function(status){
  70 + this.appendRainbow();
  71 + this.drawScoreboard();
  72 + this.drawRainbow();
  73 + this.drawNyanCat(status);
  74 + this.tick = !this.tick;
  75 +};
  76 +
  77 +/**
  78 + * Draw the "scoreboard" showing the number
  79 + * of passes, failures and pending tests.
  80 + *
  81 + * @api private
  82 + */
  83 +
  84 +NyanCat.prototype.drawScoreboard = function(){
  85 + var stats = this.stats;
  86 + var colors = Base.colors;
  87 +
  88 + function draw(color, n) {
  89 + write(' ');
  90 + write('\u001b[' + color + 'm' + n + '\u001b[0m');
  91 + write('\n');
  92 + }
  93 +
  94 + draw(colors.green, stats.passes);
  95 + draw(colors.fail, stats.failures);
  96 + draw(colors.pending, stats.pending);
  97 + write('\n');
  98 +
  99 + this.cursorUp(this.numberOfLines);
  100 +};
  101 +
  102 +/**
  103 + * Append the rainbow.
  104 + *
  105 + * @api private
  106 + */
  107 +
  108 +NyanCat.prototype.appendRainbow = function(){
  109 + var segment = this.tick ? '_' : '-';
  110 + var rainbowified = this.rainbowify(segment);
  111 +
  112 + for (var index = 0; index < this.numberOfLines; index++) {
  113 + var trajectory = this.trajectories[index];
  114 + if (trajectory.length >= this.trajectoryWidthMax) trajectory.shift();
  115 + trajectory.push(rainbowified);
  116 + }
  117 +};
  118 +
  119 +/**
  120 + * Draw the rainbow.
  121 + *
  122 + * @api private
  123 + */
  124 +
  125 +NyanCat.prototype.drawRainbow = function(){
  126 + var self = this;
  127 +
  128 + this.trajectories.forEach(function(line, index) {
  129 + write('\u001b[' + self.scoreboardWidth + 'C');
  130 + write(line.join(''));
  131 + write('\n');
  132 + });
  133 +
  134 + this.cursorUp(this.numberOfLines);
  135 +};
  136 +
  137 +/**
  138 + * Draw the nyan cat with `status`.
  139 + *
  140 + * @param {String} status
  141 + * @api private
  142 + */
  143 +
  144 +NyanCat.prototype.drawNyanCat = function(status) {
  145 + var self = this;
  146 + var startWidth = this.scoreboardWidth + this.trajectories[0].length;
  147 +
  148 + [0, 1, 2, 3].forEach(function(index) {
  149 + write('\u001b[' + startWidth + 'C');
  150 +
  151 + switch (index) {
  152 + case 0:
  153 + write('_,------,');
  154 + write('\n');
  155 + break;
  156 + case 1:
  157 + var padding = self.tick ? ' ' : ' ';
  158 + write('_|' + padding + '/\\_/\\ ');
  159 + write('\n');
  160 + break;
  161 + case 2:
  162 + var padding = self.tick ? '_' : '__';
  163 + var tail = self.tick ? '~' : '^';
  164 + var face;
  165 + switch (status) {
  166 + case 'pass':
  167 + face = '( ^ .^)';
  168 + break;
  169 + case 'fail':
  170 + face = '( o .o)';
  171 + break;
  172 + default:
  173 + face = '( - .-)';
  174 + }
  175 + write(tail + '|' + padding + face + ' ');
  176 + write('\n');
  177 + break;
  178 + case 3:
  179 + var padding = self.tick ? ' ' : ' ';
  180 + write(padding + '"" "" ');
  181 + write('\n');
  182 + break;
  183 + }
  184 + });
  185 +
  186 + this.cursorUp(this.numberOfLines);
  187 +};
  188 +
  189 +/**
  190 + * Move cursor up `n`.
  191 + *
  192 + * @param {Number} n
  193 + * @api private
  194 + */
  195 +
  196 +NyanCat.prototype.cursorUp = function(n) {
  197 + write('\u001b[' + n + 'A');
  198 +};
  199 +
  200 +/**
  201 + * Move cursor down `n`.
  202 + *
  203 + * @param {Number} n
  204 + * @api private
  205 + */
  206 +
  207 +NyanCat.prototype.cursorDown = function(n) {
  208 + write('\u001b[' + n + 'B');
  209 +};
  210 +
  211 +/**
  212 + * Generate rainbow colors.
  213 + *
  214 + * @return {Array}
  215 + * @api private
  216 + */
  217 +
  218 +NyanCat.prototype.generateColors = function(){
  219 + var colors = [];
  220 +
  221 + for (var i = 0; i < (6 * 7); i++) {
  222 + var pi3 = Math.floor(Math.PI / 3);
  223 + var n = (i * (1.0 / 6));
  224 + var r = Math.floor(3 * Math.sin(n) + 3);
  225 + var g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3);
  226 + var b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3);
  227 + colors.push(36 * r + 6 * g + b + 16);
  228 + }
  229 +
  230 + return colors;
  231 +};
  232 +
  233 +/**
  234 + * Apply rainbow to the given `str`.
  235 + *
  236 + * @param {String} str
  237 + * @return {String}
  238 + * @api private
  239 + */
  240 +
  241 +NyanCat.prototype.rainbowify = function(str){
  242 + var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length];
  243 + this.colorIndex += 1;
  244 + return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m';
  245 +};
  246 +
  247 +/**
  248 + * Stdout helper.
  249 + */
  250 +
  251 +function write(string) {
  252 + process.stdout.write(string);
  253 +}
  254 +
  255 +/**
  256 + * Inherit from `Base.prototype`.
  257 + */
  258 +
  259 +NyanCat.prototype.__proto__ = Base.prototype;
23 node_modules/mocha/my-reporter.js
... ... @@ -0,0 +1,23 @@
  1 +
  2 +exports = module.exports = MyReporter;
  3 +
  4 +function MyReporter(runner) {
  5 + var passes = 0;
  6 + var failures = 0;
  7 + var total = 0;
  8 +
  9 + runner.on('pass', function(test){
  10 + passes++;
  11 + console.log('pass: %s', test.fullTitle());
  12 + });
  13 +
  14 + runner.on('fail', function(test, err){
  15 + failures++;
  16 + console.log('fail: %s -- error: %s', test.fullTitle(), err.message);
  17 + });
  18 +
  19 + runner.on('end', function(){
  20 + console.log('end: %d/%d', passes, passes + failures);
  21 + process.exit(failures);
  22 + });
  23 +}
510 node_modules/mocha/node_modules/jade/jade.md
Source Rendered
... ... @@ -0,0 +1,510 @@
  1 +
  2 +# Jade
  3 +
  4 + The jade template engine for node.js
  5 +
  6 +## Synopsis
  7 +
  8 + jade [-h|--help] [-v|--version] [-o|--obj STR]
  9 + [-O|--out DIR] [-p|--path PATH] [-P|--pretty]
  10 + [-c|--client] [-D|--no-debug]
  11 +
  12 +## Examples
  13 +
  14 + translate jade the templates dir
  15 +
  16 + $ jade templates
  17 +
  18 + create {foo,bar}.html
  19 +
  20 + $ jade {foo,bar}.jade
  21 +
  22 + jade over stdio
  23 +
  24 + $ jade < my.jade > my.html
  25 +
  26 + jade over s
  27 +
  28 + $ echo "h1 Jade!" | jade
  29 +
  30 + foo, bar dirs rendering to /tmp
  31 +
  32 + $ jade foo bar --out /tmp
  33 +
  34 + compile client-side templates without debugging
  35 + instrumentation, making the output javascript
  36 + very light-weight. This requires runtime.js
  37 + in your projects.
  38 +
  39 + $ jade --client --no-debug < my.jade
  40 +
  41 +## Tags
  42 +
  43 + Tags are simply nested via whitespace, closing
  44 + tags defined for you. These indents are called "blocks".
  45 +
  46 + ul
  47 + li
  48 + a Foo
  49 + li
  50 + a Bar
  51 +
  52 + You may have several tags in one "block":
  53 +
  54 + ul
  55 + li
  56 + a Foo
  57 + a Bar
  58 + a Baz
  59 +
  60 +## Self-closing Tags
  61 +
  62 + Some tags are flagged as self-closing by default, such
  63 + as `meta`, `link`, and so on. To explicitly self-close
  64 + a tag simply append the `/` character:
  65 +
  66 + foo/
  67 + foo(bar='baz')/
  68 +
  69 + Would yield:
  70 +
  71 + <foo/>
  72 + <foo bar="baz"/>
  73 +
  74 +## Attributes
  75 +
  76 + Tag attributes look similar to HTML, however
  77 + the values are regular JavaScript, here are
  78 + some examples:
  79 +
  80 + a(href='google.com') Google
  81 + a(class='button', href='google.com') Google
  82 +
  83 + As mentioned the attribute values are just JavaScript,
  84 + this means ternary operations and other JavaScript expressions
  85 + work just fine:
  86 +
  87 + body(class=user.authenticated ? 'authenticated' : 'anonymous')
  88 + a(href=user.website || 'http://google.com')
  89 +
  90 + Multiple lines work too:
  91 +
  92 + input(type='checkbox',
  93 + name='agreement',
  94 + checked)
  95 +
  96 + Multiple lines without the comma work fine:
  97 +
  98 + input(type='checkbox'
  99 + name='agreement'
  100 + checked)
  101 +
  102 + Funky whitespace? fine:
  103 +
  104 + input(
  105 + type='checkbox'
  106 + name='agreement'
  107 + checked)
  108 +
  109 +## Boolean attributes
  110 +
  111 + Boolean attributes are mirrored by Jade, and accept
  112 + bools, aka _true_ or _false_. When no value is specified
  113 + _true_ is assumed. For example:
  114 +
  115 + input(type="checkbox", checked)
  116 + // => "<input type="checkbox" checked="checked" />"
  117 +
  118 + For example if the checkbox was for an agreement, perhaps `user.agreed`
  119 + was _true_ the following would also output 'checked="checked"':
  120 +
  121 + input(type="checkbox", checked=user.agreed)
  122 +
  123 +## Class attributes
  124 +
  125 + The _class_ attribute accepts an array of classes,
  126 + this can be handy when generated from a javascript
  127 + function etc:
  128 +
  129 + classes = ['foo', 'bar', 'baz']
  130 + a(class=classes)
  131 + // => "<a class="foo bar baz"></a>"
  132 +
  133 +## Class literal
  134 +
  135 + Classes may be defined using a ".CLASSNAME" syntax:
  136 +
  137 + .button
  138 + // => "<div class="button"></div>"
  139 +
  140 + Or chained:
  141 +
  142 + .large.button
  143 + // => "<div class="large button"></div>"
  144 +
  145 + The previous defaulted to divs, however you
  146 + may also specify the tag type:
  147 +
  148 + h1.title My Title
  149 + // => "<h1 class="title">My Title</h1>"
  150 +
  151 +## Id literal
  152 +
  153 + Much like the class literal there's an id literal:
  154 +
  155 + #user-1
  156 + // => "<div id="user-1"></div>"
  157 +
  158 + Again we may specify the tag as well:
  159 +
  160 + ul#menu
  161 + li: a(href='/home') Home
  162 + li: a(href='/store') Store
  163 + li: a(href='/contact') Contact
  164 +
  165 + Finally all of these may be used in any combination,
  166 + the following are all valid tags:
  167 +
  168 + a.button#contact(style: 'color: red') Contact
  169 + a.button(style: 'color: red')#contact Contact
  170 + a(style: 'color: red').button#contact Contact
  171 +
  172 +## Block expansion
  173 +
  174 + Jade supports the concept of "block expansion", in which
  175 + using a trailing ":" after a tag will inject a block:
  176 +
  177 + ul
  178 + li: a Foo
  179 + li: a Bar
  180 + li: a Baz
  181 +
  182 +## Text
  183 +
  184 + Arbitrary text may follow tags:
  185 +
  186 + p Welcome to my site
  187 +
  188 + yields:
  189 +
  190 + <p>Welcome to my site</p>
  191 +
  192 +## Pipe text
  193 +
  194 + Another form of text is "pipe" text. Pipes act
  195 + as the text margin for large bodies of text.
  196 +
  197 + p
  198 + | This is a large
  199 + | body of text for
  200 + | this tag.
  201 + |
  202 + | Nothing too
  203 + | exciting.
  204 +
  205 + yields:
  206 +
  207 + <p>This is a large
  208 + body of text for
  209 + this tag.
  210 +
  211 + Nothing too
  212 + exciting.
  213 + </p>
  214 +
  215 + Using pipes we can also specify regular Jade tags
  216 + within the text:
  217 +
  218 + p
  219 + | Click to visit
  220 + a(href='http://google.com') Google
  221 + | if you want.
  222 +
  223 +## Text only tags
  224 +
  225 + As an alternative to pipe text you may add
  226 + a trailing "." to indicate that the block
  227 + contains nothing but plain-text, no tags:
  228 +
  229 + p.
  230 + This is a large
  231 + body of text for
  232 + this tag.
  233 +
  234 + Nothing too
  235 + exciting.
  236 +
  237 + Some tags are text-only by default, for example
  238 + _script_, _textarea_, and _style_ tags do not
  239 + contain nested HTML so Jade implies the trailing ".":
  240 +
  241 + script
  242 + if (foo) {
  243 + bar();
  244 + }
  245 +
  246 + style
  247 + body {
  248 + padding: 50px;
  249 + font: 14px Helvetica;
  250 + }
  251 +
  252 +## Template script tags
  253 +
  254 + Sometimes it's useful to define HTML in script
  255 + tags using Jade, typically for client-side templates.
  256 +
  257 + To do this simply give the _script_ tag an arbitrary
  258 + _type_ attribute such as _text/x-template_:
  259 +
  260 + script(type='text/template')
  261 + h1 Look!
  262 + p Jade still works in here!
  263 +
  264 +## Interpolation
  265 +
  266 + Both plain-text and piped-text support interpolation,
  267 + which comes in two forms, escapes and non-escaped. The
  268 + following will output the _user.name_ in the paragraph
  269 + but HTML within it will be escaped to prevent XSS attacks:
  270 +
  271 + p Welcome #{user.name}
  272 +
  273 + The following syntax is identical however it will _not_ escape
  274 + HTML, and should only be used with strings that you trust:
  275 +
  276 + p Welcome !{user.name}
  277 +
  278 +## Inline HTML
  279 +
  280 + Sometimes constructing small inline snippets of HTML
  281 + in Jade can be annoying, luckily we can add plain
  282 + HTML as well:
  283 +
  284 + p Welcome <em>#{user.name}</em>
  285 +
  286 +## Code
  287 +
  288 + To buffer output with Jade simply use _=_ at the beginning
  289 + of a line or after a tag. This method escapes any HTML
  290 + present in the string.
  291 +
  292 + p= user.description
  293 +
  294 + To buffer output unescaped use the _!=_ variant, but again
  295 + be careful of XSS.
  296 +
  297 + p!= user.description
  298 +
  299 + The final way to mess with JavaScript code in Jade is the unbuffered
  300 + _-_, which can be used for conditionals, defining variables etc:
  301 +
  302 + - var user = { description: 'foo bar baz' }
  303 + #user
  304 + - if (user.description) {
  305 + h2 Description
  306 + p.description= user.description
  307 + - }
  308 +
  309 + When compiled blocks are wrapped in anonymous functions, so the
  310 + following is also valid, without braces:
  311 +
  312 + - var user = { description: 'foo bar baz' }
  313 + #user
  314 + - if (user.description)
  315 + h2 Description
  316 + p.description= user.description
  317 +
  318 + If you really want you could even use `.forEach()` and others:
  319 +
  320 + - users.forEach(function(user){
  321 + .user
  322 + h2= user.name
  323 + p User #{user.name} is #{user.age} years old
  324 + - })
  325 +
  326 + Taking this further Jade provides some syntax for conditionals,
  327 + iteration, switch statements etc. Let's look at those next!
  328 +
  329 +## Assignment
  330 +
  331 + Jade's first-class assignment is simple, simply use the _=_
  332 + operator and Jade will _var_ it for you. The following are equivalent:
  333 +
  334 + - var user = { name: 'tobi' }
  335 + user = { name: 'tobi' }
  336 +
  337 +## Conditionals
  338 +
  339 + Jade's first-class conditional syntax allows for optional
  340 + parenthesis, and you may now omit the leading _-_ otherwise
  341 + it's identical, still just regular javascript:
  342 +
  343 + user = { description: 'foo bar baz' }
  344 + #user
  345 + if user.description
  346 + h2 Description
  347 + p.description= user.description
  348 +
  349 + Jade provides the negated version, _unless_ as well, the following
  350 + are equivalent:
  351 +
  352 + - if (!(user.isAnonymous))
  353 + p You're logged in as #{user.name}
  354 +
  355 + unless user.isAnonymous
  356 + p You're logged in as #{user.name}
  357 +
  358 +## Iteration
  359 +
  360 + JavaScript's _for_ loops don't look very declarative, so Jade
  361 + also provides its own _for_ loop construct, aliased as _each_:
  362 +
  363 + for user in users
  364 + .user
  365 + h2= user.name
  366 + p user #{user.name} is #{user.age} year old
  367 +
  368 + As mentioned _each_ is identical:
  369 +
  370 + each user in users
  371 + .user
  372 + h2= user.name
  373 +
  374 + If necessary the index is available as well:
  375 +
  376 + for user, i in users
  377 + .user(class='user-#{i}')
  378 + h2= user.name
  379 +
  380 + Remember, it's just JavaScript:
  381 +
  382 + ul#letters
  383 + for letter in ['a', 'b', 'c']
  384 + li= letter
  385 +
  386 +## Mixins
  387 +
  388 + Mixins provide a way to define jade "functions" which "mix in"
  389 + their contents when called. This is useful for abstracting
  390 + out large fragments of Jade.
  391 +
  392 + The simplest possible mixin which accepts no arguments might
  393 + look like this:
  394 +
  395 + mixin hello
  396 + p Hello
  397 +
  398 + You use a mixin by placing `+` before the name:
  399 +
  400 + +hello
  401 +
  402 + For something a little more dynamic, mixins can take
  403 + arguments, the mixin itself is converted to a javascript
  404 + function internally:
  405 +
  406 + mixin hello(user)
  407 + p Hello #{user}
  408 +
  409 + +hello('Tobi')
  410 +
  411 + Yields:
  412 +
  413 + <p>Hello Tobi</p>
  414 +
  415 + Mixins may optionally take blocks, when a block is passed
  416 + its contents becomes the implicit `block` argument. For
  417 + example here is a mixin passed a block, and also invoked
  418 + without passing a block:
  419 +
  420 + mixin article(title)
  421 + .article
  422 + .article-wrapper
  423 + h1= title
  424 + if block
  425 + block
  426 + else
  427 + p No content provided
  428 +
  429 + +article('Hello world')
  430 +
  431 + +article('Hello world')
  432 + p This is my
  433 + p Amazing article
  434 +
  435 + yields:
  436 +
  437 + <div class="article">
  438 + <div class="article-wrapper">
  439 + <h1>Hello world</h1>
  440 + <p>No content provided</p>
  441 + </div>
  442 + </div>
  443 +
  444 + <div class="article">
  445 + <div class="article-wrapper">
  446 + <h1>Hello world</h1>
  447 + <p>This is my</p>
  448 + <p>Amazing article</p>
  449 + </div>
  450 + </div>
  451 +
  452 + Mixins can even take attributes, just like a tag. When
  453 + attributes are passed they become the implicit `attributes`
  454 + argument. Individual attributes can be accessed just like
  455 + normal object properties:
  456 +
  457 + mixin centered
  458 + .centered(class=attributes.class)
  459 + block
  460 +
  461 + +centered.bold Hello world
  462 +
  463 + +centered.red
  464 + p This is my
  465 + p Amazing article
  466 +
  467 + yields:
  468 +
  469 + <div class="centered bold">Hello world</div>
  470 + <div class="centered red">
  471 + <p>This is my</p>
  472 + <p>Amazing article</p>
  473 + </div>
  474 +
  475 + If you use `attributes` directly, *all* passed attributes
  476 + get used:
  477 +
  478 + mixin link
  479 + a.menu(attributes)
  480 + block
  481 +
  482 + +link.highlight(href='#top') Top
  483 + +link#sec1.plain(href='#section1') Section 1
  484 + +link#sec2.plain(href='#section2') Section 2
  485 +
  486 + yields:
  487 +
  488 + <a href="#top" class="highlight menu">Top</a>
  489 + <a id="sec1" href="#section1" class="plain menu">Section 1</a>
  490 + <a id="sec2" href="#section2" class="plain menu">Section 2</a>
  491 +
  492 + If you pass arguments, they must directly follow the mixin:
  493 +
  494 + mixin list(arr)
  495 + if block
  496 + .title
  497 + block
  498 + ul(attributes)
  499 + each item in arr
  500 + li= item
  501 +
  502 + +list(['foo', 'bar', 'baz'])(id='myList', class='bold')
  503 +
  504 + yields:
  505 +
  506 + <ul id="myList" class="bold">
  507 + <li>foo</li>
  508 + <li>bar</li>
  509 + <li>baz</li>
  510 + </ul>
77 node_modules/mocha/node_modules/jade/lib/nodes/attrs.js
... ... @@ -0,0 +1,77 @@
  1 +
  2 +/*!
  3 + * Jade - nodes - Attrs
  4 + * Copyright(c) 2010 TJ Holowaychuk <tj@vision-media.ca>
  5 + * MIT Licensed
  6 + */
  7 +
  8 +/**
  9 + * Module dependencies.
  10 + */
  11 +
  12 +var Node = require('./node'),
  13 + Block = require('./block');
  14 +
  15 +/**
  16 + * Initialize a `Attrs` node.
  17 + *
  18 + * @api public
  19 + */
  20 +
  21 +var Attrs = module.exports = function Attrs() {
  22 + this.attrs = [];
  23 +};
  24 +
  25 +/**
  26 + * Inherit from `Node`.
  27 + */
  28 +
  29 +Attrs.prototype.__proto__ = Node.prototype;
  30 +
  31 +/**
  32 + * Set attribute `name` to `val`, keep in mind these become
  33 + * part of a raw js object literal, so to quote a value you must
  34 + * '"quote me"', otherwise or example 'user.name' is literal JavaScript.
  35 + *
  36 + * @param {String} name
  37 + * @param {String} val
  38 + * @param {Boolean} escaped
  39 + * @return {Tag} for chaining
  40 + * @api public
  41 + */
  42 +
  43 +Attrs.prototype.setAttribute = function(name, val, escaped){
  44 + this.attrs.push({ name: name, val: val, escaped: escaped });
  45 + return this;
  46 +};
  47 +
  48 +/**
  49 + * Remove attribute `name` when present.
  50 + *
  51 + * @param {String} name
  52 + * @api public
  53 + */
  54 +
  55 +Attrs.prototype.removeAttribute = function(name){
  56 + for (var i = 0, len = this.attrs.length; i < len; ++i) {
  57 + if (this.attrs[i] && this.attrs[i].name == name) {
  58 + delete this.attrs[i];
  59 + }
  60 + }
  61 +};
  62 +
  63 +/**
  64 + * Get attribute value by `name`.
  65 + *
  66 + * @param {String} name
  67 + * @return {String}
  68 + * @api public
  69 + */
  70 +
  71 +Attrs.prototype.getAttribute = function(name){
  72 + for (var i = 0, len = this.attrs.length; i < len; ++i) {
  73 + if (this.attrs[i] && this.attrs[i].name == name) {
  74 + return this.attrs[i].val;
  75 + }
  76 + }
  77 +};
7 node_modules/mocha/node_modules/jade/test.jade
... ... @@ -0,0 +1,7 @@
  1 +p.
  2 + This is a large
  3 + body of text for
  4 + this tag.
  5 +
  6 + Nothing too
  7 + exciting.
5 node_modules/mocha/node_modules/jade/testing/head.jade
... ... @@ -0,0 +1,5 @@
  1 +head
  2 + script(src='/jquery.js')
  3 + yield
  4 + if false
  5 + script(src='/jquery.ui.js')
22 node_modules/mocha/node_modules/jade/testing/index.jade
... ... @@ -0,0 +1,22 @@
  1 +
  2 +tag = 'p'
  3 +foo = 'bar'
  4 +
  5 +#{tag} value
  6 +#{tag}(foo='bar') value
  7 +#{foo ? 'a' : 'li'}(something) here
  8 +
  9 +mixin item(icon)
  10 + li
  11 + if attributes.href
  12 + a(attributes)
  13 + img.icon(src=icon)
  14 + block
  15 + else
  16 + span(attributes)
  17 + img.icon(src=icon)
  18 + block
  19 +
  20 +ul
  21 + +item('contact') Contact
  22 + +item(href='/contact') Contact
11 node_modules/mocha/node_modules/jade/testing/index.js
... ... @@ -0,0 +1,11 @@
  1 +
  2 +/**
  3 + * Module dependencies.
  4 + */
  5 +
  6 +var jade = require('../');
  7 +
  8 +jade.renderFile('testing/index.jade', { pretty: true, debug: true, compileDebug: false }, function(err, str){
  9 + if (err) throw err;
  10 + console.log(str);
  11 +});
6 node_modules/mocha/node_modules/jade/testing/layout.jade
... ... @@ -0,0 +1,6 @@
  1 +html
  2 + include head
  3 + script(src='/caustic.js')
  4 + script(src='/app.js')
  5 + body
  6 + block content
7 node_modules/mocha/node_modules/jade/testing/user.jade
... ... @@ -0,0 +1,7 @@