rfmt 1.3.2-x64-mingw-ucrt → 1.3.3-x64-mingw-ucrt

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: b7194910d64a5c4811d3e8e7bda057a84ebcf329fa5c0ca407b888b03e8b3358
4
- data.tar.gz: c9295c32a9ba36d51f466a13545e227424a0326fb5fa1cc97ee5ade9ed493490
3
+ metadata.gz: 2a41db7ee0455b37ba0e3f465cf54d0be52c5671c19e7b0654f21e822758d514
4
+ data.tar.gz: 4d32dc2f3741433dde015706f0092c73fa6cf961959aae03d6e275228510377a
5
5
  SHA512:
6
- metadata.gz: b311c32d6984525c1515792917da3722c7e283b13aff5949889e175d1cda298f8701ccbb022e08f6f5db0196219d5baeb0e67cfed31fac46feb1bda775c33996
7
- data.tar.gz: c6663ae934c3d1fee65ce80d63bd125e24c8ac348532e1528aef5330da8db5f352d35cc300f575189663b71d23c84d3c243eeefaeb3c1bc5c3be78ec009ab9ad
6
+ metadata.gz: 772da63a647cb028fe6306a69809eea3ad2d7d4ed025aaef692a880f9026ba2cf7d2dc8c9ef01f8782e398f90b52a4fa3d15373ab0e7940d7f221c2f5fb093f3
7
+ data.tar.gz: b2e75cc023745941d8d4154be4637cff5036056b64aff6a31d8880fcd43bb94e38979d82a56362b48f6b37719fdf237c3144cee4131860d11fef20b7a03f9683
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.so CHANGED
Binary file
data/lib/rfmt/3.2/rfmt.so CHANGED
Binary file
data/lib/rfmt/3.3/rfmt.so 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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rfmt
4
- VERSION = '1.3.2'
4
+ VERSION = '1.3.3'
5
5
  end
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/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.2
4
+ version: 1.3.3
5
5
  platform: x64-mingw-ucrt
6
6
  authors:
7
7
  - fujitani sora
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-01-09 00:00:00.000000000 Z
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