mirror of
https://github.com/GitbookIO/gitbook.git
synced 2026-09-16 15:45:13 +00:00
Merge pull request #1216 from GitbookIO/fix/ignore
Fix #1215: fix ignore rules not working
This commit is contained in:
@@ -37,6 +37,11 @@ function Output(book, opts, parent) {
|
||||
|
||||
// Files to ignore in output
|
||||
this.ignore = Ignore();
|
||||
|
||||
// Hack to inherits from rules of the book:
|
||||
// Waiting for https://github.com/kaelzhang/node-ignore/pull/19 to be merged
|
||||
this.ignore._rules = this.ignore._rules.concat(this.book.ignore._rules);
|
||||
this.ignore._cache = {};
|
||||
}
|
||||
|
||||
// Default name for generator
|
||||
|
||||
@@ -19,6 +19,7 @@ require('./git');
|
||||
require('./plugins');
|
||||
require('./template');
|
||||
require('./conrefs');
|
||||
require('./ignore');
|
||||
|
||||
// Page and HTML generation
|
||||
require('./page');
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
var mock = require('./mock');
|
||||
var WebsiteOutput = require('../lib/output/website');
|
||||
|
||||
describe('Ignore', function() {
|
||||
var output;
|
||||
|
||||
before(function() {
|
||||
return mock.outputDefaultBook(WebsiteOutput, {
|
||||
'.ignore': 'test-1.js',
|
||||
'.gitignore': 'test-2.js\ntest-3.js',
|
||||
'.bookignore': '!test-3.js',
|
||||
'test-1.js': '1',
|
||||
'test-2.js': '2',
|
||||
'test-3.js': '3'
|
||||
})
|
||||
.then(function(_output) {
|
||||
output = _output;
|
||||
});
|
||||
});
|
||||
|
||||
it('should load rules from .ignore', function() {
|
||||
output.should.not.have.file('test-1.js');
|
||||
});
|
||||
|
||||
it('should load rules from .gitignore', function() {
|
||||
output.should.not.have.file('test-2.js');
|
||||
});
|
||||
|
||||
it('should load rules from .bookignore', function() {
|
||||
output.should.have.file('test-3.js');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user