jets 3.0.18 → 3.0.22

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: 30209fb06ab88c5a593d26b7d20bf15f1164b5915a40f23ea8f61b2f7538361a
4
- data.tar.gz: 5c68efddc6c6b6c183c2191f23f5729c094247031ff88c3d0d73db2ea1e992e2
3
+ metadata.gz: 564e115dd93f465b1041093b350e560009dc437fce0d2cd45a0d0120b7c1c214
4
+ data.tar.gz: df694dde52f5122bb77268be781b476c4fe49312a3b8de95d941cba91ad81c69
5
5
  SHA512:
6
- metadata.gz: 843dac414dc95a7aefc8ff4e02df7dc652319fdffefb1b61ce44043955021d6f438cc0877eb814e5b160220a17744b349120484a8633da18744158360e68ded1
7
- data.tar.gz: 2b5b0dfb86f76f09d9bcc9f2a167a7af0cd260fde702fd4c6b7dc5db4f7af9d949a04fd77d2fb2e54ce0f3681a606064c249f7e6944d565d4d6a38b8c41afb9d
6
+ metadata.gz: 28e5b7d47af46c49abbff1419ea9b0fe788780bc4fb91e6acfb70d5b3e5c79c6d8df4af5f39e15085bcbd338648d7f4773bdcadd6c2bac96b0e720cdf1bd7d7e
7
+ data.tar.gz: 363782b3d1244f097b043b4d1cbc5bec06250234af75d5031813f4fe0cb1772444de7d8fde5d2f325f8357d9961d5af73f5c57fb3b0093a5a8a340ff28525cc8
data/CHANGELOG.md CHANGED
@@ -3,6 +3,19 @@
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
+ ## [3.0.22] - 2021-10-26
7
+ - [#607](https://github.com/boltops-tools/jets/pull/607) Job serialize - Revert "Fix job params serialization"
8
+
9
+ ## [3.0.21] - 2021-10-21
10
+ - [#605](https://github.com/boltops-tools/jets/pull/605) use safer 302 redirect as default
11
+
12
+ ## [3.0.20] - 2021-10-20
13
+ - [#603](https://github.com/boltops-tools/jets/pull/603) redirect_to: smarter handling of request xhr
14
+ - [#604](https://github.com/boltops-tools/jets/pull/604) fix redirect_to 301 and keep use default
15
+
16
+ ## [3.0.19] - 2021-10-20
17
+ - [#602](https://github.com/boltops-tools/jets/pull/602) pin zeitwerk to 2.4.x in gemfile
18
+
6
19
  ## [3.0.18] - 2021-10-20
7
20
  - [#596](https://github.com/boltops-tools/jets/pull/596) Serialize job data correctly
8
21
  - [#598](https://github.com/boltops-tools/jets/pull/598) fixing issues when mounting
@@ -18,6 +18,7 @@ gem "mysql2", "~> 0.5.3"
18
18
  <% unless options[:mode] == 'job' -%>
19
19
  gem "dynomite"
20
20
  <% end -%>
21
+ gem "zeitwerk", "~> 2.4.0"
21
22
 
22
23
  # development and test groups are not bundled as part of the deployment
23
24
  group :development, :test do
@@ -10,12 +10,22 @@ class Jets::Controller
10
10
  redirect_url = add_stage(url)
11
11
  redirect_url = ensure_protocol(redirect_url)
12
12
 
13
- aws_proxy = Rendering::RackRenderer.new(self,
14
- status: options[:status] || 302,
13
+ default = {
15
14
  headers: { "Location" => redirect_url },
16
- body: "",
17
15
  isBase64Encoded: false,
18
- )
16
+ }
17
+ if request.xhr?
18
+ options[:content_type] ||= "application/json"
19
+ options[:status] ||= 200
20
+ options[:body] ||= JSON.dump(success: true, location: redirect_url)
21
+ else
22
+ options[:status] ||= 302
23
+ options[:body] ||= ""
24
+ end
25
+ Jets.logger.info("redirect_to options #{options}")
26
+ options = default.merge(options)
27
+
28
+ aws_proxy = Rendering::RackRenderer.new(self, options)
19
29
  resp = aws_proxy.render
20
30
  # redirect is a type of rendering
21
31
  @rendered = true
@@ -29,11 +29,7 @@ class <%= controller_class_name %>Controller < ApplicationController
29
29
  @<%= singular_table_name %> = <%= orm_class.build(class_name, "#{singular_table_name}_params") %>
30
30
 
31
31
  if @<%= orm_instance.save %>
32
- if request.xhr?
33
- render json: {success: true, location: url_for(@<%= singular_table_name %>)}
34
- else
35
- redirect_to <%= singular_table_name %>_path(@<%= singular_table_name %>)
36
- end
32
+ redirect_to <%= singular_table_name %>_path(@<%= singular_table_name %>)
37
33
  else
38
34
  render :new
39
35
  end
@@ -42,11 +38,7 @@ class <%= controller_class_name %>Controller < ApplicationController
42
38
  # PUT <%= route_url %>/1
43
39
  def update
44
40
  if @<%= orm_instance.update("#{singular_table_name}_params") %>
45
- if request.xhr?
46
- render json: {success: true, location: url_for(@<%= singular_table_name %>)}
47
- else
48
- redirect_to <%= singular_table_name %>_path(@<%= singular_table_name %>)
49
- end
41
+ redirect_to <%= singular_table_name %>_path(@<%= singular_table_name %>)
50
42
  else
51
43
  render :edit
52
44
  end
@@ -55,11 +47,7 @@ class <%= controller_class_name %>Controller < ApplicationController
55
47
  # DELETE <%= route_url %>/1
56
48
  def delete
57
49
  @<%= orm_instance.destroy %>
58
- if request.xhr?
59
- render json: {success: true, location: <%= table_name %>_path}
60
- else
61
- redirect_to <%= table_name %>_path
62
- end
50
+ redirect_to <%= table_name %>_path
63
51
  end
64
52
 
65
53
  private
data/lib/jets/job/base.rb CHANGED
@@ -26,13 +26,13 @@ module Jets::Job
26
26
  end
27
27
 
28
28
  def perform_now(meth, event={}, context={})
29
- new(event.try(:to_unsafe_h), context, meth).send(meth)
29
+ new(event, context, meth).send(meth)
30
30
  end
31
31
 
32
32
  def perform_later(meth, event={}, context={})
33
33
  if on_lambda?
34
34
  function_name = "#{self.to_s.underscore}-#{meth}"
35
- call = Jets::Commands::Call.new(function_name, JSON.dump(event.try(:to_unsafe_h)), invocation_type: "Event")
35
+ call = Jets::Commands::Call.new(function_name, JSON.dump(event), invocation_type: "Event")
36
36
  call.run
37
37
  else
38
38
  puts "INFO: Not on AWS Lambda. In local mode perform_later executes the job with perform_now instead."
@@ -13,7 +13,7 @@ module Jets::Middleware
13
13
  middleware.use Shotgun::Static
14
14
  middleware.use Rack::Runtime
15
15
  middleware.use Jets::Controller::Middleware::Cors if cors_enabled?
16
- middleware.use Rack::MethodOverride # must come before Middleware::Local for multipart post forms to work
16
+ middleware.use Rack::MethodOverride unless ENV['JETS_RACK_METHOD_OVERRIDE'] == '0' # must come before Middleware::Local for multipart post forms to work
17
17
  middleware.use Jets::Controller::Middleware::Reloader if Jets.config.hot_reload
18
18
  middleware.use Jets::Controller::Middleware::Local # mimics AWS Lambda for local server only
19
19
  middleware.use session_store, session_options
data/lib/jets/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "3.0.18"
2
+ VERSION = "3.0.22"
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: 3.0.18
4
+ version: 3.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tung Nguyen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-20 00:00:00.000000000 Z
11
+ date: 2021-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer