patches 3.4.0 → 3.6.2

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: 2efd0dc04504ab68ece9ffb46f6e1c2a6adcae93b39dac5824d4cfed34093a99
4
- data.tar.gz: 167f4f394fea327cbdf85f9c3e1ac067639abdfd606b2077ec70e5b1bb0a4bbb
3
+ metadata.gz: 3ef48f4cd04fd29602ab012fab6414c16cece6fa3ecd687f9deac3ff9244bf7b
4
+ data.tar.gz: f89c55aa18e9f84e77e5a26872896df6b5b0819842e940976b262a5b20e55dda
5
5
  SHA512:
6
- metadata.gz: 90edf98dc27bdeb176f8075711a2703cad55853ef010ce99b908a63001739d58dfab1ccc002e5ce61e4bbfe0724b4ca08321037b673c20fe529e76bc5a58f535
7
- data.tar.gz: 666b762d233f27259f8c33afe2cf2ddb4cff060d313de6795840fac767e14e46401e1c5e8ff321379b4d9f9dbeea4bd00704656e03942ac312bdb3fea13f64a4
6
+ metadata.gz: 5899f3e9202d2227efd661d38771eef7534ac48414903b1fbd66820631ccf8dd90dcb20b2bc9f8bfbca81375388fe531acacab6dc294c92a621804083fd0b93b
7
+ data.tar.gz: 59707c3bb9d64ad45971fa7ef2287c346aa72fe6bcb393ed027ddd47ca6202feff2034b5ec30c1a32e5d39041ba4fe2bb2d1ee6ca625aabc58d87978f7e9e7c6
@@ -0,0 +1,26 @@
1
+ name: Publish
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ build:
9
+ name: Build + Publish
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: read
13
+ packages: write
14
+
15
+ steps:
16
+ - uses: actions/checkout@v3
17
+ - uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: '2.7'
20
+
21
+ - name: Publish to RubyGems
22
+ run: |
23
+ gem build *.gemspec
24
+ gem push *.gem
25
+ env:
26
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
data/CHANGELOG.md CHANGED
@@ -6,7 +6,34 @@ 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
9
+ ## [3.6.2] - 2022-08-10
10
+
11
+ Fixes incorrect release - tag and published gem back in sync
12
+
13
+ ## [3.6.1] - 2022-08-10
14
+ ### Added
15
+ - Github actions to publish to Rubygems upon release
16
+
17
+ ### Fixed
18
+ - Fix `patches:pending` rake task
19
+
20
+ ## [3.6.0] - 2022-05-27
21
+
22
+ 3.6.1 changes were incorrectly published as 3.6.0 but tagged as 3.6.1
23
+
24
+ ### Added
25
+ - Added `notification_prefix` and `notification_suffix` to configuration options
26
+ - Linked to docs/usage.md in README
27
+
28
+ ### Changed
29
+ - Refactored `Patches::Notifier`
30
+ - `Patches::Notifier.append_tenant_message` effectively replaced by `tenant_suffix`
31
+
32
+ ## [3.5.0] - 2020-07-22
33
+ ### Added
34
+ - Enable application version constraint support on `Patches::TenantWorker`
35
+
36
+ ## [3.4.0] - 2020-07-22
10
37
  ### Added
11
38
  - `Patches::TenantWorker` application version constraint forward compatibility
12
39
 
data/README.md CHANGED
@@ -11,7 +11,7 @@ A simple gem for one off tasks
11
11
 
12
12
  ## Version 2.0
13
13
 
14
- Please note the breaking change release around deployment. See docs/usage.md for the full change.
14
+ Please note the breaking change release around deployment. See [docs/usage.md](docs/usage.md) for the full change.
15
15
 
16
16
  TL;DR You need to manually declare the patches task to run in your deploy.rb
17
17
 
@@ -32,7 +32,7 @@ Or install it yourself as:
32
32
 
33
33
  ## Usage
34
34
 
35
- see `docs/usage.md`
35
+ see [docs/usage.md](docs/usage.md)
36
36
 
37
37
  ## Development
38
38
 
data/docs/usage.md CHANGED
@@ -39,6 +39,15 @@ Patches::Config.configure do |config|
39
39
  end
40
40
  ```
41
41
 
42
+ Additionally, you can override the default prefix and suffix of the
43
+ notification message in the patches config:
44
+
45
+ ```ruby
46
+ # for example
47
+ config.notification_prefix = "#{Tenant.current.name}-#{Rails.env}" # => [READYTECH-STAGING]
48
+ config.notification_suffix = Tenant.current.name # => ... patches succeeded for Readytech
49
+ ```
50
+
42
51
  ### Running patches in parallel for tenants
43
52
 
44
53
  If you are using the Apartment gem, you can run the patches for each tenant in parallel.
@@ -16,6 +16,8 @@ module Patches
16
16
  class Configuration
17
17
  attr_accessor \
18
18
  :application_version,
19
+ :notification_prefix,
20
+ :notification_suffix,
19
21
  :retry_after_version_mismatch_in,
20
22
  :sidekiq_options,
21
23
  :sidekiq_parallel,
@@ -11,23 +11,32 @@ class Patches::Notifier
11
11
  end
12
12
 
13
13
  def success_message(patches)
14
- message = "#{environment_prefix}#{patches.count} patches succeeded"
15
- append_tenant_message(message)
14
+ message(patches.count, "patches succeeded")
16
15
  end
17
16
 
18
17
  def failure_message(patch_path, error)
19
- details = "#{Pathname.new(patch_path).basename} failed with error: #{error}"
20
- message = "#{environment_prefix}Error applying patch: #{details}"
21
- append_tenant_message(message)
18
+ message("Error applying patch:", Pathname.new(patch_path).basename, "failed with error:", error)
19
+ end
20
+
21
+ def message(*args)
22
+ [notification_prefix, *args, notification_suffix].compact.join(" ")
23
+ end
24
+
25
+ def notification_prefix
26
+ prefix = config.notification_prefix.presence || environment_prefix
27
+ "[#{prefix}]" if prefix.present?
22
28
  end
23
29
 
24
30
  def environment_prefix
25
- "[#{Rails.env.upcase}] " if defined?(Rails)
31
+ Rails.env.upcase if defined?(Rails)
32
+ end
33
+
34
+ def notification_suffix
35
+ config.notification_suffix.presence || tenant_suffix
26
36
  end
27
37
 
28
- def append_tenant_message(message)
29
- message = message + " for tenant: #{Apartment::Tenant.current}" if defined?(Apartment)
30
- message
38
+ def tenant_suffix
39
+ "for tenant: #{Apartment::Tenant.current}" if defined?(Apartment)
31
40
  end
32
41
 
33
42
  def send_slack_message(message, color)
@@ -11,7 +11,11 @@ class Patches::TenantRunner
11
11
  Patches.logger.info("Patches tenant runner for: #{tenants.join(',')}")
12
12
  tenants.each do |tenant|
13
13
  if parallel?
14
- Patches::TenantWorker.perform_async(tenant, path)
14
+ Patches::TenantWorker.perform_async(
15
+ tenant,
16
+ path,
17
+ application_version: Patches::Config.configuration.application_version
18
+ )
15
19
  else
16
20
  run(tenant, path)
17
21
  end
@@ -1,6 +1,6 @@
1
1
  module Patches
2
2
  MAJOR = 3
3
- MINOR = 4
4
- PATCH = 0
3
+ MINOR = 6
4
+ PATCH = 2
5
5
  VERSION = [MAJOR, MINOR, PATCH].compact.join(".").freeze
6
6
  end
@@ -22,7 +22,7 @@ namespace :patches do
22
22
  end
23
23
 
24
24
  task :pending => [:environment] do
25
- Patches::Pending.each do |patch|
25
+ Patches::Pending.new.each do |patch|
26
26
  puts patch
27
27
  end
28
28
  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.0
4
+ version: 3.6.2
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-22 00:00:00.000000000 Z
11
+ date: 2022-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -242,6 +242,7 @@ extensions: []
242
242
  extra_rdoc_files: []
243
243
  files:
244
244
  - ".buildkite/pipeline.yml"
245
+ - ".github/workflows/publish.yml"
245
246
  - ".gitignore"
246
247
  - ".rspec"
247
248
  - CHANGELOG.md
@@ -297,7 +298,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
297
298
  - !ruby/object:Gem::Version
298
299
  version: '0'
299
300
  requirements: []
300
- rubygems_version: 3.0.3
301
+ rubygems_version: 3.1.6
301
302
  signing_key:
302
303
  specification_version: 4
303
304
  summary: A simple gem for one off tasks