Comparing version 1.2.1 to 1.3.0
@@ -1,4 +0,12 @@ | ||
2015-01-13, Version 1.2.1 | ||
2015-01-23, Version 1.3.0 | ||
========================= | ||
* Preserve indentation, but trim trailing whitespace (Ryan Graham) | ||
* style: tabs to 2 spaces, clean up indentation only (Ryan Graham) | ||
2015-01-12, Version 1.2.1 | ||
========================= | ||
* Fix bad CLA URL in CONTRIBUTING.md (Ryan Graham) | ||
@@ -118,12 +126,15 @@ | ||
* proxy: Fix regression caused by http-proxy upgrade (Ryan Graham) | ||
2014-03-28, Version 0.2.1 | ||
2014-03-28, Version 0.2.0 | ||
========================= | ||
* proxy: Fix regression caused by http-proxy upgrade (Ryan Graham) | ||
2014-03-28, Version 0.2.0 | ||
2014-03-28, Version 0.2.1 | ||
========================= | ||
* proxy: Fix regression caused by http-proxy upgrade (Ryan Graham) | ||
* Release v0.2.0 (Ryan Graham) | ||
@@ -151,12 +162,15 @@ | ||
* Ignore npm packed tarballs (Ryan Graham) | ||
2014-03-27, Version 0.1.2 | ||
2014-03-27, Version 0.1.1 | ||
========================= | ||
* Ignore npm packed tarballs (Ryan Graham) | ||
2014-03-27, Version 0.1.1 | ||
2014-03-27, Version 0.1.2 | ||
========================= | ||
* Ignore npm packed tarballs (Ryan Graham) | ||
* env: Ignore quoted #'s (Ryan Graham) | ||
@@ -163,0 +177,0 @@ |
@@ -5,10 +5,10 @@ var util = require('util') | ||
function wrap(log,length,res){ | ||
if(!res) res=[] | ||
if(log.length <= length){ | ||
res.push(log) | ||
return res | ||
}else{ | ||
res.push(log.substr(0,length)) | ||
return wrap(log.substr(length),length,res) | ||
} | ||
if(!res) res=[] | ||
if(log.length <= length){ | ||
res.push(log) | ||
return res | ||
}else{ | ||
res.push(log.substr(0,length)) | ||
return wrap(log.substr(length),length,res) | ||
} | ||
} | ||
@@ -27,2 +27,3 @@ | ||
function trim(line, n) { | ||
line = line.replace(/\s+$/, ''); // aka, .trimRight() | ||
var stripped = stripANSI(line); | ||
@@ -37,83 +38,83 @@ if (stripped.length <= n) { | ||
function Console(logger) { | ||
logger = logger || console | ||
this.padding = 25 | ||
logger = logger || console | ||
this.padding = 25 | ||
this.trimline = 10 | ||
this.wrapline = 500 | ||
this.trimline = 10 | ||
this.wrapline = 500 | ||
this.fmt = function fmt(){ | ||
return util.format.apply(null,arguments); | ||
} | ||
this.fmt = function fmt(){ | ||
return util.format.apply(null,arguments); | ||
} | ||
this.pad = function pad(string,n){ | ||
var l = string.length; | ||
var d = n - l; | ||
var o = string; | ||
for(i=l;i<n;i++){ | ||
o += " " | ||
} | ||
return o | ||
} | ||
this.pad = function pad(string,n){ | ||
var l = string.length; | ||
var d = n - l; | ||
var o = string; | ||
for(i=l;i<n;i++){ | ||
o += " " | ||
} | ||
return o | ||
} | ||
this.trim = trim; | ||
// Process Specific Loggers // | ||
this.info = function info(key,proc,string){ | ||
var stamp = (new Date().toLocaleTimeString()) + " " + key; | ||
logger.log(proc.color(this.pad(stamp,this.padding)), | ||
colors.cyan(string)); | ||
} | ||
// Process Specific Loggers // | ||
this.info = function info(key,proc,string){ | ||
var stamp = (new Date().toLocaleTimeString()) + " " + key; | ||
logger.log(proc.color(this.pad(stamp,this.padding)), | ||
colors.cyan(string)); | ||
} | ||
this.Info = function info(key,proc,string){ | ||
var stamp = (new Date().toLocaleTimeString()) + " " + key; | ||
logger.log(proc.color(this.pad(stamp,this.padding)), | ||
colors.bright_cyan(string)); | ||
} | ||
this.Info = function info(key,proc,string){ | ||
var stamp = (new Date().toLocaleTimeString()) + " " + key; | ||
logger.log(proc.color(this.pad(stamp,this.padding)), | ||
colors.bright_cyan(string)); | ||
} | ||
this.log = function log(key,proc,string){ | ||
var self = this; | ||
string.split(/\n/).forEach(function(line){ | ||
this.log = function log(key,proc,string){ | ||
var self = this; | ||
string.split(/\n/).forEach(function(line){ | ||
if (line.trim().length==0) return; | ||
if (line.trim().length==0) return; | ||
var stamp = (new Date().toLocaleTimeString()) + " " + key; | ||
var stamp = (new Date().toLocaleTimeString()) + " " + key; | ||
if(self.trimline>0){ | ||
line = self.trim(line,self.trimline); | ||
} | ||
if(self.trimline>0){ | ||
line = self.trim(line,self.trimline); | ||
} | ||
var delimiter = " | " | ||
var delimiter = " | " | ||
var wrapline | ||
if(self.wrapline==0){ | ||
wrapline = line.length | ||
}else{ | ||
wrapline = self.wrapline | ||
} | ||
var wrapline | ||
if(self.wrapline==0){ | ||
wrapline = line.length | ||
}else{ | ||
wrapline = self.wrapline | ||
} | ||
wrap(line,wrapline).forEach(function(l){ | ||
logger.log(proc.color(self.pad(stamp,self.padding) + delimiter),l.trim()); | ||
delimiter = " | > " | ||
}) | ||
wrap(line,wrapline).forEach(function(l){ | ||
logger.log(proc.color(self.pad(stamp,self.padding) + delimiter),l); | ||
delimiter = " | > " | ||
}) | ||
}); | ||
} | ||
}); | ||
} | ||
// Foreman Loggers // | ||
// Foreman Loggers // | ||
this.Alert = function Alert(){ | ||
logger.log( colors.green('[OKAY] '+ this.fmt.apply(null,arguments)) ); | ||
} | ||
this.Alert = function Alert(){ | ||
logger.log( colors.green('[OKAY] '+ this.fmt.apply(null,arguments)) ); | ||
} | ||
this.Done = function Info(){ | ||
logger.log( colors.cyan('[DONE] ' + this.fmt.apply(null,arguments)) ); | ||
} | ||
this.Done = function Info(){ | ||
logger.log( colors.cyan('[DONE] ' + this.fmt.apply(null,arguments)) ); | ||
} | ||
this.Warn = function Warn(){ | ||
logger.warn( colors.yellow('[WARN] ' + this.fmt.apply(null,arguments)) ); | ||
} | ||
this.Warn = function Warn(){ | ||
logger.warn( colors.yellow('[WARN] ' + this.fmt.apply(null,arguments)) ); | ||
} | ||
this.Error = function Error(){ | ||
logger.error( colors.bright_red('[FAIL] ' + this.fmt.apply(null,arguments)) ); | ||
} | ||
this.Error = function Error(){ | ||
logger.error( colors.bright_red('[FAIL] ' + this.fmt.apply(null,arguments)) ); | ||
} | ||
@@ -120,0 +121,0 @@ } |
{ | ||
"name": "foreman", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"homepage": "http://strongloop.github.io/node-foreman/", | ||
@@ -5,0 +5,0 @@ "description": "Node Implementation of Foreman", |
@@ -21,1 +21,9 @@ // Needed before requiring colors, otherwise its colorizers are no-ops. | ||
'trim() should leave colors intact if no trimming is performed') | ||
var indented = ' indented'; | ||
assert.equal(Console.trim(indented, 100), indented, | ||
'trim() should always preserve leading whitespace') | ||
var padded = ' padded '; | ||
var trimmed = ' padded'; | ||
assert.equal(Console.trim(padded, 100), trimmed, | ||
'trim() should always trim trailing whitespace') |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
352391
1129
8