rumbda 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bee1aed26ff8b5a992de1babad49ec150b8f5f6d
4
- data.tar.gz: d9783a813ebf8ed9d1f2b7306eccedb97db73ed6
3
+ metadata.gz: 9bb0b519c0f83fda894220d3b81d5b029a06964c
4
+ data.tar.gz: 4424dbe397c952ad834b1b25d6a45691be03a390
5
5
  SHA512:
6
- metadata.gz: 6e4f3d10e848a83f1dfe2b427538d6935a60ec4135ab3e7e6b009d821832f19192ea8f6609680cdcccb2a605453e6d46997370d0281d11653c92ec1a4f4167f8
7
- data.tar.gz: 6add15aa81a4183d15bd1b627e16b01b82d862f5961ffd583830f2d6c0e7661ab325a66aa8cc82869bf01c003e0f1321461392e8f026c3c65695d0703c657207
6
+ metadata.gz: 986cab720f0a0b5f2cfb9c77f69b15bbc12a2d814d369c67b553ef524404720e4d9014d1a70507d5a7e93e06f4ea0db78a2ae709d8814e0c7513fdecb68a0386
7
+ data.tar.gz: 9848ffec187755d1a46a33f0ccd6d47f9c91ddf70329253ae62002f951de8ecb7346239f881141b60ff4f7a5711be3340aaba3eb95f553af25437d7d47a7aaff
@@ -1,10 +1,33 @@
1
1
  const exec = require('child_process').exec;
2
+ const fs = require('fs');
2
3
 
3
- exports.handler = function(event, context) {
4
- const child = exec('./ruby_wrapper ' + "'" + JSON.stringify(event) + "'", (result) => {
5
- context.done(result);
4
+ exports.handler = function(event, context, callback) {
5
+ // In order to return a value and not deal with stdout rumbda watches a file.
6
+ const jsonFilePath = '/tmp/rumbda.' + Math.random() + '.json';
7
+ process.env['RUMBDA_RESULT_JSON_FILENAME'] = jsonFilePath;
8
+
9
+ const child = exec('./ruby_wrapper ' + "'" + JSON.stringify(event) + "'", (error, stdout, stderr) => {
10
+ if (error) {
11
+ callback(error);
12
+ return;
13
+ }
14
+
15
+ if (fs.existsSync(jsonFilePath)) {
16
+ fs.readFile(jsonFilePath, 'utf8', function (err, data) {
17
+ fs.unlink(jsonFilePath);
18
+
19
+ if (err) {
20
+ callback(err);
21
+ return;
22
+ }
23
+ callback(null, (data.length > 0) ? JSON.parse(data) : null);
24
+ });
25
+ } else {
26
+ callback(null);
27
+ }
6
28
  });
7
29
 
8
30
  child.stdout.on('data', console.log);
9
31
  child.stderr.on('data', console.error);
10
32
  };
33
+
@@ -1,3 +1,3 @@
1
1
  module Rumbda
2
- VERSION = '1.0.0'.freeze
2
+ VERSION = '1.1.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rumbda
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - kleaver
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-21 00:00:00.000000000 Z
11
+ date: 2017-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor