patches 3.3.0 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/patches.rb +1 -0
- data/lib/patches/application_version_validation.rb +9 -0
- data/lib/patches/tenant_worker.rb +7 -2
- data/lib/patches/version.rb +1 -1
- data/lib/patches/worker.rb +2 -9
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2efd0dc04504ab68ece9ffb46f6e1c2a6adcae93b39dac5824d4cfed34093a99
|
4
|
+
data.tar.gz: 167f4f394fea327cbdf85f9c3e1ac067639abdfd606b2077ec70e5b1bb0a4bbb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90edf98dc27bdeb176f8075711a2703cad55853ef010ce99b908a63001739d58dfab1ccc002e5ce61e4bbfe0724b4ca08321037b673c20fe529e76bc5a58f535
|
7
|
+
data.tar.gz: 666b762d233f27259f8c33afe2cf2ddb4cff060d313de6795840fac767e14e46401e1c5e8ff321379b4d9f9dbeea4bd00704656e03942ac312bdb3fea13f64a4
|
data/CHANGELOG.md
CHANGED
@@ -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
|
data/lib/patches.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/patches/version.rb
CHANGED
data/lib/patches/worker.rb
CHANGED
@@ -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.
|
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-
|
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
|