|
3 | 3 | const _ = require('lodash'),
|
4 | 4 | BbPromise = require('bluebird'),
|
5 | 5 | tables = require('./tables/core'),
|
6 |
| - dynamodb = require('./dynamodb/core'); |
| 6 | + dynamodb = require('./dynamodb/core'), |
| 7 | + dynamodbLocal = require('dynamodb-localhost'); |
7 | 8 |
|
8 | 9 | module.exports = function(S) { // Always pass in the ServerlessPlugin Class
|
9 | 10 | const SCli = require(S.getServerlessPath('utils/cli'));
|
@@ -45,6 +46,12 @@ module.exports = function(S) { // Always pass in the ServerlessPlugin Class
|
45 | 46 | context: 'dynamodb',
|
46 | 47 | contextAction: 'remove'
|
47 | 48 | });
|
| 49 | + S.addAction(this.install.bind(this), { |
| 50 | + handler: 'dynamodbInstall', |
| 51 | + description: 'Install dynamodb local database. This is a single time operation.', |
| 52 | + context: 'dynamodb', |
| 53 | + contextAction: 'install' |
| 54 | + }); |
48 | 55 | S.addAction(this.start.bind(this), {
|
49 | 56 | handler: 'dynamodbStart',
|
50 | 57 | description: 'Start dynamodb local database',
|
@@ -101,7 +108,17 @@ module.exports = function(S) { // Always pass in the ServerlessPlugin Class
|
101 | 108 | */
|
102 | 109 |
|
103 | 110 | remove() {
|
104 |
| - return dynamodb.remove(); |
| 111 | + //return dynamodb.remove(); |
| 112 | + return dynamodbLocal.remove(function(){ |
| 113 | + |
| 114 | + }); |
| 115 | + } |
| 116 | + |
| 117 | + install() { |
| 118 | + //return dynamodb.remove(); |
| 119 | + return dynamodbLocal.install(function(){ |
| 120 | + |
| 121 | + }); |
105 | 122 | }
|
106 | 123 |
|
107 | 124 | table(evt) {
|
@@ -132,18 +149,16 @@ module.exports = function(S) { // Always pass in the ServerlessPlugin Class
|
132 | 149 | options = _.merge({
|
133 | 150 | sharedDb: evt.options.sharedDb || true
|
134 | 151 | },
|
135 |
| - evt.options, { downloadFrom: config.downloadFrom }, |
| 152 | + evt.options, |
136 | 153 | config && config.start
|
137 |
| - ), |
138 |
| - _spinner = SCli.spinner(); |
| 154 | + ); |
139 | 155 | if (options.create) {
|
140 |
| - dynamodb.start(options).then(function() { |
| 156 | + dynamodbLocal.start(options).then(function() { |
141 | 157 | console.log(""); // seperator
|
142 | 158 | self.table(evt).then(resolve, reject);
|
143 | 159 | });
|
144 | 160 | } else {
|
145 |
| - _spinner.start(); |
146 |
| - dynamodb.start(options, _spinner).then(resolve, reject); |
| 161 | + dynamodbLocal.start(options).then(resolve, reject); |
147 | 162 | }
|
148 | 163 | });
|
149 | 164 | }
|
|
0 commit comments