jets 0.8.10 → 0.8.11

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: 240ea62121417687a7b24ed6cf556ac1d6f4f2c543238af1b4ac83b6893b28dc
4
- data.tar.gz: 45856a9db0ae99ad504f07e83620b96e45a461261103ed336b02e35705ccc5fa
3
+ metadata.gz: 3264a5fe8f2efe3fd744fa432d0ae6e73ada5bde0d9b816be1e39f0ba57e710d
4
+ data.tar.gz: a375816841050159a774bb104f97327fae41ab0935466fff959c3f54127aa26e
5
5
  SHA512:
6
- metadata.gz: 1d9d8ab908e3206a94011151ea57200f8ddd2d4a6f30adb962d29b7282f11a724fd72ad5ad4682726ff66f20de3fe204b0492bae9fdcb3b92083322a7e7bb45d
7
- data.tar.gz: c9a98f6f292ef8383533b7de5bc62d75f15374c932028a5c8e7370c79961b7693d5152754e74b4c1208de7b07dc8ab3e589d92336eafe77730a9d33246987e31
6
+ metadata.gz: 74694ae655562a8d40610a4f3ceba61d845f1695100966fd6bb424ad8c9a083f818f2921cdd40274c8b2844afa4ca61fcfaecb7d245b7528752fb72d37f2a039
7
+ data.tar.gz: 7fc5634ed17b2abd762cdf3014686caafec5e7bfc6add32ccc5c3172b6d75dae7406010a5275658a45dfb1dae0d705a3e17e4aa0621d54c4afe0ee7f022f041e
data/CHANGELOG.md CHANGED
@@ -3,6 +3,11 @@
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.8.11]
7
+ - Inherit class properties from parent classes PR #25
8
+ - Make more puts like methods show up in cloudwatch logs
9
+ - Fix add_logical_id_counter to events
10
+
6
11
  ## [0.8.10]
7
12
  - allow perform_now to run with default empty event
8
13
  - fix env_properties in function resource, fixes stage name
data/Gemfile.lock CHANGED
@@ -11,7 +11,7 @@ GIT
11
11
  PATH
12
12
  remote: .
13
13
  specs:
14
- jets (0.8.10)
14
+ jets (0.8.11)
15
15
  actionpack (>= 5.2.1)
16
16
  actionview (>= 5.2.1)
17
17
  activerecord (>= 5.2.1)
data/README.md CHANGED
@@ -131,3 +131,10 @@ For more documentation, check out the official docs: [Ruby on Jets](http://rubyo
131
131
  * [CLI Reference](http://rubyonjets.com/reference/)
132
132
  * [Contributing](http://rubyonjets.com/docs/contributing/)
133
133
  * [Support Jets](http://rubyonjets.com/support-jets/)
134
+
135
+ ## Articles
136
+
137
+ * [Introducing Jets: A Ruby Serverless Framework](https://blog.boltops.com/2018/08/18/introducing-jets-a-ruby-serverless-framework)
138
+ * [AWS Lambda Ruby Support at Native Speed with Jets](https://blog.boltops.com/2018/09/02/aws-lambda-ruby-support-at-native-speed-with-jets)
139
+ * [Jets Tutorial An Introductory CRUD App Part 1](https://blog.boltops.com/2018/09/07/jets-tutorial-crud-app-introduction-part-1)
140
+ * [Jets Tutorial Deploy to AWS Lambda Part 2](https://blog.boltops.com/2018/09/08/jets-tutorial-deploy-to-aws-lambda-part-2)
@@ -12,7 +12,6 @@ class Jets::Cfn::Builders
12
12
  def compose
13
13
  return if @options[:stack_type] == :minimal
14
14
 
15
- puts "Building API Gateway Deployment template."
16
15
  deployment = Jets::Resource::ApiGateway::Deployment.new
17
16
  add_resource(deployment)
18
17
  add_parameters(deployment.parameters)
@@ -12,7 +12,6 @@ class Jets::Cfn::Builders
12
12
  def compose
13
13
  return if @options[:stack_type] == :minimal
14
14
 
15
- puts "Building API Gateway template."
16
15
  add_gateway_rest_api
17
16
  add_gateway_routes
18
17
  end
@@ -12,7 +12,7 @@ class Jets::Cfn::Builders
12
12
 
13
13
  # compose is an interface method
14
14
  def compose
15
- puts "Building parent template."
15
+ puts "Building parent CloudFormation template."
16
16
 
17
17
  build_minimal_resources
18
18
  build_child_resources unless @options[:stack_type] == :minimal
@@ -36,6 +36,8 @@ class Jets::Cfn::Builders
36
36
  end
37
37
 
38
38
  def build_child_resources
39
+ puts "Building child CloudFormation templates."
40
+
39
41
  expression = "#{Jets::Naming.template_path_prefix}-*"
40
42
  # IE: path: #{Jets.build_root}/templates/demo-dev-2-comments_controller.yml
41
43
  Dir.glob(expression).each do |path|
@@ -42,7 +42,6 @@ module Jets::Commands
42
42
  def build_all_templates
43
43
  clean_templates
44
44
  # CloudFormation templates
45
- puts "Building Lambda functions as CloudFormation templates."
46
45
  # 1. Shared templates - child templates needs them
47
46
  build_api_gateway_templates
48
47
  # 2. Child templates - parent template needs them
@@ -2,16 +2,36 @@
2
2
  module Kernel
3
3
  @@io_buffer = []
4
4
 
5
- alias_method :original_puts, :puts
6
- def puts(message)
7
- @@io_buffer << message
8
- original_puts(message)
5
+ # List from https://ruby-doc.org/core-2.5.1/Kernel.html
6
+ # Note, will lose pp format in the @io_buffer but looks like a lot of work to keep the pp format.
7
+ # Must override stdout which can be messy quick: https://www.ruby-forum.com/topic/43725
8
+ OVERRIDE_METHODS = %w[
9
+ p
10
+ pp
11
+ print
12
+ printf
13
+ putc
14
+ puts
15
+ sprintf
16
+ ]
17
+ OVERRIDE_METHODS.each do |meth|
18
+ # Example of generated code:
19
+ #
20
+ # alias_method :original_puts, :puts
21
+ # def puts(*args, &block)
22
+ # @@io_buffer << args.first # message
23
+ # original_puts(*args, &block)
24
+ # end
25
+ #
26
+ class_eval <<~CODE
27
+ alias_method :original_#{meth}, :#{meth}
28
+ def #{meth}(*args, &block)
29
+ @@io_buffer << args.first # message
30
+ original_#{meth}(*args, &block)
31
+ end
32
+ CODE
9
33
  end
10
34
 
11
- # TODO: implement other methods that write output:
12
- # p, print, printf, putc, puts, sprintf?
13
- # Also, would be nice to figure out pp method also.
14
-
15
35
  def io_buffer
16
36
  @@io_buffer
17
37
  end
@@ -24,9 +44,8 @@ module Kernel
24
44
  begin
25
45
  IO.write("/tmp/jets-output.log", chunk)
26
46
  # Writing to log with binary content will crash the process so rescuing it and writing an info message.
27
- rescue Encoding::UndefinedConversionError => e
28
- error_message = "Encoding::UndefinedConversionError: Binary data was written to Jets::IO buffer. Writing binary data to the log will crash the process, so discarding it. This is an info message only. If you want to return binary data please base64 encode the data."
29
- IO.write("/tmp/jets-output.log", error_message)
47
+ rescue Encoding::UndefinedConversionError
48
+ IO.write("/tmp/jets-output.log", "[BINARY DATA]")
30
49
  end
31
50
  @@io_buffer = []
32
51
  end
data/lib/jets/job/dsl.rb CHANGED
@@ -66,6 +66,7 @@ module Jets::Job::Dsl
66
66
  n = 1
67
67
  @resources.map do |definition|
68
68
  logical_id = definition.keys.first
69
+ logical_id = logical_id.sub(/\d+$/,'')
69
70
  numbered_resources << { "#{logical_id}#{n}" => definition.values.first }
70
71
  n += 1
71
72
  end
@@ -4,7 +4,6 @@ class Jets::Resource
4
4
  delegate :logical_id, :type, :properties, :attributes, :parameters, :outputs,
5
5
  to: :resource
6
6
 
7
- # Usually overridden
8
7
  def resource
9
8
  Jets::Resource.new(definition, replacements)
10
9
  end
@@ -81,11 +81,28 @@ class Jets::Resource
81
81
  def class_properties
82
82
  # klass is PostsController, HardJob, GameRule, Hello or HelloFunction
83
83
  klass = Jets::Klass.from_task(@task)
84
- class_properties = klass.class_properties
84
+
85
+ class_properties = lookup_class_properties(klass)
85
86
  if klass.build_class_iam?
86
87
  iam_policy = Jets::Resource::Iam::ClassRole.new(klass)
87
88
  class_properties[:role] = "!GetAtt #{iam_policy.logical_id}.Arn"
88
89
  end
90
+
91
+ class_properties
92
+ end
93
+
94
+ # Accounts for inherited class_properties
95
+ def lookup_class_properties(klass)
96
+ all_classes = []
97
+ while klass != Object
98
+ all_classes << klass
99
+ klass = klass.superclass
100
+ end
101
+ class_properties = {}
102
+ # Go back down class heirachry top to down
103
+ all_classes.reverse.each do |k|
104
+ class_properties.merge!(k.class_properties)
105
+ end
89
106
  class_properties
90
107
  end
91
108
 
data/lib/jets/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "0.8.10"
2
+ VERSION = "0.8.11"
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: 0.8.10
4
+ version: 0.8.11
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-09-08 00:00:00.000000000 Z
11
+ date: 2018-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor