Skip to content

Commit 1387fea

Browse files
Removing Coming up section from Readme (#19)
* Updating README.md * Updating the README.md * Fixing the plugin context issue, updating readme
1 parent c0c975b commit 1387fea

File tree

2 files changed

+37
-39
lines changed

2 files changed

+37
-39
lines changed

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Like this: `"plugins": ["serverless-dynamodb-local"]`
2929

3030
## Starting Dynamodb Local
3131

32-
In your project root run:
32+
In your project root run (Note: Run this command first before any other command, since it will download the dynamodb local during the first run):
3333
`sls dynamodb start`
3434

3535
DynamoDB will process incoming requests until you stop it. To stop DynamoDB, type Ctrl+C in the command prompt window
@@ -47,7 +47,7 @@ All CLI options are optional:
4747
--create -c After starting dynamodb local, create dynamodb tables and run seeds. Check the "Manage tables and seeds" section for more information.
4848
```
4949

50-
All the above options can be added to s-function.json to set default configuration: e.g
50+
All the above options can be added to s-project.json to set default configuration: e.g
5151

5252
```json
5353
"custom": {
@@ -129,10 +129,6 @@ Open a browser and go to the url http://localhost:8000/shell to access the web s
129129

130130
Note: Default port: 8000 and if you change the port, change it accordingly in usage
131131

132-
## Coming up
133-
134-
* Allow to create tables & run seeds remotely with a simple set of commands.
135-
136132
## Links
137133

138134
* [Dynamodb local documentation](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html)

index.js

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ module.exports = function (S) { // Always pass in the ServerlessPlugin Class
2323
*/
2424
registerActions() {
2525

26-
S.addAction(this._tables.bind(this), {
27-
handler: 'table',
26+
S.addAction(this.table.bind(this), {
27+
handler: 'dynamodbTable',
2828
description: 'New dynamodb table template',
2929
context: 'dynamodb',
3030
contextAction: 'table',
@@ -38,14 +38,14 @@ module.exports = function (S) { // Always pass in the ServerlessPlugin Class
3838
description: 'Create dynamodb tables and run seeds'
3939
}]
4040
});
41-
S.addAction(this._removeDynamodb.bind(this), {
42-
handler: 'remove',
41+
S.addAction(this.remove.bind(this), {
42+
handler: 'dynamodbRemove',
4343
description: 'Remove dynamodb local database. This is needed if the installed version is currupted or needs to be upgraded.',
4444
context: 'dynamodb',
4545
contextAction: 'remove'
4646
});
47-
S.addAction(this._startDynamodb.bind(this), {
48-
handler: 'start',
47+
S.addAction(this.start.bind(this), {
48+
handler: 'dynamodbStart',
4949
description: 'Start dynamodb local database',
5050
context: 'dynamodb',
5151
contextAction: 'start',
@@ -95,43 +95,45 @@ module.exports = function (S) { // Always pass in the ServerlessPlugin Class
9595
* - You can also access other Project-specific data @ this.S Again, if you mess with data on this object, it could break everything, so make sure you know what you're doing ;)
9696
*/
9797

98-
_removeDynamodb() {
98+
remove() {
9999
return dynamodb.remove();
100100
}
101101

102-
_tables(evt) {
103-
let options = evt.options,
104-
config = S.getProject().custom.dynamodb,
105-
table = config && config.table || {},
106-
rootPath = S.getProject().getRootPath(),
107-
tablesPath = rootPath + '/' + (table.dir || 'dynamodb'),
108-
suffix = table.suffix || '',
109-
prefix = table.prefix || '';
102+
table(evt) {
103+
return new BbPromise(function (resolve, reject) {
104+
let options = evt.options,
105+
config = S.getProject().custom.dynamodb,
106+
table = config && config.table || {},
107+
rootPath = S.getProject().getRootPath(),
108+
tablesPath = rootPath + '/' + (table.dir || 'dynamodb'),
109+
suffix = table.suffix || '',
110+
prefix = table.prefix || '';
110111

111-
if (options.new) {
112-
return tables.newTemplate(options.new, tablesPath);
113-
} else if (options.create) {
114-
return tables.create(tablesPath, {
115-
prefix: prefix,
116-
suffix: suffix
117-
});
118-
}
112+
if (options.new) {
113+
tables.newTemplate(options.new, tablesPath).then(resolve, reject);
114+
} else if (options.create) {
115+
tables.create(tablesPath, {
116+
prefix: prefix,
117+
suffix: suffix
118+
}).then(resolve, reject);
119+
}
120+
});
119121
}
120122

121-
_startDynamodb(evt) {
122-
var self = this,
123-
config = S.getProject().custom.dynamodb;
124-
let options = _.merge({
125-
sharedDb: evt.options.sharedDb || true
126-
},
127-
evt.options,
128-
config && config.start
129-
);
123+
start(evt) {
124+
let self = this;
130125
return new BbPromise(function (resolve, reject) {
126+
let config = S.getProject().custom.dynamodb,
127+
options = _.merge({
128+
sharedDb: evt.options.sharedDb || true
129+
},
130+
evt.options,
131+
config && config.start
132+
);
131133
if (options.create) {
132134
dynamodb.start(options).then(function () {
133135
console.log(""); // seperator
134-
self._tables(evt).then(resolve, reject);
136+
self.table(evt).then(resolve, reject);
135137
});
136138
} else {
137139
dynamodb.start(options).then(resolve, reject);

0 commit comments

Comments
 (0)