Skip to content
Snippets Groups Projects
Commit 167804e4 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

Merge branch '0.13'

parents 0c6fda78 463e615e
Branches
Tags v0.13.2
No related merge requests found
......@@ -10,10 +10,15 @@ module.exports = {
INSTANCE_NAME: getDomain(opts.mdb),
INSTANCE_HOME: getHomePath(opts.mdb, opts.home),
INSTANCE_HOMELOG_FILE: getLogsPath(opts.mdb, opts.home),
getHome: (profile, dir) => getHomePath(profile, dir)
};
function getLogsPath(profile, dir) {
return path.join(getHomePath(profile, dir), 'ucoin.log');
}
function getHomePath(profile, dir) {
return path.normalize(getUserHome(dir) + '/') + getDomain(profile);
}
......
......@@ -56,7 +56,7 @@ module.exports = function sanitize (json, contract) {
// Test json member type
let tjson = typeof json[prop];
if (~['Array', 'Object'].indexOf(t)) {
if (tjson == 'object') {
if (tjson == 'object' && json[prop] !== null) {
tjson = json[prop].length == undefined ? 'Object' : 'Array';
}
}
......@@ -87,7 +87,7 @@ module.exports = function sanitize (json, contract) {
}
}
// Recursivity
if (t == 'Object') {
if (t == 'Object' && json[prop] !== null) {
json[prop] = sanitize(json[prop], contract[prop]);
}
}
......
......@@ -3,6 +3,9 @@
var directory = require('../app/lib/directory');
var path = require('path');
var Tail = require('always-tail');
var fs = require('fs');
var util = require('util');
var daemon = require("daemonize2").setup({
main: "ucoind",
......@@ -20,6 +23,19 @@ switch (process.argv[2]) {
daemon.stop();
break;
case "logs":
let stats = fs.statSync(directory.INSTANCE_HOMELOG_FILE);
let fileSizeInBytes = stats.size;
let lastLines = 0.995 * fileSizeInBytes;
var tail = new Tail(directory.INSTANCE_HOMELOG_FILE, '\n', {
interval: 5,
start: Math.max(0, lastLines)
});
tail.on("line", function(data) {
console.log(data);
});
break;
case "restart":
daemon.stop(function(err) {
err && console.error(err);
......
......@@ -11,7 +11,7 @@ if [ -z "$UCOIN_DIR" ]; then
fi
ucoin_latest_version() {
echo "v0.13.1"
echo "v0.13.2"
}
ucoin_repo_url() {
......
{
"name": "ucoin",
"version": "0.13.1",
"version": "0.13.2",
"engines": {
"node": ">=4.2.0",
"npm": ">=2.11"
......@@ -33,6 +33,7 @@
"url": "https://github.com/ucoin-io/ucoin/issues"
},
"dependencies": {
"always-tail": "0.2.0",
"async": "0.2.9",
"bindings": "1.2.1",
"co": "4.6.0",
......
......@@ -225,7 +225,7 @@ describe("Branches", function() {
it('should have a 3 blocks fork window size', function() {
return expectAnswer(rp('http://127.0.0.1:7778/node/summary', { json: true }), function(res) {
res.should.have.property('ucoin').property('software').equal('ucoind');
res.should.have.property('ucoin').property('version').equal('0.13.1');
res.should.have.property('ucoin').property('version').equal('0.13.2');
res.should.have.property('ucoin').property('forkWindowSize').equal(3);
});
});
......
......@@ -35,7 +35,7 @@ ucoind() {
# UCOIN DAEMON MANAGEMENT
#---------------------------------
start|stop|restart)
start|stop|restart|logs)
$NODE "$UCOIN_DIR/bin/daemon" $*
;;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment