diff options
author | Samy Pessé <samypesse@gmail.com> | 2015-09-15 13:57:21 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2015-09-15 13:57:21 +0200 |
commit | 5a205346e3d125b1c834220ce98a206d88697811 (patch) | |
tree | 47700546d3b7a3e484975e37b1bb06e7efa88b92 /lib/configuration.js | |
parent | e1930046599d430a6bb378af62bce78fb9d24ff7 (diff) | |
download | gitbook-5a205346e3d125b1c834220ce98a206d88697811.zip gitbook-5a205346e3d125b1c834220ce98a206d88697811.tar.gz gitbook-5a205346e3d125b1c834220ce98a206d88697811.tar.bz2 |
Jshint all files
Diffstat (limited to 'lib/configuration.js')
-rw-r--r-- | lib/configuration.js | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/lib/configuration.js b/lib/configuration.js index acff1c1..34d6351 100644 --- a/lib/configuration.js +++ b/lib/configuration.js @@ -1,14 +1,13 @@ var _ = require("lodash"); var Q = require("q"); var path = require("path"); -var semver = require('semver'); +var semver = require("semver"); -var pkg = require('../package.json'); -var fs = require("./utils/fs"); +var pkg = require("../package.json"); var i18n = require("./utils/i18n"); // Default plugins added to each books -var defaultsPlugins = ['highlight']; +var defaultsPlugins = ["highlight"]; // Normalize a list of plugins to use function normalizePluginsList(plugins) { @@ -24,9 +23,9 @@ function normalizePluginsList(plugins) { var parts = plugin.split("@"); return { - 'name': parts[0], - 'version': parts[1] // optional - } + "name": parts[0], + "version": parts[1] // optional + }; }); // List plugins to remove @@ -42,7 +41,7 @@ function normalizePluginsList(plugins) { // Merge with defaults plugins = _.chain(plugins) .concat(_.map(defaultsPlugins, function(plugin) { - return { 'name': plugin } + return { "name": plugin }; })) .uniq() .value(); @@ -55,11 +54,6 @@ function normalizePluginsList(plugins) { return plugins; } -// Normalize a list of plugin name to use -function normalizePluginsNames(plugins) { - return _.pluck(normalizePluginsList(plugins), "name"); -}; - var Configuration = function(book, options) { var that = this; @@ -96,7 +90,7 @@ Configuration.prototype.load = function() { return Q() .then(function() { - var configPath, config; + var configPath, _config; try { configPath = require.resolve( @@ -109,7 +103,7 @@ Configuration.prototype.load = function() { _config = require(configPath); that.options = _.merge( that.options, - _.omit(_config, 'configFile', 'defaultsPlugins', 'generator', 'extension') + _.omit(_config, "configFile", "defaultsPlugins", "generator", "extension") ); } catch(err) { @@ -121,7 +115,7 @@ Configuration.prototype.load = function() { if (!semver.satisfies(pkg.version, that.options.gitbook)) { throw "GitBook version doesn't satisfy version required by the book: "+that.options.gitbook; } - if (that.options.gitbook != '*' && !semver.satisfies(semver.inc(pkg.version, 'patch'), that.options.gitbook)) { + if (that.options.gitbook != "*" && !semver.satisfies(semver.inc(pkg.version, "patch"), that.options.gitbook)) { that.book.log.warn.ln("gitbook version specified in your book.json might be too strict for future patches, \""+(_.first(pkg.version.split("."))+".x.x")+"\" is more adequate"); } @@ -163,7 +157,7 @@ Configuration.prototype.get = function(key, def) { // Default configuration Configuration.DEFAULT = { - // Options that can't be extend + // Options that can"t be extend "configFile": "book", "generator": "website", "extension": null, @@ -213,9 +207,9 @@ Configuration.DEFAULT = { "variables": {}, // Set another theme with your own layout - // It's recommended to use plugins or add more options for default theme, though + // It"s recommended to use plugins or add more options for default theme, though // See https://github.com/GitbookIO/gitbook/issues/209 - "theme": path.resolve(__dirname, '../theme'), + "theme": path.resolve(__dirname, "../theme"), // Links in template (null: default, false: remove, string: new value) "links": { |