summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2016-02-18 19:19:09 +0100
committerSamy Pesse <samypesse@gmail.com>2016-02-18 19:19:09 +0100
commitf763e1dc4201f1593c1baf26697b175e96402442 (patch)
treeba46f4ede0460007825817b1cd800cb927ceadca
parentea13e3cec45ad2b52f9346914331c43d91000d17 (diff)
downloadgitbook-f763e1dc4201f1593c1baf26697b175e96402442.zip
gitbook-f763e1dc4201f1593c1baf26697b175e96402442.tar.gz
gitbook-f763e1dc4201f1593c1baf26697b175e96402442.tar.bz2
Lint after travis tests
-rw-r--r--.travis.yml2
-rwxr-xr-xbin/gitbook.js1
-rw-r--r--gulpfile.js47
-rw-r--r--lib/config/default.js2
-rw-r--r--lib/config/index.js6
-rw-r--r--lib/output/index.js10
-rw-r--r--lib/template/index.js14
-rw-r--r--package.json14
-rw-r--r--test/mock.js2
9 files changed, 15 insertions, 83 deletions
diff --git a/.travis.yml b/.travis.yml
index 6326f67..8de84e7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -6,3 +6,5 @@ node_js:
- "0.12"
before_install:
- npm install svgexport -g
+after_success:
+ - npm run lint
diff --git a/bin/gitbook.js b/bin/gitbook.js
index 5f47420..5cadbc9 100755
--- a/bin/gitbook.js
+++ b/bin/gitbook.js
@@ -1,4 +1,5 @@
#! /usr/bin/env node
+/* eslint-disable no-console */
var color = require('bash-color');
diff --git a/gulpfile.js b/gulpfile.js
deleted file mode 100644
index 570b6a0..0000000
--- a/gulpfile.js
+++ /dev/null
@@ -1,47 +0,0 @@
-var _ = require('lodash');
-var gulp = require('gulp');
-var gutil = require('gulp-util');
-var less = require('gulp-less');
-var rename = require('gulp-rename');
-var minifyCSS = require('gulp-minify-css');
-var browserify = require('browserify');
-var mergeStream = require('merge-stream');
-var source = require('vinyl-source-stream');
-
-gulp.task('css', function() {
- var merged = mergeStream();
-
- _.each({
- 'ebook.less': 'ebook/ebook.css',
- 'pdf.less': 'ebook/pdf.css',
- 'mobi.less': 'ebook/mobi.css',
- 'epub.less': 'ebook/epub.css',
- 'website.less': 'website/style.css'
- }, function(out, input) {
- gutil.log('compiling', input, 'into', out);
- merged.add(gulp.src('theme/stylesheets/'+input)
- .pipe(less())
- .pipe(minifyCSS())
- .pipe(rename(out))
- .pipe(gulp.dest('theme/assets/')));
- });
-
- return merged;
-});
-
-gulp.task('js', function() {
- return browserify('./theme/javascript/index.js')
- .bundle()
- .pipe(source('app.js'))
- .pipe(gulp.dest('./theme/assets/website'));
-});
-
-gulp.task('assets', function() {
- return gulp.src('./node_modules/font-awesome/fonts/*')
- .pipe(gulp.dest('theme/assets/website/fonts/fontawesome/'));
-});
-
-gulp.task('default', ['css', 'js', 'assets'], function() {
-
-});
-
diff --git a/lib/config/default.js b/lib/config/default.js
index 1695e11..23a92f9 100644
--- a/lib/config/default.js
+++ b/lib/config/default.js
@@ -1,5 +1,3 @@
-var path = require('path');
-
module.exports = {
// Book metadatas (somes are extracted from the README by default)
'title': null,
diff --git a/lib/config/index.js b/lib/config/index.js
index a5a0d67..34bf97c 100644
--- a/lib/config/index.js
+++ b/lib/config/index.js
@@ -62,12 +62,6 @@ Config.prototype.load = function() {
that.options.plugins = _.union(that.options.plugins, that.options.defaultsPlugins);
that.options.plugins = _.uniq(that.options.plugins, 'name');
- // Default value for text direction (from language)
- /*if (!that.options.direction) {
- var lang = i18n.getCatalog(that.options.language);
- if (lang) that.options.direction = lang.direction;
- }*/
-
that.options.gitbook = gitbook.version;
});
};
diff --git a/lib/output/index.js b/lib/output/index.js
deleted file mode 100644
index dcb2ffe..0000000
--- a/lib/output/index.js
+++ /dev/null
@@ -1,10 +0,0 @@
-var _ = require('lodash');
-//var EbookGenerator = require('./ebook');
-
-module.exports = {
- json: require('./json'),
- /*website: require('./website'),
- pdf: _.partialRight(EbookGenerator, 'pdf'),
- mobi: _.partialRight(EbookGenerator, 'mobi'),
- epub: _.partialRight(EbookGenerator, 'epub')*/
-};
diff --git a/lib/template/index.js b/lib/template/index.js
index bb8272c..d426988 100644
--- a/lib/template/index.js
+++ b/lib/template/index.js
@@ -176,7 +176,7 @@ TemplateEngine.prototype.addBlock = function(name, block) {
var args = parser.parseSignature(null, true);
parser.advanceAfterBlockEnd(tok.value);
- while (1) {
+ do {
// Read body
var currentBody = parser.parseUntilBlocks.apply(parser, allBlocks);
@@ -193,14 +193,14 @@ TemplateEngine.prototype.addBlock = function(name, block) {
// Read new block
lastBlockName = parser.peekToken().value;
- if (lastBlockName == block.end) {
- break;
- }
// Parse signature and move to the end of the block
- lastBlockArgs = parser.parseSignature(null, true);
- parser.advanceAfterBlockEnd(lastBlockName);
- }
+ if (lastBlockName != block.end) {
+ lastBlockArgs = parser.parseSignature(null, true);
+ parser.advanceAfterBlockEnd(lastBlockName);
+ }
+ } while (lastBlockName == block.end)
+
parser.advanceAfterBlockEnd();
var bodies = [body];
diff --git a/package.json b/package.json
index 4189a64..714952b 100644
--- a/package.json
+++ b/package.json
@@ -52,19 +52,11 @@
"devDependencies": {
"eslint": "1.5.0",
"mocha": "2.4.5",
- "should": "8.2.2",
- "gulp": "^3.8.11",
- "gulp-rename": "^1.2.2",
- "gulp-uglify": "1.1.0",
- "gulp-less": "3.0.2",
- "gulp-minify-css": "1.0.0",
- "gulp-util": "3.0.6",
- "browserify": "11.0.1",
- "merge-stream": "0.1.7",
- "vinyl-source-stream": "1.1.0"
+ "should": "8.2.2"
},
"scripts": {
- "test": "node_modules/.bin/mocha --reporter spec --bail --timeout 15000 ./test/all.js"
+ "test": "node_modules/.bin/mocha --reporter spec --bail --timeout 15000 ./test/all.js",
+ "lint": "eslint ."
},
"repository": {
"type": "git",
diff --git a/test/mock.js b/test/mock.js
index f9cc657..b075f2c 100644
--- a/test/mock.js
+++ b/test/mock.js
@@ -1,3 +1,5 @@
+/* eslint-disable no-console */
+
var Q = require('q');
var _ = require('lodash');
var tmp = require('tmp');