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 +4 -4
- data/CHANGELOG.md +20 -0
- data/Cargo.lock +1 -1
- data/README.md +7 -5
- data/exe/rfmt +7 -1
- data/ext/rfmt/Cargo.toml +1 -1
- data/lib/rfmt/cli.rb +36 -12
- data/lib/rfmt/rfmt.so +0 -0
- data/lib/rfmt/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: e72bec96df5da8aafa6e1cd49ab3c14af9aaaaf79a880cbf2a6b05715a61aa7c
|
|
4
|
+
data.tar.gz: 381c235d258b0db3f7c770dd360cc3816ccaa1fdbe1af4fc857e0f871618d29b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
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
|
|
159
|
+
rfmt lib/user.rb
|
|
158
160
|
```
|
|
159
161
|
|
|
160
162
|
Format multiple files:
|
|
161
163
|
|
|
162
164
|
```bash
|
|
163
|
-
rfmt
|
|
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
|
|
177
|
+
rfmt lib/user.rb --diff
|
|
176
178
|
```
|
|
177
179
|
|
|
178
180
|
Enable verbose output for debugging:
|
|
179
181
|
|
|
180
182
|
```bash
|
|
181
|
-
rfmt
|
|
183
|
+
rfmt lib/user.rb --verbose
|
|
182
184
|
# or use environment variable
|
|
183
|
-
DEBUG=1 rfmt
|
|
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(
|
|
13
|
+
Rfmt::CLI.start(args)
|
|
8
14
|
rescue Interrupt
|
|
9
15
|
puts "\nInterrupted"
|
|
10
16
|
exit(130)
|
data/ext/rfmt/Cargo.toml
CHANGED
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
|
-
|
|
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
|
|
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) (
|
|
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
|
-
|
|
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 :
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
229
|
-
|
|
230
|
-
|
|
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
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
|
+
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
|
+
date: 2025-12-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rb_sys
|