Skip to content

Commit

Permalink
Add default package includes for .wsgi_app and .requirements (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
logandk committed Aug 8, 2017
1 parent 433fc44 commit 1eaad2d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# 1.2.2
## Features
* Add default package includes for `.wsgi_app` and `.requirements`

## Bugs
* Fix requirement packaging on Mac OS with Python 3.6 (Anaconda)

Expand Down
8 changes: 8 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@ class ServerlessWSGI {
this.wsgiApp = this.serverless.service.custom.wsgi.app;
this.appPath = path.dirname(path.join(this.serverless.config.servicePath, this.wsgiApp));
}

this.serverless.service.package = this.serverless.service.package || {};
this.serverless.service.package.include = this.serverless.service.package.include || [];

this.serverless.service.package.include = _.union(
this.serverless.service.package.include,
['.wsgi_app', '.requirements/**']
);
}

packWsgiHandler() {
Expand Down
5 changes: 4 additions & 1 deletion index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ describe('serverless-wsgi', function() {
]
)).to.be.ok;
sandbox.restore();
expect(plugin.serverless.service.package.include).to.have.members(['.wsgi_app', '.requirements/**']);
});
});

Expand Down Expand Up @@ -112,7 +113,8 @@ describe('serverless-wsgi', function() {
var plugin = new Plugin({
config: { servicePath: '/tmp' },
service: {
custom: { wsgi: { app: 'api.app' } }
custom: { wsgi: { app: 'api.app' } },
package: { include: ['sample.txt'] }
},
classes: { Error: Error },
cli: { log: function () {} }
Expand All @@ -137,6 +139,7 @@ describe('serverless-wsgi', function() {
'/tmp/.requirements'
]
)).to.be.ok;
expect(plugin.serverless.service.package.include).to.have.members(['sample.txt', '.wsgi_app', '.requirements/**']);
sandbox.restore();
});
});
Expand Down

0 comments on commit 1eaad2d

Please sign in to comment.