cfhighlander 0.3.3 → 0.4.0.alpha.1531468125

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: 05f4776ad4b7fdda865a75512c7510d8afbc399af0d7bee1e057d2b4eba2fa70
4
- data.tar.gz: 41768db26a4ddab7f0e4f8ef9f6f0eb7a1556ec17758d1b0c8e2cb764786da54
3
+ metadata.gz: 1b7f58f63b43165d981517f1889394622596a4bb29310603cace6a499a97eae0
4
+ data.tar.gz: 036e82c1936b723258a06d1629925090f683072220c767a3abf6f0bd18631f71
5
5
  SHA512:
6
- metadata.gz: 607cf05d6e3db3bfb3654724b1094955441fdc8645ddb0bbbfe7d0f564b49f80e1f3ea2e6148802448c32f20c9491899f931306c267326fc9eac5d2f684b139b
7
- data.tar.gz: 078d9cfd9d16cd1db1deaa36d86ceacd08d412c99417b84ca1257ac91a270a43167abc94b4ec606b13b4fc46e9ad572ec4f5e3e18db6034fba1f202c8d8174ea
6
+ metadata.gz: c1a9d52b0cfb141b626c3ed80a9538195722be9c89fdbbcf61c370729e7acebafea26ff286c0f06492854a78a9099e7c3d830529e7ffb7b43fc839b4843c779a
7
+ data.tar.gz: 862f7dccfe02cd336f6606acc12b2fd4e5a22c2eaec135e41e73520eb507b1c6b1a2f5fb63da7c5d0770d82b22a7b884e9e21c84a43058e3055dc74fc65ddb58
@@ -61,9 +61,6 @@ def render_lambda_functions(cfndsl, lambdas, lambda_metadata, distribution)
61
61
  FunctionName(Ref(name))
62
62
  Action('lambda:InvokeFunction')
63
63
  Principal(source['principal'])
64
- if source.key? 'source_arn'
65
- SourceArn source['source_arn']
66
- end
67
64
  end
68
65
  i += 1
69
66
  end
@@ -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,16 +232,8 @@ 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"
236
235
  archive_paths << full_destination_path
237
236
  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
-
245
237
  # clear destination if already there
246
238
  FileUtils.remove full_destination_path if File.exist? full_destination_path
247
239
 
@@ -271,25 +263,14 @@ module Cfhighlander
271
263
  end
272
264
  else
273
265
  # zip local code
274
- component = @component
275
- component_dir = component.template.template_location
276
- full_path = "#{component_dir}/lambdas/#{lambda_config['code']}"
277
-
278
- until (File.exist? full_path or component_dir.nil?)
279
- parent_exists = (not component.extended_component.nil?)
280
- component = component.extended_component if parent_exists
281
- component_dir = component.template.template_location if parent_exists
282
- full_path = "#{component_dir}/lambdas/#{lambda_config['code']}" if parent_exists
283
- component_dir = nil unless parent_exists
284
- end
285
- if component_dir.nil?
286
- STDERR.puts "ERROR: Could not find source code directory for lambda function #{name} in component #{@component.name}"
287
- exit -9
288
- end
266
+ zip_options = ''
267
+ full_path = "#{@component_dir}/lambdas/#{lambda_config['code']}"
289
268
 
290
269
  # lambda source can be either path to file or directory within that file
291
270
  # optionally, lambda source code
292
271
  lambda_source_dir = File.dirname(full_path)
272
+ lambda_source_file = File.basename(full_path)
273
+ lambda_source_file = '.' if Pathname.new(full_path).directory?
293
274
  lambda_source_dir = full_path if Pathname.new(full_path).directory?
294
275
 
295
276
  # executing package command can generate files. We DO NOT want this file in source directory,
@@ -321,10 +302,7 @@ module Cfhighlander
321
302
  zip_generator.write
322
303
 
323
304
  end
324
- # add version information to avoid same package ever deployed 2 times
325
- Zip::File.open(full_destination_path) do |zipfile|
326
- zipfile.add 'hlpackage_info.txt', info_path
327
- end
305
+
328
306
  sha256 = Digest::SHA256.file full_destination_path
329
307
  sha256 = sha256.base64digest
330
308
  puts "Created zip package #{full_destination_path} for lambda #{name} with digest #{sha256}"
@@ -5,7 +5,6 @@ module Cfhighlander
5
5
 
6
6
  attr_accessor :config
7
7
 
8
- # intrinsic functions
9
8
 
10
9
  def GetAtt(resource, property)
11
10
  return FnGetAtt(resource, property)
@@ -17,94 +16,6 @@ module Cfhighlander
17
16
  }
18
17
  end
19
18
 
20
- def FnImportValue(value)
21
- return {
22
- 'Fn::ImportValue' => value
23
- }
24
- end
25
-
26
- def FnSub(string, replacementMap = nil)
27
- if replacementMap.nil?
28
- return { 'Fn::Sub' => string }
29
- else
30
- return { 'Fn::Sub' => [string, replacementMap] }
31
- end
32
- end
33
-
34
- def FnSplit(delimiter, source)
35
- return { 'Fn::Split' => [delimiter, source] }
36
- end
37
-
38
- def FnSelect(index, list)
39
- return { 'Fn::Select' => [index, list] }
40
- end
41
-
42
- def FnGetAZs(region = nil)
43
- if region.nil?
44
- region = AWSStackRegion()
45
- end
46
- return { 'Fn::GetAZs' => region }
47
- end
48
-
49
- def FnCidr(ip_block, count, sizeMask)
50
- return { 'Fn::Cidr' => [ip_block, count, sizeMask] }
51
- end
52
-
53
- def FnBase64(value)
54
- return { 'Fn::Base64' => value }
55
- end
56
-
57
- # pseudo reference
58
- def AWSStackRegion
59
- return Ref('AWS::Region')
60
- end
61
-
62
- def AWSStackName
63
- return Ref('AWS::StackName')
64
- end
65
-
66
- def AWSAccountId
67
- return Ref('AWS::AccountId')
68
- end
69
-
70
- def AWSURLSuffix
71
- return Ref('AWS::URLSuffix')
72
- end
73
-
74
- def AWSPartition
75
- return Ref('AWS::Partition')
76
- end
77
-
78
- def AWSNoValue
79
- return Ref('AWS::NoValue')
80
- end
81
-
82
- def AWSNotificationARNs
83
- return Ref('AWS::NotificationARNs')
84
- end
85
-
86
- # logic intrinsic functions
87
- def FnIf(condition, true_branch, false_branch)
88
- return { 'Fn::If' => [condition, true_branch, false_branch] }
89
- end
90
-
91
- def FnAnd(*args)
92
- return { 'Fn::And' => args }
93
- end
94
-
95
- def FnEquals(val1, val2)
96
- return { 'Fn::Equals' => [val1, val2] }
97
- end
98
-
99
- def FnNot(condition)
100
- return { 'Fn::Not' => [condition] }
101
- end
102
-
103
- def FnOr(*args)
104
- return { 'Fn::Or' => args }
105
- end
106
-
107
-
108
19
  def Ref(resource)
109
20
  return {
110
21
  'Ref' => resource
@@ -174,7 +174,7 @@ module Cfhighlander
174
174
  if not @parent_template.nil?
175
175
  extended_component = @factory.loadComponentFromTemplate(@parent_template)
176
176
  extended_component.is_parent_component = true
177
- extended_component.load(@config)
177
+ extended_component.load()
178
178
 
179
179
  @config = extended_component.config.extend(@config)
180
180
  @mappings = extended_component.mappings.extend(@mappings)
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cfhighlander
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.0.alpha.1531468125
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikola Tosic
8
8
  - Aaron Walker
9
- - Angus Vine
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2018-07-17 00:00:00.000000000 Z
12
+ date: 2018-07-13 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: highline
@@ -278,9 +277,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
278
277
  version: '0'
279
278
  required_rubygems_version: !ruby/object:Gem::Requirement
280
279
  requirements:
281
- - - ">="
280
+ - - ">"
282
281
  - !ruby/object:Gem::Version
283
- version: '0'
282
+ version: 1.3.1
284
283
  requirements: []
285
284
  rubyforge_project:
286
285
  rubygems_version: 2.7.7