Skip to content

Commit

Permalink
Merge commit 'wuher/master' into integration
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskowal committed May 11, 2010
2 parents 349a397 + 174d291 commit 23b9a4e
Show file tree
Hide file tree
Showing 7 changed files with 199 additions and 47 deletions.
68 changes: 57 additions & 11 deletions docs/available-packages.md
@@ -1,32 +1,78 @@

Available Packages
==================

You can download and install packages using the `tusk` application that comes with Narwhal. Check out `tusk help` for details. These are some of the packages:

* `activejs`: The Cross Platform JavaScript MVC, http://activejs.org/
* `appengine`: A port of the Python Google App Engine SDK to JavaScript
* `appengine-java-sdk`: Java components necessary for deploying applications on Google's App Engine.
* `appengine`: A port of the Python AppEngine API to JavaScript
* `barista`: An automated user interface testing framework.
* `bogart`: A simple web framework
* `browserjs`: A simulated web browser environment, includes XMLHttpRequest, timeouts, console, a DOM, etc
* `cappruby`: Experimental Ruby implementation on top of the Objective-J runtime / JavaScript
* `cappuccino`: Cappuccino module
* `CappuccinoResource`: Cappuccino on Rails
* `chiron`: A system of interoperable JavaScript modules, including a Pythonic type system and types
* `closure-compiler`: Closure Compiler
* `coffee-script`: Unfancy JavaScript
* `commonjs-utils`
* `couchdb`: API to access CouchDB servers, a schema-free database of JSON documents
* `creolejs`: A JavaScript implementation of the CreoleWiki language, for browsers.
* `env`:
* `inspec`:
* `ejs`: Embedded JavaScript templating framework
* `env`
* `haml-js`: Haml ported to server-side Javascript. This is a traditional server-side templating language.
* `htmlparser`: An HTML parser
* `inspec`: BDD test framwork inspired by rspec
* `jack`
* `jack-dav`: A JSGI compatible WebDAV server, based on RackDAV
* `jack-servlet`: A Java servlet for running JSGI applications
* `jack`: A library of JSGI middleware, handlers, and utilities, based on Rack
* `jake`: A build system for ServerJS, inspired by Rake
* `jsdocs`: Tool for generating template-formatted, multi-page HTML (or XML, JSON, or any other text-based) documentation from commented JavaScript source code.
* `jake`: A build system for CommonJS, lifted from Rake
* `jaml`: A library of JSGI middleware, handlers, and utilities, based on Rack
* `jdbc`
* `jscrypto`: Fast symmetric cryptography in Javascript
* `jsdocs`: JavaScript documentation generator. Tool for generating template-formatted, multi-page HTML (or XML, JSON, or any other text-based) documentation from commented JavaScript source code.
* `json-rpc`: An implementation of JSON-RPC for CommonJS, include a JSGI appliance
* `json-template`: Minimal but powerful templating language implemented in multiple languages.
* `jsont`: JSON transforms, akin to XSLT but for JSON: http://goessner.net/articles/jsont/
* `kupo`:
* `kupo`
* `markdown`: A port of markdown to JavaScript
* `mustache`: {{mustaches}} in JavaScript — shameless port from @defunkt
* `mysql-jdbc`
* `narcissus`: JavaScript implemented in JavaScript
* `narwhal-jaxer`:
* `narwhal`: A general purpose JavaScript platform
* `narwhal-jaxer`
* `narwhal-johnson`: Johnson (Ruby-JavaScript bridge, using SpiderMonkey) engine support for Narwhal
* `narwhal-jsc`: JavaScriptCore engine support for Narwhal
* `narwhal-moar-monkeys`
* `narwhal-v8`: V8 engine support for Narwhal
* `narwhal-xulrunner`:
* `narwhal`: A general purpose JavaScript platform
* `narwhal-v8cgi`: v8cgi engine support for Narwhal
* `narwhal-xulrunner`: XULRunner engine support for Narwhal
* `nitro`: A Web Application Framework
* `objj`: Objective-J and Cappuccino tools
* `normal-template`: A simple, powerful and safe templating engine
* `oauth`: OAuth Library
* `objective-j`: Objective-J and Cappuccino module
* `observable`: JavaScript framework for Observable mixins with plugin support
* `ojmoq`: A mocking library for Objective-J that is inspired by the Moq project.
* `ojunit`: A simple Objective-J unit test framework.
* `ometa-highlighter`: Code highlighter based on Ometa/JS (little inspired by Pygments)
* `ometajs`: A object-oriented language for pattern matching
* `parenscript`: Parenscript is a small Lispy language that compiles to JavaScript. This is the Narwhal module that integrates ParenScript with Narwhal.
* `prototype`: Prototype is a JavaScript Framework that aims to ease development of dynamic web applications. This package implements a subset of Prototype
* `qunit`: An easy-to-use JavaScript Unit Testing framework.
* `qxoo`
* `reform`: A Narwhal module for working with HTML forms, similar to Django's forms.
* `seethrough`: Seethrough is a simple XML/XHTML template engine for JavaScript based on E4X. It’s a port of a former project for Erlang.
* `shmakowiki`: Yet another wiki dialect, inspired by WackoWiki and WikiCreole
* `shrinksafe`: ShrinkSafe
* `silk`: A comprehensive set of 16x16px icons.
* `sizzle`: A sizzlin' hot selector engine
* `speller`: A JavaScript spell-checker
* `sqlite-jdbc`
* `syntax-stroop`: A syntax highlighter based on Google-code-prettify.
* `template`: A simple templating engine
* `underscore`: Functional programming aid for JavaScript. Works well with jQuery.
* `wiky`: A bidirectional Wiki markup to and from HTML converter written in JavaScript.
* `xbin`: A suite of Unix command line tools for enlightened pipelines.
* `yuicompressor`: YUI Compressor
* `zipjs`: An implementation of zip for JavaScript
13 changes: 6 additions & 7 deletions docs/download.md
Expand Up @@ -7,19 +7,18 @@ Download a version of Narwhal then follow the [quick start guide](http://narwhal
Bleeding Edge
-------------

* [Download zip](http://github.com/tlrobinson/narwhal/zipball/master)
* [Download tar](http://github.com/tlrobinson/narwhal/tarball/master)
* [Download zip](http://github.com/280north/narwhal/zipball/master)
* [Download tar](http://github.com/280north/narwhal/tarball/master)

* Git: `git clone git://github.com/tlrobinson/narwhal.git`
* Git: `git clone git://github.com/280north/narwhal.git`

* [View tree](http://github.com/tlrobinson/narwhal/tree/master)
* [View commit](http://github.com/tlrobinson/narwhal/commit/master)
* [View tree](http://github.com/280north/narwhal/tree/master)
* [View commit](http://github.com/280north/narwhal/commit/master)


Releases
--------

<div id="releases-list">Loading...</div>
<script type="text/javascript" charset="utf-8" src="js/releases.js"></script>
<script type="text/javascript" charset="utf-8" src="http://github.com/api/v2/json/repos/show/tlrobinson/narwhal/tags?callback=showreleases"></script>

<script type="text/javascript" charset="utf-8" src="http://github.com/api/v2/json/repos/show/280north/narwhal/tags?callback=showreleases"></script>
4 changes: 2 additions & 2 deletions docs/posts/2009-07-29-hello-0.1.md
Expand Up @@ -5,8 +5,8 @@ Today we're announcing [Narwhal](http://narwhaljs.org/) 0.1 and [Jack](http://ja

### Download

* Narwhal 0.1: [tar](http://github.com/tlrobinson/narwhal/tarball/0.1), [zip](http://github.com/tlrobinson/narwhal/zipball/0.1)
* Jack 0.1: [tar](http://github.com/tlrobinson/jack/tarball/0.1), [zip](http://github.com/tlrobinson/jack/zipball/0.1)
* Narwhal 0.1: [tar](http://github.com/280north/narwhal/tarball/v0.1), [zip](http://github.com/280north/narwhal/zipball/v0.1)
* Jack 0.1: [tar](http://github.com/280north/jack/tarball/v0.1), [zip](http://github.com/280north/jack/zipball/v0.1)

Check out the [quick start guide](http://narwhaljs.org/quick-start.html) for instructions on getting up and running with Narwhal and Jack.

Expand Down
79 changes: 79 additions & 0 deletions engines/rhino/lib/http.js
@@ -0,0 +1,79 @@

// -- tlrobinson Tom Robinson

var FILE = require("file");
var IO = require("io").IO;

exports.open = function(url, mode, options) {
mode = mode || "b";
options = options || {};

options.method = options.method || "GET";
options.headers = options.headers || {};

var connection = new java.net.URL(url).openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
connection.setRequestMethod(options.method);

for (var name in options.headers){
connection.addRequestProperty(String(name), String(options.headers[name]));
}

connection.connect();

var output = new IO(null, connection.getOutputStream());
var input = null;

var request = {
status : null,
headers : {},
read : function() {
if (!input) {
output.close();
input = new IO(connection.getInputStream(), null);
this.status = Number(connection.getResponseCode());
this.statusText = String(connection.getResponseMessage() || "");
for (var i = 0; ; i++) {
var key = connection.getHeaderFieldKey(i), value = connection.getHeaderField(i)
if (! key && ! value)
break;
if (key)
this.headers[String(key)] = String(value);
}
}
return input.read.apply(input, arguments);
},
write : function() {
output.write.apply(output, arguments);
return this;
},
flush : function() {
output.flush.apply(output, arguments);
return this;
},
close : function() {
if (output)
output.close();
if (input)
input.close();
return this;
},
copy : IO.prototype.copy
}
return request
};

exports.read = function(url) {
var stream = exports.open(url);
try {
return stream.read();
} finally {
stream.close();
}
};

exports.copy = function(source, target, mode) {
mode = mode || "b";
return FILE.path(target).write(exports.read(source, mode), mode);
};
41 changes: 26 additions & 15 deletions packages/narwhal-lib/lib/narwhal/util.js
Expand Up @@ -10,7 +10,7 @@
// that is, that return a function that can be tested
// against various objects if they're only "partially
// completed", or fewer arguments than needed are used.
//
//
// this enables the idioms:
// [1, 2, 3].every(lt(4)) eq true
// [1, 2, 3].map(add(1)) eq [2, 3, 4]
Expand Down Expand Up @@ -302,7 +302,7 @@ exports.isArguments = function (object) {
if (
!typeof object == "object" ||
!Object.prototype.hasOwnProperty.call(object, 'callee') ||
!object.callee ||
!object.callee ||
// It should be a Function object ([[Class]] === 'Function')
Object.prototype.toString.call(object.callee) !== '[object Function]' ||
typeof object.length != 'number'
Expand Down Expand Up @@ -462,7 +462,7 @@ exports.get = exports.operator('get', 2, function (object, key, value) {
throw new Error("KeyError: " + exports.repr(key));
}
return object[key];
}
}
throw new Error("Object does not have keys: " + exports.repr(object));
});

Expand Down Expand Up @@ -593,7 +593,7 @@ exports.all = exports.operator('all', 1, function (array) {
return true;
});

exports.any = exports.operator('all', 1, function (array) {
exports.any = exports.operator('any', 1, function (array) {
array = exports.array.coerce(array);
for (var i = 0; i < array.length; i++)
if (array[i])
Expand Down Expand Up @@ -673,7 +673,7 @@ exports.eq = exports.operator('eq', 2, function (a, b, stack) {
a.global === b.global &&
a.ignoreCase === b.ignoreCase &&
a.multiline === b.multiline;
if (typeof a === "function") {
if (typeof a === "function") {
var caller = stack[stack.length - 1];
// XXX what is this for? can it be axed?
// it comes from the "equiv" project code
Expand Down Expand Up @@ -709,15 +709,15 @@ exports.gt = exports.operator('gt', 2, function (a, b) {
return !(exports.lt(a, b) || exports.eq(a, b));
});

exports.le = exports.operator(2, 'le', function (a, b) {
exports.le = exports.operator('le', 2, function (a, b) {
return exports.lt(a, b) || exports.eq(a, b);
});

exports.ge = exports.operator(2, 'ge', function (a, b) {
exports.ge = exports.operator('ge', 2, function (a, b) {
return !exports.lt(a, b);
});

exports.mul = exports.operator(2, 'mul', function (a, b) {
exports.mul = exports.operator('mul', 2, function (a, b) {
if (typeof a == "string")
return exports.string.mul(a, b);
return a * b;
Expand Down Expand Up @@ -758,7 +758,7 @@ exports.by = function (relation) {
return comparator;
};

exports.compare = exports.operator(2, 'compare', function (a, b) {
exports.compare = exports.operator('compare', 2, function (a, b) {
if (exports.no(a) !== exports.no(b))
return exports.no(b) - exports.no(a);
if (typeof a === "number" && typeof b === "number")
Expand Down Expand Up @@ -813,11 +813,11 @@ exports.reversed = function (array) {
return exports.reverse(exports.array.copy(array));
};

exports.hash = exports.operator(1, 'hash', function (object) {
exports.hash = exports.operator('hash', 1, function (object) {
return '' + object;
});

exports.unique = exports.operator(1, 'unique', function (array, eq, hash) {
exports.unique = exports.operator('unique', 1, function (array, eq, hash) {
var visited = {};
if (!eq) eq = exports.eq;
if (!hash) hash = exports.hash;
Expand All @@ -834,7 +834,7 @@ exports.unique = exports.operator(1, 'unique', function (array, eq, hash) {

// string

exports.string = exports.operator(1, 'toString', function (object) {
exports.string = exports.operator('toString', 1, function (object) {
return '' + object;
});

Expand Down Expand Up @@ -874,7 +874,7 @@ exports.escape = function (value, strictJson) {
exports.repr(value)
);
return value.replace(
escapeExpression,
escapeExpression,
function (match) {
if (escapePatterns[match])
return escapePatterns[match];
Expand Down Expand Up @@ -902,6 +902,17 @@ exports.enquote = function (value, strictJson) {
return '"' + exports.escape(value, strictJson) + '"';
};

/**
* remove adjacent characters
* todo: i'm not sure if this works correctly without the second argument
*/
exports.squeeze = function (s) {
var set = arguments.length > 0 ? "["+Array.prototype.join.call(arguments.slice(1), '')+"]" : ".|\\n",
regex = new RegExp("("+set+")\\1+", "g");

return s.replace(regex, "$1");
};

/*** expand
transforms tabs to an equivalent number of spaces.
*/
Expand Down Expand Up @@ -941,12 +952,12 @@ exports.expand = function (str, tabLength) {

var trimBeginExpression = /^\s\s*/g;
exports.trimBegin = function (value) {
return String(value).replace(trimBeginExpression, "");
return String(value).replace(trimBeginExpression, "");
};

var trimEndExpression = /\s\s*$/g;
exports.trimEnd = function (value) {
return String(value).replace(trimEndExpression, "");
return String(value).replace(trimEndExpression, "");
};

exports.trim = function (value) {
Expand Down

0 comments on commit 23b9a4e

Please sign in to comment.