summaryrefslogtreecommitdiffstats
path: root/lib/parse/listAssets.js
diff options
context:
space:
mode:
authorSamy Pesse <samypesse@gmail.com>2016-04-30 14:37:44 +0200
committerSamy Pesse <samypesse@gmail.com>2016-04-30 14:37:44 +0200
commit30bce5f9bb1f8ceee867770386fa6f7fdffd27ee (patch)
tree8470737d295aa6c4c7f861b1553d50bce34a9936 /lib/parse/listAssets.js
parentfbe028273828bc8518e92e87fcbd2a6718dc91e2 (diff)
downloadgitbook-30bce5f9bb1f8ceee867770386fa6f7fdffd27ee.zip
gitbook-30bce5f9bb1f8ceee867770386fa6f7fdffd27ee.tar.gz
gitbook-30bce5f9bb1f8ceee867770386fa6f7fdffd27ee.tar.bz2
Add option "--timing" to mesure gitbook performances
Diffstat (limited to 'lib/parse/listAssets.js')
-rw-r--r--lib/parse/listAssets.js26
1 files changed, 15 insertions, 11 deletions
diff --git a/lib/parse/listAssets.js b/lib/parse/listAssets.js
index a0dbbc9..c43b054 100644
--- a/lib/parse/listAssets.js
+++ b/lib/parse/listAssets.js
@@ -1,3 +1,4 @@
+var timing = require('../utils/timing');
/**
List all assets in a book
@@ -16,17 +17,20 @@ function listAssets(book, pages) {
var glossary = book.getGlossary();
var glossaryFile = glossary.getFile().getPath();
- return fs.listAllFiles()
- .then(function(files) {
- return files.filterNot(function(file) {
- return (
- book.isContentFileIgnored(file) ||
- pages.has(file) ||
- file !== summaryFile ||
- file !== glossaryFile
- );
- });
- });
+ return timing.measure(
+ 'parse.listAssets',
+ fs.listAllFiles()
+ .then(function(files) {
+ return files.filterNot(function(file) {
+ return (
+ book.isContentFileIgnored(file) ||
+ pages.has(file) ||
+ file !== summaryFile ||
+ file !== glossaryFile
+ );
+ });
+ })
+ );
}
module.exports = listAssets;