cfhighlander 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cfhighlander.compiler.rb +18 -7
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 303e58de44d1c04b2e1bc15115e8d8c030536f2223dfce4db0b4de285ad23dd3
4
- data.tar.gz: 866caf19ad7d8f9edd47997834c2591c81d4dfceb00f503f9d1b6775f73aa1ad
3
+ metadata.gz: f21fd5ed213981ccad9e067ac5ddef3d514bf7b2068502b2af1a7a95b9884718
4
+ data.tar.gz: 9828daf82341fe563f88828ef00346395575ef29fd405c53093caf1c0cb02c14
5
5
  SHA512:
6
- metadata.gz: 14d0a175c2b2d26164beab92d23bc65b24284b352d5ab0ef765cc78b7383823c80c5227c64eddc35430d8cd068a1b11ba9a38f854d3681e0fcf2bd77d4a2fbf4
7
- data.tar.gz: 5f3a411115a6d4db1c5839eac05d8a5eaf2ddd9618049c1ab3e4b93f2b0b92bc595843937298e275927a89ab9fe30323f5d49d403226365de1d3a85018385979
6
+ metadata.gz: 7bec060a285e620fab51464acd4c3dc8c4cc0376867abe9711affead8f2b02c13038c3e305e4e6b1ffa7a690d62e8450c3c04d1a125d9b7e8753c38a9f8537de
7
+ data.tar.gz: d1e47a92493c6c2c72a92a342025ea666dbebfd23fc49b9335c532a12fd96dadcf12e9f08dfd61a14417213db52ea7478e68f554a88363869d0a31e37866d4ee
@@ -50,7 +50,7 @@ module Cfhighlander
50
50
 
51
51
  if @@global_extensions_paths.empty?
52
52
  global_extensions_folder = "#{File.dirname(__FILE__)}/../cfndsl_ext"
53
- Dir["#{global_extensions_folder}/*.rb"].each { |f| @@global_extensions_paths << f }
53
+ Dir["#{global_extensions_folder}/*.rb"].each {|f| @@global_extensions_paths << f}
54
54
  end
55
55
 
56
56
  @component.highlander_dsl.subcomponents.each do |sub_component|
@@ -62,12 +62,12 @@ module Cfhighlander
62
62
 
63
63
  def process_lambdas=(value)
64
64
  @process_lambdas = value
65
- @sub_components.each { |scc| scc.process_lambdas=value }
65
+ @sub_components.each {|scc| scc.process_lambdas = value}
66
66
  end
67
67
 
68
68
  def silent_mode=(value)
69
69
  @silent_mode = value
70
- @sub_components.each { |scc| scc.silent_mode=value }
70
+ @sub_components.each {|scc| scc.silent_mode = value}
71
71
  end
72
72
 
73
73
  def compileCfnDsl(out_format)
@@ -76,7 +76,7 @@ module Cfhighlander
76
76
  dsl = @component.highlander_dsl
77
77
  component_cfndsl = @component.cfndsl_content
78
78
 
79
- @component.highlander_dsl.subcomponents.each { |sc|
79
+ @component.highlander_dsl.subcomponents.each {|sc|
80
80
  sc.distribution_format = out_format
81
81
  }
82
82
 
@@ -89,7 +89,7 @@ module Cfhighlander
89
89
  'dsl' => dsl,
90
90
  'component_cfndsl' => component_cfndsl,
91
91
  'component_requires' => (@@global_extensions_paths + @component.cfndsl_ext_files)
92
- }).instance_eval { binding })
92
+ }).instance_eval {binding})
93
93
 
94
94
  # write to output file
95
95
  output_dir = "#{@workdir}/out/cfndsl"
@@ -100,7 +100,7 @@ module Cfhighlander
100
100
  puts "cfndsl template for #{dsl.name} written to #{output_path}"
101
101
  @cfndsl_compiled_path = output_path
102
102
 
103
- @sub_components.each { |subcomponent_compiler|
103
+ @sub_components.each {|subcomponent_compiler|
104
104
  puts "Rendering sub-component cfndsl: #{subcomponent_compiler.component_name}"
105
105
  subcomponent_compiler.compileCfnDsl out_format
106
106
  }
@@ -232,8 +232,16 @@ module Cfhighlander
232
232
  file_name = "#{name}.#{@component.name}.#{@component.version}.#{timestamp}.zip"
233
233
  @metadata['path'][name] = file_name
234
234
  full_destination_path = "#{out_folder}#{file_name}"
235
+ info_path = "#{out_folder}#{file_name}.info.yaml"
235
236
  archive_paths << full_destination_path
236
237
  FileUtils.mkdir_p out_folder
238
+ File.write(info_path, {
239
+ 'component' => @component.name,
240
+ 'function' => name,
241
+ 'packagedAt' => timestamp,
242
+ 'config' => lambda_config
243
+ }.to_yaml)
244
+
237
245
  # clear destination if already there
238
246
  FileUtils.remove full_destination_path if File.exist? full_destination_path
239
247
 
@@ -302,7 +310,10 @@ module Cfhighlander
302
310
  zip_generator.write
303
311
 
304
312
  end
305
-
313
+ # add version information to avoid same package ever deployed 2 times
314
+ Zip::File.open(full_destination_path) do |zipfile|
315
+ zipfile.add 'hlpackage_info.txt', info_path
316
+ end
306
317
  sha256 = Digest::SHA256.file full_destination_path
307
318
  sha256 = sha256.base64digest
308
319
  puts "Created zip package #{full_destination_path} for lambda #{name} with digest #{sha256}"
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.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikola Tosic
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-07-13 00:00:00.000000000 Z
12
+ date: 2018-07-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: highline