Merge branch 'class'
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by visionmedia · committed by visionmedia · parents 2208826, c3b8ba4 · Browse files · 14 files·+30 added−42 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
14 files+30 added−42 removed
- tests:+3 added−3 removed
- other:+27 added−39 removed
Provenance
- Commit
2aa858b- Tree
dedca84- Author
visionmedia <tj@vision-media.ca>- Committer
visionmedia <tj@vision-media.ca>- Parent 1
2208826- Parent 2
c3b8ba4
14 files changed+30 added−42 removed
modified:lib/express/plugins/cache.js+6 added-6 removed
1 unmodified line2 // Express - Cache - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)3 4 // --- Cache5 6-var Cache = Class({6+var Cache = new Class({7 8 /**9 * Initialize cache with _key_ and _val_.10 */11 12- init: function(key, val) {12+ constructor: function(key, val) {13 this.key = key14 this.val = val15 this.created = Number(new Date)16 }17 })18 19 // --- Store20 21-exports.Store = Class({21+exports.Store = new Class({22 23 /**24 * Ensure that the given _key_ is a string.25 * Override in subclass to provide data-store specific functionality.46 unmodified lines72 /**73 * Initialize data.74 */75 76- init: function() {76+ constructor: function() {77 this.data = {}78 },79 80 /**5 unmodified lines86 * @api public87 */88 89 set: function(key, val) {90- this.__super__(key, val)90+ exports.Store.prototype.set.apply(this, arguments)91 return this.data[key] = new Cache(key, val), val92 },93 94 /**14 unmodified lines109 * @api public110 */111 112 get: function(key) {113- this.__super__(key)113+ exports.Store.prototype.get.apply(this, arguments)114 if (key.indexOf('*') === -1)115 return this.data[key] instanceof Cache ?116 this.data[key].val :117 null103 unmodified linesmodified:lib/express/plugins/session.js+4 added-4 removed
7 unmodified lines8 var utils = require('express/utils')9 10 // --- Session11 12-var Session = Class({12+var Session = new Class({13 14 /**15 * Initialize session _sid_.16 */17 18- init: function(sid) {18+ constructor: function(sid) {19 this.id = sid20 this.touch()21 },22 9 unmodified lines32 })33 34 // --- Store35 36-exports.Store = Class({36+exports.Store = new Class({37 38 /**39 * Convert to '[NAME Store]'.40 *19 unmodified lines60 /**61 * Initialize in-memory session store.62 */63 64- init: function() {64+ constructor: function() {65 this.store = {}66 },67 68 /**133 unmodified linesmodified:lib/express/spec/mocks.js+3 added-3 removed
7 unmodified lines8910111212131415168 unmodified lines2526272829293031323310 unmodified lines4445464748484950515283 unmodified lines7 unmodified linesvar utils = require('express/utils')
// --- MockRequest
var MockRequest = Class({var MockRequest = new Class({ /** * Default HTTP version. */8 unmodified lines * @param {hash} options * @api private */ init: function(method, path, options) { constructor: function(method, path, options) { this.method = method this.url = path this.connection = { remoteAddress: '127.0.0.1'10 unmodified lines})
// --- MockResponse
var MockResponse = Class({var MockResponse = new Class({ /** * Store _code_ and _headers_. */83 unmodified linesmodified:lib/express/core.js+5 added-5 removed
16 unmodified lines17 global.merge(require('express/dsl'))18 19 // --- Route20 21-Route = Class({21+Route = new Class({22 23 /**24 * Initialize a route with the given _method_,25 * _path_, and callback _fn_.8 unmodified lines34 * @param {hash} options35 * @api private36 */37 38- init: function(method, path, fn, options){38+ constructor: function(method, path, fn, options){39 this.method = method40 this.originalPath = path41 this.path = this.normalize(path)42 this.fn = fn40 unmodified lines83 })84 85 // --- Router86 87-Router = Class({87+Router = new Class({88 89 /**90 * Initialize with _request_ and parse url.91 *92 * @param {Request} request93 * @api private94 */95 96- init: function(request) {96+ constructor: function(request) {97 this.request = request98 },99 100 /**71 unmodified lines172 })173 174 // --- Server175 176-Server = Class({176+Server = new Class({177 178 /**179 * Default port number.180 */166 unmodified linesmodified:lib/express/event.js+2 added-2 removed
12344567891011121314141516171811 unmodified lines
// Express - Event - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)
exports.Event = Class({exports.Event = new Class({ /** * Initialize with event _name_ and optional _data_. * * @param {string} name * @param {hash} data * @api private */ init: function(name, data) { constructor: function(name, data) { this.name = name this.merge(data || {}) }, 11 unmodified linesmodified:lib/express/http.js-1 removed
41 unmodified lines42 else43 headers['content-length'] = data.length,44 headers['content-type'] = 'application/x-www-form-urlencoded'45 }46- 46 var req = client.request(method, path + search + hash, headers)47 if (data && method !== 'GET') req.write(data)48 req.addListener('response', function(res){49 if (req.statusCode < 200 || req.statusCode >= 400)44 unmodified linesmodified:lib/express/plugin.js+2 added-2 removed
30 unmodified lines31 }32 33 // --- Plugin34 35-exports.Plugin = Class({35+exports.Plugin = new Class({36 37 /**38 * Initialize with _options_.39 *40 * @param {hash} options41 * @api private42 */43 44- init: function(options) {44+ constructor: function(options) {45 if (options)46 utils.mixin(this, options)47 },48 13 unmodified linesmodified:lib/express/request.js+2 added-2 removed
27 unmodified lines28 }29 30 // --- Request31 32-exports.Request = Class({32+exports.Request = new Class({33 34 /**35 * Initialize with node's _request_ and _response_ objects.36 *7 unmodified lines44 * @param {object} response45 * @api private46 */47 48- init: function(request, response) {48+ constructor: function(request, response) {49 utils.mixin(true, this, request)50 response.headers = {}51 this.response = response52 this.url = url.parse(this.url)235 unmodified linesmodified:lib/express/static.js+2 added-2 removed
8 unmodified lines9 fs = require('fs')10 11 // --- File12 13-exports.File = Class({13+exports.File = new Class({14 15 /**16 * Initialize with file _path_.17 *18 * @param {string} path19 * @api public20 */21 22- init: function(path) {22+ constructor: function(path) {23 this.path = path24 if (path.indexOf('..') != -1)25 Error.raise('InvalidPathError', "`" + path + "' is not a valid path")26 },35 unmodified linesmodified:lib/express/utils.js-14 removed
73 unmodified lines74 }, queryString.parseQuery(key))75 return orig76 }77 78-/**79- * Return a clone of _obj_.80- *81- * @param {mixed} obj82- * @return {mixed}83- * @api public84- */85-86-function Clone() {}87-exports.clone = function(obj) {88- Clone.prototype = obj89- return new Clone90-}91-78 // From jQuery.extend in the jQuery JavaScript Library v1.3.279 // Copyright (c) 2009 John Resig80 // Dual licensed under the MIT and GPL licenses.81 // http://docs.jquery.com/License56 unmodified linesadded:lib/support/classnot shown
Its text is not shown, added.
deleted:lib/support/oonot shown
Its text is not shown, deleted.
modified:lib/express.js+1 added-1 removed
1 unmodified line2 require.paths.unshift(__dirname + '/support/ext/lib')3 require.paths.unshift(__dirname + '/support/haml/lib')4 require.paths.unshift(__dirname + '/support/sass/lib')5 require('ext')6-require('support/oo/lib/oo')6+Class = require('support/class/lib/class').Class7 require('express/core')modified:.gitmodules+3 added
8 unmodified lines9 url = git://github.com/visionmedia/sass.js.git10 [submodule "lib/support/haml"]11 path = lib/support/haml12 url = git://github.com/creationix/haml-js.git13+[submodule "lib/support/class"]14+ path = lib/support/class15+ url = git://github.com/visionmedia/class.js.git