Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Merge branch 'json-api-v0.6' into v0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Mar 1, 2012
2 parents 4065b24 + 4ca3fd0 commit a63ce6e
Show file tree
Hide file tree
Showing 106 changed files with 3,076 additions and 2,275 deletions.
45 changes: 15 additions & 30 deletions Makefile
Expand Up @@ -78,12 +78,15 @@ test-npm-publish: all
out/Release/node: all

apidoc_sources = $(wildcard doc/api/*.markdown)
apidocs = $(addprefix out/,$(apidoc_sources:.markdown=.html))
apidocs = $(addprefix out/,$(apidoc_sources:.markdown=.html)) \
$(addprefix out/,$(apidoc_sources:.markdown=.json))

apidoc_dirs = out/doc out/doc/api/ out/doc/api/assets out/doc/about out/doc/community out/doc/logos
apidoc_dirs = out/doc out/doc/api/ out/doc/api/assets out/doc/about out/doc/community out/doc/logos out/doc/images

apiassets = $(subst api_assets,api/assets,$(addprefix out/,$(wildcard doc/api_assets/*)))

doc_images = $(addprefix out/,$(wildcard doc/images/* doc/*.jpg doc/*.png))

website_files = \
out/doc/index.html \
out/doc/v0.4_announcement.html \
Expand All @@ -92,35 +95,14 @@ website_files = \
out/doc/sh_javascript.min.js \
out/doc/sh_vim-dark.css \
out/doc/sh.css \
out/doc/logo.png \
out/doc/favicon.ico \
out/doc/pipe.css \
out/doc/about/index.html \
out/doc/close-downloads.png \
out/doc/community/index.html \
out/doc/community/not-invented-here.png \
out/doc/logos/index.html \
out/doc/microsoft-logo.png \
out/doc/ryan-speaker.jpg \
out/doc/download-logo.png \
out/doc/ebay-logo.png \
out/doc/footer-logo-alt.png \
out/doc/footer-logo.png \
out/doc/icons-interior.png \
out/doc/icons.png \
out/doc/home-icons.png \
out/doc/joyent-logo_orange_nodeorg-01.png \
out/doc/linkedin-logo.png \
out/doc/logo-light.png \
out/doc/mac_osx_nodejs_installer_logo.png \
out/doc/microsoft-logo.png \
out/doc/platform-icons.png \
out/doc/sponsored.png \
out/doc/twitter-bird.png \
out/doc/community-icons.png \
out/doc/yahoo-logo.png

doc docs: out/Release/node $(apidoc_dirs) $(website_files) $(apiassets) $(apidocs)
$(doc_images)

doc: node $(apidoc_dirs) $(website_files) $(apiassets) $(apidocs) tools/doc/

$(apidoc_dirs):
mkdir -p $@
Expand All @@ -129,10 +111,13 @@ out/doc/api/assets/%: doc/api_assets/% out/doc/api/assets/
cp $< $@

out/doc/%: doc/%
cp $< $@
cp -r $< $@

out/doc/api/%.json: doc/api/%.markdown
out/Release/node tools/doc/generate.js --format=json $< > $@

out/doc/api/%.html: doc/api/%.markdown out/Release/node $(apidoc_dirs) $(apiassets) tools/doctool/doctool.js
out/Release/node tools/doctool/doctool.js doc/template.html $< > $@
out/doc/api/%.html: doc/api/%.markdown
out/Release/node tools/doc/generate.js --format=html --template=doc/template.html $< > $@

out/doc/%:

Expand Down Expand Up @@ -197,7 +182,7 @@ $(TARBALL): out/doc
cp doc/node.1 $(TARNAME)/doc/node.1
cp -r out/doc/api $(TARNAME)/doc/api
rm -rf $(TARNAME)/deps/v8/test # too big
rm -rf $(TARNAME)/doc/logos/*.{png,eps} # too big
rm -rf $(TARNAME)/doc/images # too big
tar -cf $(TARNAME).tar $(TARNAME)
rm -rf $(TARNAME)
gzip -f -9 $(TARNAME).tar
Expand Down
4 changes: 2 additions & 2 deletions doc/about/index.html
Expand Up @@ -21,7 +21,7 @@
<body class="alt int" id="about">
<div id="intro" class="interior">
<a href="/" title="Go back to the home page">
<img id="logo" src="../logo-light.png" alt="node.js">
<img id="logo" src="http://nodejs.org/images/logo-light.png" alt="node.js">
</a>
</div>
<div id="content" class="clearfix">
Expand Down Expand Up @@ -102,7 +102,7 @@ <h1>Node's goal is to provide an easy way to build scalable
<p>But what about multiple-processor concurrency? Aren't
threads necessary to scale programs to multi-core computers?
You can start new processes via <code><a
href="http://nodejs.org/docs/latest/api/child_processes.html#child_process.fork">child_process.fork()</a></code>
href="http://nodejs.org/docs/latest/api/child_process.html#child_process.fork">child_process.fork()</a></code>
these other processes will be scheduled in parallel. For load
balancing incoming connections across multiple processes use
<a href="http://nodejs.org/docs/latest/api/cluster.html">the
Expand Down
10 changes: 4 additions & 6 deletions doc/api/_toc.markdown
@@ -1,5 +1,4 @@
## Table of Contents

* [About these Docs](documentation.html)
* [Synopsis](synopsis.html)
* [Globals](globals.html)
* [STDIO](stdio.html)
Expand All @@ -9,8 +8,8 @@
* [Process](process.html)
* [Utilities](util.html)
* [Events](events.html)
* [Buffers](buffers.html)
* [Streams](streams.html)
* [Buffer](buffer.html)
* [Stream](stream.html)
* [Crypto](crypto.html)
* [TLS/SSL](tls.html)
* [String Decoder](string_decoder.html)
Expand All @@ -26,7 +25,7 @@
* [Readline](readline.html)
* [REPL](repl.html)
* [VM](vm.html)
* [Child Processes](child_processes.html)
* [Child Processes](child_process.html)
* [Assertion Testing](assert.html)
* [TTY](tty.html)
* [ZLIB](zlib.html)
Expand All @@ -35,4 +34,3 @@
* [Cluster](cluster.html)
* Appendixes
* [Appendix 1: Recommended Third-party Modules](appendix_1.html)
* [Appendix 2: Deprecated API's](appendix_2.html)
18 changes: 9 additions & 9 deletions doc/api/addons.markdown
@@ -1,4 +1,4 @@
## Addons
# Addons

Addons are dynamically linked shared objects. They can provide glue to C and
C++ libraries. The API (at the moment) is rather complex, involving
Expand All @@ -24,7 +24,7 @@ compiling your module, you don't need to worry about linking to any of these
libraries.


### Hello world
## Hello world

To get started let's make a small Addon which is the C++ equivalent of
the following Javascript code:
Expand Down Expand Up @@ -129,7 +129,7 @@ In cases where there is more than one `.cc` file, simply add the file name to th
obj.source = ['addon.cc', 'myexample.cc']


#### Function arguments
### Function arguments

The following pattern illustrates how to read arguments from JavaScript
function calls and return a result. This is the main and only needed source
Expand Down Expand Up @@ -172,7 +172,7 @@ You can test it with the following JavaScript snippet:
console.log( 'This should be eight:', addon.add(3,5) );


#### Callbacks
### Callbacks

You can pass JavaScript functions to a C++ function and execute them from
there. Here's `addon.cc`:
Expand Down Expand Up @@ -209,7 +209,7 @@ To test it run the following JavaScript snippet:
});


#### Object factory
### Object factory

You can create and return new objects from within a C++ function with this
`addon.cc` pattern, which returns an object with property `msg` that echoes
Expand Down Expand Up @@ -245,7 +245,7 @@ To test it in JavaScript:
console.log(obj1.msg+' '+obj2.msg); // 'hello world'


#### Function factory
### Function factory

This pattern illustrates how to create and return a JavaScript function that
wraps a C++ function:
Expand Down Expand Up @@ -286,7 +286,7 @@ To test:
console.log(fn()); // 'hello world'


#### Wrapping C++ objects
### Wrapping C++ objects

Here we will create a wrapper for a C++ object/class `MyObject` that can be
instantiated in JavaScript through the `new` operator. First prepare the main
Expand Down Expand Up @@ -381,7 +381,7 @@ Test it with:
console.log( obj.plusOne() ); // 13


#### Factory of wrapped objects
### Factory of wrapped objects

This is useful when you want to be able to create native objects without
explicitly instantiating them with the `new` operator in JavaScript, e.g.
Expand Down Expand Up @@ -507,7 +507,7 @@ Test it with:
console.log( obj2.plusOne() ); // 23


#### Passing wrapped objects around
### Passing wrapped objects around

In addition to wrapping and returning C++ objects, you can pass them around
by unwrapping them with Node's `node::ObjectWrap::Unwrap` helper function.
Expand Down
12 changes: 4 additions & 8 deletions doc/api/all.markdown
@@ -1,16 +1,15 @@
@include documentation
@include synopsis
@include globals
@include stdio
@include timers
@include modules
@include addons
@include process
@include constants
@include util
@include freelist
@include events
@include buffers
@include streams
@include buffer
@include stream
@include crypto
@include tls
@include string_decoder
Expand All @@ -26,14 +25,11 @@
@include readline
@include repl
@include vm
@include child_processes
@include child_process
@include assert
@include tty
@include zlib
@include os
@include debugger
@include cluster

# Appendixes
@include appendix_1
@include appendix_2
2 changes: 1 addition & 1 deletion doc/api/appendix_1.markdown
@@ -1,4 +1,4 @@
## Appendix 1 - Third Party Modules
# Appendix 1 - Third Party Modules

There are many third party modules for Node. At the time of writing, August
2010, the master repository of modules is
Expand Down
Empty file removed doc/api/appendix_2.markdown
Empty file.
24 changes: 12 additions & 12 deletions doc/api/assert.markdown
@@ -1,41 +1,41 @@
## Assert
# Assert

This module is used for writing unit tests for your applications, you can
access it with `require('assert')`.

### assert.fail(actual, expected, message, operator)
## assert.fail(actual, expected, message, operator)

Throws an exception that displays the values for `actual` and `expected` separated by the provided operator.

### assert(value, message), assert.ok(value, [message])
## assert(value, message), assert.ok(value, [message])

Tests if value is a `true` value, it is equivalent to `assert.equal(true, value, message);`

### assert.equal(actual, expected, [message])
## assert.equal(actual, expected, [message])

Tests shallow, coercive equality with the equal comparison operator ( `==` ).

### assert.notEqual(actual, expected, [message])
## assert.notEqual(actual, expected, [message])

Tests shallow, coercive non-equality with the not equal comparison operator ( `!=` ).

### assert.deepEqual(actual, expected, [message])
## assert.deepEqual(actual, expected, [message])

Tests for deep equality.

### assert.notDeepEqual(actual, expected, [message])
## assert.notDeepEqual(actual, expected, [message])

Tests for any deep inequality.

### assert.strictEqual(actual, expected, [message])
## assert.strictEqual(actual, expected, [message])

Tests strict equality, as determined by the strict equality operator ( `===` )

### assert.notStrictEqual(actual, expected, [message])
## assert.notStrictEqual(actual, expected, [message])

Tests strict non-equality, as determined by the strict not equal operator ( `!==` )

### assert.throws(block, [error], [message])
## assert.throws(block, [error], [message])

Expects `block` to throw an error. `error` can be constructor, regexp or
validation function.
Expand Down Expand Up @@ -72,11 +72,11 @@ Custom error validation:
"unexpected error"
);

### assert.doesNotThrow(block, [error], [message])
## assert.doesNotThrow(block, [error], [message])

Expects `block` not to throw an error, see assert.throws for details.

### assert.ifError(value)
## assert.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.

0 comments on commit a63ce6e

Please sign in to comment.