aws_sam_yarn_builder 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec681650e83d331eeb1d02baada666601cfad67a0e5c90ead3c080881791783e
4
- data.tar.gz: 648cf5ac65aff8c2fcac1def5067e62832082eba9b8969c6741e6c50b8dbebd8
3
+ metadata.gz: 762229d65b7e22d038b3ab516aee8c0dab2a2c769b7dbe258db3b4324fcfee66
4
+ data.tar.gz: 7cc91f7e9cb33c33e1cda52a5d29eefacdd3493ac28caf2a8e8de9dac2b4ad59
5
5
  SHA512:
6
- metadata.gz: 48a9ac6c082e97d860b50f8f80b0147cfb03524c80cee538c6c7503dc1cae6f6d5b0317bb4da5c385b61a034aa5e5126ddffa42c24a908860a2bc54292e437b0
7
- data.tar.gz: 2b9c9cbfe1a0a42369cd8b20e4c20e416553c0e124d5410945d80520a8d50c0bfbcf09fe47167fffab002dca25d8fc9d7efbfc09f62a069006d0d8ae189c97e7
6
+ metadata.gz: 685d6b3659bc74c1478c395de4f7307586bae707a4e9fb4d7ffef3055ea7053e0df60073c5768824df10214c521a345ec1f82685aa81edff9b03561d20281f2d
7
+ data.tar.gz: 67ef963f33032315c382a63f0404a4a578fc1d178015e1ee821459cb1b66301c6893b0a0f79ac111843b346a454ae9d580dd395436bd1f5f699ae96b0df3424f
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- aws_sam_yarn_builder (0.2.4)
4
+ aws_sam_yarn_builder (0.2.5)
5
5
  activesupport (~> 5.2.0)
6
6
  slop (~> 4.6.0)
7
7
 
@@ -18,18 +18,14 @@ module AwsSamYarnBuilder
18
18
  reset_build_dir!
19
19
  reset_staging_dir!
20
20
 
21
- local_dependencies = template.function_resources.map do |function|
22
- get_local_file_dependencies(function)
23
- end.flatten.uniq.compact
21
+ package = package_from_global_path(template.function_globals.path)
22
+
23
+ local_dependencies = package.dependencies.select(&:local?).flatten.uniq.compact
24
24
 
25
25
  local_dependencies.each do |d|
26
26
  d.pack destination_staging_dir
27
27
  end
28
28
 
29
- function_resource = template.function_resources.first
30
-
31
- package = package_from_function(function_resource)
32
-
33
29
  package.pack destination_staging_dir
34
30
  package.build "UnifiedPackage", destination_dir, destination_staging_dir
35
31
 
@@ -94,6 +90,10 @@ module AwsSamYarnBuilder
94
90
  package.dependencies.select(&:local?)
95
91
  end
96
92
 
93
+ def package_from_global_path(path)
94
+ Package.extract_from_file! File.join(File.expand_path(File.join(template_base_dir, path)), "package.json")
95
+ end
96
+
97
97
  def package_from_function(function)
98
98
  Package.extract_from_file! File.join(File.expand_path(File.join(template_base_dir, function.path)), "package.json")
99
99
  end
@@ -33,6 +33,20 @@ module AwsSamYarnBuilder
33
33
  attr_writer :name
34
34
  end
35
35
 
36
+ class FunctionGlobals
37
+ def initialize(properties = {})
38
+ self.properties = properties
39
+ end
40
+
41
+ def path
42
+ properties["CodeUri"]
43
+ end
44
+
45
+ protected
46
+
47
+ attr_accessor :properties
48
+ end
49
+
36
50
  def self.extract_from_file!(file_path)
37
51
  new file_path, File.read(file_path)
38
52
  end
@@ -62,6 +76,10 @@ module AwsSamYarnBuilder
62
76
  FunctionResource.new(raw_function_resource.first, raw_function_resource.last["Properties"])
63
77
  end
64
78
 
79
+ def function_globals
80
+ FunctionGlobals.new(document["Globals"]["Function"])
81
+ end
82
+
65
83
  protected
66
84
 
67
85
  attr_accessor :contents, :path
@@ -1,3 +1,3 @@
1
1
  module AwsSamYarnBuilder
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws_sam_yarn_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Allam
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-06-11 00:00:00.000000000 Z
11
+ date: 2019-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slop