yiffspace-fixers 0.0.1 → 0.0.3
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 +4 -4
- data/CHANGELOG.md +14 -0
- data/README.md +3 -2
- data/lib/yiffspace/fix_tracker.rb +6 -3
- data/lib/yiffspace/fixers/script.rb +12 -0
- data/lib/yiffspace/fixers/version.rb +1 -1
- data/lib/yiffspace/fixers.rb +3 -0
- 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: 63554d772d4091d0d869023320f37c67b15f7e210ca23ef72ac99f2aaaad2fd3
|
|
4
|
+
data.tar.gz: f6466feaf844911fd1ddcdedebe1c4d9f55ff225fbce907bf1f37defc3258662
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 06e9bfd1da3f639d35d8d14f773a6d8d947486c8b2601aa8ac1bed4fc0746efe8f7e4f85a4d334516db6017d6c2fc3046f0c7069dc5145716ed33b1b413d49b4
|
|
7
|
+
data.tar.gz: 2b6bde7b6c07121e45cf4f4869ce0274898272fda784d653206551ab378418cb93bb2add97c3a11601b604106a99075e941598282805691cc9b189acc68edf8c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## Unreleased
|
|
2
|
+
|
|
3
|
+
- Fixes run through `YiffSpace::FixTracker.run!` (so every `fixes:*` task) can call
|
|
4
|
+
`requires_migration!` unqualified, via `YiffSpace::Fixers::Script` - each fix is now loaded
|
|
5
|
+
wrapped in its own module including it, rather than straight into the top level, so it isn't
|
|
6
|
+
defined anywhere else in the app. Constants a fix defines now land in that wrapper too, instead
|
|
7
|
+
of on `Object`. `required_migration_for` reads the unqualified form as well.
|
|
8
|
+
- Fixed `lib/yiffspace/fixers.rb` never actually defining `YiffSpace::Fixers` -
|
|
9
|
+
it set up the `for_gem_extension` Zeitwerk loader but skipped the namespace
|
|
10
|
+
module the convention requires the root file to define, so referencing
|
|
11
|
+
`YiffSpace::Fixers` (even indirectly, e.g. `YiffSpace::Fixers::Engine`)
|
|
12
|
+
after the gem's initial `require` raised `Zeitwerk::NameError: expected
|
|
13
|
+
file ... to define constant YiffSpace::Fixers, but didn't`.
|
|
14
|
+
|
|
1
15
|
## 0.0.1
|
|
2
16
|
|
|
3
17
|
- Initial release, extracted from the `yiffspace` gem's `YiffSpace::FixTracker`/
|
data/README.md
CHANGED
|
@@ -32,11 +32,12 @@ $ bin/rails fixes:migrate
|
|
|
32
32
|
A fix can require that a migration has already been applied, and a migration can require that a
|
|
33
33
|
fix has already been applied - useful when one depends on schema or data the other provides.
|
|
34
34
|
`bin/rails fixes:migrate_all` runs both `db/migrate` and `db/fixes` together, in whichever order
|
|
35
|
-
those requirements demand
|
|
35
|
+
those requirements demand. `requires_migration!` is available unqualified inside fixes run by the
|
|
36
|
+
`fixes:*` tasks (`YiffSpace::FixTracker.requires_migration!` works too, and anywhere else):
|
|
36
37
|
|
|
37
38
|
```ruby
|
|
38
39
|
# db/fixes/12_backfill_widget_type.rb
|
|
39
|
-
|
|
40
|
+
requires_migration!("20260822004454")
|
|
40
41
|
|
|
41
42
|
# db/migrate/20260901000000_remove_legacy_widget_column.rb
|
|
42
43
|
class RemoveLegacyWidgetColumn < ActiveRecord::Migration[8.1]
|
|
@@ -11,12 +11,14 @@ module YiffSpace
|
|
|
11
11
|
# A fix script calls this as its first statement to declare that a migration must already be
|
|
12
12
|
# applied before it can run, e.g.:
|
|
13
13
|
#
|
|
14
|
-
#
|
|
14
|
+
# requires_migration!("20260822004454")
|
|
15
|
+
#
|
|
16
|
+
# (unqualified via YiffSpace::Fixers::Script, or as YiffSpace::FixTracker.requires_migration!)
|
|
15
17
|
#
|
|
16
18
|
# Written as a literal string call like that (not built dynamically) so YiffSpace::MigrationSync
|
|
17
19
|
# can also read it back out of the file with #required_migration_for, without loading/running
|
|
18
20
|
# the fix, to order `fixes:migrate_all` correctly.
|
|
19
|
-
REQUIRES_MIGRATION_PATTERN = /^\s*YiffSpace::FixTracker\.requires_migration!\(\s*["']([^"']+)["']\s*\)/
|
|
21
|
+
REQUIRES_MIGRATION_PATTERN = /^\s*(?:YiffSpace::FixTracker\.)?requires_migration!\(\s*["']([^"']+)["']\s*\)/
|
|
20
22
|
|
|
21
23
|
module_function
|
|
22
24
|
|
|
@@ -108,7 +110,8 @@ module YiffSpace
|
|
|
108
110
|
|
|
109
111
|
def run!(path)
|
|
110
112
|
name = File.basename(path, ".rb")
|
|
111
|
-
|
|
113
|
+
# A fresh wrapper per fix, so any constants a script defines don't carry over to the next one.
|
|
114
|
+
load(File.expand_path(path), Module.new.include(Fixers::Script))
|
|
112
115
|
record!(name)
|
|
113
116
|
name
|
|
114
117
|
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module YiffSpace
|
|
4
|
+
module Fixers
|
|
5
|
+
# Helpers available unqualified at the top level of a db/fixes/*.rb script when it's run
|
|
6
|
+
# through YiffSpace::FixTracker.run! - the script is loaded wrapped in a module including
|
|
7
|
+
# this, so they never leak onto Object for the rest of the app.
|
|
8
|
+
module Script
|
|
9
|
+
delegate(:requires_migration!, to: "YiffSpace::FixTracker")
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
data/lib/yiffspace/fixers.rb
CHANGED
|
@@ -13,6 +13,9 @@ loader.setup
|
|
|
13
13
|
require_relative("fixers/engine") if defined?(Rails)
|
|
14
14
|
|
|
15
15
|
module YiffSpace
|
|
16
|
+
module Fixers
|
|
17
|
+
end
|
|
18
|
+
|
|
16
19
|
class Configuration
|
|
17
20
|
# Named `--steps` presets for `bin/rails generate yiffspace:fixer`. See
|
|
18
21
|
# YiffSpace::Configuration::FixerTemplates.
|
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: yiffspace-fixers
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Donovan_DMC
|
|
8
8
|
bindir: bin
|
|
9
9
|
cert_chain: []
|
|
10
|
-
date: 2026-
|
|
10
|
+
date: 2026-10-03 00:00:00.000000000 Z
|
|
11
11
|
dependencies:
|
|
12
12
|
- !ruby/object:Gem::Dependency
|
|
13
13
|
name: rails
|
|
@@ -75,6 +75,7 @@ files:
|
|
|
75
75
|
- lib/yiffspace/fixers.rb
|
|
76
76
|
- lib/yiffspace/fixers/engine.rb
|
|
77
77
|
- lib/yiffspace/fixers/requires_fix.rb
|
|
78
|
+
- lib/yiffspace/fixers/script.rb
|
|
78
79
|
- lib/yiffspace/fixers/version.rb
|
|
79
80
|
- lib/yiffspace/migration_sync.rb
|
|
80
81
|
homepage: https://yiff.space
|