rfmt 1.2.6 → 1.2.7

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: b43c4cd99b99ae5b4525bc2efc9a3759e315cdbb200853345e2422d161fc58b6
4
- data.tar.gz: e2f2f9fe52c401fadcd509e2705cbfca4a5bf0e84265f3ce7f764c1916e73470
3
+ metadata.gz: 5ab6ecad407c85286dad54ee0f744f6adc601c9778d0a2171bbae197d7d5c58d
4
+ data.tar.gz: c3f7f178538d64891d60936e9303b93e63a28403aa6e4f50adab4b7eaa1f641b
5
5
  SHA512:
6
- metadata.gz: 9e728fee6c041313543cd631255e9ac6fdc3a69c7a22f32b2846be6cbed6a59e1d1ba2dd46d989850e9ac6bc8d4b31bd630a4477e6d0d767ef7dd73c4a5c76ed
7
- data.tar.gz: 6a7d78ae563cc30ae96970562ddf027005631ae9a2d79755b49a44411fc0f90a2c81ba48a29150c326cc5e5ad793159890f46ae2ee4658a0baeeef7f5907a3d1
6
+ metadata.gz: a1f272f73406b14d1d5a735bdb0e66138f753b64ba26d369262a824cefda6d2fc0df14665a2c4f85ae62f3139845c8c01a8f9ad39c2d5fa3db4ad821b7aa7c29
7
+ data.tar.gz: 0a40da5d6084cfd3e3c4ccfd66d3b4be39d7f0a534a5ba7161ca151d98cce039820c587de0109a3065585cceee0a7eeaaaae2c8a4889ec7eb3bd60f843801bc6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.2.7] - 2026-01-04
4
+
5
+ ### Changed
6
+ - Remove OpenSSL dependency: Use mtime instead of SHA256 hash for cache invalidation
7
+
3
8
  ## [1.2.6] - 2026-01-04
4
9
 
5
10
  ### Changed
data/Cargo.lock CHANGED
@@ -1219,7 +1219,7 @@ checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001"
1219
1219
 
1220
1220
  [[package]]
1221
1221
  name = "rfmt"
1222
- version = "1.2.6"
1222
+ version = "1.2.7"
1223
1223
  dependencies = [
1224
1224
  "anyhow",
1225
1225
  "clap",
data/ext/rfmt/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "rfmt"
3
- version = "1.2.6"
3
+ version = "1.2.7"
4
4
  edition = "2021"
5
5
  authors = ["fujitani sora <fujitanisora0414@gmail.com>"]
6
6
  license = "MIT"
data/lib/rfmt/cache.rb CHANGED
@@ -1,12 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'openssl'
4
3
  require 'json'
5
4
  require 'fileutils'
6
5
 
7
6
  module Rfmt
8
7
  # Cache system for formatted files
9
- # Uses SHA256 hash of file content to determine if formatting is needed
8
+ # Uses mtime (modification time) to determine if formatting is needed
10
9
  class Cache
11
10
  class CacheError < StandardError; end
12
11
 
@@ -23,22 +22,22 @@ module Rfmt
23
22
  end
24
23
 
25
24
  # Check if file needs formatting
26
- # Returns true if file content has changed or not in cache
25
+ # Returns true if file mtime has changed or not in cache
27
26
  def needs_formatting?(file_path)
28
27
  return true unless File.exist?(file_path)
29
28
 
30
- current_hash = file_hash(file_path)
31
- cached_hash = @cache_data.dig(file_path, 'hash')
29
+ current_mtime = File.mtime(file_path).to_i
30
+ cached_mtime = @cache_data.dig(file_path, 'mtime')
32
31
 
33
- current_hash != cached_hash
32
+ current_mtime != cached_mtime
34
33
  end
35
34
 
36
- # Mark file as formatted with current content
35
+ # Mark file as formatted with current mtime
37
36
  def mark_formatted(file_path)
38
37
  return unless File.exist?(file_path)
39
38
 
40
39
  @cache_data[file_path] = {
41
- 'hash' => file_hash(file_path),
40
+ 'mtime' => File.mtime(file_path).to_i,
42
41
  'formatted_at' => Time.now.to_i,
43
42
  'version' => CACHE_VERSION
44
43
  }
@@ -103,13 +102,6 @@ module Rfmt
103
102
  @cache_data = {}
104
103
  end
105
104
 
106
- def file_hash(file_path)
107
- content = File.read(file_path)
108
- OpenSSL::Digest::SHA256.hexdigest(content)
109
- rescue StandardError => e
110
- raise CacheError, "Failed to read file #{file_path}: #{e.message}"
111
- end
112
-
113
105
  def cache_size
114
106
  cache_file = File.join(@cache_dir, 'cache.json')
115
107
  return 0 unless File.exist?(cache_file)
data/lib/rfmt/rfmt.so CHANGED
Binary file
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.2.6'
4
+ VERSION = '1.2.7'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rfmt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.6
4
+ version: 1.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - fujitani sora