seperated stable and unstable branches so that docs are not generated for the unstable ones

This commit is contained in:
Spencer Alger
2014-05-05 10:25:04 -07:00
parent f54826fa6b
commit 9a1cfe7c42
4 changed files with 36 additions and 18 deletions

View File

@ -2,12 +2,18 @@ var _ = require('../src/lib/utils');
var root = require('find-root')(__dirname); var root = require('find-root')(__dirname);
var pkg = require(root + '/package.json'); var pkg = require(root + '/package.json');
var branches = pkg.config.supported_es_branches; var stable = pkg.config.supported_es_branches;
branches._default = pkg.config.default_api_branch; var unstable = pkg.config.unstable_es_branches;
module.exports = { var utils = {
branchSuffix: function (branch) { branchSuffix: function (branch) {
return branch === branches._default ? '' : '_' + _.snakeCase(branch); return branch === utils.branches._default ? '' : '_' + _.snakeCase(branch);
}, },
branches: branches branches: [].concat(stable, unstable),
}; stableBranches: stable,
unstableBranches: unstable
};
utils.branches._default = pkg.config.default_api_branch;
module.exports = utils;

View File

@ -20,12 +20,14 @@
"pattern": "specified in test/unit/coverage.js" "pattern": "specified in test/unit/coverage.js"
}, },
"supported_es_branches": [ "supported_es_branches": [
"master",
"1.x",
"1.1", "1.1",
"1.0", "1.0",
"0.90" "0.90"
], ],
"unstable_es_branches": [
"master",
"1.x"
],
"default_api_branch": "1.1" "default_api_branch": "1.1"
}, },
"devDependencies": { "devDependencies": {

View File

@ -93,7 +93,8 @@ function initStep() {
} }
function fetchBranchesStep() { function fetchBranchesStep() {
return spawnStep('git', ['fetch', '--no-tags', 'origin'].concat(branches.map(function (b) { return b + ':' + b; })), sourceDir); var branchArgs = branches.map(function (b) { return b + ':' + b; });
return spawnStep('git', ['fetch', '--no-tags', '--force', 'origin'].concat(branchArgs), sourceDir);
} }
function removePrevArchive(branch) { function removePrevArchive(branch) {
@ -121,7 +122,10 @@ function generateStep(branch) {
async.parallel([ async.parallel([
argv.api && async.apply(require('./js_api'), branch), argv.api && async.apply(require('./js_api'), branch),
argv.tests && async.apply(require('./yaml_tests'), branch) argv.tests && async.apply(require('./yaml_tests'), branch)
].filter(Boolean), done); ].filter(Boolean), function () {
console.log('----\n');
done();
});
}; };
} }

View File

@ -27,16 +27,22 @@ module.exports = function (branch, done) {
aliases = require('./aliases'); aliases = require('./aliases');
} }
// generate the API var steps = [
async.series([
readSpecFiles, readSpecFiles,
parseSpecFiles, parseSpecFiles,
writeApiFile, writeApiFile
ensureDocsDir, ];
formatDocVars,
writeMethodDocs if (!~utils.unstableBranches.indexOf(branch)) {
], function (err) { steps.push(
console.log(''); ensureDocsDir,
formatDocVars,
writeMethodDocs
);
}
// generate the API
async.series(steps, function (err) {
done(err); done(err);
}); });