Comparing version 0.0.4 to 0.0.5
29
index.js
@@ -8,2 +8,3 @@ var inherits = require('util').inherits | ||
, glob = require('glob') | ||
, debug = require('debug')('apacheconf') | ||
@@ -87,2 +88,7 @@ function removeQuotes(str) { | ||
if (this.multiline) { | ||
line = this.multiline + ' ' + line | ||
this.multiline = null | ||
} | ||
line = line.trim() | ||
@@ -92,2 +98,8 @@ | ||
if (line[line.length - 1] === '\\' && line[line.length - 2] !== '\\') { | ||
this.multiline = line.slice(0, line.length - 1) | ||
return true | ||
} | ||
switch(line[0]) { | ||
@@ -101,2 +113,3 @@ case '<': | ||
debug('[block] /%s', this.name) | ||
this.emit('end') | ||
@@ -129,8 +142,11 @@ return true | ||
child.name = line.split(' ', 1)[0] | ||
child.name = line.split(/[ \t]/, 1)[0] | ||
child.config.$args = removeQuotes(line.slice(child.name.length + 1)) | ||
debug('[block] %s', child.name) | ||
break | ||
case '#': | ||
debug('[comment] %s', line) | ||
this._comments.push(line) | ||
@@ -141,3 +157,3 @@ this.emit('comment', line) | ||
default: | ||
var name = line.split(' ', 1)[0] | ||
var name = line.split(/[ \t]/, 1)[0] | ||
, value = line.slice(name.length + 1).trim() | ||
@@ -148,6 +164,8 @@ | ||
var self = this | ||
, filepath = path.resolve(this._getProp('serverRoot'), value) | ||
this.pause() | ||
glob(path.resolve(this._getProp('serverRoot'), value), function(err, files) { | ||
debug('[glob] %s', filepath) | ||
glob(filepath, function(err, files) { | ||
@@ -186,2 +204,3 @@ var current | ||
debug('[add] %s: %s', name, value) | ||
this.add(name, value) | ||
@@ -192,2 +211,3 @@ | ||
default: | ||
debug('[add] %s: %s', name, value) | ||
this.add(name, value) | ||
@@ -232,2 +252,3 @@ break | ||
Parser.prototype.pause = function() { | ||
debug('[stream] pause') | ||
return this._getProp('_stream').pause() | ||
@@ -237,2 +258,3 @@ } | ||
Parser.prototype.resume = function() { | ||
debug('[stream] resume') | ||
return this._getProp('_stream').resume() | ||
@@ -242,2 +264,3 @@ } | ||
Parser.prototype._include = function(filename, cb) { | ||
debug('[include] %s', filename) | ||
this._getProp('files').push(filename) | ||
@@ -244,0 +267,0 @@ |
{ | ||
"name": "apacheconf", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Apacheconf is an apache config file parser", | ||
@@ -17,3 +17,4 @@ "main": "index.js", | ||
"event-stream": "~3.0.2", | ||
"glob": "~3.2.1" | ||
"glob": "~3.2.1", | ||
"debug": "~0.7.2" | ||
}, | ||
@@ -20,0 +21,0 @@ "devDependencies": {}, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7564
5
221
3
+ Addeddebug@~0.7.2
+ Addeddebug@0.7.4(transitive)