rfmt 0.4.0 → 0.5.0

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: 3077996bae0d4959192fb7885a197916fc85679858ebc10ea00ea8696bf6d320
4
- data.tar.gz: c3adf00614cc4ed60df41858c482e77b9618f06f7dadc7e9bc016c7b4d419f99
3
+ metadata.gz: e72bec96df5da8aafa6e1cd49ab3c14af9aaaaf79a880cbf2a6b05715a61aa7c
4
+ data.tar.gz: 381c235d258b0db3f7c770dd360cc3816ccaa1fdbe1af4fc857e0f871618d29b
5
5
  SHA512:
6
- metadata.gz: 8c1a042bcbcd8e74ac67918428fee08f8f4cf85e4f5f67a0cd9196bf7305489808176c442e8d388ae50c32c7d3f329706788c02a62ef69708be9126e600556bf
7
- data.tar.gz: 2f13782fff7bb4eaea95a78bc8e3d55c4f00395074b9e5befb6d93e66b803673f5bfb1f285ae74facb009d65dbdf2ae8322f405232277994c010d88135d62746
6
+ metadata.gz: 97261a648e5aa560d4b3a2499ed82e208d445f422b50dc0d17be0b0aa2065b7d54cc8547e09a8632019a8538cafae750468e2f95ad73bf881955bc982e527d5c
7
+ data.tar.gz: 8ee6c5ec43066f7d70d07198dc72032c87fe4be1759a74196f4c17c74bfbf91579116a0744ea2b39cb8a222748a61b1e65e723e43e22d19b4589c4a28ce4baed
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.5.0] - 2025-12-07
4
+
5
+ ### Changed
6
+ - Synchronized markdown command documentation
7
+ - Added project logo
8
+
9
+ ### Fixed
10
+ - Removed unnecessary exec command
11
+
12
+ ## [0.4.1] - 2025-11-28
13
+
14
+ ### Fixed
15
+ - CLI exec message output optimization for better user experience
16
+ - RuboCop compliance issues resolved
17
+
18
+ ### Changed
19
+ - Improved output formatting with colored success/failure messages
20
+ - Debug logs now only shown with `--verbose` flag or debug environment variables
21
+ - Enhanced progress indicators during file processing
22
+
3
23
  ## [0.4.0] - 2025-11-26
4
24
 
5
25
  ### Added
data/Cargo.lock CHANGED
@@ -1219,7 +1219,7 @@ checksum = "caf4aa5b0f434c91fe5c7f1ecb6a5ece2130b02ad2a590589dda5146df959001"
1219
1219
 
1220
1220
  [[package]]
1221
1221
  name = "rfmt"
1222
- version = "0.4.0"
1222
+ version = "0.5.0"
1223
1223
  dependencies = [
1224
1224
  "anyhow",
1225
1225
  "clap",
data/README.md CHANGED
@@ -13,6 +13,8 @@ A Ruby code formatter written in Rust
13
13
  [Documentation](#documentation) •
14
14
  [Contributing](#contributing)
15
15
 
16
+ <a href="https://flatt.tech/oss/gmo/trampoline" target="_blank"><img src="https://flatt.tech/assets/images/badges/gmo-oss.svg" height="24px"/></a>
17
+
16
18
  </div>
17
19
 
18
20
  ---
@@ -154,13 +156,13 @@ rfmt init --force
154
156
  Format a single file:
155
157
 
156
158
  ```bash
157
- rfmt exec lib/user.rb
159
+ rfmt lib/user.rb
158
160
  ```
159
161
 
160
162
  Format multiple files:
161
163
 
162
164
  ```bash
163
- rfmt exec lib/**/*.rb
165
+ rfmt lib/**/*.rb
164
166
  ```
165
167
 
166
168
  Check if files need formatting (CI/CD):
@@ -172,15 +174,15 @@ rfmt check .
172
174
  Show diff without modifying files:
173
175
 
174
176
  ```bash
175
- rfmt exec lib/user.rb --diff
177
+ rfmt lib/user.rb --diff
176
178
  ```
177
179
 
178
180
  Enable verbose output for debugging:
179
181
 
180
182
  ```bash
181
- rfmt exec lib/user.rb --verbose
183
+ rfmt lib/user.rb --verbose
182
184
  # or use environment variable
183
- DEBUG=1 rfmt exec lib/user.rb
185
+ DEBUG=1 rfmt lib/user.rb
184
186
  ```
185
187
 
186
188
  ### Ruby API
data/exe/rfmt CHANGED
@@ -3,8 +3,14 @@
3
3
 
4
4
  require 'rfmt/cli'
5
5
 
6
+ # Known subcommands - if first arg is not one of these, prepend 'format'
7
+ SUBCOMMANDS = %w[format check version config cache init help].freeze
8
+
9
+ args = ARGV.dup
10
+ args.unshift('format') if args.empty? || (!SUBCOMMANDS.include?(args.first) && !args.first.start_with?('-'))
11
+
6
12
  begin
7
- Rfmt::CLI.start(ARGV)
13
+ Rfmt::CLI.start(args)
8
14
  rescue Interrupt
9
15
  puts "\nInterrupted"
10
16
  exit(130)
data/ext/rfmt/Cargo.toml CHANGED
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "rfmt"
3
- version = "0.4.0"
3
+ version = "0.5.0"
4
4
  edition = "2021"
5
5
  authors = ["fujitani sora <fujitanisora0414@gmail.com>"]
6
6
  license = "MIT"
data/lib/rfmt/cli.rb CHANGED
@@ -47,7 +47,9 @@ module Rfmt
47
47
  class_option :config, type: :string, desc: 'Path to configuration file'
48
48
  class_option :verbose, type: :boolean, aliases: '-v', desc: 'Verbose output'
49
49
 
50
- desc 'exec [FILES]', 'Format Ruby files'
50
+ default_command :format
51
+
52
+ desc 'format [FILES]', 'Format Ruby files (default command)'
51
53
  option :write, type: :boolean, default: true, desc: 'Write formatted output'
52
54
  option :check, type: :boolean, desc: "Check if files are formatted (don't write)"
53
55
  option :diff, type: :boolean, desc: 'Show diff of changes'
@@ -56,7 +58,7 @@ module Rfmt
56
58
  option :jobs, type: :numeric, desc: 'Number of parallel jobs (default: CPU count)'
57
59
  option :cache, type: :boolean, default: true, desc: 'Use cache to skip unchanged files'
58
60
  option :cache_dir, type: :string, desc: 'Cache directory (default: ~/.cache/rfmt)'
59
- def exec(*files)
61
+ def format(*files)
60
62
  config = load_config
61
63
  files = files.empty? ? config.files_to_format : files.flatten
62
64
 
@@ -76,15 +78,20 @@ module Rfmt
76
78
  original_count = files.size
77
79
  files = files.select { |file| cache.needs_formatting?(file) }
78
80
  skipped = original_count - files.size
79
- say "Skipped #{skipped} unchanged file(s) (cache hit)", :blue if skipped.positive? && options[:verbose]
81
+ say "Skipped #{skipped} unchanged file(s) (cached)", :cyan if skipped.positive? && options[:verbose]
80
82
  end
81
83
 
82
84
  if files.empty?
83
- say 'All files are already formatted', :green
85
+ say 'All files are already formatted (cached)', :green
84
86
  return
85
87
  end
86
88
 
87
- say "Formatting #{files.size} file(s)...", :blue if options[:verbose]
89
+ # Show progress message
90
+ if files.size == 1
91
+ say "Processing #{files.first}...", :blue
92
+ else
93
+ say "Processing #{files.size} file(s)...", :blue
94
+ end
88
95
 
89
96
  results = if options[:parallel] && files.size > 1
90
97
  format_files_parallel(files)
@@ -96,7 +103,7 @@ module Rfmt
96
103
 
97
104
  desc 'check [FILES]', 'Check if files need formatting'
98
105
  def check(*files)
99
- invoke :exec, files, check: true, write: false
106
+ invoke :format, files, check: true, write: false
100
107
  end
101
108
 
102
109
  desc 'version', 'Show version'
@@ -206,7 +213,8 @@ module Rfmt
206
213
  show_diff(result[:file], result[:original], result[:formatted])
207
214
  elsif options[:write]
208
215
  File.write(result[:file], result[:formatted])
209
- say "Formatted #{result[:file]}", :green if options[:verbose]
216
+ # Always show formatted files (not just in verbose mode)
217
+ say "✓ Formatted #{result[:file]}", :green
210
218
 
211
219
  # Update cache after successful write
212
220
  cache&.mark_formatted(result[:file])
@@ -214,7 +222,8 @@ module Rfmt
214
222
  puts result[:formatted]
215
223
  end
216
224
  else
217
- say "#{result[:file]} already formatted", :blue if options[:verbose]
225
+ # Show already formatted files in non-check mode
226
+ say "✓ #{result[:file]} already formatted", :cyan unless options[:check]
218
227
 
219
228
  # Update cache even if no changes (file was checked)
220
229
  cache&.mark_formatted(result[:file])
@@ -224,10 +233,25 @@ module Rfmt
224
233
  # Save cache to disk
225
234
  cache&.save
226
235
 
227
- # Summary
228
- say "\n#{results.size} file(s) processed", :blue if options[:verbose]
229
- say "#{changed_count} file(s) changed", :yellow if changed_count.positive? && options[:verbose]
230
- say "#{error_count} error(s)", :red if error_count.positive?
236
+ # Summary - always show a summary message
237
+ if error_count.positive?
238
+ say "\n✗ Failed: #{error_count} error(s) occurred", :red
239
+ elsif options[:check] && failed_count.positive?
240
+ say "\n✗ Check failed: #{failed_count} file(s) need formatting", :yellow
241
+ elsif changed_count.positive?
242
+ # Success message with appropriate details
243
+ say "\n✓ Success! Formatted #{changed_count} file(s)", :green
244
+ elsif results.size == 1
245
+ say "\n✓ Success! File is already formatted", :green
246
+ else
247
+ say "\n✓ Success! All #{results.size} files are already formatted", :green
248
+ end
249
+
250
+ # Detailed summary in verbose mode
251
+ if options[:verbose]
252
+ say "Total: #{results.size} file(s) processed", :blue
253
+ say "Changed: #{changed_count} file(s)", :yellow if changed_count.positive?
254
+ end
231
255
 
232
256
  exit(1) if (options[:check] && failed_count.positive?) || error_count.positive?
233
257
  end
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 = '0.4.0'
4
+ VERSION = '0.5.0'
5
5
  end
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: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - fujitani sora
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-11-25 00:00:00.000000000 Z
11
+ date: 2025-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rb_sys