jets 5.0.9 → 5.0.11

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: '094fcef1e3f074fb9e70284e71928a9573ace2c2698dfa1d7771929c14143cc1'
4
- data.tar.gz: 99bf0fe5ff1d74b1f77f55249022fa857f61daf0e54d93d9f18cfa3fde8d3113
3
+ metadata.gz: e0f81036f4a6561d9a79f029ca1362a8f48ad234b5318d97126b4530aee2ea27
4
+ data.tar.gz: 1051b3344523c20ed370a2602b65de25c71d1bce50a5c7cb67ef9dcbcd97e190
5
5
  SHA512:
6
- metadata.gz: 91eb6f101f26f4e48c5f201240ae658d92cb92518e6a8f1a84b76a9681e0302401f0251bffe9755b6326b85ea1eab70878ac573ca381bb789e9abeea8c4207bf
7
- data.tar.gz: 62dad308974fdecb2dcad03c937f0fc30588090f15d8ed18db6170feebb88630f880ae8ea79f8ce5307211f0ec2e1daecda13e65881c3f7b80d67a73e3f835a6
6
+ metadata.gz: f47b839cb9d3138c110d825a3936f0b823b7317e9f6559de1b199f64bad9820bd7716d04576f16ee27242a82e3090877967a6bc540dbe611afdd065e44deb8ff
7
+ data.tar.gz: a3bca9d28b17ce9a133b1a35bb01154e35601233ce9630172c5be15fe063e341df8af12d6a534628f8c022ac93093276bb879921e8b69d39b9dcc167cc34195b
data/CHANGELOG.md CHANGED
@@ -3,6 +3,15 @@
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
+ ## [5.0.11] - 2024-03-20
7
+ - [#711](https://github.com/rubyonjets/jets/pull/711) Fix controller testing in jets 5 - handling of params and query
8
+ - [#715](https://github.com/rubyonjets/jets/pull/715) remove force_encoding that causes issues for international characters
9
+
10
+ ## [5.0.10] - 2024-02-08
11
+ - [#706](https://github.com/rubyonjets/jets/pull/706) permit YAML load of Date class
12
+ - [#708](https://github.com/rubyonjets/jets/pull/708) Fix Prewarming
13
+ - [#709](https://github.com/rubyonjets/jets/pull/709) Remove iam_class_policy warning from Jobs
14
+
6
15
  ## [5.0.9] - 2024-01-08
7
16
  - [#704](https://github.com/rubyonjets/jets/pull/704) fix jets --version outside of jets project
8
17
  - update jets generate job scheduled template JSON.dump
@@ -22,6 +22,7 @@ class Jets::PreheatJob < Jets::Job::Base
22
22
  }
23
23
  ])
24
24
 
25
+ rate(Jets.config.prewarm.rate) if Jets.config.prewarm.enable
25
26
  def warm
26
27
  options = call_options(event[:quiet])
27
28
  Jets::Preheat.warm_all(options)
@@ -31,7 +32,7 @@ class Jets::PreheatJob < Jets::Job::Base
31
32
  class << self
32
33
  # Can use this to prewarm post deploy
33
34
  def prewarm!
34
- perform_now(:warn, quiet: true)
35
+ perform_now(:warm, quiet: true)
35
36
  end
36
37
  end
37
38
 
@@ -136,6 +136,12 @@ module Jets::Cfn
136
136
  relative_path = path.sub("#{Jets.root}/", '') # rid of the Jets.root at beginning
137
137
  paths << relative_path
138
138
  end
139
+
140
+ if Jets.config.prewarm.enable
141
+ internal = File.expand_path("../internal", __dir__)
142
+ paths << "#{internal}/app/jobs/jets/preheat_job.rb"
143
+ end
144
+
139
145
  paths
140
146
  end
141
147
 
@@ -23,7 +23,7 @@ module Jets::Lambda::Dsl
23
23
  def class_iam_policy_unused_warning(managed=false)
24
24
  return unless Jets.config.cfn.build.controllers == "one_lambda_for_all_controllers"
25
25
  return if self.to_s == "ApplicationController" # ApplicationController not defined in job mode
26
- return if self == Jets::PreheatJob
26
+ return if self.ancestors.include?(Jets::Job::Base)
27
27
 
28
28
  managed_prefix = managed ? "managed_" : ""
29
29
  puts <<~EOL.color(:yellow)
@@ -1,4 +1,4 @@
1
- require 'json'
1
+ require "json"
2
2
 
3
3
  # Hack AwsLambda Ruby Runtime to fix .to_json issue collision with ActiveSupport.
4
4
  # To reproduce:
@@ -18,24 +18,14 @@ module AwsLambda
18
18
  def marshall_response(method_response)
19
19
  case method_response
20
20
  when StringIO, IO
21
- [method_response, 'application/unknown']
21
+ [method_response, "application/unknown"]
22
22
  else
23
- # Orignal method calls .to_json but this collides with ActiveSupport's to_json
24
- # method_response.to_json # application/json is assumed
25
- # https://stackoverflow.com/questions/18067203/ruby-to-json-issue-with-error-illegal-malformed-utf-8
26
- if method_response.is_a?(Hash)
27
- method_response.deep_transform_values! do |v|
28
- if v.respond_to?(:force_encoding) && !v.frozen?
29
- v.force_encoding("ISO-8859-1").encode("UTF-8")
30
- else
31
- v # IE: Integer
32
- end
33
- end
34
- end
23
+ # Note: Removed previous code which did force_encoding("ISO-8859-1").encode("UTF-8")
24
+ # It caused issues with international characters.
25
+ # It does not seem like we need the force_encoding anymore.
35
26
  JSON.dump(method_response)
36
27
  end
37
28
  end
38
-
39
29
  end
40
30
  end
41
31
  end
@@ -16,19 +16,18 @@ module Jets::SpecHelpers
16
16
  attr_reader :request, :response
17
17
  def http_call(method:, path:, **options)
18
18
  headers = options.delete(:headers) || {}
19
+ params_hash = options.delete(:params) || options
19
20
  md = path.match(/\?(.*)/)
20
- query_string = md ? md[1] : ''
21
- query = Rack::Utils.parse_nested_query(query_string)
21
+ path = path.gsub("?#{md[1]}", '') if md
22
+ query = md ? Rack::Utils.parse_nested_query(md[1]).merge(params_hash) : params_hash
22
23
 
23
24
  params = Params.new
24
25
  if method.to_sym == :get
25
26
  params.body_params = {}
26
- params.query_params ||= options.delete(:params) || options
27
+ params.query_params = query || {}
27
28
  else
28
- params.body_params = options.delete(:body) || options.delete(:params) || options
29
+ params.body_params = options.delete(:body) || query
29
30
  end
30
- params.path_params = params.path_params
31
- params.query_params = query
32
31
 
33
32
  # Note: Do not cache the request object. Otherwise, it cannot be reused between specs.
34
33
  # See: https://community.rubyonjets.com/t/is-jets-spechelpers-controllers-request-being-cached/244/2
@@ -52,4 +51,4 @@ module Jets::SpecHelpers
52
51
  Jets.logger = old_logger
53
52
  end
54
53
  end
55
- end
54
+ end
@@ -3,12 +3,14 @@ class Jets::Util
3
3
  class Yamler
4
4
  class << self
5
5
  def load(text)
6
- options = RUBY_VERSION =~ /^3/ ? {aliases: true} : {} # Ruby 3.0.0 deprecates aliases: true
6
+ options = { permitted_classes: [Date] }
7
+ options[:aliases] = true if RUBY_VERSION =~ /^3/ # Ruby 3.0.0 deprecates aliases: true
7
8
  YAML.load(text, **options)
8
9
  end
9
10
 
10
11
  def load_file(path)
11
- options = RUBY_VERSION =~ /^3/ ? {aliases: true} : {} # Ruby 3.0.0 deprecates aliases: true
12
+ options = { permitted_classes: [Date] }
13
+ options[:aliases] = true if RUBY_VERSION =~ /^3/ # Ruby 3.0.0 deprecates aliases: true
12
14
  YAML.load_file(path, **options)
13
15
  end
14
16
  end
data/lib/jets/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Jets
2
- VERSION = "5.0.9"
2
+ VERSION = "5.0.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: 5.0.9
4
+ version: 5.0.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: 2024-01-08 00:00:00.000000000 Z
11
+ date: 2024-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer
@@ -1208,7 +1208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1208
1208
  - !ruby/object:Gem::Version
1209
1209
  version: '0'
1210
1210
  requirements: []
1211
- rubygems_version: 3.4.20
1211
+ rubygems_version: 3.4.19
1212
1212
  signing_key:
1213
1213
  specification_version: 4
1214
1214
  summary: Ruby Serverless Framework