adds Project.getAllRegionNames(stageName)

This commit is contained in:
Egor Kislitsyn 2016-03-03 19:08:30 +07:00
parent 47dea979d8
commit 4e45bc3a97
5 changed files with 8 additions and 5 deletions

View File

@ -263,6 +263,10 @@ class Project extends SerializerFileSystem {
return this.getStage( stageName ).getAllRegions();
}
getAllRegionNames(stageName){
return _.map(this.getAllRegions(stageName), 'name');
}
setRegion(stageName, region){
let stage = this.getStage(stageName);
stage.setRegion(region);

View File

@ -169,7 +169,7 @@ module.exports = function(SPlugin, serverlessPath) {
// Set defaults
_this.evt.options.names = _this.evt.options.names ? _this.evt.options.names : [];
_this.regions = _this.evt.options.region ? [_this.evt.options.region] : _this.project.getAllRegions(_this.evt.options.stage).map(r => {return r.name;});
_this.regions = _this.evt.options.region ? [_this.evt.options.region] : _this.project.getAllRegionNames(_this.evt.options.stage);
if (_this.evt.options.names.length) {
_this.evt.options.names.forEach(function(name) {

View File

@ -151,7 +151,7 @@ module.exports = function(SPlugin, serverlessPath) {
// Set defaults
_this.evt.options.names = _this.evt.options.names ? _this.evt.options.names : [];
_this.regions = _this.evt.options.region ? [_this.evt.options.region] : Object.keys(_this.meta.stages[_this.evt.options.stage].regions);
_this.regions = _this.evt.options.region ? [_this.evt.options.region] : _this.project.getAllRegionNames(_this.evt.options.stage);
if (_this.evt.options.names.length) {
_this.evt.options.names.forEach(function(endpointName) {

View File

@ -186,8 +186,7 @@ module.exports = function(SPlugin, serverlessPath) {
_this.project = _this.S.getProject();
// Set Deploy Regions
_this.regions = _this.evt.options.region ? [_this.evt.options.region] : _this.S.getProject().getAllRegions(_this.evt.options.stage).map(r => r.name);
_this.regions = _this.evt.options.region ? [_this.evt.options.region] : _this.S.getProject().getAllRegionNames(_this.evt.options.stage);
if (_this.evt.options.names.length) {
_this.evt.options.names.forEach(function(name) {

View File

@ -472,7 +472,7 @@ module.exports = {
return BbPromise.reject(new SError(`Invalid stage ${stage}`, SError.errorCodes.UNKNOWN));
}
regions = _.map(S.getProject().getAllRegions(stage), 'name');
regions = S.getProject().getAllRegionNames(stage);
}
return BbPromise.map(regions, (region => {