rfmt 1.3.2-arm64-darwin → 1.3.3-arm64-darwin
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 +12 -0
- data/lib/rfmt/3.1/rfmt.bundle +0 -0
- data/lib/rfmt/3.2/rfmt.bundle +0 -0
- data/lib/rfmt/3.3/rfmt.bundle +0 -0
- data/lib/rfmt/native_extension_loader.rb +138 -0
- data/lib/rfmt/version.rb +1 -1
- data/lib/rfmt.rb +4 -1
- 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: 8b2f8ba4f4833b0816c8a43fb0c9fca256641c2bf9cccfda07090bcb09ca2ab6
|
|
4
|
+
data.tar.gz: 91d499e02f3c10489d99e0dcabee5b26e09db69782e9704b5c410d733dd22716
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 56500f8fa9256e0240a161c4b78fbc85a3e123ffe6e597fe3d015cdf5a40ece01757ff95b0e24628ccc7c6b60d5ff2b1527c2164010f04f55da4a67255748f93
|
|
7
|
+
data.tar.gz: 2633a7b26283ce611947865e6377e762443fd6c03634a179f399383c47a2c6a23d287991e3d8c383b6b6df3994cad1b3510a9b1718bf51ae42491e2b0f2e9b55
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
## [Unreleased]
|
|
2
2
|
|
|
3
|
+
## [1.3.3] - 2026-01-17
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Add native extension loader for Ruby 3.3+ compatibility (#65)
|
|
7
|
+
- Resolves LoadError on Ruby 3.3+ arm64-darwin systems
|
|
8
|
+
- Implements dynamic path resolution for version-specific directories
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- Remove unnecessary String clones in comment emission (performance optimization)
|
|
12
|
+
- Remove debug logs and obvious comments from codebase
|
|
13
|
+
- Update .gitignore with development artifacts
|
|
14
|
+
|
|
3
15
|
## [1.3.2] - 2026-01-09
|
|
4
16
|
|
|
5
17
|
### Added
|
data/lib/rfmt/3.1/rfmt.bundle
CHANGED
|
Binary file
|
data/lib/rfmt/3.2/rfmt.bundle
CHANGED
|
Binary file
|
data/lib/rfmt/3.3/rfmt.bundle
CHANGED
|
Binary file
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Rfmt
|
|
4
|
+
# Handles loading of native extension across different Ruby versions
|
|
5
|
+
# Ruby 3.3+ places native extensions in version-specific subdirectories
|
|
6
|
+
module NativeExtensionLoader
|
|
7
|
+
class << self
|
|
8
|
+
# Load the native extension, trying multiple possible paths
|
|
9
|
+
# @return [Boolean] true if successfully loaded
|
|
10
|
+
# @raise [LoadError] if the extension cannot be found
|
|
11
|
+
def load_extension
|
|
12
|
+
debug_log "Loading native extension for Ruby #{RUBY_VERSION}"
|
|
13
|
+
|
|
14
|
+
possible_paths = build_possible_paths
|
|
15
|
+
debug_log "Trying paths: #{possible_paths.inspect}"
|
|
16
|
+
|
|
17
|
+
load_from_paths(possible_paths) || raise(LoadError, build_error_message(possible_paths))
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
private
|
|
21
|
+
|
|
22
|
+
# Try loading from multiple paths
|
|
23
|
+
# @param paths [Array<String>] paths to try
|
|
24
|
+
# @return [Boolean, nil] true if loaded, nil otherwise
|
|
25
|
+
def load_from_paths(paths)
|
|
26
|
+
paths.each do |path|
|
|
27
|
+
if try_load_extension(path)
|
|
28
|
+
debug_log "Successfully loaded from: #{path}"
|
|
29
|
+
return true
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
nil
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
# Build list of possible paths for the native extension
|
|
36
|
+
# @return [Array<String>] paths to try, in order of preference
|
|
37
|
+
def build_possible_paths
|
|
38
|
+
paths = []
|
|
39
|
+
|
|
40
|
+
# Ruby 3.3+ style: version-specific subdirectory
|
|
41
|
+
paths << version_specific_path if ruby_version >= '3.3'
|
|
42
|
+
|
|
43
|
+
# Ruby 3.0-3.2 style: might use version directory
|
|
44
|
+
paths << version_specific_path if ruby_version >= '3.0' && ruby_version < '3.3'
|
|
45
|
+
|
|
46
|
+
# Legacy/fallback: direct placement
|
|
47
|
+
paths << File.join(__dir__, 'rfmt')
|
|
48
|
+
|
|
49
|
+
# Additional fallback: check for .bundle extension explicitly
|
|
50
|
+
paths << File.join(__dir__, 'rfmt.bundle')
|
|
51
|
+
|
|
52
|
+
paths.uniq
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Get version-specific path
|
|
56
|
+
# @return [String] path with version directory
|
|
57
|
+
def version_specific_path
|
|
58
|
+
File.join(__dir__, ruby_version_dir, 'rfmt')
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Try to load extension from a specific path
|
|
62
|
+
# @param path [String] path to try
|
|
63
|
+
# @return [Boolean] true if successful, false otherwise
|
|
64
|
+
def try_load_extension(path)
|
|
65
|
+
require path
|
|
66
|
+
true
|
|
67
|
+
rescue LoadError => e
|
|
68
|
+
debug_log "Failed to load from #{path}: #{e.message}"
|
|
69
|
+
false
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Get Ruby version for comparison
|
|
73
|
+
# @return [String] Ruby version string
|
|
74
|
+
def ruby_version
|
|
75
|
+
RUBY_VERSION
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Get Ruby version directory name (e.g., "3.3" for Ruby 3.3.0)
|
|
79
|
+
# @return [String] version directory name
|
|
80
|
+
def ruby_version_dir
|
|
81
|
+
RUBY_VERSION.split('.')[0..1].join('.')
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
# Build detailed error message when extension cannot be loaded
|
|
85
|
+
# @param tried_paths [Array<String>] paths that were tried
|
|
86
|
+
# @return [String] error message
|
|
87
|
+
def build_error_message(tried_paths)
|
|
88
|
+
[
|
|
89
|
+
error_header,
|
|
90
|
+
format_tried_paths(tried_paths),
|
|
91
|
+
error_explanation,
|
|
92
|
+
workaround_instructions
|
|
93
|
+
].join("\n")
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# Error message header
|
|
97
|
+
# @return [String] header text
|
|
98
|
+
def error_header
|
|
99
|
+
"Unable to load rfmt native extension for Ruby #{RUBY_VERSION}.\n"
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
# Format list of tried paths
|
|
103
|
+
# @param paths [Array<String>] paths that were tried
|
|
104
|
+
# @return [String] formatted path list
|
|
105
|
+
def format_tried_paths(paths)
|
|
106
|
+
"Tried the following paths:\n#{paths.map { |p| " - #{p}" }.join("\n")}\n"
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
# Error explanation text
|
|
110
|
+
# @return [String] explanation
|
|
111
|
+
def error_explanation
|
|
112
|
+
"This might be a packaging issue with the gem for your Ruby version.\n"
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# Workaround instructions
|
|
116
|
+
# @return [String] instructions
|
|
117
|
+
def workaround_instructions
|
|
118
|
+
<<~MSG.chomp
|
|
119
|
+
Workaround:
|
|
120
|
+
1. Check if rfmt.bundle exists in: #{__dir__}/
|
|
121
|
+
2. If it's in a subdirectory, create a symlink:
|
|
122
|
+
cd #{__dir__}
|
|
123
|
+
ln -sf <subdirectory>/rfmt.bundle rfmt.bundle
|
|
124
|
+
|
|
125
|
+
Please report this issue at: https://github.com/fs0414/rfmt/issues
|
|
126
|
+
MSG
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Log debug information if RFMT_DEBUG is set
|
|
130
|
+
# @param message [String] message to log
|
|
131
|
+
def debug_log(message)
|
|
132
|
+
return unless ENV['RFMT_DEBUG']
|
|
133
|
+
|
|
134
|
+
warn "[RFMT::NativeExtensionLoader] #{message}"
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
end
|
data/lib/rfmt/version.rb
CHANGED
data/lib/rfmt.rb
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require_relative 'rfmt/version'
|
|
4
|
-
require_relative 'rfmt/
|
|
4
|
+
require_relative 'rfmt/native_extension_loader'
|
|
5
5
|
require_relative 'rfmt/prism_bridge'
|
|
6
6
|
|
|
7
|
+
# Load native extension with version-aware loader
|
|
8
|
+
Rfmt::NativeExtensionLoader.load_extension
|
|
9
|
+
|
|
7
10
|
module Rfmt
|
|
8
11
|
class Error < StandardError; end
|
|
9
12
|
# Errors from Rust side
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rfmt
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.3
|
|
5
5
|
platform: arm64-darwin
|
|
6
6
|
authors:
|
|
7
7
|
- fujitani sora
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-01-
|
|
11
|
+
date: 2026-01-16 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Write a longer description or delete this line.
|
|
14
14
|
email:
|
|
@@ -29,6 +29,7 @@ files:
|
|
|
29
29
|
- lib/rfmt/cache.rb
|
|
30
30
|
- lib/rfmt/cli.rb
|
|
31
31
|
- lib/rfmt/configuration.rb
|
|
32
|
+
- lib/rfmt/native_extension_loader.rb
|
|
32
33
|
- lib/rfmt/prism_bridge.rb
|
|
33
34
|
- lib/rfmt/prism_node_extractor.rb
|
|
34
35
|
- lib/rfmt/version.rb
|