jets 2.3.1 → 2.3.2

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: edcc031b3ecbf752200590a6b964983604f0fd95e15d0270abe26341a3013cfe
4
- data.tar.gz: 2b12ab8e0dcd3d7ad5cddb5169a32b189968d946ccc8fbe059dd0a3e37541f3d
3
+ metadata.gz: 222bfa44ac05628217a64b6f48266ed78ee3c880767b867c3a63e5d3cd88e87c
4
+ data.tar.gz: a02c9e363b665e2aee1e96448bc591bb56e3c1e293fb18aa6ed336e2a9db324f
5
5
  SHA512:
6
- metadata.gz: 778038a7c6b3d5deb3e78d65061095ffa2c52add54d66aba17abdf1feefcea29e37a9f673eb96ced091f5d58ece36781ac7e72e12e0a4bc99f542f0046d6038d
7
- data.tar.gz: f6e6aebfe968362c36083e3dc6d60a4ace9772a6135aff0bfc7e138618f43050503010014ad61d1c12425b4f071fd7fca2cdea4797ab3f82da1ead1c98da3977
6
+ metadata.gz: bb07d8fb5c9de83582a60f73bbb77a835a7290fecffd356668d90d3c4b51fc43d53fdc8ff688a8a144f124670cf513ea3ff179b9e017e6eb8b054d16e9a3d800
7
+ data.tar.gz: 8d218da7a87d8ad0e835804a68fd6fffe1a87af3c333f70e7175552311c35b58afe3783f5f3d76700cbf7b3fbe67a02e39e94f78b2c18c8f55c1fac87f5193aa
@@ -3,6 +3,9 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  This project *loosely tries* to adhere to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ## [2.3.2]
7
+ - #394 introduce internal_finisher to fix shared resource extensions
8
+
6
9
  ## [2.3.1]
7
10
  - #378 use JETS_TEST=1 env var instead of TEST=1 and favor Jets.env.test? method
8
11
  - #382 associated resources support for controllers
@@ -25,6 +25,7 @@ class Jets::Booter
25
25
 
26
26
  setup_db # establish db connections in Lambda Execution Context.
27
27
  # The eager load calls connects_to in models and establish those connections in Lambda Execution Context also.
28
+ internal_finisher
28
29
  eager_load
29
30
 
30
31
  # TODO: Figure out how to build middleware during Jets.boot without breaking jets new and webpacker:install
@@ -33,6 +34,26 @@ class Jets::Booter
33
34
  @booted = true
34
35
  end
35
36
 
37
+ # Runs right before eager_load
38
+ def internal_finisher
39
+ load_shared_extensions
40
+ end
41
+
42
+ # Shared extensions are added near the end because they require the Jets app load paths to first.
43
+ # We eager load the extensions and then use the loaded modules to extend Jets::Stack directly.
44
+ # Originally used an included hook but thats too early before app/shared/extensions is in the load_path.
45
+ def load_shared_extensions
46
+ Jets::Autoloaders.once.preload("#{Jets.root}/app/shared/extensions")
47
+ base_path = "#{Jets.root}/app/shared/extensions"
48
+ Dir.glob("#{base_path}/**/*.rb").each do |path|
49
+ next unless File.file?(path)
50
+
51
+ class_name = path.sub("#{base_path}/", '').sub(/\.rb/,'').camelize
52
+ mod = class_name.constantize # autoload
53
+ Jets::Stack.extend(mod)
54
+ end
55
+ end
56
+
36
57
  def eager_load
37
58
  preload_extensions
38
59
  Jets::Autoloaders.main.eager_load # Eager load project code. Rather have user find out early than later on AWS Lambda.
@@ -12,17 +12,6 @@ class Jets::Stack
12
12
  include Sns
13
13
  include Sqs
14
14
  end
15
-
16
- def self.included(base)
17
- base_path = "#{Jets.root}/app/shared/extensions"
18
- Dir.glob("#{base_path}/**/*.rb").each do |path|
19
- next unless File.file?(path)
20
-
21
- class_name = path.sub("#{base_path}/", '').sub(/\.rb/,'').camelize
22
- klass = class_name.constantize # autoload
23
- base.extend(klass)
24
- end
25
- end
26
15
  end
27
16
  end
28
17
  end
@@ -4,8 +4,22 @@ module Jets::Stack::Main::Dsl
4
4
  "!Ref #{value.to_s.camelize}"
5
5
  end
6
6
 
7
- def getatt(value, attribute=:arn)
8
- "!GetAtt #{value.to_s.camelize}.#{attribute.to_s.camelize}"
7
+ # Examples:
8
+ # get_attr("logical_id.attribute")
9
+ # get_attr("logical_id", "attribute")
10
+ # get_attr(["logical_id", "attribute"])
11
+ def get_att(*item)
12
+ item = item.flatten
13
+ options = item.last.is_a?(Hash) ? item.pop : {}
14
+
15
+ # list is an Array
16
+ list = if item.size == 1
17
+ item.first.split('.')
18
+ else
19
+ item
20
+ end
21
+ list.map! { |s| s.to_s.camelize } unless options[:autoformat] == false
22
+ { "Fn::GetAtt" => list }
9
23
  end
10
24
 
11
25
  def logical_id(value)
@@ -3,7 +3,7 @@ module Jets::Stack::Main::Dsl
3
3
  def sqs_queue(id, props={})
4
4
  # props[:queue_name] ||= id.to_s # comment out to allow CloudFormation to generate name
5
5
  resource(id, "AWS::SQS::Queue", props)
6
- output(id, getatt(id, :arn)) # normal !Ref returns the sqs url the ARN is useful for nested stacks depends_on
6
+ output(id, get_att(id, :arn)) # normal !Ref returns the sqs url the ARN is useful for nested stacks depends_on
7
7
  output("#{id}_url", ref(id)) # useful for Stack.lookup method. IE: List.lookup(:waitlist_url)
8
8
  end
9
9
  end
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "2.3.1"
2
+ VERSION = "2.3.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jets
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.1
4
+ version: 2.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-10-12 00:00:00.000000000 Z
11
+ date: 2019-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer