aws_sam_yarn_builder 0.2.1 → 0.2.2

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: b56c50003ee18b21d61d0d2e4bb4d906f50bbc5a03ad2452fbe62404a9ea54f7
4
- data.tar.gz: 4cd31e11094d6926553661df3befb0bb6338c0c3d041163a7d4e7cfdfc2157cd
3
+ metadata.gz: 249d84c22f208ea1f59dcaa89eae95001880f744c93d3d76bfd97852fdc6c1fd
4
+ data.tar.gz: bb2f505dadbd43d4ae995591d328a95e3a369062665a6cc79d470f29eaef3706
5
5
  SHA512:
6
- metadata.gz: 6fe5777bc193d4902d7c6004d0e4d144b4d86d8c26bd9fc40ea5d7e29e50d1ebf0897ba299631dfd5bc8c52e21c68bc7a5f88a3e8e33b9f419880593e5a62615
7
- data.tar.gz: 88f22bbac67c22e235439c26e6ea355a87c0990a1ab7ed452adcc1850dd08d9baf24d80520e1b707cb38b3a07dd86bb315e48b262916f3cd908a0973143a883b
6
+ metadata.gz: b6717c47b5556c29ac2f5f22213f3ecb1977d3cfa7adbca831dd1ac0b1b5a94a25772415d81d685d31d40179355fd3dff58f08ef193a949e376ddcb98a31cf91
7
+ data.tar.gz: 4076c12e36f9e21032e6135e6acff2abbfa764c0e0f454d0730d2a82510d8e5b72f5c44a27eeaccdd42a946fcc21f9319ea47ae38b9652f6e20a2f8cbea91fbe
@@ -5,6 +5,14 @@ module AwsSamYarnBuilder
5
5
  end
6
6
 
7
7
  def build!
8
+ if options[:function]
9
+ build_single_function!
10
+ else
11
+ build_full_template!
12
+ end
13
+ end
14
+
15
+ def build_full_template!
8
16
  reset_build_dir!
9
17
  reset_staging_dir!
10
18
 
@@ -28,6 +36,28 @@ module AwsSamYarnBuilder
28
36
  FileUtils.rm_rf(destination_staging_dir)
29
37
  end
30
38
 
39
+ def build_single_function!
40
+ reset_build_dir!
41
+ reset_staging_dir!
42
+
43
+ function_resource = template.function_resource_by_logical_id(options[:function])
44
+
45
+ if function_resource
46
+ local_dependencies = get_local_file_dependencies(function_resource).flatten.uniq.compact
47
+
48
+ local_dependencies.each do |d|
49
+ d.pack destination_staging_dir
50
+ end
51
+
52
+ package = package_from_function(function_resource)
53
+
54
+ package.pack destination_staging_dir
55
+ package.build function_resource.name, destination_dir, destination_staging_dir
56
+
57
+ FileUtils.rm_rf(destination_staging_dir)
58
+ end
59
+ end
60
+
31
61
  protected
32
62
 
33
63
  attr_accessor :options
@@ -6,6 +6,7 @@ module AwsSamYarnBuilder
6
6
  Slop.parse do |o|
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
+ o.string "-f", "--function", "The logical ID of a single function to build (optional)"
9
10
 
10
11
  o.on "--help" do
11
12
  puts o
@@ -56,6 +56,12 @@ module AwsSamYarnBuilder
56
56
  @function_resources ||= raw_function_resources.map { |name, options| FunctionResource.new(name, options["Properties"]) }
57
57
  end
58
58
 
59
+ def function_resource_by_logical_id(logical_id)
60
+ raw_function_resource = raw_function_resources.detect { |name, options| name == logical_id }
61
+
62
+ FunctionResource.new(raw_function_resource.first, raw_function_resource.last["Properties"])
63
+ end
64
+
59
65
  protected
60
66
 
61
67
  attr_accessor :contents, :path
@@ -1,3 +1,3 @@
1
1
  module AwsSamYarnBuilder
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
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.1
4
+ version: 0.2.2
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-04-30 00:00:00.000000000 Z
11
+ date: 2019-05-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: slop