jets 0.6.8 → 0.6.9
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/Gemfile.lock +2 -2
- data/bin/release +9 -0
- data/lib/jets/cfn/template_builders/interface.rb +3 -2
- data/lib/jets/cfn/template_builders/rule_builder.rb +16 -0
- data/lib/jets/commands/base.rb +1 -1
- data/lib/jets/commands/templates/skeleton/config/application.rb.tt +1 -1
- data/lib/jets/commands/templates/skeleton/config/database.yml.tt +0 -5
- data/lib/jets/commands/templates/skeleton/config/dynamodb.yml +0 -3
- data/lib/jets/core.rb +1 -1
- data/lib/jets/erb.rb +1 -1
- data/lib/jets/lambda/dsl.rb +10 -0
- data/lib/jets/rule.rb +2 -1
- data/lib/jets/rule/aws_managed_rule.rb +12 -0
- data/lib/jets/rule/dsl.rb +28 -1
- data/lib/jets/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 557604f70083b13e25eb88496bbc2709d715688386e6cea83fc6d84d9c830799
|
4
|
+
data.tar.gz: 618b800e673d812303e28411d8cc16304777141a195c2ddd3029f416ed755591
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25c15f2f3f7ecf2d5b40ade99d990d2548be2c03f4a4312616aecff04482ca6a193a100e0c4851572ee3692b91534811f431c51640aff718645e7447fa4950b9
|
7
|
+
data.tar.gz: 9e16e4ad95fd469021853e328e982c22eed8dff9e85feb7f77c1a216c407e7239715399255afa0770f813858129b45707e1563673a2dfe25046c009ac8bf8463
|
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/), even before v1.0.
|
5
5
|
|
6
|
+
## [0.6.9]
|
7
|
+
- add aws managed rule support, pull request #18
|
8
|
+
|
6
9
|
## [0.6.8]
|
7
10
|
- add jets clean:log and clean:build commands pull request #17
|
8
11
|
- allow integration.sh test script to run locally
|
data/Gemfile.lock
CHANGED
@@ -11,7 +11,7 @@ GIT
|
|
11
11
|
PATH
|
12
12
|
remote: .
|
13
13
|
specs:
|
14
|
-
jets (0.6.
|
14
|
+
jets (0.6.9)
|
15
15
|
actionpack (>= 5.2.1)
|
16
16
|
actionview (>= 5.2.1)
|
17
17
|
activerecord (>= 5.2.1)
|
@@ -64,7 +64,7 @@ GEM
|
|
64
64
|
tzinfo (~> 1.1)
|
65
65
|
arel (9.0.0)
|
66
66
|
aws-eventstream (1.0.1)
|
67
|
-
aws-partitions (1.
|
67
|
+
aws-partitions (1.102.0)
|
68
68
|
aws-sdk-cloudformation (1.6.0)
|
69
69
|
aws-sdk-core (~> 3)
|
70
70
|
aws-sigv4 (~> 1.0)
|
data/bin/release
ADDED
@@ -5,8 +5,9 @@
|
|
5
5
|
class Jets::Cfn::TemplateBuilders
|
6
6
|
module Interface
|
7
7
|
def build
|
8
|
-
|
9
|
-
|
8
|
+
# Do not bother building
|
9
|
+
# or writing the template unless there are functions defined
|
10
|
+
return if @app_klass && !@app_klass.build?
|
10
11
|
|
11
12
|
compose # must be implemented by subclass
|
12
13
|
write
|
@@ -7,6 +7,7 @@ class Jets::Cfn::TemplateBuilders
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def add_config_rules
|
10
|
+
# Handle config_rules associated with lambda functions.
|
10
11
|
# @app_klass is PostsController, HardRule, Hello, or HelloFunction, or GameRule
|
11
12
|
@app_klass.tasks.each do |task|
|
12
13
|
map = Jets::Cfn::TemplateMappers::ConfigRuleMapper.new(task)
|
@@ -14,8 +15,23 @@ class Jets::Cfn::TemplateBuilders
|
|
14
15
|
add_config_rule(task, map)
|
15
16
|
add_permission(map)
|
16
17
|
end
|
18
|
+
|
19
|
+
# Handle config_rules associated with aws managed rules.
|
20
|
+
# List of AWS Config Managed Rules: https://amzn.to/2BOt9KN
|
21
|
+
@app_klass.managed_rules.each do |rule|
|
22
|
+
map = Jets::Cfn::TemplateMappers::ConfigRuleMapper.new(rule)
|
23
|
+
add_aws_managed_rule(rule, map)
|
24
|
+
end
|
17
25
|
end
|
18
26
|
|
27
|
+
def add_aws_managed_rule(rule, map)
|
28
|
+
# Usually we build the properties with the mappers but in the case for
|
29
|
+
# a config_rule it makes more sense to grab properties from the task
|
30
|
+
# using config_rule_properties
|
31
|
+
add_resource(map.logical_id, "AWS::Config::ConfigRule",
|
32
|
+
Properties: rule.config_rule_properties
|
33
|
+
)
|
34
|
+
end
|
19
35
|
|
20
36
|
def add_config_rule(task, map)
|
21
37
|
# Usually we build the properties with the mappers but in the case for
|
data/lib/jets/commands/base.rb
CHANGED
@@ -64,7 +64,7 @@ class Jets::Commands::Base < Thor
|
|
64
64
|
class_name.sub!(/Task$/, "Tasks") # special rule here for Tasks class
|
65
65
|
# NOTE: Weird thing where Jets::Commands::Db::Task => Thor::Command
|
66
66
|
# because Task is a class available to Thor I believe.
|
67
|
-
puts "eager_load! loading path: #{path} class_name: #{class_name}" if ENV['
|
67
|
+
puts "eager_load! loading path: #{path} class_name: #{class_name}" if ENV['JETS_DEBUG']
|
68
68
|
class_name.constantize # dont have to worry about order.
|
69
69
|
end
|
70
70
|
end
|
@@ -7,7 +7,7 @@ Jets.application.configure do
|
|
7
7
|
# config.extra_autoload_paths = []
|
8
8
|
|
9
9
|
config.function.timeout = 10
|
10
|
-
# config.function.role = "arn:aws:iam::#{
|
10
|
+
# config.function.role = "arn:aws:iam::#{Jets.aws.account}:role/service-role/pre-created"
|
11
11
|
# config.function.memory_size= 1536
|
12
12
|
# config.function.cors = true
|
13
13
|
config.function.environment = {
|
data/lib/jets/core.rb
CHANGED
@@ -135,7 +135,7 @@ module Jets::Core
|
|
135
135
|
.sub(/^\.\//,'') # remove ./
|
136
136
|
.sub(/app\/\w+\//,'') # remove app/controllers or app/jobs etc
|
137
137
|
.classify
|
138
|
-
puts "eager_load! loading path: #{path} class_name: #{class_name}" if ENV['
|
138
|
+
puts "eager_load! loading path: #{path} class_name: #{class_name}" if ENV['JETS_DEBUG']
|
139
139
|
class_name.constantize # use constantize instead of require so dont have to worry about order.
|
140
140
|
end
|
141
141
|
end
|
data/lib/jets/erb.rb
CHANGED
@@ -15,7 +15,7 @@ class Jets::Erb
|
|
15
15
|
ERB.new(template, nil, "-").result(binding)
|
16
16
|
rescue Exception => e
|
17
17
|
puts e
|
18
|
-
puts e.backtrace if ENV['
|
18
|
+
puts e.backtrace if ENV['JETS_DEBUG']
|
19
19
|
|
20
20
|
# how to know where ERB stopped? - https://www.ruby-forum.com/topic/182051
|
21
21
|
# syntax errors have the (erb):xxx info in e.message
|
data/lib/jets/lambda/dsl.rb
CHANGED
@@ -42,6 +42,10 @@ module Jets::Lambda::Dsl
|
|
42
42
|
class_properties(handler: name)
|
43
43
|
end
|
44
44
|
|
45
|
+
def class_runtime(value)
|
46
|
+
class_properties(runtime: value)
|
47
|
+
end
|
48
|
+
|
45
49
|
# convenience method that set properties
|
46
50
|
def timeout(value)
|
47
51
|
properties(timeout: value)
|
@@ -146,6 +150,12 @@ module Jets::Lambda::Dsl
|
|
146
150
|
all_tasks.values
|
147
151
|
end
|
148
152
|
|
153
|
+
# Used in Jets::Cfn::TemplateBuilders::Interface#build
|
154
|
+
# Overridden in rule/dsl.rb
|
155
|
+
def build?
|
156
|
+
!tasks.empty?
|
157
|
+
end
|
158
|
+
|
149
159
|
# The public methods defined in the project app class ulimately become
|
150
160
|
# lambda functions.
|
151
161
|
#
|
data/lib/jets/rule.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
class Jets::Rule::AwsManagedRule < Jets::Rule::Task
|
2
|
+
def config_rule_defaults
|
3
|
+
source_identifier = meth.to_s.upcase
|
4
|
+
{
|
5
|
+
"ConfigRuleName" => config_rule_name,
|
6
|
+
"Source" => {
|
7
|
+
"Owner" => "AWS",
|
8
|
+
"SourceIdentifier" => source_identifier
|
9
|
+
}
|
10
|
+
}
|
11
|
+
end
|
12
|
+
end
|
data/lib/jets/rule/dsl.rb
CHANGED
@@ -41,7 +41,6 @@ module Jets::Rule::Dsl
|
|
41
41
|
config_rule(maximum_execution_frequency: value)
|
42
42
|
end
|
43
43
|
|
44
|
-
# not really meant to be used but provided for completeness
|
45
44
|
def source(value)
|
46
45
|
config_rule(source: value)
|
47
46
|
end
|
@@ -57,8 +56,36 @@ module Jets::Rule::Dsl
|
|
57
56
|
def register_task(meth, lang=:ruby)
|
58
57
|
all_tasks[meth] = Jets::Rule::Task.new(self.name, meth,
|
59
58
|
properties: @properties, config_rule: @config_rule, lang: lang)
|
59
|
+
clear_properties
|
60
60
|
true
|
61
61
|
end
|
62
|
+
|
63
|
+
def clear_properties
|
64
|
+
super
|
65
|
+
@config_rule = nil
|
66
|
+
end
|
67
|
+
|
68
|
+
## aws managed rules work different enough to merit their own storage
|
69
|
+
|
70
|
+
def all_managed_rules
|
71
|
+
@all_managed_rules ||= ActiveSupport::OrderedHash.new
|
72
|
+
end
|
73
|
+
|
74
|
+
def managed_rules
|
75
|
+
all_managed_rules.values
|
76
|
+
end
|
77
|
+
|
78
|
+
def managed_rule(meth)
|
79
|
+
all_managed_rules[meth] = Jets::Rule::AwsManagedRule.new(self.name, meth,
|
80
|
+
properties: @properties, config_rule: @config_rule)
|
81
|
+
clear_properties
|
82
|
+
true
|
83
|
+
end
|
84
|
+
|
85
|
+
# Override Lambda::Dsl.build? to account of possible managed_rules
|
86
|
+
def build?
|
87
|
+
!tasks.empty? || !managed_rules.empty?
|
88
|
+
end
|
62
89
|
end
|
63
90
|
end
|
64
91
|
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: 0.6.
|
4
|
+
version: 0.6.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -408,6 +408,7 @@ files:
|
|
408
408
|
- Procfile
|
409
409
|
- README.md
|
410
410
|
- Rakefile
|
411
|
+
- bin/release
|
411
412
|
- buildspec.yml
|
412
413
|
- exe/jets
|
413
414
|
- jets.gemspec
|
@@ -627,6 +628,7 @@ files:
|
|
627
628
|
- lib/jets/router.rb
|
628
629
|
- lib/jets/ruby_server.rb
|
629
630
|
- lib/jets/rule.rb
|
631
|
+
- lib/jets/rule/aws_managed_rule.rb
|
630
632
|
- lib/jets/rule/base.rb
|
631
633
|
- lib/jets/rule/dsl.rb
|
632
634
|
- lib/jets/rule/task.rb
|