
All the docs related files (docs-app, doc-gen, content, etc) are now to be found inside the `/aio` folder. The related gulp tasks have been moved from the top level gulp file to a new one inside the `/aio` folder. The structure of the `/aio` folder now looks like: ``` /aio/ build/ # gulp tasks content/ #MARKDOWN FILES for devguides, cheatsheet, etc devguides/ cheatsheets/ transforms/ #dgeni packages, templates, etc src/ app/ assets/ content/ #HTML + JSON build artifacts produced by dgeni from /aio/content. #This dir is .gitignored-ed e2e/ #protractor tests for the doc viewer app node_modules/ #dependencies for both the doc viewer builds and the dgeni stuff #This dir is .gitignored-ed gulpfile.js #Tasks for generating docs and building & deploying the doc viewer ``` Closes #14361
51 lines
1.3 KiB
JavaScript
51 lines
1.3 KiB
JavaScript
module.exports = function targetEnvironments() {
|
|
var _targets = Object.create(null);
|
|
var _activeCount = 0;
|
|
|
|
var checkAllowed = function(target) {
|
|
if (!(target in _targets)) {
|
|
throw new Error(
|
|
'Error accessing target "' + target + '". It is not in the list of allowed targets: ' +
|
|
Object.keys(_targets));
|
|
}
|
|
};
|
|
|
|
var updateActiveCount = function() {
|
|
_activeCount = 0;
|
|
for (target in _targets) {
|
|
if (_targets[target]) _activeCount++;
|
|
}
|
|
};
|
|
|
|
return {
|
|
addAllowed: function(target, isActive) {
|
|
_targets[target] = !!isActive;
|
|
updateActiveCount();
|
|
},
|
|
removeAllowed: function(target) {
|
|
delete _targets[target];
|
|
updateActiveCount();
|
|
},
|
|
activate: function(target) {
|
|
checkAllowed(target);
|
|
_targets[target] = true;
|
|
updateActiveCount();
|
|
},
|
|
deactivate: function(target) {
|
|
checkAllowed(target);
|
|
_targets[target] = false;
|
|
updateActiveCount();
|
|
},
|
|
isActive: function(target) {
|
|
checkAllowed(target);
|
|
return _targets[target];
|
|
},
|
|
hasActive: function() { return _activeCount > 0; },
|
|
someActive: function(targets) {
|
|
for (var i = 0, ii = targets.length; i < ii; i++) {
|
|
if (this.isActive(targets[i])) return true;
|
|
}
|
|
return false;
|
|
}
|
|
};
|
|
}; |