@@ -6,6 +6,8 @@ const readline = require('readline');
66
77const GdwAwsLambda = require ( '../lib/main' ) ;
88
9+ const lambda = new GdwAwsLambda ( ) ;
10+
911const CMD_INIT = 'init' ;
1012const CMD_TEST = 'test' ;
1113const CMD_DEPLOY = 'deploy' ;
@@ -49,7 +51,7 @@ function processCommand () {
4951 switch ( args [ 2 ] ) {
5052 case CMD_INIT :
5153
52- GdwAwsLambda . init ( )
54+ lambda . init ( )
5355 . then (
5456 ( result ) => {
5557
@@ -74,13 +76,13 @@ function processCommand () {
7476 switch ( remainingArguments . length ) {
7577 case 0 :
7678
77- GdwAwsLambda . test ( )
79+ lambda . test ( )
7880 . then ( onTestResult , onTestError ) ;
7981
8082 break ;
8183 case 1 :
8284
83- GdwAwsLambda . test ( remainingArguments [ 0 ] )
85+ lambda . test ( remainingArguments [ 0 ] )
8486 . then ( onTestResult , onTestError ) ;
8587
8688 break ;
@@ -92,7 +94,7 @@ function processCommand () {
9294 break ;
9395 case CMD_DEPLOY :
9496
95- GdwAwsLambda . deploy ( )
97+ lambda . deploy ( )
9698 . then ( onDeployResult , onDeployError ) ;
9799
98100 break ;
@@ -109,7 +111,7 @@ function onDeployError (error) {
109111
110112 askConfirmation (
111113 'Create AWS Lambda function (' +
112- GdwAwsLambda . lambdaCfg . FunctionName + ')?' ,
114+ lambda . lambdaCfg . FunctionName + ')?' ,
113115 true ,
114116 onConfirmation
115117 ) ;
@@ -119,7 +121,7 @@ function onDeployError (error) {
119121
120122 askConfirmation (
121123 'Update AWS Lambda function (' +
122- GdwAwsLambda . lambdaCfg . FunctionName + ') configuration?' ,
124+ lambda . lambdaCfg . FunctionName + ') configuration?' ,
123125 true ,
124126 onConfirmation
125127 ) ;
@@ -140,13 +142,13 @@ function onDeployError (error) {
140142 switch ( error ) {
141143 case GdwAwsLambda . ERR_LAMBDA_NOT_FOUND :
142144
143- GdwAwsLambda . deploy ( { create : true } )
145+ lambda . deploy ( { create : true } )
144146 . then ( onDeployResult , onErrorDeploy ) ;
145147
146148 break ;
147149 case GdwAwsLambda . ERR_LAMBDA_CONFIG :
148150
149- GdwAwsLambda . deploy ( { updateConfig : true } )
151+ lambda . deploy ( { updateConfig : true } )
150152 . then ( onDeployResult , onErrorDeploy ) ;
151153 }
152154
0 commit comments