Skip to content

Commit

Permalink
Fix gravatar helper tests failed and update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
tommy351 committed Nov 1, 2015
1 parent 85fccb6 commit d07895c
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 45 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ script:
- npm run test-cov

after_script:
- npm install coveralls
- cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js
2 changes: 1 addition & 1 deletion bin/hexo
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

'use strict';

require('hexo-cli')();
require('hexo-cli')();
4 changes: 2 additions & 2 deletions lib/box/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ File.prototype.read = function(options, callback) {
if (options.escape) return resolve(escapeContent(result));

resolve(result);
}).nodeify(callback);
}).asCallback(callback);
};

File.prototype.readSync = function(options) {
Expand Down Expand Up @@ -89,7 +89,7 @@ File.prototype.stat = function(options, callback) {
if (stats && cache) return resolve(stats);

fs.stat(self.source).then(resolve, reject);
}).nodeify(callback);
}).asCallback(callback);
};

File.prototype.statSync = function(options) {
Expand Down
6 changes: 3 additions & 3 deletions lib/box/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function Box(ctx, base, options) {
text: content,
path: self.source
}, options);
}).nodeify(callback);
}).asCallback(callback);
};

_File.prototype.renderSync = function(options) {
Expand Down Expand Up @@ -99,7 +99,7 @@ Box.prototype.process = function(callback) {
return self._process(files).finally(function() {
files.length = 0;
});
}).nodeify(callback);
}).asCallback(callback);
};

Box.prototype.load = Box.prototype.process;
Expand Down Expand Up @@ -360,7 +360,7 @@ Box.prototype.watch = function(callback) {
});

return watcher;
}).nodeify(callback);
}).asCallback(callback);
};

Box.prototype.unwatch = function() {
Expand Down
8 changes: 4 additions & 4 deletions lib/hexo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ Hexo.prototype.call = function(name, args, callback) {
} else {
reject(new Error('Console `' + name + '` has not been registered yet!'));
}
}).nodeify(callback);
}).asCallback(callback);
};

Hexo.prototype.model = function(name, schema) {
Expand Down Expand Up @@ -227,7 +227,7 @@ Hexo.prototype.loadPlugin = function(path, callback) {
var fn = vm.runInThisContext(script, path);

return fn(module.exports, require, module, path, pathFn.dirname(path), self);
}).nodeify(callback);
}).asCallback(callback);
};

Hexo.prototype._showDrafts = function() {
Expand All @@ -245,7 +245,7 @@ Hexo.prototype.load = function(callback) {
]);
}).then(function() {
return self._generate({cache: true});
}).nodeify(callback);
}).asCallback(callback);
};

Hexo.prototype.watch = function(callback) {
Expand All @@ -263,7 +263,7 @@ Hexo.prototype.watch = function(callback) {
}).then(function() {
self.on('processAfter', generate);
return generate();
}).nodeify(callback);
}).asCallback(callback);
};

Hexo.prototype.unwatch = function() {
Expand Down
4 changes: 2 additions & 2 deletions lib/hexo/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Post.prototype.create = function(data, replace, callback) {
]).then(function() {
ctx.emit('new', result);
}).thenReturn(result);
}).nodeify(callback);
}).asCallback(callback);
};

function prepareFrontMatter(data) {
Expand Down Expand Up @@ -226,7 +226,7 @@ Post.prototype.publish = function(data, replace, callback) {
return fs.rmdir(assetSrc);
});
});
}).thenReturn(result).nodeify(callback);
}).thenReturn(result).asCallback(callback);
};

Post.prototype.render = function(source, data, callback) {
Expand Down
2 changes: 1 addition & 1 deletion lib/hexo/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ Render.prototype.render = function(data, options, callback) {
context: ctx,
args: [data]
});
}).nodeify(callback);
}).asCallback(callback);
};

Render.prototype.renderSync = function(data, options) {
Expand Down
6 changes: 3 additions & 3 deletions lib/hexo/scaffold.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Scaffold.prototype.get = function(name, callback) {
}

return self.defaults[name];
}).nodeify(callback);
}).asCallback(callback);
};

Scaffold.prototype.set = function(name, content, callback) {
Expand All @@ -66,15 +66,15 @@ Scaffold.prototype.set = function(name, content, callback) {
if (!pathFn.extname(path)) path += '.md';

return fs.writeFile(path, content);
}).nodeify(callback);
}).asCallback(callback);
};

Scaffold.prototype.remove = function(name, callback) {
return this._getScaffold(name).then(function(item) {
if (!item) return;

return fs.unlink(item.path);
}).nodeify(callback);
}).asCallback(callback);
};

module.exports = Scaffold;
2 changes: 1 addition & 1 deletion lib/theme/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ View.prototype.render = function(options, callback) {
layoutLocals.layout = false;

return layoutView.render(layoutLocals, callback);
}).nodeify(callback);
}).asCallback(callback);
};

View.prototype.renderSync = function(options) {
Expand Down
49 changes: 24 additions & 25 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"eslint": "eslint .",
"jscs": "jscs .",
"test": "mocha test/index.js",
"test-cov": "istanbul cover --print both _mocha -- test/index.js && istanbul check-coverage"
"test-cov": "istanbul cover --print both _mocha -- test/index.js"
},
"directories": {
"lib": "./lib",
Expand All @@ -31,41 +31,40 @@
"author": "Tommy Chen <[email protected]> (http://zespia.tw)",
"license": "MIT",
"dependencies": {
"abbrev": "^1.0.5",
"abbrev": "^1.0.7",
"archy": "^1.0.0",
"bluebird": "^2.9.8",
"bunyan": "^1.3.3",
"chalk": "^1.0.0",
"bluebird": "^3.0.3",
"bunyan": "^1.5.1",
"chalk": "^1.1.1",
"cheerio": "^0.19.0",
"hexo-cli": "^0.1.6",
"hexo-front-matter": "^0.2.1",
"hexo-fs": "^0.1.3",
"hexo-cli": "^0.1.8",
"hexo-front-matter": "^0.2.2",
"hexo-fs": "^0.1.4",
"hexo-i18n": "^0.2.1",
"hexo-util": "^0.1.7",
"js-yaml": "^3.2.5",
"lodash": "^3.2.0",
"minimatch": "^2.0.1",
"moment": "~2.10.3",
"moment-timezone": "^0.4.0",
"js-yaml": "^3.4.3",
"lodash": "^3.10.1",
"minimatch": "^3.0.0",
"moment": "~2.10.6",
"moment-timezone": "^0.4.1",
"nunjucks": "^2.1.0",
"pretty-hrtime": "^1.0.0",
"strip-indent": "^1.0.0",
"pretty-hrtime": "^1.0.1",
"strip-indent": "^1.0.1",
"swig": "1.4.2",
"swig-extras": "0.0.1",
"text-table": "^0.2.0",
"through2": "^2.0.0",
"tildify": "^1.0.0",
"tildify": "^1.1.2",
"titlecase": "^1.0.2",
"warehouse": "^1.0.2"
"warehouse": "^1.0.3"
},
"devDependencies": {
"chai": "^3.2.0",
"coveralls": "^2.11.2",
"eslint": "^1.5.0",
"hexo-renderer-marked": "^0.2.3",
"istanbul": "^0.3.20",
"jscs": "^2.1.1",
"mocha": "^2.0.1",
"sinon": "^1.12.2"
"chai": "^3.4.0",
"eslint": "^1.8.0",
"hexo-renderer-marked": "^0.2.5",
"istanbul": "^0.4.0",
"jscs": "^2.5.0",
"mocha": "^2.3.3",
"sinon": "^1.17.2"
}
}
6 changes: 3 additions & 3 deletions test/scripts/helpers/gravatar.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@ describe('gravatar', function() {
var hash = md5(email);

it('default', function() {
gravatar(email).should.eql('http://www.gravatar.com/avatar/' + hash);
gravatar(email).should.eql('https://www.gravatar.com/avatar/' + hash);
});

it('size', function() {
gravatar(email, 100).should.eql('http://www.gravatar.com/avatar/' + hash + '?s=100');
gravatar(email, 100).should.eql('https://www.gravatar.com/avatar/' + hash + '?s=100');
});

it('options', function() {
gravatar(email, {
s: 200,
r: 'pg',
d: 'mm'
}).should.eql('http://www.gravatar.com/avatar/' + hash + '?s=200&r=pg&d=mm');
}).should.eql('https://www.gravatar.com/avatar/' + hash + '?s=200&r=pg&d=mm');
});
});

0 comments on commit d07895c

Please sign in to comment.