diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-09-15 14:21:27 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-09-15 14:21:27 +0200 |
commit | 6732957e42350b3aefa4b1c80371baea92950651 (patch) | |
tree | 1605473bf22c7e4ab90a6cc9bebf5cb807fa1d90 /lib/index.js | |
parent | 5f56098ae7fae80a4dd75a944c38201560b480c6 (diff) | |
parent | 1fd00068595dfced5a0f16ac05ae2553d09608bc (diff) | |
download | gitbook-6732957e42350b3aefa4b1c80371baea92950651.zip gitbook-6732957e42350b3aefa4b1c80371baea92950651.tar.gz gitbook-6732957e42350b3aefa4b1c80371baea92950651.tar.bz2 |
Merge pull request #930 from GitbookIO/jshint
Add config for jshint and fix lint errors
Diffstat (limited to 'lib/index.js')
-rw-r--r-- | lib/index.js | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/lib/index.js b/lib/index.js index b5aa06d..89d5d3c 100644 --- a/lib/index.js +++ b/lib/index.js @@ -1,11 +1,10 @@ var Q = require("q"); var _ = require("lodash"); var path = require("path"); -var tinylr = require('tiny-lr'); -var color = require('bash-color'); +var tinylr = require("tiny-lr"); +var color = require("bash-color"); var Book = require("./book"); -var Plugin = require("./plugin"); var Server = require("./utils/server"); var stringUtils = require("./utils/string"); var watch = require("./utils/watch"); @@ -42,10 +41,10 @@ module.exports = { var output = args[1] || path.join(input, "_book"); var book = new Book(input, _.extend({}, { - 'config': { - 'output': output + "config": { + "output": output }, - 'logLevel': kwargs.log + "logLevel": kwargs.log })); return book.parse() @@ -71,7 +70,7 @@ module.exports = { var output = args[1]; var book = new Book(input, _.extend({}, { - 'logLevel': kwargs.log + "logLevel": kwargs.log })); return book.parse() @@ -116,7 +115,7 @@ module.exports = { // Init livereload server var lrServer = tinylr({}); - var lrPath = undefined; + var lrPath; var generate = function() { if (server.isRunning()) console.log("Stopping server"); @@ -124,10 +123,10 @@ module.exports = { return server.stop() .then(function() { var book = new Book(input, _.extend({}, { - 'config': { - 'defaultsPlugins': ["livereload"] + "config": { + "defaultsPlugins": ["livereload"] }, - 'logLevel': kwargs.log + "logLevel": kwargs.log })); return book.parse() @@ -138,10 +137,10 @@ module.exports = { }) .then(function(book) { console.log(); - console.log('Starting server ...'); + console.log("Starting server ..."); return server.start(book.options.output, kwargs.port) .then(function() { - console.log('Serving book on http://localhost:'+kwargs.port); + console.log("Serving book on http://localhost:"+kwargs.port); if (lrPath) { // trigger livereload @@ -159,18 +158,18 @@ module.exports = { // set livereload path lrPath = filepath; console.log("Restart after change in file", filepath); - console.log(''); + console.log(""); return generate(); - }) - }) + }); + }); }); }; return Q.nfcall(lrServer.listen.bind(lrServer), kwargs.lrport) .then(function() { - console.log('Live reload server started on port:', kwargs.lrport); - console.log('Press CTRL+C to quit ...'); - console.log('') + console.log("Live reload server started on port:", kwargs.lrport); + console.log("Press CTRL+C to quit ..."); + console.log(""); return generate(); }); } @@ -179,7 +178,7 @@ module.exports = { { name: "install [book]", description: "install plugins dependencies", - exec: function(args, kwargs) { + exec: function(args) { var input = args[0] || process.cwd(); var book = new Book(input); @@ -198,7 +197,7 @@ module.exports = { { name: "init [directory]", description: "create files and folders based on contents of SUMMARY.md", - exec: function(args, kwargs) { + exec: function(args) { return Book.init(args[0] || process.cwd()) .then(function(){ console.log(""); |