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 +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/jets/booter.rb +21 -0
- data/lib/jets/stack/main/dsl.rb +0 -11
- data/lib/jets/stack/main/dsl/base.rb +16 -2
- data/lib/jets/stack/main/dsl/sqs.rb +1 -1
- data/lib/jets/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 222bfa44ac05628217a64b6f48266ed78ee3c880767b867c3a63e5d3cd88e87c
|
4
|
+
data.tar.gz: a02c9e363b665e2aee1e96448bc591bb56e3c1e293fb18aa6ed336e2a9db324f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb07d8fb5c9de83582a60f73bbb77a835a7290fecffd356668d90d3c4b51fc43d53fdc8ff688a8a144f124670cf513ea3ff179b9e017e6eb8b054d16e9a3d800
|
7
|
+
data.tar.gz: 8d218da7a87d8ad0e835804a68fd6fffe1a87af3c333f70e7175552311c35b58afe3783f5f3d76700cbf7b3fbe67a02e39e94f78b2c18c8f55c1fac87f5193aa
|
data/CHANGELOG.md
CHANGED
@@ -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
|
data/lib/jets/booter.rb
CHANGED
@@ -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.
|
data/lib/jets/stack/main/dsl.rb
CHANGED
@@ -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
|
-
|
8
|
-
|
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,
|
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
|
data/lib/jets/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2019-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionmailer
|