mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
add way to list things that are currently tagged for deloyment
This commit is contained in:
parent
f6b1e6ee31
commit
42b6d76497
13
bin/jaws
13
bin/jaws
@ -47,9 +47,10 @@ program
|
||||
|
||||
program
|
||||
.command('tag [type]')
|
||||
.option('-u, --untag', 'un-tag lambda')
|
||||
.option('-a, --tag-all', 'tag all lambda functions in project')
|
||||
.option('-n, --untag-all', 'un-tag all lambda functions in project')
|
||||
.option('-u, --untag', 'un-tag lambda|api')
|
||||
.option('-a, --tag-all', 'tag all lambda|api functions in project')
|
||||
.option('-l, --list-all', 'list all tagged lambda|api functions in project')
|
||||
.option('-n, --untag-all', 'un-tag all lambda|api functions in project')
|
||||
.description('Tag a lambda function (type: lambda, the default) or api gateway resource (api) to be deployed the next time deploy command is run')
|
||||
.action(function(type, options) {
|
||||
type = type || 'lambda';
|
||||
@ -60,7 +61,11 @@ program
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (options.tagAll || options.untagAll) {
|
||||
if (options.listAll) {
|
||||
handleExit(JAWS.listAll(type).then(function(relPaths) {
|
||||
console.log(relPaths)
|
||||
}));
|
||||
} else if (options.tagAll || options.untagAll) {
|
||||
var untag = (options.untagAll) ? true : false;
|
||||
handleExit(JAWS.tagAll(type, untag));
|
||||
} else { //If not tagging all, you have to be tagging whats in your CWD (null 1st param)
|
||||
|
||||
@ -416,7 +416,7 @@ module.exports = function(JAWS) {
|
||||
.then(_prepareProjectData)
|
||||
.then(_createS3JawsStructure) //see if bucket is avail first before doing work
|
||||
.then(_createProjectDirectory)
|
||||
.then(_createCfStack)
|
||||
.then(_createCfStack)//TODO: have an option to NOT create the cf stack
|
||||
.then(function(cfStackData) {
|
||||
return AWSUtils.cfDescribeStackResource(
|
||||
project.awsProfile,
|
||||
|
||||
@ -67,7 +67,7 @@ module.exports = function(JAWS) {
|
||||
.then(function(lJawsJsonPaths) {
|
||||
var tagQueue = [];
|
||||
if (!lJawsJsonPaths) {
|
||||
throw new JawsError('Could not find any lambdas');
|
||||
throw new JawsError('Could not find any lambdas', JawsError.errorCodes.UNKNOWN);
|
||||
}
|
||||
|
||||
lJawsJsonPaths.forEach(function(ljp) {
|
||||
@ -77,4 +77,35 @@ module.exports = function(JAWS) {
|
||||
return Promise.all(tagQueue);
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* List all lambda|api that are currently tagged
|
||||
*
|
||||
* @prams type api|lambda
|
||||
* @returns {Promise}
|
||||
*/
|
||||
JAWS.listAll = function(type) {
|
||||
var _this = this,
|
||||
cwd = process.cwd();
|
||||
|
||||
return utils.findAllLambdas(utils.findProjectRootPath(cwd))
|
||||
.then(function(lJawsJsonPaths) {
|
||||
if (!lJawsJsonPaths) {
|
||||
throw new JawsError('Could not find any lambdas', JawsError.errorCodes.UNKNOWN);
|
||||
}
|
||||
|
||||
var relPaths = [],
|
||||
attr = (type == 'lambda') ? 'lambda' : 'endpoint';
|
||||
|
||||
lJawsJsonPaths.forEach(function(ljp) {
|
||||
var jawsJson = require(ljp);
|
||||
if (jawsJson[attr] && jawsJson[attr].deploy == true) {
|
||||
console.log(ljp, cwd);
|
||||
relPaths.push(path.relative(cwd, ljp));
|
||||
}
|
||||
});
|
||||
|
||||
return Promise.all(relPaths);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user