jets 3.0.19 → 3.0.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 628d962d35e5e497e1e5362ea11d5844c94e28f9e71877295edd046d291e6b81
4
- data.tar.gz: 0a353487be640729460d85debb14d71064415847311ec952b5612e8a483e6a63
3
+ metadata.gz: a02adce73b38c44ec15f546538285e9797f544bdf6abe1301bfd97369c2d5cec
4
+ data.tar.gz: de64b60cfcc68e6af7b37f2c35ebd404c7d038dee00adb2f03f67c1a2d408ee0
5
5
  SHA512:
6
- metadata.gz: b36f4d843a60052f42935df53e4d801e74dba09237b03b2cee11835894d0a4574493b1b26793f2fdbc8e26b040bd911378752000201b0bcfaeda56727936f04f
7
- data.tar.gz: ce8b72b84930ccd20727504c1955f4d1f4acf9c36e750207eb85ab2ccee6fd8a9d85e5f1ee6e449bf8a7e7925de3e55a08c3c294dd9eb0c8cb84cf98757412b2
6
+ metadata.gz: d9e95182926df309068f600c5179a0ea327884ba412b374490ae19130dd44b2dfdf4b4d1106e8527150cf05722e5b17df876d4ecf92ebcae252ad363748d6608
7
+ data.tar.gz: 12a73a2866479ab9e76466d7577a04cb319697f62441f90b86609f9f6567d48bd857fbaca1e8a3958ad0c9979e78da91b2e9afd82994e99f0e962c60faf4bfc4
data/CHANGELOG.md CHANGED
@@ -3,6 +3,20 @@
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.23] - 2021-12-14
7
+ - [#610](https://github.com/boltops-tools/jets/pull/610) Rewrite PLATFORMS section to specify Ruby only
8
+ - [#611](https://github.com/boltops-tools/jets/pull/611) Update ruby_packager.rb
9
+
10
+ ## [3.0.22] - 2021-10-26
11
+ - [#607](https://github.com/boltops-tools/jets/pull/607) Job serialize - Revert "Fix job params serialization"
12
+
13
+ ## [3.0.21] - 2021-10-21
14
+ - [#605](https://github.com/boltops-tools/jets/pull/605) use safer 302 redirect as default
15
+
16
+ ## [3.0.20] - 2021-10-20
17
+ - [#603](https://github.com/boltops-tools/jets/pull/603) redirect_to: smarter handling of request xhr
18
+ - [#604](https://github.com/boltops-tools/jets/pull/604) fix redirect_to 301 and keep use default
19
+
6
20
  ## [3.0.19] - 2021-10-20
7
21
  - [#602](https://github.com/boltops-tools/jets/pull/602) pin zeitwerk to 2.4.x in gemfile
8
22
 
@@ -3,7 +3,9 @@ require "bundler" # for clean_old_submodules only
3
3
  module Jets::Builders
4
4
  class RubyPackager
5
5
  include Util
6
-
6
+
7
+ GEM_REGEXP = /-(arm|x)\d+.*-(darwin|linux)/
8
+
7
9
  attr_reader :full_app_root
8
10
  def initialize(relative_app_root)
9
11
  @full_app_root = "#{build_area}/#{relative_app_root}"
@@ -169,21 +171,28 @@ module Jets::Builders
169
171
  # Replace things like nokogiri (1.11.1-x86_64-darwin) => nokogiri (1.11.1)
170
172
  lines, new_lines = new_lines, []
171
173
  lines.each do |l|
172
- if l.include?("-x86_64-darwin")
173
- l = l.sub('-x86_64-darwin','')
174
- end
174
+ l.sub!(GEM_REGEXP, '') if l =~ GEM_REGEXP
175
175
  new_lines << l
176
176
  end
177
177
 
178
178
  # Make sure platform is ruby
179
- lines, new_lines, marker = new_lines, [], false
179
+ lines, new_lines, in_platforms_section, platforms_rewritten = new_lines, [], false, false
180
180
  lines.each do |l|
181
- if marker # the next loop has the platform we want to replace
181
+ if in_platforms_section && platforms_rewritten # once PLATFORMS has been found, skip all lines until the next section
182
+ if l.present?
183
+ next
184
+ else
185
+ in_platforms_section = false
186
+ end
187
+ end
188
+
189
+ if in_platforms_section && !platforms_rewritten # specify ruby as the only platform
182
190
  new_lines << " ruby\n"
183
- marker = false
191
+ platforms_rewritten = true
184
192
  next
185
193
  end
186
- marker = l.include?('PLATFORMS')
194
+
195
+ in_platforms_section = l.include?('PLATFORMS')
187
196
  new_lines << l
188
197
  end
189
198
 
@@ -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.19"
2
+ VERSION = "3.0.23"
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.19
4
+ version: 3.0.23
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-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer