cfhighlander 0.5.0 → 0.6.0.alpha.1537958909

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
  SHA256:
3
- metadata.gz: 7b7c838fff4e882df269d587a0d5b2048110c578b427736aa585e1263356518c
4
- data.tar.gz: 3c3550787154b47551e400e5dd62bb5f4a6da44f43581d89ebd805bd27752246
3
+ metadata.gz: 49b0dbff944645174441291c571ae7445e47948053cefffec5ddec0532aa2aa4
4
+ data.tar.gz: 7b466c6db9775530110f811c4c27d90f328de3bfbacc99ceceecf1a5baddbbb1
5
5
  SHA512:
6
- metadata.gz: 9d7e9c626748c6abd2fe83868883f13b130920cc00fb18b4228d49f7c9494cbb9a08cc9e224faa12b283c9c4663699e8e34045e7ae98c9384e16de5fb42cf952
7
- data.tar.gz: 0e332bd182449545b18abef13c834544f229a85c1c3a54b6a233ca621f96190969705fccdd2d187ad335d6d339f5eae32f4b81be82fe0136683e0d0ec86b86d4
6
+ metadata.gz: d5aec709945685df36917fcdfff437e783ff756eb17dc87b8e12f99373a289bfc19989efc4fa92510b20b2a30f65f00ec91407bcd723fc8df2b370efe6bc0c61
7
+ data.tar.gz: a7d0604958ebebd14b8f03f8b8cecbc5b1b39027878e3beb31775540c1a895bf4cd8bdeb6e67d2530ca2935cb5a6439e9fa1071d2d3c3e8a1081726564a7149e
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- [![Build Status](https://travis-ci.org/theonestack/cfhighlander.svg?branch=develop)](https://travis-ci.org/theonestack/cfhighlander)
1
+ [![Build Status](https://travis-ci.org/theonestack/cfhighlander.svg?branch=develop)](https://travis-ci.org/theonestack/cfhighlander) [![Join the chat at https://gitter.im/theonestack/cfhighlander](https://badges.gitter.im/theonestack/cfhighlander.svg)](https://gitter.im/theonestack/cfhighlander?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
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
+ ## place contents below in file name application.cfhighlander.rb
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.cfhighlander.rb
83
+ cfcompile application
84
84
  ```
85
85
 
86
86
  ... and check how the subnets are being passed around ..
87
87
 
88
88
  ```shell
89
- $ cat out/yaml/app.compiled.yaml | grep -A3 SubnetCompute0
89
+ $ cat out/yaml/application.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 "Packaging AWS Lambda function #{name}...\n"
250
- puts "Destination archive is #{full_destination_path}"
249
+ puts "INFO | Lambda #{name} | Start package process"
250
+ puts "INFO | Lambda #{name} | Destination 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 = "#{@workdir}/.cache/lambdas/#{hash}"
255
+ cached_location = "#{ENV['HOME']}/.cfhighlander/cache/lambdas/#{hash}"
256
256
  if cached_downloads.key? lambda_config['code']
257
- puts "Using already downloaded archive #{lambda_config['code']}"
257
+ puts "INFO | Lambda #{name} | 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 "Using cached download - '#{cached_location}'"
260
+ puts "INFO | Lambda #{name} | Using cache from #{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 Downloading lambda #{name} source from #{lambda_config['code']}"
264
+ puts "INFO | Lambda #{name} | Downloading 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('.cache/lambdas')
267
+ FileUtils.mkdir_p("#{ENV['HOME']}/.cfhighlander/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 lambda #{name} source cached to #{cached_location}"
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: Lambda function source code from s3 should be in s3://bucket/path format"
275
+ STDERR.puts "ERROR | Lambda #{name} | 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 Downloading lambda #{name} source from #{lambda_config['code']}"
281
+ puts "INFO | Lambda #{name} | Downloading source from #{lambda_config['code']}"
282
282
  s3.get_object({ bucket: bucket, key: key, response_target: cached_location })
283
- puts "INFO lambda #{name} source cached to #{cached_location}"
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: Could not find source code directory for lambda function #{name} in component #{@component.name}"
300
+ STDERR.puts "ERROR | Lambda #{name} | Could not find source code directory 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 "Following code will be executed to generate lambda function #{name}:\n\n#{lambda_config['package_cmd']}\n\n"
319
+ puts "INFO | Lambda #{name} | 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 "Error packaging lambda function, following command failed\n\n#{package_cmd}\n\n"
329
+ puts "ERROR | Lambda #{name} | create package - 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 "Created zip package #{full_destination_path} for lambda #{name} with digest #{sha256}"
345
+ puts "INFO | Lambda #{name} | Created zip package #{full_destination_path} 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.6.0.alpha.1537958909
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-03 00:00:00.000000000 Z
13
+ date: 2018-09-26 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: '0'
283
+ version: 1.3.1
284
284
  requirements: []
285
285
  rubyforge_project:
286
286
  rubygems_version: 2.7.7