patches 3.6.3 → 4.0.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: 7eea93b86dd926979c0b3cf0fcf292711d7ce1cb6256950458eed354a4783749
4
- data.tar.gz: f3305c8346f6d2b5d657de8c25b69ed820ff8149dca2fb5724204d77a9cda5f4
3
+ metadata.gz: 4d3cb95acebf22bd69de36b12b559515c6c2cf39160bfb6a135af5677ef90ad8
4
+ data.tar.gz: db396ae1486ff61282a2b363dd3fc3dceb3bdad6247ba4bce5ae409ccef939d8
5
5
  SHA512:
6
- metadata.gz: 52fa0f3c8458a92cc8e4fa9e8ec65856943ab06148bec02c706175699dcb2d5042b71699039c14461e272fe0e8bfcdf2cda4eb68639f3100fd75fb9cd8539224
7
- data.tar.gz: c4548f2c1d92fd32648062443e5c156838c9b02c3b4e02d755b376a9583adc59bf8c3df3bb707494b4d1605660403ed00b56e2835eef0996f9275fc54d28183a
6
+ metadata.gz: 672d33b4552fbdcd038949290361b9da0cbc346e300811ee423ee5bf95069d6399c90b6eab06600706377a5070bc6e6012ebea6c26f5bafea523d44d0daf7806
7
+ data.tar.gz: 47452cd282ccaa753399e74eecd97bc7407514de7f09cb22ac30e7a5d1d6e9c1b6786d43572408442d69b70378517cfbbd2b5482a73684a1e0ea6672a0e59a2c
data/CHANGELOG.md CHANGED
@@ -6,7 +6,96 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
- Converted to GitHub Actions for CI
9
+ ## [4.0.0] - 2026-09-21
10
+
11
+ Removes everything 3.7.0 deprecated. Nothing here is a surprise if you upgraded
12
+ to 3.7.0 and cleared its warnings; see Upgrading from 3.x in README.md.
13
+
14
+ ### Breaking
15
+ - Ruby 3.2 and Rails 7.2 are the minimum, enforced by `required_ruby_version`
16
+ and `railties`/`activerecord >= 7.2`. Every combination CI verifies is now at
17
+ or above the floors, which was not true before
18
+ - `slack-notifier` is no longer a runtime dependency. `Patches::Notifier`
19
+ requires it inside a `begin`/`rescue`, so the `defined?(Slack)` guard it always
20
+ carried finally does something. Applications that set `config.use_slack` add
21
+ `gem 'slack-notifier'` themselves
22
+ - The Capistrano integration is removed - `require 'patches/capistrano'` and its
23
+ `patches:run` task. Invoke `bundle exec rake patches:run` from your deployment
24
+ process instead; `docs/usage.md` shows where
25
+ - The workers include `Sidekiq::Job` directly, so Sidekiq 6.3 or newer is
26
+ required when the integration is used. `Patches.sidekiq_job_module` and its
27
+ `Sidekiq::Worker` fallback are gone
28
+ - The install migration declares `ActiveRecord::Migration[7.2]` rather than
29
+ `[5.0]`. A fresh `patches_patches` therefore gets `datetime(6)` timestamp
30
+ columns, matching what a modern Rails schema uses, where `[5.0]`
31
+ compatibility produced `datetime` without precision. Existing installs are
32
+ untouched - they ran their own copy of the file long ago
33
+ - Rails is required rather than guarded for. `railties` and `activerecord` were
34
+ always hard dependencies and the gem ships an engine, so the `defined?(Rails)`
35
+ checks described a mode nobody used - one of them read `defined?(:Rails)`,
36
+ always truthy, unnoticed until 3.6.3. `lib/patches.rb` now requires `rails`,
37
+ because loading the engine without it fails
38
+
39
+ ### Removed
40
+ - The deprecation warnings 3.7.0 added, now that what they announced has
41
+ happened. `Patches.deprecator` itself stays - applications were told to
42
+ configure it - and its horizon points at the next major
43
+
44
+ ### Changed
45
+ - CI covers every combination the gemspec allows, 12 cells rather than a wider
46
+ range, plus a leg for each optional-integration state: Sidekiq 7.x and 8.x
47
+ with strict arguments on and off, Sidekiq absent, `slack-notifier` absent, and
48
+ neither installed - the last of which nothing covered before
49
+
50
+ ## [3.7.0] - 2026-09-17
51
+
52
+ Declares dependencies the gem always relied on, and announces what 4.0 is
53
+ expected to require. No public API changes and no version constraint moves, so
54
+ anything that installed 3.6.x installs this.
55
+
56
+ ### Added
57
+ - Gem metadata (`source_code_uri`, `changelog_uri`, `bug_tracker_uri`,
58
+ `documentation_uri`). None were declared, so rubygems.org kept showing values
59
+ carried over from older releases - 3.6.3 still lists `source_code_uri` as
60
+ `http://github.com/jobready/patches`, from before the org was renamed
61
+ - `activerecord` as an explicit runtime dependency, at the same `>= 3.2` floor
62
+ as `railties` so nothing currently installable is excluded. `Patches::Patch`
63
+ subclasses `ActiveRecord::Base` and `Patches::Base#execute` calls
64
+ `ActiveRecord::Base.connection`, but only `railties` had been declared
65
+ - `Patches.deprecator`, a gem-owned `ActiveSupport::Deprecation` instance rather
66
+ than the singleton Rails 7.1 deprecated and 8.0 removed. Host applications can
67
+ silence or redirect it with `Patches.deprecator.behavior = :silence`
68
+ - A deprecation warning when `config.use_slack` is set: from 4.0 Patches will
69
+ not depend on `slack-notifier`, so only applications using Slack carry it.
70
+ Add `gem 'slack-notifier'` to your Gemfile to keep notifications working
71
+ - A deprecation warning on `require 'patches/capistrano'`. The Capistrano task
72
+ is removed in 4.0; invoke `rake patches:run` from your deployment process
73
+ instead. It remains opt-in and loads nothing unless a Capfile requires it
74
+ - Deprecation warnings for the two other things 4.0 is expected to require:
75
+ Sidekiq 6.3 or newer, which is where `Sidekiq::Job` arrives, and Ruby 3.2 /
76
+ Rails 7.2. Those floors are higher than the range CI verifies - Ruby 3.0 and
77
+ Rails 7.1 still pass - so anyone below them hears about it a release ahead.
78
+ The Ruby and Rails notice runs from a Rails initializer, after the
79
+ application's own, so `Patches.deprecator.behavior` can silence it
80
+
81
+ ### Changed
82
+ - The published gem carries only what a consumer needs - 27 files rather than
83
+ 42. `Dockerfile`, `docker-compose.yml`, `.devcontainer/`, `.github/`, `bin/`,
84
+ `Rakefile`, `RELEASING.md` and a decorative image were being packaged. `lib`,
85
+ the install migration, `docs/usage.md` and the top-level docs remain
86
+ - The development container works again. It was pinned to `ruby:2.3`, which
87
+ cannot satisfy the current Gemfile, and had not been touched since 2018. The
88
+ Ruby version is now a build argument and the gem versions are passed through
89
+ from the shell, so any cell of the matrix in README.md is reproducible in it.
90
+ A `.devcontainer/` referencing the same compose service comes with it, for
91
+ VS Code and Codespaces
92
+
93
+ ### Removed
94
+ - `.github/workflows/publish.yml`. It published on `release: published` using a
95
+ `GEM_HOST_API_KEY`, had never run in the four years since it was added, and
96
+ would now attempt a duplicate push if a GitHub Release were created after a
97
+ tag. Releases come from `.github/workflows/release.yml` - see
98
+ [RELEASING.md](RELEASING.md)
10
99
 
11
100
  ## [3.6.3] - 2026-09-09
12
101
 
data/README.md CHANGED
@@ -1,41 +1,77 @@
1
1
  # Patches
2
2
  [![Run specs](https://github.com/rdytech/patches/actions/workflows/specs.yml/badge.svg)](https://github.com/rdytech/patches/actions/workflows/specs.yml)
3
- [![Maintainability](https://api.codeclimate.com/v1/badges/39d142050017ffeb2564/maintainability)](https://codeclimate.com/repos/557f93b76956807f81000001/maintainability)
4
- [![Test Coverage](https://api.codeclimate.com/v1/badges/39d142050017ffeb2564/test_coverage)](https://codeclimate.com/repos/557f93b76956807f81000001/test_coverage)
5
3
  [![Gem Version](https://badge.fury.io/rb/patches.svg)](https://badge.fury.io/rb/patches)
6
4
 
7
5
  ![patches](docs/patches.jpg)
8
6
 
7
+ A simple gem for one off tasks - the things that do not belong in a schema
8
+ migration. Back-filling a column, correcting bad data, kicking off a one-time
9
+ import: write it as a class, deploy it, and Patches runs it once and records
10
+ that it ran.
9
11
 
10
- A simple gem for one off tasks
12
+ ## Installation
13
+
14
+ Add the gem to your application's Gemfile:
15
+
16
+ ```ruby
17
+ gem 'patches'
18
+ ```
11
19
 
12
- ## Version 2.0
20
+ Then install the migration that records which patches have run:
13
21
 
14
- Please note the breaking change release around deployment. See [docs/usage.md](docs/usage.md) for the full change.
22
+ ```
23
+ bundle exec rake patches:install:migrations
24
+ bundle exec rake db:migrate
25
+ ```
26
+
27
+ ## Usage
15
28
 
16
- TL;DR You need to manually declare the patches task to run in your deploy.rb
29
+ Generate a patch:
30
+
31
+ ```
32
+ bundle exec rails g patches:patch PreferenceUpdate
33
+ ```
34
+
35
+ Fill in `run`:
36
+
37
+ ```ruby
38
+ class PreferenceUpdate < Patches::Base
39
+ def run
40
+ User.where(preference: nil).update_all(preference: 'default')
41
+ end
42
+ end
43
+ ```
44
+
45
+ Run the pending ones - each patch runs once, and is recorded in
46
+ `patches_patches`:
47
+
48
+ ```
49
+ bundle exec rake patches:run
50
+ ```
51
+
52
+ `rake patches:pending` lists what has not run yet. Patches can run inline or in
53
+ the background via Sidekiq, across all tenants when you use Apartment, and
54
+ report to Slack. See [docs/usage.md](docs/usage.md) for configuration, tenants,
55
+ deployment and the Capistrano task.
17
56
 
18
57
  ## Compatibility
19
58
 
20
- This release changes no version constraint: the gemspec still requires only
21
- `railties >= 3.2` and sets no Ruby floor, so anything that installed 3.6.2
22
- installs 3.6.3. The table is what CI verifies, which is narrower than what the
23
- gem permits - older Ruby and Rails are untested here, not blocked.
24
-
25
- | | Rails 7.1 | Rails 7.2 | Rails 8.0 | Rails 8.1 |
26
- |---|---|---|---|---|
27
- | **Ruby 3.0** | ✅ | | | |
28
- | **Ruby 3.1** | ✅ | ✅ | | |
29
- | **Ruby 3.2** | ✅ | ✅ | ✅ | ✅ |
30
- | **Ruby 3.3** | ✅ | ✅ | ✅ | ✅ |
31
- | **Ruby 3.4** | | ✅ | ✅ | ✅ |
32
- | **Ruby 4.0** | | ✅ | ✅ | ✅ |
33
-
34
- A blank cell is a pairing Rails itself does not support. Ruby 2.7 and Rails
35
- 6.1/7.0 are deliberately not exercised - they are well past upstream support -
36
- though the gem still installs and, as of this release, passes on them.
37
-
38
- Ruby 4.0 is newer than all of these Rails releases, so those cells record that
59
+ | | Minimum |
60
+ |---|---|
61
+ | Ruby | 3.2 |
62
+ | Rails | 7.2 |
63
+
64
+ Every combination the gemspec allows is verified on each push and pull request -
65
+ the floors and the matrix are the same set, which they were not before 4.0:
66
+
67
+ | | Rails 7.2 | Rails 8.0 | Rails 8.1 |
68
+ |---|---|---|---|
69
+ | **Ruby 3.2** | ✅ | ✅ | ✅ |
70
+ | **Ruby 3.3** | ✅ | ✅ | ✅ |
71
+ | **Ruby 3.4** | ✅ | ✅ | ✅ |
72
+ | **Ruby 4.0** | ✅ | ✅ | ✅ |
73
+
74
+ Ruby 4.0 is newer than all three Rails releases, so those cells record that
39
75
  Patches is verified on it, not that Rails claims support for it.
40
76
 
41
77
  ### Sidekiq
@@ -44,17 +80,21 @@ Sidekiq is an **optional** integration, not a runtime dependency: Patches runs
44
80
  each patch inline when Sidekiq is absent. Set `config.use_sidekiq = true` to run
45
81
  them in the background - see [docs/usage.md](docs/usage.md).
46
82
 
47
- The workers resolve their mixin at load time via `Patches.sidekiq_job_module`,
48
- preferring `Sidekiq::Job` (the name Sidekiq has used since 6.3) and falling back
49
- to `Sidekiq::Worker`, so older Sidekiq keeps working. CI covers each state a
50
- consumer can be in:
83
+ The workers include `Sidekiq::Job`, so Sidekiq 6.3 or newer is required when the
84
+ integration is used - 6.2 and earlier predate that constant. CI covers each
85
+ state a consumer can be in:
51
86
 
52
87
  | State | Covered by |
53
88
  |---|---|
54
89
  | Sidekiq not installed | A leg omitting the gem entirely, exercising the `defined?(Sidekiq)` guards |
55
90
  | Installed, strict arguments on | Sidekiq 7.x and 8.x at their default (`:raise`) |
56
91
  | Installed, strict arguments off | Sidekiq 7.x and 8.x with `Sidekiq.strict_args!(false)` |
57
- | Older Sidekiq | A 6.5 leg, plus a spec covering the `Sidekiq::Worker` fallback |
92
+
93
+ ### Slack
94
+
95
+ Slack notifications are optional and Patches does not install
96
+ `slack-notifier` - add `gem 'slack-notifier'` to your own Gemfile if you set
97
+ `config.use_slack`. CI runs a leg without it to keep that path honest.
58
98
 
59
99
  ### Running one combination locally
60
100
 
@@ -107,30 +147,55 @@ combination again, and delete `test.db` when switching between them: the suite
107
147
  creates `patches_patches` only when it is missing, so a database left by an
108
148
  earlier run can mask ordering problems.
109
149
 
110
- ## Installation
150
+ ## Upgrading from 3.x
111
151
 
112
- Add this line to your application's Gemfile:
152
+ Everything 4.0 removes was deprecated in 3.7.0, so upgrade to that first and
153
+ clear its warnings - `Patches.deprecator.behavior = :raise` in an initializer
154
+ turns them into failures if you would rather find them that way.
113
155
 
114
- ```ruby
115
- gem 'patches'
116
- ```
117
- And then execute:
156
+ | Change | What to do |
157
+ |---|---|
158
+ | Ruby 3.2 and Rails 7.2 are now the minimum | Upgrade, or stay on 3.7.x |
159
+ | `slack-notifier` is no longer a dependency | Add `gem 'slack-notifier'` to your Gemfile if you set `config.use_slack` |
160
+ | The Capistrano task is gone | Invoke `bundle exec rake patches:run` from your deployment process |
161
+ | The workers include `Sidekiq::Job` | Use Sidekiq 6.3 or newer - 7.x or 8.x are the supported lines |
162
+
163
+ Nothing else changed: patch classes, `Patches::Base`, the generator, the rake
164
+ tasks, the configuration and the `patches_patches` table are all as they were.
165
+ `Patches.deprecator` remains, so an initializer that configures it keeps
166
+ working.
118
167
 
119
- $ bundle
168
+ ## Development
120
169
 
121
- Or install it yourself as:
170
+ In VS Code or Codespaces, open the repository in the dev container - it reuses
171
+ the `app` service from `docker-compose.yml`, so there is one definition of the
172
+ environment rather than two. Otherwise, from a shell:
122
173
 
123
- $ gem install patches
174
+ ```
175
+ docker compose build
176
+ docker compose run --rm app
177
+ ```
124
178
 
125
- ## Usage
179
+ The container's default command runs the specs. Any cell of the matrix above is
180
+ reproducible in it: the Ruby version is a build argument, and the gem versions
181
+ are passed through from your shell. The image is built with the default
182
+ versions, so a non-default cell has to install them first:
126
183
 
127
- see [docs/usage.md](docs/usage.md)
184
+ ```
185
+ docker compose build --build-arg RUBY_VERSION=3.1
128
186
 
129
- ## Development
187
+ RAILS_VERSION="~> 7.1.0" docker compose run --rm app \
188
+ sh -c 'bundle install && bundle exec rspec'
130
189
 
190
+ SIDEKIQ_VERSION=none docker compose run --rm app \
191
+ sh -c 'bundle install && bundle exec rspec --exclude-pattern "sidekiq/**/*_spec.rb"'
131
192
  ```
132
- docker-compose build
133
- docker-compose run app bundle exec rspec
193
+
194
+ Or without Docker, if you have the Ruby you want on your path:
195
+
196
+ ```
197
+ bundle install
198
+ bundle exec rspec
134
199
  ```
135
200
 
136
201
  To install this gem onto your local machine, run `bundle exec rake install`.
@@ -146,4 +211,4 @@ Releases are published by GitHub Actions from a `vX.Y.Z` tag — see
146
211
  2. Create your feature branch (`git checkout -b feature/my-feature-name`)
147
212
  3. Commit your changes (`git commit -am 'Add some feature'`)
148
213
  4. Push to the branch (`git push origin feature/my-new-feature`)
149
- 5. Create a new Pull Request
214
+ 5. Create a new Pull Request against `develop`
@@ -1,4 +1,4 @@
1
- class CreatePatch < ActiveRecord::Migration[5.0]
1
+ class CreatePatch < ActiveRecord::Migration[7.2]
2
2
  def change
3
3
  create_table :patches_patches do |t|
4
4
  t.string :path, null: false
data/docs/usage.md CHANGED
@@ -22,6 +22,9 @@ bundle exec rake db:migrate
22
22
 
23
23
  ## Configuration
24
24
 
25
+ > **Note.** Patches does not depend on `slack-notifier`. If you set
26
+ > `config.use_slack`, add `gem 'slack-notifier'` to your own Gemfile.
27
+
25
28
  If you would like to run the patches asynchronously, or would like them to notify
26
29
  your Slack channel when they fail or succeed, you need to set up
27
30
  an initializer to set those options.
@@ -113,21 +116,18 @@ bundle exec rake patches:run
113
116
 
114
117
  Patches will only ever run once, patches will run in order of creation date.
115
118
 
116
- To run patches on deployment using Capistrano, edit your Capfile and add
117
-
118
- ```ruby
119
- require 'patches/capistrano'
120
- ```
119
+ ### Running on deploy
121
120
 
122
- And then in your deploy.rb
121
+ Invoke the rake task from your deployment process, after the application code is
122
+ in place:
123
123
 
124
- ```ruby
125
- after 'last_task_you_want_to_run' 'patches:run'
124
+ ```
125
+ bundle exec rake patches:run
126
126
  ```
127
127
 
128
- If you are using sidekiq and restarting the sidekiq process on the box
129
- as a part of the deploy process, please make sure that the patches run task runs
130
- after sidekiq restarts, otherwise there is no guarentee the tasks will run.
128
+ If you use Sidekiq and restart it as part of the deploy, make sure the patches
129
+ task runs after Sidekiq restarts - otherwise there is no guarantee the jobs will
130
+ be picked up.
131
131
 
132
132
  ## File Download
133
133
 
@@ -0,0 +1,12 @@
1
+ require 'active_support/deprecation'
2
+
3
+ module Patches
4
+ # A gem-owned deprecator rather than ActiveSupport::Deprecation's singleton,
5
+ # which Rails 7.1 deprecated and 8.0 removed. Nothing is deprecated in 4.0 -
6
+ # everything 3.7.0 announced has been removed - but this stays: applications
7
+ # were told to configure it to silence those warnings, so removing it would
8
+ # break their initializers. The horizon is the next major.
9
+ def self.deprecator
10
+ @deprecator ||= ActiveSupport::Deprecation.new('5.0', 'patches')
11
+ end
12
+ end
@@ -1,4 +1,12 @@
1
- require 'slack-notifier'
1
+ # Optional: an application that sets config.use_slack adds slack-notifier to its
2
+ # own Gemfile. Patches runs without it, and send_slack_message's `defined?(Slack)`
3
+ # guard - which could never be false while this require was unconditional - now
4
+ # does its job.
5
+ begin
6
+ require 'slack-notifier'
7
+ rescue LoadError
8
+ nil
9
+ end
2
10
 
3
11
  class Patches::Notifier
4
12
  class << self
@@ -28,7 +36,7 @@ class Patches::Notifier
28
36
  end
29
37
 
30
38
  def environment_prefix
31
- Rails.env.upcase if defined?(Rails)
39
+ Rails.env.upcase
32
40
  end
33
41
 
34
42
  def notification_suffix
@@ -1,8 +1,8 @@
1
1
  require 'active_support/core_ext/hash/keys'
2
- require 'patches/sidekiq_job'
2
+ require 'sidekiq'
3
3
 
4
4
  class Patches::TenantWorker
5
- include Patches.sidekiq_job_module
5
+ include Sidekiq::Job
6
6
  include Patches::TenantRunConcern
7
7
  include Patches::ApplicationVersionValidation
8
8
 
@@ -1,6 +1,6 @@
1
1
  module Patches
2
- MAJOR = 3
3
- MINOR = 6
4
- PATCH = 3
2
+ MAJOR = 4
3
+ MINOR = 0
4
+ PATCH = 0
5
5
  VERSION = [MAJOR, MINOR, PATCH].compact.join(".").freeze
6
6
  end
@@ -1,8 +1,8 @@
1
1
  require 'active_support/core_ext/hash/keys'
2
- require 'patches/sidekiq_job'
2
+ require 'sidekiq'
3
3
 
4
4
  class Patches::Worker
5
- include Patches.sidekiq_job_module
5
+ include Sidekiq::Job
6
6
  include Patches::ApplicationVersionValidation
7
7
 
8
8
  sidekiq_options Patches::Config.configuration.sidekiq_options
data/lib/patches.rb CHANGED
@@ -1,8 +1,15 @@
1
+ # railties and activerecord are hard dependencies, and the engine, the install
2
+ # migration and Patches.default_path all assume a Rails application. The gem
3
+ # used to guard on `defined?(Rails)` as though Rails were optional; one of those
4
+ # guards read `defined?(:Rails)`, which is always truthy, and went unnoticed for
5
+ # years - nobody was running this outside Rails.
6
+ require 'rails'
7
+
1
8
  require "patches/version"
2
9
 
3
10
  module Patches
4
11
  def self.default_path
5
- Rails.root.join('db/patches/') if defined?(Rails)
12
+ Rails.root.join('db/patches/')
6
13
  end
7
14
 
8
15
  def self.class_name(path)
@@ -19,13 +26,13 @@ module Patches
19
26
  end
20
27
  end
21
28
 
29
+ require "patches/deprecation"
22
30
  require "patches/base"
23
31
  require "patches/config"
24
32
  require "patches/tenant_run_concern"
25
33
  require "patches/application_version_validation"
26
- require "patches/sidekiq_job" if defined?(Sidekiq)
27
34
  require "patches/tenant_worker" if defined?(Sidekiq)
28
- require "patches/engine" if defined?(Rails)
35
+ require "patches/engine"
29
36
  require "patches/patch"
30
37
  require "patches/pending"
31
38
  require "patches/runner"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: patches
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.6.3
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ReadyTech
@@ -15,28 +15,28 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: '3.2'
18
+ version: '7.2'
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: '3.2'
25
+ version: '7.2'
26
26
  - !ruby/object:Gem::Dependency
27
- name: slack-notifier
27
+ name: activerecord
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: '0'
32
+ version: '7.2'
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: '0'
39
+ version: '7.2'
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: bundler
42
42
  requirement: !ruby/object:Gem::Requirement
@@ -134,23 +134,10 @@ executables: []
134
134
  extensions: []
135
135
  extra_rdoc_files: []
136
136
  files:
137
- - ".github/workflows/publish.yml"
138
- - ".github/workflows/release.yml"
139
- - ".github/workflows/specs.yml"
140
- - ".gitignore"
141
- - ".rspec"
142
137
  - CHANGELOG.md
143
- - Dockerfile
144
- - Gemfile
145
138
  - LICENSE.md
146
139
  - README.md
147
- - RELEASING.md
148
- - Rakefile
149
- - bin/console
150
- - bin/setup
151
140
  - db/migrate/201506011700_create_patch.rb
152
- - docker-compose.yml
153
- - docs/patches.jpg
154
141
  - docs/usage.md
155
142
  - lib/generators/patches/patch_generator.rb
156
143
  - lib/generators/patches/templates/patch.rb.erb
@@ -158,26 +145,27 @@ files:
158
145
  - lib/patches.rb
159
146
  - lib/patches/application_version_validation.rb
160
147
  - lib/patches/base.rb
161
- - lib/patches/capistrano.rb
162
- - lib/patches/capistrano/tasks.rake
163
148
  - lib/patches/config.rb
149
+ - lib/patches/deprecation.rb
164
150
  - lib/patches/engine.rb
165
151
  - lib/patches/notifier.rb
166
152
  - lib/patches/patch.rb
167
153
  - lib/patches/pending.rb
168
154
  - lib/patches/runner.rb
169
- - lib/patches/sidekiq_job.rb
170
155
  - lib/patches/tenant_run_concern.rb
171
156
  - lib/patches/tenant_runner.rb
172
157
  - lib/patches/tenant_worker.rb
173
158
  - lib/patches/version.rb
174
159
  - lib/patches/worker.rb
175
160
  - lib/tasks/patches.rake
176
- - patches.gemspec
177
161
  homepage: https://github.com/rdytech/patches
178
162
  licenses:
179
163
  - MIT
180
- metadata: {}
164
+ metadata:
165
+ source_code_uri: https://github.com/rdytech/patches
166
+ changelog_uri: https://github.com/rdytech/patches/blob/v4.0.0/CHANGELOG.md
167
+ bug_tracker_uri: https://github.com/rdytech/patches/issues
168
+ documentation_uri: https://github.com/rdytech/patches/blob/v4.0.0/docs/usage.md
181
169
  rdoc_options: []
182
170
  require_paths:
183
171
  - lib
@@ -185,7 +173,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
185
173
  requirements:
186
174
  - - ">="
187
175
  - !ruby/object:Gem::Version
188
- version: '0'
176
+ version: '3.2'
189
177
  required_rubygems_version: !ruby/object:Gem::Requirement
190
178
  requirements:
191
179
  - - ">="
@@ -1,26 +0,0 @@
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}}"
@@ -1,35 +0,0 @@
1
- name: Release
2
-
3
- on:
4
- push:
5
- tags: ["v*"]
6
-
7
- permissions:
8
- contents: write # rake release (via rubygems/release-gem) pushes the tag; no-op here since it's already pushed
9
- id-token: write # RubyGems.org OIDC trusted publishing
10
- packages: write # GitHub Packages push
11
-
12
- jobs:
13
- release:
14
- runs-on: ubuntu-latest
15
- steps:
16
- - uses: actions/checkout@v5
17
- with:
18
- fetch-depth: 0
19
- persist-credentials: false
20
-
21
- - name: Verify tag is reachable from develop
22
- run: |
23
- if ! git merge-base --is-ancestor "$GITHUB_SHA" origin/develop; then
24
- echo "::error::$GITHUB_REF_NAME is not reachable from develop. Refusing to publish."
25
- exit 1
26
- fi
27
-
28
- - name: Set up Ruby
29
- uses: ruby/setup-ruby@v1
30
- with:
31
- bundler-cache: true
32
- ruby-version: "3.4"
33
-
34
- - name: Publish to RubyGems.org
35
- uses: rubygems/release-gem@v1
@@ -1,113 +0,0 @@
1
- name: Run specs
2
- on:
3
- workflow_dispatch:
4
- pull_request:
5
- branches:
6
- - develop
7
- push:
8
- branches:
9
- - develop
10
-
11
- jobs:
12
- # This patch release changes no version constraint, so the matrix records the
13
- # range the gem is verified against rather than narrowing what it allows -
14
- # older Ruby and Rails remain permitted, just untested. Rails 6.1/7.0 and
15
- # Ruby 2.7 are left out deliberately: they are long past upstream support,
16
- # and they were the cells that needed harness pins (Rails <= 7.0 pins its
17
- # sqlite3 adapter to `~> 1.4`, Rails < 7.1 predates concurrent-ruby 1.3.5
18
- # dropping a Logger constant) or a pinned runner image. The Gemfile still
19
- # accepts those overrides for reproducing an old combination locally.
20
- specs:
21
- name: Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }}
22
- runs-on: ubuntu-latest
23
- strategy:
24
- fail-fast: false
25
- matrix:
26
- include:
27
- - { ruby: '3.0', rails: '~> 7.1.0' }
28
- - { ruby: '3.1', rails: '~> 7.1.0' }
29
- - { ruby: '3.1', rails: '~> 7.2.0' }
30
- - { ruby: '3.2', rails: '~> 7.1.0' }
31
- - { ruby: '3.2', rails: '~> 7.2.0' }
32
- - { ruby: '3.2', rails: '~> 8.0.0' }
33
- - { ruby: '3.2', rails: '~> 8.1.0' }
34
- - { ruby: '3.3', rails: '~> 7.1.0' }
35
- - { ruby: '3.3', rails: '~> 7.2.0' }
36
- - { ruby: '3.3', rails: '~> 8.0.0' }
37
- - { ruby: '3.3', rails: '~> 8.1.0' }
38
- - { ruby: '3.4', rails: '~> 7.2.0' }
39
- - { ruby: '3.4', rails: '~> 8.0.0' }
40
- - { ruby: '3.4', rails: '~> 8.1.0' }
41
- - { ruby: '4.0', rails: '~> 7.2.0' }
42
- - { ruby: '4.0', rails: '~> 8.0.0' }
43
- - { ruby: '4.0', rails: '~> 8.1.0' }
44
- env:
45
- RAILS_VERSION: ${{ matrix.rails }}
46
- steps:
47
- - uses: actions/checkout@v4
48
- - uses: ruby/setup-ruby@v1
49
- with:
50
- ruby-version: ${{ matrix.ruby }}
51
- bundler-cache: true
52
- - name: Run specs
53
- run: bundle exec rspec
54
-
55
- # Sidekiq is optional, so it gets its own axis rather than multiplying the
56
- # matrix above. All three states a consumer can be in are covered: absent,
57
- # present with strict argument checking (the Sidekiq 7+ default), and present
58
- # with it disabled. The 6.5 leg covers the Sidekiq::Worker-era fallback path.
59
- sidekiq:
60
- name: Sidekiq ${{ matrix.sidekiq }} (strict args ${{ matrix.strict_args || 'absent' }})
61
- runs-on: ubuntu-latest
62
- strategy:
63
- fail-fast: false
64
- matrix:
65
- include:
66
- - { sidekiq: '~> 6.5' }
67
- - { sidekiq: '~> 7.0', strict_args: 'raise' }
68
- - { sidekiq: '~> 7.0', strict_args: 'false' }
69
- - { sidekiq: '~> 8.0', strict_args: 'raise' }
70
- - { sidekiq: '~> 8.0', strict_args: 'false' }
71
- - { sidekiq: 'none' }
72
- env:
73
- SIDEKIQ_VERSION: ${{ matrix.sidekiq }}
74
- SIDEKIQ_STRICT_ARGS: ${{ matrix.strict_args }}
75
- steps:
76
- - uses: actions/checkout@v4
77
- - uses: ruby/setup-ruby@v1
78
- with:
79
- ruby-version: '3.4'
80
- bundler-cache: true
81
- - name: Run specs
82
- run: |
83
- if [ "$SIDEKIQ_VERSION" = "none" ]; then
84
- bundle exec rspec --exclude-pattern "sidekiq/**/*_spec.rb"
85
- else
86
- bundle exec rspec
87
- fi
88
-
89
- sonarqube:
90
- name: SonarQube
91
- runs-on: ubuntu-latest
92
- steps:
93
- - uses: actions/checkout@v4
94
- - uses: ruby/setup-ruby@v1
95
- with:
96
- ruby-version: '3.2'
97
- bundler-cache: true
98
- - name: Run specs
99
- run: bundle exec rspec
100
-
101
- - name: SonarQube Scan
102
- uses: sonarsource/sonarqube-scan-action@master
103
- with:
104
- args: >
105
- -Dsonar.projectKey=rdytech_patches_4fe7fcf4-bbfc-4b19-be78-87e73d1f301e
106
- -Dsonar.host.url=https://sonarqube.readytech.io
107
- -Dsonar.sources=lib/
108
- -Dsonar.inclusions=**/*.rb
109
- -Dsonar.tests=spec/
110
- -Dsonar.ruby.coverage.reportPaths=coverage/.resultset.json
111
- -Dsonar.plugins.downloadOnlyRequired=true
112
- env:
113
- SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
data/.gitignore DELETED
@@ -1,13 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- /coverage/
11
- /test.db
12
- /*.gem
13
- .byebug_history
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --color
2
- --require spec_helper
data/Dockerfile DELETED
@@ -1,9 +0,0 @@
1
- FROM ruby:2.3
2
-
3
- RUN touch ~/.gemrc && echo "gem: --no-ri --no-rdoc" >> ~/.gemrc
4
-
5
- WORKDIR /app/
6
- ADD . /app/
7
- RUN bundle install
8
-
9
- CMD bundle exec rake -T
data/Gemfile DELETED
@@ -1,39 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- # rails, sqlite3, concurrent-ruby and sidekiq are declared here rather than in
6
- # the gemspec so that CI can vary them across the support matrix in README.md.
7
- # Reproduce any CI cell locally by setting the same variables:
8
- #
9
- # RAILS_VERSION="~> 7.0.0" SQLITE3_VERSION="~> 1.4" bundle install
10
- # bundle exec rspec
11
- #
12
- # An unset *or empty* value falls back to the default, because GitHub Actions
13
- # passes an empty string for matrix keys a given cell doesn't define.
14
- def version_requirement(name, default = nil)
15
- value = ENV.fetch(name, '').strip
16
- value.empty? ? default : value
17
- end
18
-
19
- # Unset, this resolves to the newest Rails the running Ruby allows. The gemspec
20
- # floor stays at railties >= 3.2; see Compatibility in README.md for the range
21
- # CI verifies.
22
- gem 'rails', version_requirement('RAILS_VERSION', '>= 7.1')
23
-
24
- # Rails pins its sqlite3 adapter: <= 7.0 needs `~> 1.4`, 7.1 accepts either,
25
- # 8.0+ needs `>= 2.1`. Unset, bundler picks the newest 2.x.
26
- gem 'sqlite3', version_requirement('SQLITE3_VERSION', '>= 1.4')
27
-
28
- # Rails < 7.1 predates concurrent-ruby 1.3.5 removing the Logger constant that
29
- # ActiveSupport::LoggerThreadSafeLevel expects.
30
- concurrent_ruby = version_requirement('CONCURRENT_RUBY_VERSION')
31
- gem 'concurrent-ruby', concurrent_ruby if concurrent_ruby
32
-
33
- # Sidekiq is an optional integration, not a runtime dependency. SIDEKIQ_VERSION
34
- # =none leaves it out entirely so the `defined?(Sidekiq)` guards get exercised.
35
- # The library itself still supports older Sidekiq through
36
- # Patches.sidekiq_job_module; this default only picks what the suite runs
37
- # against by default.
38
- sidekiq = version_requirement('SIDEKIQ_VERSION')
39
- gem 'sidekiq', *[sidekiq].compact unless sidekiq == 'none'
data/RELEASING.md DELETED
@@ -1,50 +0,0 @@
1
- # Releasing patches
2
-
3
- Publishing is only ever done by GitHub Actions (`.github/workflows/release.yml`), triggered by
4
- a `vX.Y.Z` tag whose commit is reachable from `develop`. Tags on any other branch are rejected by
5
- the workflow before anything is built. No one needs local publishing credentials — the workflow
6
- authenticates to RubyGems.org via OIDC trusted publishing.
7
-
8
- The `v` prefix is required: the workflow triggers on `v*`, and it is the tag `rake release`
9
- creates. RubyGems.org strips it, so `v3.6.3` publishes version `3.6.3` — which is why the
10
- versions listed on rubygems.org never carry the prefix.
11
-
12
- ## Cutting a release
13
-
14
- 1. Bump `MAJOR` / `MINOR` / `PATCH` in `lib/patches/version.rb`.
15
- 2. Add a new `## [X.Y.Z] - YYYY-MM-DD` entry to the top of `CHANGELOG.md` describing the changes.
16
- 3. Commit both changes and get them onto `develop` (PR + merge, as normal).
17
- 4. From an up-to-date `develop`, tag the commit and push the tag:
18
-
19
- ```bash
20
- git tag vX.Y.Z
21
- git push origin vX.Y.Z
22
- ```
23
-
24
- 5. Watch the "Release" workflow run in the Actions tab.
25
- 6. Confirm the new version shows up on [rubygems.org](https://rubygems.org/gems/patches).
26
-
27
- Do **not** run `bundle exec rake release` from a workstation. It would push the gem under your own
28
- credentials *and* push the tag, and the workflow's own `rake release` would then fail because the
29
- version already exists.
30
-
31
- ## One-time setup
32
-
33
- - **RubyGems.org**: an existing owner of the `patches` gem must add a Trusted Publisher for
34
- `rdytech/patches`, workflow `release.yml` (no environment). See
35
- [Trusted Publishing: adding a publisher](https://guides.rubygems.org/trusted-publishing/adding-a-publisher/).
36
- Until this is done, the release will fail while configuring credentials. The gem currently lists
37
- a single owner, handle `jr`.
38
- - **GitHub Packages**: the workflow carries a `packages: write` permission, inherited from the
39
- shared workflow, but no step publishes there and nothing is pushed to it.
40
-
41
- ## Why this exists
42
-
43
- Six tagged versions never reached RubyGems.org — `2.0.1`, `2.1.0`, `2.2.0`, `2.3.0`, `3.0.0` and
44
- `3.6.1` — and nothing reported the gap. The `3.6.2` entry in `CHANGELOG.md` ("Fixes incorrect
45
- release - tag and published gem back in sync") is the visible trace of the most recent one:
46
- `3.6.1` was tagged and released on GitHub but never published, because
47
- `.github/workflows/publish.yml` was added the same day and has never run.
48
-
49
- `rubygems/release-gem` waits for the new version to appear on RubyGems.org before the job
50
- succeeds, so a release that does not land now fails loudly instead of passing unnoticed.
data/Rakefile DELETED
@@ -1,2 +0,0 @@
1
- require "bundler/gem_tasks"
2
-
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "patches"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start
data/bin/setup DELETED
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
-
5
- bundle install
6
-
7
- # Do any other automated setup that you need to do here
data/docker-compose.yml DELETED
@@ -1,11 +0,0 @@
1
- version: '3.2'
2
- services:
3
- app:
4
- build: .
5
- volumes:
6
- - .:/app
7
- - app-gems:/usr/local/bundle
8
-
9
- volumes:
10
- app-gems:
11
- driver: local
data/docs/patches.jpg DELETED
Binary file
@@ -1,12 +0,0 @@
1
- namespace :patches do
2
- desc 'Runs rake patches:run'
3
- task :run do
4
- on primary fetch(:migration_role) do
5
- within release_path do
6
- with rails_env: fetch(:rails_env) do
7
- execute :rake, "patches:run"
8
- end
9
- end
10
- end
11
- end
12
- end
@@ -1 +0,0 @@
1
- load File.expand_path("capistrano/tasks.rake", File.dirname(__FILE__))
@@ -1,11 +0,0 @@
1
- require 'sidekiq'
2
-
3
- module Patches
4
- # Sidekiq renamed Sidekiq::Worker to Sidekiq::Job in 6.3 and still ships the
5
- # old name as a deprecated alias. Resolving it at include time keeps the
6
- # workers working on every Sidekiq this gem has ever supported, so the change
7
- # needs no version bump from consumers.
8
- def self.sidekiq_job_module
9
- defined?(::Sidekiq::Job) ? ::Sidekiq::Job : ::Sidekiq::Worker
10
- end
11
- end
data/patches.gemspec DELETED
@@ -1,43 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'patches/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "patches"
8
- spec.version = Patches::VERSION
9
- spec.authors = ["ReadyTech"]
10
- spec.email = ["ruby_gems@readytech.io"]
11
-
12
- spec.licenses = ['MIT']
13
- spec.summary = %q{A simple gem for one off tasks}
14
- spec.description = %q{A simple gem for one off tasks for example database patches}
15
- spec.homepage = "https://github.com/rdytech/patches"
16
-
17
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- spec.bindir = "exe"
19
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
21
-
22
- # Runtime constraints are deliberately unchanged here: raising a minimum can
23
- # block an install that works today, which is a major-version change.
24
- # README.md records the range CI actually verifies. Declaring activerecord
25
- # (Patches::Patch subclasses ActiveRecord::Base) and bounding slack-notifier
26
- # are queued for the next minor.
27
- spec.add_dependency "railties", ">= 3.2"
28
- spec.add_dependency "slack-notifier"
29
-
30
- spec.add_development_dependency "bundler", "> 1.8"
31
- spec.add_development_dependency "rake", "> 10.0"
32
- spec.add_development_dependency "rspec", "~> 3.13"
33
- spec.add_development_dependency "simplecov", "~> 0.17", '< 0.18' # sonarscanner requires < 0.18
34
- spec.add_development_dependency "pry"
35
- spec.add_development_dependency "webmock"
36
-
37
- # rails, sqlite3, sidekiq and concurrent-ruby live in the Gemfile so CI can
38
- # vary them across the range documented in README.md. capybara, factory_girl,
39
- # timecop, generator_spec, byebug and database_cleaner were referenced by no
40
- # spec, and rspec-rails was never required, so plain rspec replaces it.
41
- # Sidekiq is an optional integration, not a runtime dependency, and the suite
42
- # is expected to pass without it installed.
43
- end