Permalink
Browse files

Sorry I've been gone so long guys

  • Loading branch information...
1 parent 42cd618 commit 867899adc374d5b4750f7c975b0f61802e83a3ef @partheseas committed Oct 7, 2012
View
@@ -1,16 +0,0 @@
-#!/usr/bin/env node
-
-var data, path, trailer;
-
-path = require( "path" )
-trailer = require( "trailer" )
-
-data = {
- // configuration: parseTrailerConfiguration( where ever )
-}
-
-data.configuration ? trailer.hitch( data.configuration ) : console.error( "No configuration file. :c" )
-
-
-
-

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,5 +1,5 @@
{
- "author": "Tyler Washburn (http://tylermwashburn.net/)",
+ "author": "Tyler Washburn (http://tyler.lt/)",
"name": "trailer",
"description": "An HTTP server written for Node.",
"version": "0.7.3",
@@ -9,15 +9,11 @@
"type": "git",
"url": "git://github.com/tylermwashburn/trailer.git"
},
- "main": "Library/trailer.js",
- "bin": {
- "trailer": "Library/cli.js"
- },
+ "main": "trailer.js",
"engines": {
- "node": "0.6 || 0.8"
+ "node": ">=0.8"
},
"dependencies": {
"markdown": "0.3.1"
- },
- "devDependencies": {}
+ }
}
@@ -2,11 +2,12 @@
"use strict"
-var basics, configurations, data, events, fs, http, markdown, path, qs, server, trailer, url, rid, zlib;
-
Function.prototype.is = function ( item ) { return item != null && ( item.constructor === this.prototype.constructor ) }
+var basics, configurations, data, server, trailer, rid,
+
events = require( "events" ),
+errors = require( "errors" ),
fs = require( "fs" ),
http = require( "http" ),
path = require( "path" ),
@@ -15,14 +16,9 @@ url = require( "url" ),
markdown = require( "markdown" ),
zlib = require( "zlib" );
-// fs.exists compatibility
-if ( !fs.exists ) {
- fs.exists = path.exists
-}
-
// This isn't one of our event emitters,
// because then it would emit to itself in an infinite loop.
-global.trailer = trailer = module.exports = new events.EventEmitter()
+global.trailer = trailer = module.exports = new errors.Sandbox( "trailer" )
trailer.version = "0.7.3-"
// We put the http module here so that it can be extended.
@@ -109,16 +105,12 @@ trailer.MimeDictionary.prototype.fromApacheFile = function ( path, encoding ) {
} )
}
-trailer.hitch = function ( root, conf ) {
+trailer.hitch = function ( conf ) {
var prop, indexes;
- !conf&&( conf = {} )
-
- if ( String.is( root ) ) {
- conf.root = root
- } else {
- conf = root
- root = conf.root
+ if ( !conf ) {
+ trailer.warning( "hitch", "No configuration given!" )
+ return false
}
// After the given arguments have been assorted, emit that Trailer has received a configuration.
@@ -472,16 +464,16 @@ trailer.GET.preprocessors.push(
try {
return i.conf.api[ i.up ]( i, o, i.extra )
} catch ( error ) {
- console.log( "API " + i.up + " failed for " + i.url )
o.error( 500 )
+ trailer.error( i.up, i.up + " failed for " + i.url.pathname )
return true
}
} else if ( i.conf.api[ i.extra ] ) {
try {
return i.conf.api[ i.extra ]( i, o, i.up )
} catch ( error ) {
- console.log( "API " + i.extra + " failed for " + i.url )
o.error( 500 )
+ trailer.error( i.extra, i.extra + " failed for " + i.url.pathname )
return true
}
}

0 comments on commit 867899a

Please sign in to comment.