Skip to content
Myr

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

14 files+30 added−42 removed

modified:lib/express/plugins/cache.js+6 added-6 removed
1 unmodified line
2// Express - Cache - Copyright TJ Holowaychuk <tj@vision-media.ca> (MIT Licensed)34// --- Cache56var Cache = Class({6var 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})1819// --- Store2021exports.Store = Class({21exports.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 lines
72 /**73 * Initialize data.74 */75 76 init: function() {76 constructor: function() {77 this.data = {}78 },79 80 /**
5 unmodified lines
86 * @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 lines
109 * @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 null
103 unmodified lines
modified:lib/express/plugins/session.js+4 added-4 removed
7 unmodified lines
8var utils = require('express/utils')910// --- Session1112var Session = Class({12var 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 lines
32})3334// --- Store3536exports.Store = Class({36exports.Store = new Class({37 38 /**39 * Convert to '[NAME Store]'.40 *
19 unmodified lines
60 /**61 * Initialize in-memory session store.62 */63 64 init: function() {64 constructor: function() {65 this.store = {}66 },67 68 /**
133 unmodified lines
modified:lib/express/spec/mocks.js+3 added-3 removed
modified:lib/express/core.js+5 added-5 removed
16 unmodified lines
17global.merge(require('express/dsl'))1819// --- Route2021Route = Class({21Route = new Class({22 23 /**24 * Initialize a route with the given _method_,25 * _path_, and callback _fn_.
8 unmodified lines
34 * @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 = fn
40 unmodified lines
83})8485// --- Router8687Router = Class({87Router = 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 lines
172})173174// --- Server175176Server = Class({176Server = new Class({177 178 /**179 * Default port number.180 */
166 unmodified lines
modified:lib/express/event.js+2 added-2 removed
modified:lib/express/http.js-1 removed
41 unmodified lines
42 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 lines
modified:lib/express/plugin.js+2 added-2 removed
30 unmodified lines
31}3233// --- Plugin3435exports.Plugin = Class({35exports.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 lines
modified:lib/express/request.js+2 added-2 removed
27 unmodified lines
28}2930// --- Request3132exports.Request = Class({32exports.Request = new Class({33 34 /**35 * Initialize with node's _request_ and _response_ objects.36 *
7 unmodified lines
44 * @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 lines
modified:lib/express/static.js+2 added-2 removed
8 unmodified lines
9 fs = require('fs')10 11// --- File1213exports.File = Class({13exports.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 lines
modified:lib/express/utils.js-14 removed
73 unmodified lines
74 }, queryString.parseQuery(key))75 return orig76}7778/**79 * Return a clone of _obj_.80 *81 * @param {mixed} obj82 * @return {mixed}83 * @api public84 */8586function Clone() {}87exports.clone = function(obj) {88 Clone.prototype = obj89 return new Clone90}9178// 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/License
56 unmodified lines
added: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 line
2require.paths.unshift(__dirname + '/support/ext/lib')3require.paths.unshift(__dirname + '/support/haml/lib')4require.paths.unshift(__dirname + '/support/sass/lib')5require('ext')6require('support/oo/lib/oo')6Class = require('support/class/lib/class').Class7require('express/core')
modified:.gitmodules+3 added
8 unmodified lines
9 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