summaryrefslogtreecommitdiffstats
path: root/lib/plugins/findForBook.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/plugins/findForBook.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/plugins/findForBook.js')
-rw-r--r--lib/plugins/findForBook.js27
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/plugins/findForBook.js b/lib/plugins/findForBook.js
index 47b8fc4..14ccc05 100644
--- a/lib/plugins/findForBook.js
+++ b/lib/plugins/findForBook.js
@@ -2,6 +2,7 @@ var path = require('path');
var Immutable = require('immutable');
var Promise = require('../utils/promise');
+var timing = require('../utils/timing');
var findInstalled = require('./findInstalled');
/**
@@ -11,18 +12,22 @@ var findInstalled = require('./findInstalled');
@return {Promise<OrderedMap<String:Plugin>>}
*/
function findForBook(book) {
- return Promise.all([
- findInstalled(path.resolve(__dirname, '../..')),
- findInstalled(book.getRoot())
- ])
+ return timing.measure(
+ 'plugins.findForBook',
- // Merge all plugins
- .then(function(results) {
- return Immutable.List(results)
- .reduce(function(out, result) {
- return out.merge(result);
- }, Immutable.OrderedMap());
- });
+ Promise.all([
+ findInstalled(path.resolve(__dirname, '../..')),
+ findInstalled(book.getRoot())
+ ])
+
+ // Merge all plugins
+ .then(function(results) {
+ return Immutable.List(results)
+ .reduce(function(out, result) {
+ return out.merge(result);
+ }, Immutable.OrderedMap());
+ })
+ );
}