Florian Motlik 83a99b598a Merge pull request #1808 from johncmckim/issue-1496
WIP: Add DRYrun support
2016-08-16 10:34:39 +02:00

54 lines
1.5 KiB
JavaScript

'use strict';
const BbPromise = require('bluebird');
const validate = require('../lib/validate');
const createStack = require('./lib/createStack');
const mergeCustomProviderResources = require('./lib/mergeCustomProviderResources');
const uploadDeploymentPackage = require('./lib/uploadDeploymentPackage');
const deployFunctions = require('./lib/deployFunctions');
const updateStack = require('./lib/updateStack');
const SDK = require('../');
class AwsDeploy {
constructor(serverless, options) {
this.serverless = serverless;
this.options = options;
this.provider = 'aws';
this.sdk = new SDK(serverless);
Object.assign(
this,
validate,
createStack,
mergeCustomProviderResources,
uploadDeploymentPackage,
deployFunctions,
updateStack
);
this.hooks = {
'before:deploy:initialize': () => BbPromise.bind(this)
.then(this.validate),
'deploy:setupProviderConfiguration': () => BbPromise.bind(this).then(this.createStack),
'before:deploy:deploy': () => BbPromise.bind(this).then(this.mergeCustomProviderResources),
'deploy:deploy': () => BbPromise.bind(this)
.then(this.uploadDeploymentPackage)
.then(this.deployFunctions)
.then(this.updateStack)
.then(() => {
const msg = this.options.noDeploy ?
'Did not deploy due to --noDeploy' :
'Deployment successful!';
this.serverless.cli.log(msg);
}),
};
}
}
module.exports = AwsDeploy;