jets 1.3.4 → 1.3.5

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: 6457b8ac2a9c7908054a263ced583c7411cd2ae95a979964cfbc82704c70c543
4
- data.tar.gz: 393ec99839a1536c751cd870d7aaf0599e8741c952a4af4b6531e8cddd5a4b13
3
+ metadata.gz: 710bd555c93cc9c2a9023c2fa36f80f7f02bbd200b6c2372ab45c99315ba9e83
4
+ data.tar.gz: cb5b8df6e8c6dafa12391da8802e5002c2f354b87eaa741e7c6f3b7fc3e2f405
5
5
  SHA512:
6
- metadata.gz: ecfa660740504bb2d88c1069e6846edda6e91b31e034c2d2e7f7597aca027c8fe0e2c915567a8eb1ad79752ba99e50710f2959448f837abc631d4cd354977c9c
7
- data.tar.gz: 0ccbc444c1dfb01878fb1261155324f8586c873f6c562bc9e8482c7fa2ea055a9a9cd912a599ca91c142caa0bfab92ff33ed806f877f2a4e194f60bc1f7320a3
6
+ metadata.gz: 9352bfe3fc61e9e455fdee8861be8ed25e2ac4bebcc35ebc3fd21cba4fbf09db14c52157d9dc06f7921f8c2d5708477e3175e567a30712191d208698da9a7c67
7
+ data.tar.gz: 6218d7b75f13073c2c30eaf3b48a32a8e329a31632b14f1cc0f988672606e1b633c6b66366d0a32b99b27cca62f81c1820af377c3f85d01c8b0fbc5e65958df5
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
+ ## [1.3.5]
7
+ - Merge pull request #90 from tongueroo/on-exception fix on_exception hook
8
+
6
9
  ## [1.3.4]
7
10
  - fix gem replacer for macosx by using rsync to copy
8
11
 
data/Gemfile.lock CHANGED
@@ -11,7 +11,7 @@ GIT
11
11
  PATH
12
12
  remote: .
13
13
  specs:
14
- jets (1.3.4)
14
+ jets (1.3.5)
15
15
  actionpack (>= 5.2.1)
16
16
  actionview (>= 5.2.1)
17
17
  activerecord (>= 5.2.1)
@@ -66,11 +66,11 @@ GEM
66
66
  tzinfo (~> 1.1)
67
67
  arel (9.0.0)
68
68
  aws-eventstream (1.0.1)
69
- aws-partitions (1.124.0)
69
+ aws-partitions (1.125.0)
70
70
  aws-sdk-apigateway (1.23.0)
71
71
  aws-sdk-core (~> 3, >= 3.39.0)
72
72
  aws-sigv4 (~> 1.0)
73
- aws-sdk-cloudformation (1.13.0)
73
+ aws-sdk-cloudformation (1.14.0)
74
74
  aws-sdk-core (~> 3, >= 3.39.0)
75
75
  aws-sigv4 (~> 1.0)
76
76
  aws-sdk-cloudwatchlogs (1.12.0)
@@ -101,7 +101,7 @@ GEM
101
101
  builder (3.2.3)
102
102
  byebug (10.0.2)
103
103
  colorize (0.8.1)
104
- concurrent-ruby (1.1.3)
104
+ concurrent-ruby (1.1.4)
105
105
  crass (1.0.4)
106
106
  diff-lcs (1.3)
107
107
  dotenv (2.5.0)
data/README.md CHANGED
@@ -36,7 +36,12 @@ def handler_function(event:, context:)
36
36
  end
37
37
  ```
38
38
 
39
- Though simple functions are supported by Jets, they do not really add much value as other ways to write Ruby code with Jets. Classes like Controllers and Jobs add many conveniences and are more powerful to use. We’ll cover them next.
39
+ Here's the function in the Lambda console:
40
+
41
+ ![](https://raw.githubusercontent.com/tongueroo/jets/master/docs/img/docs/jets-simple-lambda-function-console.png)
42
+
43
+
44
+ Though simple functions are supported by Jets, they do not add much value as other ways to write Ruby code with Jets. Classes like [Controllers](http://rubyonjets.com/docs/controllers/) and [Jobs](http://rubyonjets.com/docs/jobs/) add many conveniences and are more powerful to use. We’ll cover them next.
40
45
 
41
46
  ### Jets Controllers
42
47
 
@@ -60,7 +65,11 @@ class PostsController < ApplicationController
60
65
  end
61
66
  ```
62
67
 
63
- Jets creates Lambda functions for each public method in your controller.
68
+ Helper methods like `params` provide the parameters from the API Gateway event. The `render` method renders a Lambda Proxy structure back that API Gateway understands.
69
+
70
+ Jets creates Lambda functions for each public method in your controller. Here they are in the Lambda console:
71
+
72
+ ![](https://raw.githubusercontent.com/tongueroo/jets/master/docs/img/docs/demo-lambda-functions-controller.png)
64
73
 
65
74
  ### Jets Routing
66
75
 
@@ -84,6 +93,10 @@ Jets.application.routes.draw do
84
93
  end
85
94
  ```
86
95
 
96
+ The `routes.rb` gets translated to API Gateway resources:
97
+
98
+ ![](https://raw.githubusercontent.com/tongueroo/jets/master/docs/img/quick-start/demo-api-gateway.png)
99
+
87
100
  Test your API Gateway endpoints with curl or postman. Note, replace the URL endpoint with the one that is created:
88
101
 
89
102
  $ curl -s "https://quabepiu80.execute-api.us-east-1.amazonaws.com/dev/posts" | jq .
@@ -112,7 +125,9 @@ class HardJob < ApplicationJob
112
125
  end
113
126
  ```
114
127
 
115
- `HardJob#dig` runs every 10 hours and `HardJob#lift` runs every 12 hours.
128
+ `HardJob#dig` runs every 10 hours and `HardJob#lift` runs every 12 hours. The `rate` and `cron` methods created CloudWatch Event Rules. Example:
129
+
130
+ ![](https://raw.githubusercontent.com/tongueroo/jets/master/docs/img/docs/demo-job-cloudwatch-rule.png)
116
131
 
117
132
  ### Jets Deployment
118
133
 
@@ -126,9 +141,15 @@ After deployment, you can test the Lambda functions with the AWS Lambda console
126
141
 
127
142
  ![Lambda Console](https://s3.amazonaws.com/boltops-demo/images/screenshots/lambda-console-posts-controller-index.png)
128
143
 
129
- ### Live Demo
144
+ ### Live Demos
145
+
146
+ Here are some demos of Jets applications:
130
147
 
131
- Here's a [Live Demo](https://demo.rubyonjets.com/posts) of the quintessential CRUD Jets app.
148
+ * [Quintessential CRUD Jets app](https://demo.rubyonjets.com/posts)
149
+ * [Rails Running on AWS Lambda Mega Mode Example](https://mega.demo.rubyonjets.com/)
150
+ * [Image Upload Example](https://upload.demo.rubyonjets.com/)
151
+
152
+ Please feel free to add your own example to the [jets-examples](https://github.com/tongueroo/jets-examples) repo.
132
153
 
133
154
  ### Rails Support
134
155
 
@@ -169,3 +190,7 @@ For more documentation, check out the official docs: [Ruby on Jets](http://rubyo
169
190
  * [Jets Tutorial Extra Environments Part 7](https://blog.boltops.com/2018/09/13/jets-tutorial-extra-environments-part-7)
170
191
  * [Jets Tutorial Different Environments Part 8](https://blog.boltops.com/2018/09/26/jets-tutorial-different-environments-part-8)
171
192
  * [Jets Tutorial Polymorphic Support Part 9](https://blog.boltops.com/2018/09/27/jets-tutorial-polymorphic-support-part-9)
193
+ * [Jets Tutorial Polymorphic Support Part 9](https://blog.boltops.com/2018/09/27/jets-tutorial-polymorphic-support-part-9)
194
+ * [Jets Tutorial Polymorphic Support Part 9](https://blog.boltops.com/2018/09/27/jets-tutorial-polymorphic-support-part-9)
195
+ * [Jets Delete Tutorial](https://blog.boltops.com/2018/11/12/jets-tutorial-jets-delete)
196
+ * [Jets Image Uploads Tutorial with CarrierWave](https://blog.boltops.com/2018/12/13/jets-image-upload-carrierwave-tutorial-binary-support)
@@ -43,7 +43,7 @@ class Jets::Builders
43
43
  ruby_folder = Jets::Gems.ruby_folder
44
44
  dest = "#{code_area}/vendor/bundle/ruby/#{ruby_folder}"
45
45
  FileUtils.mkdir_p(File.dirname(dest))
46
- puts "ln -sf /opt/ruby/gems/#{ruby_folder} #{dest}" # uncommen to debug
46
+ # puts "ln -sf /opt/ruby/gems/#{ruby_folder} #{dest}" # uncomment to debug
47
47
  FileUtils.ln_sf("/opt/ruby/gems/#{ruby_folder}", dest)
48
48
  end
49
49
  end
data/lib/jets/core.rb CHANGED
@@ -164,7 +164,7 @@ module Jets::Core
164
164
 
165
165
  def on_exception(exception)
166
166
  Jets::Turbine.subclasses.each do |subclass|
167
- reporters = subclass.exception_reporters || []
167
+ reporters = subclass.on_exceptions || []
168
168
  reporters.each do |label, block|
169
169
  block.call(exception)
170
170
  end
data/lib/jets/turbine.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Jets
2
2
  class Turbine
3
3
  class_attribute :initializers
4
- class_attribute :exception_reporters
4
+ class_attribute :on_exceptions
5
5
 
6
6
  class << self
7
7
  def subclasses
@@ -17,9 +17,13 @@ module Jets
17
17
  self.initializers[label] = block
18
18
  end
19
19
 
20
+ def on_exception(label, &block)
21
+ self.on_exceptions ||= {}
22
+ self.on_exceptions[label] = block
23
+ end
24
+
20
25
  def exception_reporter(label, &block)
21
- self.exception_reporters ||= {}
22
- self.exception_reporters[label] = block
26
+ on_exception(label, &block)
23
27
  end
24
28
  end
25
29
  end
data/lib/jets/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "1.3.4"
2
+ VERSION = "1.3.5"
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: 1.3.4
4
+ version: 1.3.5
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-12-14 00:00:00.000000000 Z
11
+ date: 2018-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack