shell
Advanced tools
Comparing version 0.5.0 to 0.5.1
# List of API changes and enhancements | ||
## Version 0.5.1 | ||
* fix: use Buffer.from | ||
* fix: validate parent dir before start | ||
## Version 0.5.0 | ||
@@ -5,0 +10,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.3 | ||
// Generated by CoffeeScript 2.7.0 | ||
var NullStream, events; | ||
@@ -37,2 +37,2 @@ | ||
})(); | ||
}).call(this); |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.3 | ||
// Generated by CoffeeScript 2.7.0 | ||
var start_stop; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.3 | ||
// Generated by CoffeeScript 2.7.0 | ||
var enrichFiles, fs, start_stop; | ||
@@ -46,12 +46,12 @@ | ||
app.configure(function() { | ||
app.use(shell.router({ | ||
shell: app | ||
})); | ||
app.use(shell.coffee({ | ||
shell: app | ||
})); | ||
app.use(shell.help({ | ||
shell: app, | ||
introduction: true | ||
})); | ||
app.use(shell.router({ | ||
shell: app | ||
})); | ||
app.use(shell.coffee({ | ||
shell: app | ||
})); | ||
app.use(shell.help({ | ||
shell: app, | ||
introduction: true | ||
})); | ||
}); | ||
@@ -58,0 +58,0 @@ ``` |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.3 | ||
// Generated by CoffeeScript 2.7.0 | ||
/* | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.3 | ||
// Generated by CoffeeScript 2.7.0 | ||
module.exports = function(settings) { | ||
@@ -3,0 +3,0 @@ var shell; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.3 | ||
// Generated by CoffeeScript 2.7.0 | ||
var pad; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.3 | ||
// Generated by CoffeeScript 2.7.0 | ||
var Interface, crypto, fs, hash; | ||
@@ -67,4 +67,4 @@ | ||
if (this.history.length) { | ||
buffer = new Buffer(JSON.stringify(this.history)); | ||
fs.write(stream.fd, buffer, 0, buffer.length, 0); | ||
buffer = Buffer.from(JSON.stringify(this.history), 'utf8'); | ||
fs.writeSync(stream.fd, buffer, 0, buffer.length, 0); | ||
} | ||
@@ -71,0 +71,0 @@ return parent.apply(this, arguments); |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.3 | ||
// Generated by CoffeeScript 2.7.0 | ||
var existsSync, fs, path, start_stop; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.3 | ||
// Generated by CoffeeScript 2.7.0 | ||
var start_stop; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.3 | ||
// Generated by CoffeeScript 2.7.0 | ||
var match, normalize, querystring, utils, | ||
@@ -3,0 +3,0 @@ indexOf = [].indexOf; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.3 | ||
// Generated by CoffeeScript 2.7.0 | ||
var enrichFiles, path, start_stop; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.3 | ||
// Generated by CoffeeScript 2.7.0 | ||
var exec, existsSync, fs, path; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.3 | ||
// Generated by CoffeeScript 2.7.0 | ||
var Request, each; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.3 | ||
// Generated by CoffeeScript 2.7.0 | ||
var Response, pad, styles; | ||
@@ -25,2 +25,2 @@ | ||
})(); | ||
}).call(this); |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.3 | ||
// Generated by CoffeeScript 2.7.0 | ||
/* | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.3 | ||
// Generated by CoffeeScript 2.7.0 | ||
/* | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.3 | ||
// Generated by CoffeeScript 2.7.0 | ||
/* | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.3 | ||
// Generated by CoffeeScript 2.7.0 | ||
/* | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.3 | ||
// Generated by CoffeeScript 2.7.0 | ||
var EventEmitter, Interface, Request, Response, Shell, events, readline, styles, util, utils; | ||
@@ -108,3 +108,3 @@ | ||
// Return the readline interface and create it if not yet initialized | ||
// Return the readline interface and create it if not yet initialized | ||
interface() { | ||
@@ -118,3 +118,3 @@ if (this._interface != null) { | ||
// Configure callback for the given `env` | ||
// Configure callback for the given `env` | ||
configure(env, fn) { | ||
@@ -132,3 +132,3 @@ if (typeof env === 'function') { | ||
// Configure callback for the given `env` | ||
// Configure callback for the given `env` | ||
use(handle) { | ||
@@ -146,3 +146,3 @@ // Add the route, handle pair to the stack | ||
// Run a command | ||
// Run a command | ||
run(command) { | ||
@@ -208,3 +208,3 @@ var index, next, req, res, self; | ||
// Display prompt | ||
// Display prompt | ||
prompt() { | ||
@@ -233,3 +233,3 @@ var text; | ||
// Command quit | ||
// Command quit | ||
quit(params) { | ||
@@ -249,5 +249,5 @@ this.emit('quit'); | ||
})(); | ||
}).call(this); | ||
//@set 'stdin', null | ||
module.exports.Shell = Shell; |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.3 | ||
// Generated by CoffeeScript 2.7.0 | ||
var crypto, exec, exists, fs, md5, path, spawn, start_stop; | ||
@@ -117,18 +117,20 @@ | ||
start = function() { | ||
var cmd, info, pipe; | ||
pipe = `</dev/null >${cmdStdout} 2>${cmdStdout}`; | ||
info = 'echo $? $!'; | ||
cmd = `${options.cmd} ${pipe} & ${info}`; | ||
return child = exec(cmd, options, function(err, stdout, stderr) { | ||
var code, msg, pid; | ||
[code, pid] = stdout.split(' '); | ||
code = parseInt(code, 10); | ||
pid = parseInt(pid, 10); | ||
if (code !== 0) { | ||
msg = `Process exit with code ${code}`; | ||
return callback(new Error(msg)); | ||
var piddir; | ||
piddir = path.dirname(options.pidfile); | ||
return exists(piddir, function(exists) { | ||
var cmd, info, pipe; | ||
if (!exists) { | ||
return callback(new Error(`Pid directory does not exist: ${piddir}.`)); | ||
} | ||
return exists(path.dirname(options.pidfile), function(exists) { | ||
if (!exists) { | ||
return callback(new Error("Pid directory does not exist")); | ||
pipe = `</dev/null >${cmdStdout} 2>${cmdStdout}`; | ||
info = 'echo $? $!'; | ||
cmd = `${options.cmd} ${pipe} & ${info}`; | ||
return child = exec(cmd, options, function(err, stdout, stderr) { | ||
var code, msg, pid; | ||
[code, pid] = stdout.split(' '); | ||
code = parseInt(code, 10); | ||
pid = parseInt(pid, 10); | ||
if (code !== 0) { | ||
msg = `Process exit with code ${code}`; | ||
return callback(new Error(msg)); | ||
} | ||
@@ -179,3 +181,3 @@ return fs.writeFile(options.pidfile, '' + pid, function(err) { | ||
* `strict` , Send an error when a pid file exists and reference | ||
an unrunning pid. | ||
an unrunning pid. | ||
@@ -205,3 +207,7 @@ `callback` , Received arguments are: | ||
// http://unix.derkeiler.com/Newsgroups/comp.unix.shell/2004-05/1108.html | ||
cmds = `for i in \`ps -ef | awk '$3 == '${pid}' { print $2 }'\`\ndo\n kill $i\ndone\nkill ${pid}`; | ||
cmds = `for i in \`ps -ef | awk '$3 == '${pid}' { print $2 }'\` | ||
do | ||
kill $i | ||
done | ||
kill ${pid}`; | ||
return exec(cmds, function(err, stdout, stderr) { | ||
@@ -259,3 +265,3 @@ if (err) { | ||
* `pid` , Process pid. Pid is null if there are no pid file or | ||
if the process isn't running. | ||
if the process isn't running. | ||
@@ -262,0 +268,0 @@ */ |
@@ -1,3 +0,3 @@ | ||
// Generated by CoffeeScript 2.0.3 | ||
var Styles, bgcolors, code, color, colors, fn; | ||
// Generated by CoffeeScript 2.7.0 | ||
var Styles, bgcolors, code, color, colors; | ||
@@ -55,10 +55,9 @@ colors = { | ||
fn = function(color) { | ||
return Styles.prototype[color] = function(text) { | ||
return this.color(color, text); | ||
}; | ||
}; | ||
for (color in colors) { | ||
code = colors[color]; | ||
fn(color); | ||
(function(color) { | ||
return Styles.prototype[color] = function(text) { | ||
return this.color(color, text); | ||
}; | ||
})(color); | ||
} | ||
@@ -65,0 +64,0 @@ |
@@ -1,2 +0,2 @@ | ||
// Generated by CoffeeScript 2.0.3 | ||
// Generated by CoffeeScript 2.7.0 | ||
var existsSync, fs, path; | ||
@@ -16,3 +16,3 @@ | ||
} | ||
for (i = j = 0, ref = arr.length; 0 <= ref ? j < ref : j > ref; i = 0 <= ref ? ++j : --j) { | ||
for (i = j = 0, ref = arr.length; (0 <= ref ? j < ref : j > ref); i = 0 <= ref ? ++j : --j) { | ||
if (Array.isArray(arr[i])) { | ||
@@ -19,0 +19,0 @@ this.flatten(arr[i], ret); |
{ | ||
"name": "shell", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "Full features and pretty console applications", | ||
@@ -27,3 +27,3 @@ "homepage": "https://github.com/adaltas/node-shell", | ||
"each": "latest", | ||
"express": "^4.16.2", | ||
"express": "^4.18.2", | ||
"optimist": "latest", | ||
@@ -36,3 +36,3 @@ "pad": "latest" | ||
"devDependencies": { | ||
"coffeescript": "^2.0.3", | ||
"coffeescript": "^2.7.0", | ||
"mocha": "latest", | ||
@@ -49,2 +49,13 @@ "should": "latest" | ||
], | ||
"mocha": { | ||
"throw-deprecation": true, | ||
"require": [ | ||
"should", | ||
"coffeescript/register" | ||
], | ||
"inline-diffs": true, | ||
"timeout": 40000, | ||
"reporter": "spec", | ||
"recursive": true | ||
}, | ||
"repository": { | ||
@@ -51,0 +62,0 @@ "type": "git", |
#!/usr/bin/env node | ||
// Using reserved port `1783` to limit the risks of collision | ||
// See https://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers | ||
var http = require('http'); | ||
@@ -7,3 +10,3 @@ http.createServer(function (req, res) { | ||
res.end('Hello World\n'); | ||
}).listen(1337, "127.0.0.1"); | ||
console.log('Server running at http://127.0.0.1:1337/'); | ||
}).listen(1783, "127.0.0.1"); | ||
console.log('Server running at http://127.0.0.1:1783/'); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
321956
2262
Updatedexpress@^4.18.2