patches 3.3.0 → 3.4.0

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: 31f20fe803ffb8762b4ebdbdacb5b33564d67eaa24505ffb8fdd25fc88a6198c
4
- data.tar.gz: c7fbbb497911d30dd73555a77f8ea946788de6b43110df7afcf6e680f9a349a3
3
+ metadata.gz: 2efd0dc04504ab68ece9ffb46f6e1c2a6adcae93b39dac5824d4cfed34093a99
4
+ data.tar.gz: 167f4f394fea327cbdf85f9c3e1ac067639abdfd606b2077ec70e5b1bb0a4bbb
5
5
  SHA512:
6
- metadata.gz: 2b2674ce8e4f2deb2f856e67c32d381bf4007729fad286179b89c0c982c8991b58072c59de133485ea7d9a40071df36778198037569a496a60fa25f4371ce6e1
7
- data.tar.gz: 5fee7f04b02862424097a26e51fe6ad376e885637e67aa90f3986942457494900646426a393f3b1a8946fc3fbb748a8bed89619a9cd7e28a2278151a0eefbc34
6
+ metadata.gz: 90edf98dc27bdeb176f8075711a2703cad55853ef010ce99b908a63001739d58dfab1ccc002e5ce61e4bbfe0724b4ca08321037b673c20fe529e76bc5a58f535
7
+ data.tar.gz: 666b762d233f27259f8c33afe2cf2ddb4cff060d313de6795840fac767e14e46401e1c5e8ff321379b4d9f9dbeea4bd00704656e03942ac312bdb3fea13f64a4
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [3.4.0] - 2020-07-21
10
+ ### Added
11
+ - `Patches::TenantWorker` application version constraint forward compatibility
12
+
9
13
  ## [3.3.0] - 2020-07-20
10
14
  ### Added
11
15
  - Application version constraints
@@ -22,6 +22,7 @@ end
22
22
  require "patches/base"
23
23
  require "patches/config"
24
24
  require "patches/tenant_run_concern"
25
+ require "patches/application_version_validation"
25
26
  require "patches/tenant_worker" if defined?(Sidekiq)
26
27
  require "patches/engine" if defined?(Rails)
27
28
  require "patches/patch"
@@ -0,0 +1,9 @@
1
+ module Patches
2
+ module ApplicationVersionValidation
3
+ def valid_application_version?(application_version)
4
+ return true unless application_version
5
+ return true unless Patches::Config.configuration.application_version
6
+ Patches::Config.configuration.application_version == application_version
7
+ end
8
+ end
9
+ end
@@ -3,10 +3,15 @@ require 'sidekiq'
3
3
  class Patches::TenantWorker
4
4
  include Sidekiq::Worker
5
5
  include Patches::TenantRunConcern
6
+ include Patches::ApplicationVersionValidation
6
7
 
7
8
  sidekiq_options Patches::Config.configuration.sidekiq_options
8
9
 
9
- def perform(tenant_name, path)
10
- run(tenant_name, path)
10
+ def perform(tenant_name, path, params = {})
11
+ if valid_application_version?(params['application_version'])
12
+ run(tenant_name, path)
13
+ else
14
+ self.class.perform_in(Patches::Config.configuration.retry_after_version_mismatch_in, tenant_name, path, params)
15
+ end
11
16
  end
12
17
  end
@@ -1,6 +1,6 @@
1
1
  module Patches
2
2
  MAJOR = 3
3
- MINOR = 3
3
+ MINOR = 4
4
4
  PATCH = 0
5
5
  VERSION = [MAJOR, MINOR, PATCH].compact.join(".").freeze
6
6
  end
@@ -2,22 +2,15 @@ require 'sidekiq'
2
2
 
3
3
  class Patches::Worker
4
4
  include Sidekiq::Worker
5
+ include Patches::ApplicationVersionValidation
5
6
 
6
7
  sidekiq_options Patches::Config.configuration.sidekiq_options
7
8
 
8
9
  def perform(runner, params = {})
9
- if valid_application_version?(params)
10
+ if valid_application_version?(params['application_version'])
10
11
  runner.constantize.new.perform
11
12
  else
12
13
  self.class.perform_in(Patches::Config.configuration.retry_after_version_mismatch_in, runner, params)
13
14
  end
14
15
  end
15
-
16
- private
17
-
18
- def valid_application_version?(params)
19
- return true unless params['application_version']
20
- return true unless Patches::Config.configuration.application_version
21
- Patches::Config.configuration.application_version == params['application_version']
22
- end
23
16
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: patches
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JobReady
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-20 00:00:00.000000000 Z
11
+ date: 2020-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -261,6 +261,7 @@ files:
261
261
  - lib/generators/patches/templates/patch.rb.erb
262
262
  - lib/generators/patches/templates/patch_spec.rb.erb
263
263
  - lib/patches.rb
264
+ - lib/patches/application_version_validation.rb
264
265
  - lib/patches/base.rb
265
266
  - lib/patches/capistrano.rb
266
267
  - lib/patches/capistrano/tasks.rake