lambda_wrap 0.4.0 → 0.5.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 +4 -4
- data/lib/lambda_wrap/api_gateway_manager.rb +17 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f3d075ab1f624fab81fbe83e804b36193668737
|
4
|
+
data.tar.gz: c91d33e60d96afd88d3b5025014acb17a3b24cc7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e8acfb158dbaa0038d4add1060174d6b3236af90a2d23c5248e3be5fe3bc16a2272761a3be5d9f9c02024ec29ad10d80ca1e6e57b8153a95320b97e0283ecdd
|
7
|
+
data.tar.gz: d8382822322779ff0e83c06ad2880691188bba498ef7290f7c42134e13c5fda02b73266e9cb7150cec3ceb4c5327fc0045c6d87dcc84f2f578777d2dd3389901
|
@@ -21,6 +21,7 @@ module LambdaWrap
|
|
21
21
|
@client = Aws::APIGateway::Client.new()
|
22
22
|
# path to apigateway-importer jar
|
23
23
|
@jarpath = File.join(Dir.tmpdir, 'aws-apigateway-importer-1.0.3-SNAPSHOT-jar-with-dependencies.jar')
|
24
|
+
@versionpath = File.join(Dir.tmpdir, 'aws-apigateway-importer-1.0.3-SNAPSHOT-jar-with-dependencies.s3version')
|
24
25
|
end
|
25
26
|
|
26
27
|
##
|
@@ -32,12 +33,23 @@ module LambdaWrap
|
|
32
33
|
# *Arguments*
|
33
34
|
# [s3_bucket] An S3 bucket from where the aws-apigateway-importer binary can be downloaded.
|
34
35
|
# [s3_key] The path (key) to the aws-apigateay-importer binary on the s3 bucket.
|
35
|
-
def download_apigateway_importer(s3_bucket, s3_key)
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
def download_apigateway_importer(s3_bucket, s3_key)
|
37
|
+
|
38
|
+
s3 = Aws::S3::Client.new
|
39
|
+
|
40
|
+
# current version
|
41
|
+
current_s3_version = File.open(@versionpath, 'rb').read if File.exists?(@versionpath)
|
42
|
+
|
43
|
+
# online s3 version
|
44
|
+
desired_s3_version = s3.head_object(bucket:s3_bucket, key:s3_key).version_id
|
45
|
+
|
46
|
+
# compare local with remote version
|
47
|
+
if current_s3_version != desired_s3_version || !File.exists?(@jarpath)
|
48
|
+
puts "Downloading aws-apigateway-importer jar with S3 version #{desired_s3_version}"
|
39
49
|
obj = s3.get_object(response_target:@jarpath, bucket:s3_bucket, key:s3_key)
|
40
|
-
|
50
|
+
File.write(@versionpath, desired_s3_version)
|
51
|
+
end
|
52
|
+
|
41
53
|
end
|
42
54
|
|
43
55
|
##
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lambda_wrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Markus Thurner
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-01-
|
12
|
+
date: 2016-01-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: aws-sdk
|