Skip to content
This repository has been archived by the owner on Jan 13, 2018. It is now read-only.

Commit

Permalink
Merge branch 'techs-v2'
Browse files Browse the repository at this point in the history
v0.6.0
  • Loading branch information
Vladimir Alaev committed Jun 11, 2013
2 parents dd1f7b4 + 2a5c5e6 commit 6af00b3
Show file tree
Hide file tree
Showing 78 changed files with 3,146 additions and 5,298 deletions.
4 changes: 4 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
bem-tools changelog
===================
11.06.2013, Version 0.6.0 (stable)
----------------------------------

- speed optimizations with techs API V2

30.05.2013, Version 0.5.33 (stable)
----------------------------------
Expand Down
11 changes: 11 additions & 0 deletions lib/base-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ var INHERIT = require('inherit'),
PATH = require('./path'),
MAKE = require('./make'),
LOGGER = require('./logger'),
LEVEL = require('./level')
U = require('./util');

var defaultDocument = 'index.html';
Expand Down Expand Up @@ -141,6 +142,8 @@ exports.Server = INHERIT({
}
},

_targetsInProcess: 0,

createRequestHandler: function(root, runner) {
var _this = this;

Expand All @@ -167,10 +170,18 @@ exports.Server = INHERIT({
.then(function(id) {
if (!id) return;

_this._targetsInProcess++;

// found, run build
LOGGER.fverbose('*** node found, building "%s"', id);
LOGGER.fdebug('targets: %s', _this._targetsInProcess);
LOGGER.time('[t] Build total for "%s"', id);
return runner.process(id).fin(function() {
_this._targetsInProcess--;

if (_this._targetsInProcess === 0) LEVEL.resetLevelsCache();

LOGGER.fdebug('targets: %s', _this._targetsInProcess);
LOGGER.timeEnd('[t] Build total for "%s"', id);
});
})
Expand Down
2 changes: 2 additions & 0 deletions lib/coa.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ var Q = require('q'),
CP = require('child_process'),
PATH = require('./path');

Q.longStackJumpLimit = 0;

module.exports = require('coa').Cmd()
.name(PATH.basename(process.argv[1]))
.title(['Tools to work with files written using the BEM-method.', '' +
Expand Down
19 changes: 17 additions & 2 deletions lib/commands/build.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
var Q = require('q'),
PATH = require('../path'),
createLevel = require('../level').createLevel,
LEVEL = require('../level'),
createLevel = LEVEL.createLevel,
Context = require('../context').Context,
U = require('../util');

Expand All @@ -16,6 +17,15 @@ module.exports = function() {
})
.req()
.end()
.opt()
.name('forceCache').title('Force level cache')
.long('force-cache')
.flag()
.def(false)
.val(function(force) {
if (force) LEVEL.setCachePolicy(true);
})
.end()
.opt()
.name('level').short('l').long('level')
.title('override level, can be used many times')
Expand Down Expand Up @@ -64,6 +74,11 @@ module.exports = function() {
.name('val').short('v').long('val')
.title('modifier value')
.end()
.opt()
.name('force').title('Force build')
.long('force')
.flag()
.end()
.act(function(opts, args) {

if (opts.outputLevel) {
Expand All @@ -87,7 +102,7 @@ module.exports = function() {

return context.getTech(techIdent)
.buildByDecl(opts.declaration, context.getLevels(),
PATH.resolve(opts.outputDir, opts.outputName));
PATH.resolve(opts.outputDir, opts.outputName), opts);

})).get(0);

Expand Down
11 changes: 11 additions & 0 deletions lib/default-arch.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ var INHERIT = require('inherit'),
LOGGER = require('./logger'),
Q = require('qq'),
registry = require('./nodesregistry'),
level = require('./level'),

node = require('./nodes/node'),
levelNodes = require('./nodes/level'),
Expand All @@ -22,6 +23,9 @@ registry.decl('Arch', {
this.arch = arch;
this.root = opts.root;
this.opts = opts;

var policy = this.getLevelCachePolicy();
level.setCachePolicy(policy.cache, policy.except);
},

bundlesLevelsRegexp: /^(pages.*|bundles.*)/i,
Expand All @@ -33,6 +37,13 @@ registry.decl('Arch', {
return this.libraries;
},

getLevelCachePolicy: function() {
return {
cache: false,
except: []
}
},

alterArch: function() {
var _this = this;

Expand Down
1 change: 1 addition & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ exports.nodes = require('./nodes');
exports.Context = require('./context').Context;

exports.Tech = TECH.Tech;
exports.TechV2 = TECH.TechV2;
exports.getTechClass = TECH.getTechClass;
exports.createTech = TECH.createTech;

Expand Down
Loading

0 comments on commit 6af00b3

Please sign in to comment.