[Pkg-javascript-commits] [node-static] 75/151: Changes the code style
Tonnerre Lombard
tonnerre-guest at moszumanska.debian.org
Tue Jan 7 23:17:59 UTC 2014
This is an automated email from the git hooks/post-receive script.
tonnerre-guest pushed a commit to branch master
in repository node-static.
commit 660d61a526361b7be7e76fa9b13c18b396c572cf
Author: Pablo Cantero <pablo at pablocantero.com>
Date: Sun Aug 26 20:02:40 2012 -0300
Changes the code style
---
bin/cli.js | 52 +++++++++++++++++++++++++++++-----------------------
package.json | 2 +-
2 files changed, 30 insertions(+), 24 deletions(-)
diff --git a/bin/cli.js b/bin/cli.js
index 8025b94..659155d 100755
--- a/bin/cli.js
+++ b/bin/cli.js
@@ -3,10 +3,9 @@
var fs = require('fs'),
path = require('path'),
tty = require('tty'),
+ statik = require('./../lib/node-static');
- statik = require('./../lib/node-static'),
-
- argv = require('optimist')
+ var argv = require('optimist')
.usage([
'USAGE: $0 [-p <port>] [<directory>]',
'simple, rfc 2616 compliant file streaming module for node']
@@ -36,47 +35,54 @@ var fs = require('fs'),
alias: 'h',
description: 'display this help message'
})
- .argv,
- dir = argv._[0] || '.',
+ .argv;
+
+ var dir = argv._[0] || '.';
- trainwreck = fs.readFileSync(path.join(__dirname, '../etc/trainwreck.jpg')),
- notFound = fs.readFileSync(path.join(__dirname, '../etc/404.html'))
+ var trainwreck = fs.readFileSync(path.join(__dirname, '../etc/trainwreck.jpg')),
+ notFound = fs.readFileSync(path.join(__dirname, '../etc/404.html'))
.toString()
- .replace('{{trainwreck}}', trainwreck.toString('base64')),
+ .replace('{{trainwreck}}', trainwreck.toString('base64'));
+
+ var colors = require('colors');
- colors = require('colors'),
- log = function(request, response, statusCode) {
- var d = new(Date),
- seconds = d.getSeconds() < 10? '0'+d.getSeconds() : d.getSeconds(),
+ var log = function(request, response, statusCode) {
+ var d = new Date();
+ var seconds = d.getSeconds() < 10? '0'+d.getSeconds() : d.getSeconds(),
datestr = d.getHours() + ':' + d.getMinutes() + ':' + seconds,
line = datestr + ' [' + response.statusCode + ']: ' + request.url,
colorized = line;
if (tty.isatty(process.stdout.fd))
- colorized = response.statusCode >= 500? line.red.bold :
- response.statusCode >= 400? line.red :
+ colorized = (response.statusCode >= 500) ? line.red.bold :
+ (response.statusCode >= 400) ? line.red :
line;
console.log(colorized);
- },
+ };
- file, options;
+ var file, options;
-if (argv.help)
- require('optimist').showHelp(console.log),
+if (argv.help){
+ require('optimist').showHelp(console.log);
process.exit(0);
+}
-if (argv.version)
- console.log('node-static', statik.version.join('.')),
+if (argv.version){
+ console.log('node-static', statik.version.join('.'));
process.exit(0);
+}
-if (argv.cache)
+if (argv.cache){
(options = options || {}).cache = argv.cache;
+}
-if (argv.headers)
+if (argv.headers){
(options = options || {}).headers = JSON.parse(argv.headers);
+}
-if (argv['header-file'])
+if (argv['header-file']){
(options = options || {}).headers =
JSON.parse(fs.readFileSync(argv['header-file']));
+}
file = new(statik.Server)(dir, options);
diff --git a/package.json b/package.json
index 4789780..062e183 100644
--- a/package.json
+++ b/package.json
@@ -30,7 +30,7 @@
"request": "latest",
"vows": "latest"
},
- "version" : "0.6.0",
+ "version" : "0.6.1",
"engines" : { "node": ">= 0.4.1" }
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-static.git
More information about the Pkg-javascript-commits
mailing list