good_job 3.12.6 → 3.12.8

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: c529a4f3811213bcf4d534c3fc5c096cac64b944db891eedadd5b553ea77aae3
4
- data.tar.gz: fc88a86278de2dd445e463a84f8a1934bc281c976dc585c7db549e5c57ff97ba
3
+ metadata.gz: 92bd0503979e96fb9119be0be1afd74b7be8594a3c377026c06ea55dcb26a3ee
4
+ data.tar.gz: fedebf29ee5a4100414367687958e6c8cfcc1bce938618344466bf86e454aacc
5
5
  SHA512:
6
- metadata.gz: d5b076dccfa450de8256870ba502c1f65f8c84fcdd9921772176afe04f1ccc57bd65fd215d46cb6a6c3be8c32570d9e271cbd45b73abdc247c64ef593edab64d
7
- data.tar.gz: c243bf54c98d38fe92fa62f104074582968dc757e65f3df611877307b2068d0126d837450745da60a20a80901b52a27af64302694e117c763d268fa3535ed6e5
6
+ metadata.gz: 3eb60ccb026da7584b87968cd89bf1df4fc763c208271d4cde46c3c831ac8887cec7eb10f607ebfb57d1c790ec0529683fb578f6bf094809d0fc43ebaf8c3c06
7
+ data.tar.gz: 425dd0a42e51c79710589948c0b99e9a148e31d524265772c4e931c9b610a7fa2bc0de0123ca8038afab42abf85e22f9083f76a151837608f0e07327aef8796a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## [v3.12.8](https://github.com/bensheldon/good_job/tree/v3.12.8) (2023-03-06)
4
+
5
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.12.7...v3.12.8)
6
+
7
+ **Fixed bugs:**
8
+
9
+ - Add `raise: false` to FrontendsController after action skip [\#881](https://github.com/bensheldon/good_job/pull/881) ([simi](https://github.com/simi))
10
+
11
+ **Closed issues:**
12
+
13
+ - GoodJob's JavaScript takes precedence over application's JavaScript in GoodJob 3.12.6, Rails 7 [\#873](https://github.com/bensheldon/good_job/issues/873)
14
+
15
+ **Merged pull requests:**
16
+
17
+ - Rewrite flaky tests: don't allow nil timeout for restart [\#872](https://github.com/bensheldon/good_job/pull/872) ([bensheldon](https://github.com/bensheldon))
18
+
19
+ ## [v3.12.7](https://github.com/bensheldon/good_job/tree/v3.12.7) (2023-03-01)
20
+
21
+ [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.12.6...v3.12.7)
22
+
23
+ **Fixed bugs:**
24
+
25
+ - Rename "assets" to "frontends" to avoid Asset Pipeline collisions [\#874](https://github.com/bensheldon/good_job/pull/874) ([bensheldon](https://github.com/bensheldon))
26
+
3
27
  ## [v3.12.6](https://github.com/bensheldon/good_job/tree/v3.12.6) (2023-03-01)
4
28
 
5
29
  [Full Changelog](https://github.com/bensheldon/good_job/compare/v3.12.5...v3.12.6)
@@ -146,7 +170,7 @@
146
170
 
147
171
  **Closed issues:**
148
172
 
149
- - Support for Ruby 3.2 [\#785](https://github.com/bensheldon/good_job/issues/785)
173
+ - Support for Rails 6.1 / Ruby 3.2 [\#785](https://github.com/bensheldon/good_job/issues/785)
150
174
  - Custom table names [\#748](https://github.com/bensheldon/good_job/issues/748)
151
175
  - Health check issue with cron scheduler job [\#741](https://github.com/bensheldon/good_job/issues/741)
152
176
 
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+ module GoodJob
3
+ class FrontendsController < ActionController::Base # rubocop:disable Rails/ApplicationController
4
+ skip_after_action :verify_same_origin_request, raise: false
5
+
6
+ STATIC_ASSETS = {
7
+ css: {
8
+ bootstrap: GoodJob::Engine.root.join("app", "frontend", "good_job", "vendor", "bootstrap", "bootstrap.min.css"),
9
+ style: GoodJob::Engine.root.join("app", "frontend", "good_job", "style.css"),
10
+ },
11
+ js: {
12
+ bootstrap: GoodJob::Engine.root.join("app", "frontend", "good_job", "vendor", "bootstrap", "bootstrap.bundle.min.js"),
13
+ chartjs: GoodJob::Engine.root.join("app", "frontend", "good_job", "vendor", "chartjs", "chart.min.js"),
14
+ es_module_shims: GoodJob::Engine.root.join("app", "frontend", "good_job", "vendor", "es_module_shims.js"),
15
+ rails_ujs: GoodJob::Engine.root.join("app", "frontend", "good_job", "vendor", "rails_ujs.js"),
16
+ },
17
+ }.freeze
18
+
19
+ MODULE_OVERRIDES = {
20
+ application: GoodJob::Engine.root.join("app", "frontend", "good_job", "application.js"),
21
+ stimulus: GoodJob::Engine.root.join("app", "frontend", "good_job", "vendor", "stimulus.js"),
22
+ }.freeze
23
+
24
+ def self.js_modules
25
+ @_js_modules ||= GoodJob::Engine.root.join("app", "frontend", "good_job", "modules").children.select(&:file?).each_with_object({}) do |file, modules|
26
+ key = File.basename(file.basename.to_s, ".js").to_sym
27
+ modules[key] = file
28
+ end.merge(MODULE_OVERRIDES)
29
+ end
30
+
31
+ before_action do
32
+ expires_in 1.year, public: true
33
+ end
34
+
35
+ def static
36
+ render file: STATIC_ASSETS.dig(params[:format].to_sym, params[:name].to_sym) || raise(ActionController::RoutingError, 'Not Found')
37
+ end
38
+
39
+ def module
40
+ raise(ActionController::RoutingError, 'Not Found') if params[:format] != "js"
41
+
42
+ render file: self.class.js_modules[params[:name].to_sym] || raise(ActionController::RoutingError, 'Not Found')
43
+ end
44
+ end
45
+ end
@@ -8,15 +8,15 @@
8
8
  <%= csp_meta_tag %>
9
9
 
10
10
  <%# Do not use asset tag helpers to avoid paths being overriden by config.asset_host %>
11
- <%= tag.link rel: "stylesheet", href: static_asset_path(:bootstrap, format: :css, v: GoodJob::VERSION, locale: nil), nonce: content_security_policy_nonce %>
12
- <%= tag.link rel: "stylesheet", href: static_asset_path(:style, format: :css, v: GoodJob::VERSION, locale: nil), nonce: content_security_policy_nonce %>
11
+ <%= tag.link rel: "stylesheet", href: frontend_static_path(:bootstrap, format: :css, v: GoodJob::VERSION, locale: nil), nonce: content_security_policy_nonce %>
12
+ <%= tag.link rel: "stylesheet", href: frontend_static_path(:style, format: :css, v: GoodJob::VERSION, locale: nil), nonce: content_security_policy_nonce %>
13
13
 
14
- <%= tag.script "", src: static_asset_path(:bootstrap, format: :js, v: GoodJob::VERSION, locale: nil), nonce: content_security_policy_nonce %>
15
- <%= tag.script "", src: static_asset_path(:chartjs, format: :js, v: GoodJob::VERSION, locale: nil), nonce: content_security_policy_nonce %>
16
- <%= tag.script "", src: static_asset_path(:rails_ujs, format: :js, v: GoodJob::VERSION, locale: nil), nonce: content_security_policy_nonce %>
14
+ <%= tag.script "", src: frontend_static_path(:bootstrap, format: :js, v: GoodJob::VERSION, locale: nil), nonce: content_security_policy_nonce %>
15
+ <%= tag.script "", src: frontend_static_path(:chartjs, format: :js, v: GoodJob::VERSION, locale: nil), nonce: content_security_policy_nonce %>
16
+ <%= tag.script "", src: frontend_static_path(:rails_ujs, format: :js, v: GoodJob::VERSION, locale: nil), nonce: content_security_policy_nonce %>
17
17
 
18
- <%= tag.script "", src: static_asset_path(:es_module_shims, format: :js, v: GoodJob::VERSION, locale: nil), async: true, nonce: content_security_policy_nonce %>
19
- <% importmaps = GoodJob::AssetsController.js_modules.keys.index_with { |module_name| module_asset_path(module_name, format: :js, locale: nil, v: GoodJob::VERSION) } %>
18
+ <%= tag.script "", src: frontend_static_path(:es_module_shims, format: :js, v: GoodJob::VERSION, locale: nil), async: true, nonce: content_security_policy_nonce %>
19
+ <% importmaps = GoodJob::FrontendsController.js_modules.keys.index_with { |module_name| frontend_module_path(module_name, format: :js, locale: nil, v: GoodJob::VERSION) } %>
20
20
  <%= tag.script({ imports: importmaps }.to_json.html_safe, type: "importmap", nonce: content_security_policy_nonce) %>
21
21
  <%= tag.script "", type: "module", nonce: content_security_policy_nonce do %> import "application"; <% end %>
22
22
  </head>
data/config/routes.rb CHANGED
@@ -27,8 +27,8 @@ GoodJob::Engine.routes.draw do
27
27
 
28
28
  resources :processes, only: %i[index]
29
29
 
30
- scope :assets, controller: :assets do
31
- get "modules/:name", action: :module, as: :module_asset, constraints: { format: 'js' }
32
- get "static/:name", action: :static, as: :static_asset, constraints: { format: %w[css js] }
30
+ scope :frontend, controller: :frontends do
31
+ get "modules/:name", action: :module, as: :frontend_module, constraints: { format: 'js' }
32
+ get "static/:name", action: :static, as: :frontend_static, constraints: { format: %w[css js] }
33
33
  end
34
34
  end
@@ -55,9 +55,11 @@ module GoodJob
55
55
  end
56
56
 
57
57
  # Shutdown and then start the capsule again.
58
- # @param timeout [nil, Numeric, Symbol] Seconds to wait for active threads.
58
+ # @param timeout [Numeric, Symbol] Seconds to wait for active threads.
59
59
  # @return [void]
60
60
  def restart(timeout: :default)
61
+ raise ArgumentError, "Capsule#restart cannot be called with a timeout of nil" if timeout.nil?
62
+
61
63
  shutdown(timeout: timeout)
62
64
  start
63
65
  end
@@ -132,11 +132,13 @@ module GoodJob # :nodoc:
132
132
 
133
133
  # Restart the Scheduler.
134
134
  # When shutdown, start; or shutdown and start.
135
- # @param timeout [nil, Numeric] Seconds to wait for actively executing jobs to finish; shares same values as {#shutdown}.
135
+ # @param timeout [Numeric] Seconds to wait for actively executing jobs to finish; shares same values as {#shutdown}.
136
136
  # @return [void]
137
137
  def restart(timeout: -1)
138
+ raise ArgumentError, "Scheduler#restart cannot be called with a timeout of nil" if timeout.nil?
139
+
138
140
  instrument("scheduler_restart_pools") do
139
- shutdown(timeout: timeout) if running?
141
+ shutdown(timeout: timeout)
140
142
  create_executor
141
143
  warm_cache
142
144
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  module GoodJob
3
3
  # GoodJob gem version.
4
- VERSION = '3.12.6'
4
+ VERSION = '3.12.8'
5
5
  end
data/lib/good_job.rb CHANGED
@@ -131,7 +131,7 @@ module GoodJob
131
131
  # When forking processes you should shut down these background threads before forking, and restart them after forking.
132
132
  # For example, you should use +shutdown+ and +restart+ when using async execution mode with Puma.
133
133
  # See the {file:README.md#executing-jobs-async--in-process} for more explanation and examples.
134
- # @param timeout [Numeric, nil] Seconds to wait for active threads to finish.
134
+ # @param timeout [Numeric] Seconds to wait for active threads to finish.
135
135
  # @return [void]
136
136
  def self.restart(timeout: -1)
137
137
  _shutdown_all(Capsule.instances, :restart, timeout: timeout)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: good_job
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.12.6
4
+ version: 3.12.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Sheldon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-03-01 00:00:00.000000000 Z
11
+ date: 2023-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob
@@ -318,30 +318,30 @@ files:
318
318
  - CHANGELOG.md
319
319
  - LICENSE.txt
320
320
  - README.md
321
- - app/assets/good_job/application.js
322
- - app/assets/good_job/modules/charts.js
323
- - app/assets/good_job/modules/checkbox_toggle.js
324
- - app/assets/good_job/modules/document_ready.js
325
- - app/assets/good_job/modules/live_poll.js
326
- - app/assets/good_job/modules/popovers.js
327
- - app/assets/good_job/modules/toasts.js
328
- - app/assets/good_job/style.css
329
- - app/assets/good_job/vendor/bootstrap/bootstrap.bundle.min.js
330
- - app/assets/good_job/vendor/bootstrap/bootstrap.min.css
331
- - app/assets/good_job/vendor/chartjs/chart.min.js
332
- - app/assets/good_job/vendor/es_module_shims.js
333
- - app/assets/good_job/vendor/rails_ujs.js
334
- - app/assets/good_job/vendor/stimulus.js
335
321
  - app/charts/good_job/scheduled_by_queue_chart.rb
336
322
  - app/controllers/good_job/application_controller.rb
337
- - app/controllers/good_job/assets_controller.rb
338
323
  - app/controllers/good_job/batches_controller.rb
339
324
  - app/controllers/good_job/cron_entries_controller.rb
325
+ - app/controllers/good_job/frontends_controller.rb
340
326
  - app/controllers/good_job/jobs_controller.rb
341
327
  - app/controllers/good_job/processes_controller.rb
342
328
  - app/filters/good_job/base_filter.rb
343
329
  - app/filters/good_job/batches_filter.rb
344
330
  - app/filters/good_job/jobs_filter.rb
331
+ - app/frontend/good_job/application.js
332
+ - app/frontend/good_job/modules/charts.js
333
+ - app/frontend/good_job/modules/checkbox_toggle.js
334
+ - app/frontend/good_job/modules/document_ready.js
335
+ - app/frontend/good_job/modules/live_poll.js
336
+ - app/frontend/good_job/modules/popovers.js
337
+ - app/frontend/good_job/modules/toasts.js
338
+ - app/frontend/good_job/style.css
339
+ - app/frontend/good_job/vendor/bootstrap/bootstrap.bundle.min.js
340
+ - app/frontend/good_job/vendor/bootstrap/bootstrap.min.css
341
+ - app/frontend/good_job/vendor/chartjs/chart.min.js
342
+ - app/frontend/good_job/vendor/es_module_shims.js
343
+ - app/frontend/good_job/vendor/rails_ujs.js
344
+ - app/frontend/good_job/vendor/stimulus.js
345
345
  - app/helpers/good_job/application_helper.rb
346
346
  - app/models/concerns/good_job/filterable.rb
347
347
  - app/models/concerns/good_job/reportable.rb
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
- module GoodJob
3
- class AssetsController < ActionController::Base # rubocop:disable Rails/ApplicationController
4
- skip_after_action :verify_same_origin_request
5
-
6
- STATIC_ASSETS = {
7
- css: {
8
- bootstrap: GoodJob::Engine.root.join("app", "assets", "good_job", "vendor", "bootstrap", "bootstrap.min.css"),
9
- style: GoodJob::Engine.root.join("app", "assets", "good_job", "style.css"),
10
- },
11
- js: {
12
- bootstrap: GoodJob::Engine.root.join("app", "assets", "good_job", "vendor", "bootstrap", "bootstrap.bundle.min.js"),
13
- chartjs: GoodJob::Engine.root.join("app", "assets", "good_job", "vendor", "chartjs", "chart.min.js"),
14
- es_module_shims: GoodJob::Engine.root.join("app", "assets", "good_job", "vendor", "es_module_shims.js"),
15
- rails_ujs: GoodJob::Engine.root.join("app", "assets", "good_job", "vendor", "rails_ujs.js"),
16
- },
17
- }.freeze
18
-
19
- MODULE_OVERRIDES = {
20
- application: GoodJob::Engine.root.join("app", "assets", "good_job", "application.js"),
21
- stimulus: GoodJob::Engine.root.join("app", "assets", "good_job", "vendor", "stimulus.js"),
22
- }.freeze
23
-
24
- def self.js_modules
25
- @_js_modules ||= GoodJob::Engine.root.join("app", "assets", "good_job", "modules").children.select(&:file?).each_with_object({}) do |file, modules|
26
- key = File.basename(file.basename.to_s, ".js").to_sym
27
- modules[key] = file
28
- end.merge(MODULE_OVERRIDES)
29
- end
30
-
31
- before_action do
32
- expires_in 1.year, public: true
33
- end
34
-
35
- def static
36
- render file: STATIC_ASSETS.dig(params[:format].to_sym, params[:name].to_sym) || raise(ActionController::RoutingError, 'Not Found')
37
- end
38
-
39
- def module
40
- raise(ActionController::RoutingError, 'Not Found') if params[:format] != "js"
41
-
42
- render file: self.class.js_modules[params[:name].to_sym] || raise(ActionController::RoutingError, 'Not Found')
43
- end
44
- end
45
- end
File without changes
File without changes