Skip to content

Commit

Permalink
Merge pull request #46 from bem-site/getBlocksData
Browse files Browse the repository at this point in the history
Get blocks data
  • Loading branch information
tadatuta committed Oct 1, 2015
2 parents 39826d4 + f5b069e commit c6d35e2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/model/nodes/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ var util = require('util'),
if (version.url) {
this.ghLibVersionUrl = version.url;
}

this.sourceUrl = version.sourceUrl;
};

BlockNode.prototype = Object.create(nodes.dynamic.DynamicNode.prototype);
Expand Down Expand Up @@ -58,6 +60,8 @@ BlockNode.prototype.setSource = function (version, level, block) {
this.source = {
data: block.data,
jsdoc: block.jsdoc,
blocksData: block.blocksData,
examplesData: block.examplesData,
enb: version.enb,
prefix: version.enb ?
util.format('/__example/%s/%s', version.repo, version.ref) :
Expand Down Expand Up @@ -123,13 +127,13 @@ BlockNode.prototype.createMeta = function (version) {
BlockNode.prototype.saveToDb = function () {
var batchOperations = [];

['data', 'jsdoc'].forEach(function(field) {
['data', 'jsdoc', 'blocksData', 'examplesData'].forEach(function(field) {
var val = this.source[field];

if (!val) {
return;
}

var key = util.format('blocks:' + field + ':%s', sha(JSON.stringify(val)));

batchOperations.push({
Expand Down
4 changes: 2 additions & 2 deletions src/model/nodes/version.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ VersionNode.prototype.addItems = function (version) {
this.items.push(new nodes.post.PostNode(this, version, docs[item], item));
}, this);

if (version['showcase']) {
var showcaseItem = new nodes.showcase.ShowcaseNode(this, version, version['showcase']);
if (version.showcase) {
var showcaseItem = new nodes.showcase.ShowcaseNode(this, version, version.showcase);
this.items.push(showcaseItem);
}

Expand Down
4 changes: 2 additions & 2 deletions src/tasks/libraries-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ module.exports = {
// формируем списки на удаление директорий версий библиотек
// и на скачивание обновленных data.json файлов версий библиотек с MDS хранилища
return vow.all([
vow.resolve([].concat(diff.added).concat(diff.modified)),
vow.resolve([].concat(diff.removed).concat(diff.modified))
vow.resolve([].concat(diff.added, diff.modified)),
vow.resolve([].concat(diff.removed, diff.modified))
]);
})
.spread(function (downloadQueue, removeQueue) {
Expand Down

0 comments on commit c6d35e2

Please sign in to comment.