aws_sam_yarn_builder 0.2.2 → 0.2.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad8d8b13ba9e72f1062105170af418674d43298c0abb123c8e0dff0dbf58cfe4
|
4
|
+
data.tar.gz: 702896342e48b42f42a31ad4f6167117feb3534554268e347d4df39776f49f07
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b37b3260b822043d80f028363791bb9e70dd0177c24c0fb3211692cda81c41e82b92d05cc6699d83c3d8fc239a34fc48847ed8cfef73a8db086090c656ba6d32
|
7
|
+
data.tar.gz: d6195fda6f3eea5806c435ce7836e83aad41a1002c18820248c48f95c69de4b0f80f053eacb82347733fa53e02f24935048708b9bd3733f8902c21bbdae88c57
|
data/Gemfile.lock
CHANGED
@@ -7,11 +7,37 @@ module AwsSamYarnBuilder
|
|
7
7
|
def build!
|
8
8
|
if options[:function]
|
9
9
|
build_single_function!
|
10
|
+
elsif options[:unified]
|
11
|
+
build_unified_template!
|
10
12
|
else
|
11
13
|
build_full_template!
|
12
14
|
end
|
13
15
|
end
|
14
16
|
|
17
|
+
def build_unified_template!
|
18
|
+
reset_build_dir!
|
19
|
+
reset_staging_dir!
|
20
|
+
|
21
|
+
local_dependencies = template.function_resources.map do |function|
|
22
|
+
get_local_file_dependencies(function)
|
23
|
+
end.flatten.uniq.compact
|
24
|
+
|
25
|
+
local_dependencies.each do |d|
|
26
|
+
d.pack destination_staging_dir
|
27
|
+
end
|
28
|
+
|
29
|
+
function_resource = template.function_resources.first
|
30
|
+
|
31
|
+
package = package_from_function(function_resource)
|
32
|
+
|
33
|
+
package.pack destination_staging_dir
|
34
|
+
package.build "UnifiedPackage", destination_dir, destination_staging_dir
|
35
|
+
|
36
|
+
template.write_to_output(destination_dir, template_base_dir, true)
|
37
|
+
|
38
|
+
FileUtils.rm_rf(destination_staging_dir)
|
39
|
+
end
|
40
|
+
|
15
41
|
def build_full_template!
|
16
42
|
reset_build_dir!
|
17
43
|
reset_staging_dir!
|
@@ -7,6 +7,7 @@ module AwsSamYarnBuilder
|
|
7
7
|
o.string "-d", "--destination", "path to use for the output of the build process", default: "./.aws-sam"
|
8
8
|
o.string "-t", "--template-file", "path to the SAM template file", default: "./template.yml"
|
9
9
|
o.string "-f", "--function", "The logical ID of a single function to build (optional)"
|
10
|
+
o.bool "-u", "--unified-package", "All the functions in the template point to the same CodeUri location, so only create a single package"
|
10
11
|
|
11
12
|
o.on "--help" do
|
12
13
|
puts o
|
@@ -42,9 +42,9 @@ module AwsSamYarnBuilder
|
|
42
42
|
self.contents = contents
|
43
43
|
end
|
44
44
|
|
45
|
-
def write_to_output(output, source_directory)
|
45
|
+
def write_to_output(output, source_directory, unified = false)
|
46
46
|
File.open(File.join(output, "template.yaml"), "w+") do |file|
|
47
|
-
file << transformed_contents(source_directory)
|
47
|
+
file << transformed_contents(source_directory, unified)
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
@@ -70,8 +70,8 @@ module AwsSamYarnBuilder
|
|
70
70
|
@document ||= YAML.load(contents)
|
71
71
|
end
|
72
72
|
|
73
|
-
def transformed_contents(source_directory)
|
74
|
-
contents_with_transformed_step_function_definitions(contents_with_transformed_function_paths(contents), source_directory)
|
73
|
+
def transformed_contents(source_directory, unified)
|
74
|
+
contents_with_transformed_step_function_definitions(contents_with_transformed_function_paths(contents, unified), source_directory)
|
75
75
|
end
|
76
76
|
|
77
77
|
def contents_with_transformed_step_function_definitions(c, source_directory)
|
@@ -84,9 +84,15 @@ module AwsSamYarnBuilder
|
|
84
84
|
File.read(File.expand_path(File.join(source_directory, definition_uri)))
|
85
85
|
end
|
86
86
|
|
87
|
-
def contents_with_transformed_function_paths(c)
|
88
|
-
|
89
|
-
|
87
|
+
def contents_with_transformed_function_paths(c, unified)
|
88
|
+
if unified
|
89
|
+
c.gsub(/CodeUri:\s*(.*)/) do |_|
|
90
|
+
"CodeUri: ./UnifiedPackage"
|
91
|
+
end
|
92
|
+
else
|
93
|
+
c.gsub(/CodeUri:\s*(.*)/) do |_|
|
94
|
+
"CodeUri: ./#{find_function_name_for_code_uri($1)}"
|
95
|
+
end
|
90
96
|
end
|
91
97
|
end
|
92
98
|
|
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
|
+
version: 0.2.3
|
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-
|
11
|
+
date: 2019-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: slop
|