Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Carlos Rodriguez
committed
Aug 29, 2012
1 parent
c215181
commit 7a6bcbc
Showing
26 changed files
with
134 additions
and
275 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
var execFile = require('child_process').execFile | ||
, utils = require('./lib/utils') | ||
, buffet | ||
|
||
exports.name = 'buffet-server'; | ||
exports.version = utils.version(exports.name); | ||
|
||
exports.listen = function (options, cb) { | ||
var port = randomPort() | ||
, buffetRoot = utils.resolve(__dirname, '..') | ||
|
||
console.log(options); | ||
buffet = execFile(buffetRoot + '/bin/buffet.js', ['-p', port, '--no-log', '--no-watch'], {cwd: options.root}); | ||
buffet.stderr.on('data', function (chunk) { | ||
if (chunk.toString().match(/listening/)) { | ||
cb(null, port); | ||
} | ||
}); | ||
}; | ||
|
||
exports.close = function () { | ||
buffet.kill(); | ||
}; | ||
|
||
function randomPort () { | ||
return Math.round((Math.random() * 2e4) + 2e4); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
var utils = require('./lib/utils') | ||
|
||
exports.name = 'buffet'; | ||
exports.version = utils.version(exports.name); | ||
|
||
exports.middleware = function (options) { | ||
return require('../')(options.root); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
var utils = require('./lib/utils') | ||
|
||
exports.name = 'ecstatic'; | ||
exports.version = utils.version(exports.name); | ||
|
||
exports.middleware = function (options) { | ||
return require('ecstatic')(options.root); | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
exports.resolve = require('path').resolve | ||
|
||
exports.version = function (name) { | ||
if (name.match(/^buffet/)) { | ||
return require(exports.resolve(__dirname, '../../package')).version; | ||
} | ||
|
||
return require(exports.resolve(__dirname, '../package')).dependencies[name]; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
var utils = require('./lib/utils') | ||
|
||
exports.name = 'node-static'; | ||
exports.version = utils.version(exports.name); | ||
|
||
exports.middleware = function (options) { | ||
var nodeStatic = require('node-static') | ||
, fileServer = new(nodeStatic.Server)(options.root) | ||
|
||
return fileServer.serve.bind(fileServer); | ||
}; |
Oops, something went wrong.