cfhighlander 0.5.0.alpha.1537756555 → 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/README.md +4 -4
- data/lib/cfhighlander.compiler.rb +15 -15
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7b7c838fff4e882df269d587a0d5b2048110c578b427736aa585e1263356518c
|
|
4
|
+
data.tar.gz: 3c3550787154b47551e400e5dd62bb5f4a6da44f43581d89ebd805bd27752246
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9d7e9c626748c6abd2fe83868883f13b130920cc00fb18b4228d49f7c9494cbb9a08cc9e224faa12b283c9c4663699e8e34045e7ae98c9384e16de5fb42cf952
|
|
7
|
+
data.tar.gz: 0e332bd182449545b18abef13c834544f229a85c1c3a54b6a233ca621f96190969705fccdd2d187ad335d6d339f5eae32f4b81be82fe0136683e0d0ec86b86d4
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[](https://travis-ci.org/theonestack/cfhighlander)
|
|
1
|
+
[](https://travis-ci.org/theonestack/cfhighlander)
|
|
2
2
|
|
|
3
3
|
# Intro
|
|
4
4
|
|
|
@@ -39,7 +39,7 @@ has to be done manually - either if you build JSON/YAML templates by hand,
|
|
|
39
39
|
or if using `Cfndsl`. With cfhighlander, this code is automatically generated for you
|
|
40
40
|
|
|
41
41
|
```ruby
|
|
42
|
-
|
|
42
|
+
|
|
43
43
|
CfhighlanderTemplate do
|
|
44
44
|
|
|
45
45
|
# explicit configuration for vpc component
|
|
@@ -80,13 +80,13 @@ end
|
|
|
80
80
|
... compile the template with ...
|
|
81
81
|
|
|
82
82
|
```shell
|
|
83
|
-
cfcompile application
|
|
83
|
+
cfcompile application.cfhighlander.rb
|
|
84
84
|
```
|
|
85
85
|
|
|
86
86
|
... and check how the subnets are being passed around ..
|
|
87
87
|
|
|
88
88
|
```shell
|
|
89
|
-
$ cat out/yaml/
|
|
89
|
+
$ cat out/yaml/app.compiled.yaml | grep -A3 SubnetCompute0
|
|
90
90
|
SubnetCompute0:
|
|
91
91
|
Fn::GetAtt:
|
|
92
92
|
- vpc
|
|
@@ -246,41 +246,41 @@ module Cfhighlander
|
|
|
246
246
|
FileUtils.remove full_destination_path if File.exist? full_destination_path
|
|
247
247
|
|
|
248
248
|
# download file if code remote archive
|
|
249
|
-
puts "
|
|
250
|
-
puts "
|
|
249
|
+
puts "Packaging AWS Lambda function #{name}...\n"
|
|
250
|
+
puts "Destination archive is #{full_destination_path}"
|
|
251
251
|
|
|
252
252
|
md5 = Digest::MD5.new
|
|
253
253
|
md5.update lambda_config['code']
|
|
254
254
|
hash = md5.hexdigest
|
|
255
|
-
cached_location = "#{
|
|
255
|
+
cached_location = "#{@workdir}/.cache/lambdas/#{hash}"
|
|
256
256
|
if cached_downloads.key? lambda_config['code']
|
|
257
|
-
puts "
|
|
257
|
+
puts "Using already downloaded archive #{lambda_config['code']}"
|
|
258
258
|
FileUtils.copy(cached_downloads[lambda_config['code']], full_destination_path)
|
|
259
259
|
elsif File.file? cached_location
|
|
260
|
-
puts "
|
|
260
|
+
puts "Using cached download - '#{cached_location}'"
|
|
261
261
|
FileUtils.copy(cached_location, full_destination_path)
|
|
262
262
|
else
|
|
263
263
|
if lambda_config['code'].include? 'http'
|
|
264
|
-
puts "INFO
|
|
264
|
+
puts "INFO Downloading lambda #{name} source from #{lambda_config['code']}"
|
|
265
265
|
download = open(lambda_config['code'])
|
|
266
266
|
IO.copy_stream(download, "#{out_folder}/src.zip")
|
|
267
|
-
FileUtils.mkdir_p(
|
|
267
|
+
FileUtils.mkdir_p('.cache/lambdas')
|
|
268
268
|
FileUtils.copy("#{out_folder}/src.zip", cached_location)
|
|
269
269
|
FileUtils.copy("#{out_folder}/src.zip", full_destination_path)
|
|
270
|
-
puts "INFO
|
|
270
|
+
puts "INFO lambda #{name} source cached to #{cached_location}"
|
|
271
271
|
cached_downloads[lambda_config['code']] = cached_location
|
|
272
272
|
elsif lambda_config['code'].include? 's3://'
|
|
273
273
|
parts = lambda_config['code'].split('/')
|
|
274
274
|
if parts.size < 4
|
|
275
|
-
STDERR.puts "ERROR
|
|
275
|
+
STDERR.puts "ERROR: Lambda function source code from s3 should be in s3://bucket/path format"
|
|
276
276
|
exit -8
|
|
277
277
|
end
|
|
278
278
|
bucket = parts[2]
|
|
279
279
|
key = parts.drop(3).join('/')
|
|
280
280
|
s3 = Aws::S3::Client.new({ region: s3_bucket_region(bucket) })
|
|
281
|
-
puts "INFO
|
|
281
|
+
puts "INFO Downloading lambda #{name} source from #{lambda_config['code']}"
|
|
282
282
|
s3.get_object({ bucket: bucket, key: key, response_target: cached_location })
|
|
283
|
-
puts "INFO
|
|
283
|
+
puts "INFO lambda #{name} source cached to #{cached_location}"
|
|
284
284
|
FileUtils.copy(cached_location, full_destination_path)
|
|
285
285
|
cached_downloads[lambda_config['code']] = cached_location
|
|
286
286
|
else
|
|
@@ -297,7 +297,7 @@ module Cfhighlander
|
|
|
297
297
|
component_dir = nil unless parent_exists
|
|
298
298
|
end
|
|
299
299
|
if component_dir.nil?
|
|
300
|
-
STDERR.puts "ERROR
|
|
300
|
+
STDERR.puts "ERROR: Could not find source code directory for lambda function #{name} in component #{@component.name}"
|
|
301
301
|
exit -9
|
|
302
302
|
end
|
|
303
303
|
|
|
@@ -316,7 +316,7 @@ module Cfhighlander
|
|
|
316
316
|
|
|
317
317
|
# Lambda function source code allows pre-processing (e.g. install code dependencies)
|
|
318
318
|
unless lambda_config['package_cmd'].nil?
|
|
319
|
-
puts "
|
|
319
|
+
puts "Following code will be executed to generate lambda function #{name}:\n\n#{lambda_config['package_cmd']}\n\n"
|
|
320
320
|
|
|
321
321
|
if @confirm_code_execution
|
|
322
322
|
exit -7 unless HighLine.agree('Proceed (y/n)?')
|
|
@@ -326,7 +326,7 @@ module Cfhighlander
|
|
|
326
326
|
puts 'Processing package command...'
|
|
327
327
|
package_result = system(package_cmd)
|
|
328
328
|
unless package_result
|
|
329
|
-
puts "
|
|
329
|
+
puts "Error packaging lambda function, following command failed\n\n#{package_cmd}\n\n"
|
|
330
330
|
exit -4
|
|
331
331
|
end
|
|
332
332
|
end
|
|
@@ -342,7 +342,7 @@ module Cfhighlander
|
|
|
342
342
|
end
|
|
343
343
|
sha256 = Digest::SHA256.file full_destination_path
|
|
344
344
|
sha256 = sha256.base64digest
|
|
345
|
-
puts "
|
|
345
|
+
puts "Created zip package #{full_destination_path} for lambda #{name} with digest #{sha256}"
|
|
346
346
|
@metadata['sha256'][name] = sha256
|
|
347
347
|
@metadata['version'][name] = timestamp
|
|
348
348
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cfhighlander
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.0
|
|
4
|
+
version: 0.5.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nikola Tosic
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
autorequire:
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2018-09-
|
|
13
|
+
date: 2018-09-03 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: highline
|
|
@@ -278,9 +278,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
278
278
|
version: '0'
|
|
279
279
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
280
280
|
requirements:
|
|
281
|
-
- - "
|
|
281
|
+
- - ">="
|
|
282
282
|
- !ruby/object:Gem::Version
|
|
283
|
-
version:
|
|
283
|
+
version: '0'
|
|
284
284
|
requirements: []
|
|
285
285
|
rubyforge_project:
|
|
286
286
|
rubygems_version: 2.7.7
|