evilution 0.22.5 → 0.22.6
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 +6 -0
- data/lib/evilution/integration/base.rb +28 -4
- data/lib/evilution/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f88a719ecd12ca2576f1254f3ef1771359f64345eea28e3537e0d9dae38e2c78
|
|
4
|
+
data.tar.gz: 01c65258b5a9d496a566437b74460ff77175d0dbea9988643d048df3b2e18171
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 136e6f94f55a9e312b777573bd73391d6ec7d05ac8c7455817341589edf018002836db6e550255ff16deb974e6a320a8e818e08661b7918bd2ac6e2f4e85aea1
|
|
7
|
+
data.tar.gz: 8e48faca42c452ba1d8ba1b8800deaf1eafc89d264997f34dc04840324296d2431fdc7e9ccb31f2cff5127862adeb818c15a10da5d060301bdcae0b0352d0cf4
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.22.6] - 2026-04-12
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **Zeitwerk re-autoloads original file during mutation load** — Zeitwerk's `const_added` hook re-autoloaded the original source when a module constant was reopened from a temp-dir copy, re-setting `@_included_block` after `clear_concern_state` already removed it; now `pin_autoloaded_constants` resolves all module/class constants from the source via `Object.const_get` before loading, preventing the autoloader from re-triggering (#680)
|
|
8
|
+
|
|
3
9
|
## [0.22.5] - 2026-04-12
|
|
4
10
|
|
|
5
11
|
### Fixed
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require "fileutils"
|
|
4
|
+
require "prism"
|
|
4
5
|
require "tmpdir"
|
|
5
6
|
require_relative "../integration"
|
|
6
7
|
require_relative "../temp_dir_tracker"
|
|
@@ -87,6 +88,7 @@ class Evilution::Integration::Base
|
|
|
87
88
|
File.write(dest, mutation.mutated_source)
|
|
88
89
|
$LOAD_PATH.unshift(@temp_dir)
|
|
89
90
|
displace_loaded_feature(mutation.file_path)
|
|
91
|
+
pin_autoloaded_constants(mutation.original_source)
|
|
90
92
|
clear_concern_state(mutation.file_path)
|
|
91
93
|
require(subpath.delete_suffix(".rb"))
|
|
92
94
|
end
|
|
@@ -96,6 +98,7 @@ class Evilution::Integration::Base
|
|
|
96
98
|
dest = File.join(@temp_dir, absolute)
|
|
97
99
|
FileUtils.mkdir_p(File.dirname(dest))
|
|
98
100
|
File.write(dest, mutation.mutated_source)
|
|
101
|
+
pin_autoloaded_constants(mutation.original_source)
|
|
99
102
|
clear_concern_state(mutation.file_path)
|
|
100
103
|
load(dest)
|
|
101
104
|
end
|
|
@@ -112,6 +115,30 @@ class Evilution::Integration::Base
|
|
|
112
115
|
@temp_dir = nil
|
|
113
116
|
end
|
|
114
117
|
|
|
118
|
+
def pin_autoloaded_constants(source)
|
|
119
|
+
collect_constant_names(Prism.parse(source).value).each do |name|
|
|
120
|
+
Object.const_get(name) if Object.const_defined?(name, false)
|
|
121
|
+
rescue NameError # :nodoc:
|
|
122
|
+
nil
|
|
123
|
+
end
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
def collect_constant_names(node, nesting = [])
|
|
127
|
+
names = []
|
|
128
|
+
case node
|
|
129
|
+
when Prism::ModuleNode, Prism::ClassNode
|
|
130
|
+
const = node.constant_path.full_name
|
|
131
|
+
qualified = nesting.any? && !const.include?("::") ? "#{nesting.join("::")}::#{const}" : const
|
|
132
|
+
names << qualified
|
|
133
|
+
names.concat(collect_constant_names(node.body, nesting + [const])) if node.body
|
|
134
|
+
when Prism::ProgramNode
|
|
135
|
+
names.concat(collect_constant_names(node.statements, nesting)) if node.statements
|
|
136
|
+
when Prism::StatementsNode
|
|
137
|
+
node.body.each { |child| names.concat(collect_constant_names(child, nesting)) }
|
|
138
|
+
end
|
|
139
|
+
names
|
|
140
|
+
end
|
|
141
|
+
|
|
115
142
|
def clear_concern_state(file_path)
|
|
116
143
|
return unless defined?(ActiveSupport::Concern)
|
|
117
144
|
|
|
@@ -135,10 +162,7 @@ class Evilution::Integration::Base
|
|
|
135
162
|
end
|
|
136
163
|
|
|
137
164
|
def source_matches?(block_path, absolute, subpath)
|
|
138
|
-
|
|
139
|
-
return true if subpath && block_path.end_with?("/#{subpath}")
|
|
140
|
-
|
|
141
|
-
false
|
|
165
|
+
block_path == absolute || (subpath && block_path.end_with?("/#{subpath}"))
|
|
142
166
|
end
|
|
143
167
|
|
|
144
168
|
def resolve_require_subpath(file_path)
|
data/lib/evilution/version.rb
CHANGED