rufio 0.9.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 +7 -0
- data/CHANGELOG.md +188 -0
- data/CHANGELOG_v0.4.0.md +146 -0
- data/CHANGELOG_v0.5.0.md +26 -0
- data/CHANGELOG_v0.6.0.md +182 -0
- data/CHANGELOG_v0.7.0.md +280 -0
- data/CHANGELOG_v0.8.0.md +267 -0
- data/CHANGELOG_v0.9.0.md +279 -0
- data/README.md +631 -0
- data/README_EN.md +561 -0
- data/Rakefile +156 -0
- data/bin/rufio +34 -0
- data/config_example.rb +88 -0
- data/docs/PLUGIN_GUIDE.md +431 -0
- data/docs/plugin_example.rb +119 -0
- data/lib/rufio/application.rb +32 -0
- data/lib/rufio/bookmark.rb +115 -0
- data/lib/rufio/bookmark_manager.rb +173 -0
- data/lib/rufio/color_helper.rb +150 -0
- data/lib/rufio/command_mode.rb +72 -0
- data/lib/rufio/command_mode_ui.rb +168 -0
- data/lib/rufio/config.rb +199 -0
- data/lib/rufio/config_loader.rb +110 -0
- data/lib/rufio/dialog_renderer.rb +127 -0
- data/lib/rufio/directory_listing.rb +113 -0
- data/lib/rufio/file_opener.rb +140 -0
- data/lib/rufio/file_operations.rb +231 -0
- data/lib/rufio/file_preview.rb +200 -0
- data/lib/rufio/filter_manager.rb +114 -0
- data/lib/rufio/health_checker.rb +246 -0
- data/lib/rufio/keybind_handler.rb +828 -0
- data/lib/rufio/logger.rb +103 -0
- data/lib/rufio/plugin.rb +89 -0
- data/lib/rufio/plugin_config.rb +59 -0
- data/lib/rufio/plugin_manager.rb +84 -0
- data/lib/rufio/plugins/file_operations.rb +44 -0
- data/lib/rufio/selection_manager.rb +79 -0
- data/lib/rufio/terminal_ui.rb +630 -0
- data/lib/rufio/text_utils.rb +108 -0
- data/lib/rufio/version.rb +5 -0
- data/lib/rufio/zoxide_integration.rb +188 -0
- data/lib/rufio.rb +33 -0
- data/publish_gem.zsh +131 -0
- data/rufio.gemspec +40 -0
- data/test_delete/test1.txt +1 -0
- data/test_delete/test2.txt +1 -0
- metadata +189 -0
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'pastel'
|
|
4
|
+
|
|
5
|
+
module Rufio
|
|
6
|
+
class HealthChecker
|
|
7
|
+
def initialize
|
|
8
|
+
@pastel = Pastel.new
|
|
9
|
+
# Load configuration including language settings
|
|
10
|
+
ConfigLoader.load_config
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def run_check
|
|
14
|
+
puts @pastel.bold(ConfigLoader.message('health.title'))
|
|
15
|
+
puts "=" * 40
|
|
16
|
+
puts
|
|
17
|
+
|
|
18
|
+
checks = [
|
|
19
|
+
{ name: ConfigLoader.message('health.ruby_version'), method: :check_ruby_version },
|
|
20
|
+
{ name: ConfigLoader.message('health.required_gems'), method: :check_required_gems },
|
|
21
|
+
{ name: ConfigLoader.message('health.fzf'), method: :check_fzf },
|
|
22
|
+
{ name: ConfigLoader.message('health.rga'), method: :check_rga },
|
|
23
|
+
{ name: ConfigLoader.message('health.zoxide'), method: :check_zoxide },
|
|
24
|
+
{ name: ConfigLoader.message('health.file_opener'), method: :check_file_opener }
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
results = []
|
|
28
|
+
checks.each do |check|
|
|
29
|
+
result = send(check[:method])
|
|
30
|
+
results << result
|
|
31
|
+
print_check_result(check[:name], result)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
puts
|
|
35
|
+
print_summary(results)
|
|
36
|
+
|
|
37
|
+
results.all? { |r| r[:status] == :ok }
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
private
|
|
41
|
+
|
|
42
|
+
def check_ruby_version
|
|
43
|
+
version = RUBY_VERSION
|
|
44
|
+
major, minor = version.split('.').map(&:to_i)
|
|
45
|
+
|
|
46
|
+
if major > 2 || (major == 2 && minor >= 7)
|
|
47
|
+
{
|
|
48
|
+
status: :ok,
|
|
49
|
+
message: "Ruby #{version}",
|
|
50
|
+
details: nil
|
|
51
|
+
}
|
|
52
|
+
else
|
|
53
|
+
{
|
|
54
|
+
status: :error,
|
|
55
|
+
message: "Ruby #{version} (requires >= 2.7.0)",
|
|
56
|
+
details: ConfigLoader.message('health.ruby_upgrade_needed')
|
|
57
|
+
}
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def check_required_gems
|
|
62
|
+
required_gems = %w[io-console pastel tty-cursor tty-screen]
|
|
63
|
+
missing_gems = []
|
|
64
|
+
|
|
65
|
+
required_gems.each do |gem_name|
|
|
66
|
+
begin
|
|
67
|
+
require gem_name.gsub('-', '/')
|
|
68
|
+
rescue LoadError
|
|
69
|
+
missing_gems << gem_name
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
if missing_gems.empty?
|
|
74
|
+
{
|
|
75
|
+
status: :ok,
|
|
76
|
+
message: ConfigLoader.message('health.all_gems_installed'),
|
|
77
|
+
details: nil
|
|
78
|
+
}
|
|
79
|
+
else
|
|
80
|
+
{
|
|
81
|
+
status: :error,
|
|
82
|
+
message: "#{ConfigLoader.message('health.missing_gems')}: #{missing_gems.join(', ')}",
|
|
83
|
+
details: "#{ConfigLoader.message('health.gem_install_instruction')} #{missing_gems.join(' ')}"
|
|
84
|
+
}
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def check_fzf
|
|
89
|
+
if system("which fzf > /dev/null 2>&1")
|
|
90
|
+
version = `fzf --version 2>/dev/null`.strip
|
|
91
|
+
{
|
|
92
|
+
status: :ok,
|
|
93
|
+
message: "fzf #{version}",
|
|
94
|
+
details: nil
|
|
95
|
+
}
|
|
96
|
+
else
|
|
97
|
+
{
|
|
98
|
+
status: :warning,
|
|
99
|
+
message: "fzf #{ConfigLoader.message('health.tool_not_found')}",
|
|
100
|
+
details: install_instruction_for('fzf')
|
|
101
|
+
}
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def check_rga
|
|
106
|
+
if system("which rga > /dev/null 2>&1")
|
|
107
|
+
version = `rga --version 2>/dev/null | head -1`.strip
|
|
108
|
+
{
|
|
109
|
+
status: :ok,
|
|
110
|
+
message: version,
|
|
111
|
+
details: nil
|
|
112
|
+
}
|
|
113
|
+
else
|
|
114
|
+
{
|
|
115
|
+
status: :warning,
|
|
116
|
+
message: "rga #{ConfigLoader.message('health.tool_not_found')}",
|
|
117
|
+
details: install_instruction_for('rga')
|
|
118
|
+
}
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
def check_zoxide
|
|
123
|
+
if system("which zoxide > /dev/null 2>&1")
|
|
124
|
+
version = `zoxide --version 2>/dev/null`.strip
|
|
125
|
+
{
|
|
126
|
+
status: :ok,
|
|
127
|
+
message: version,
|
|
128
|
+
details: nil
|
|
129
|
+
}
|
|
130
|
+
else
|
|
131
|
+
{
|
|
132
|
+
status: :warning,
|
|
133
|
+
message: "zoxide #{ConfigLoader.message('health.tool_not_found')}",
|
|
134
|
+
details: install_instruction_for('zoxide')
|
|
135
|
+
}
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def check_file_opener
|
|
140
|
+
case RUBY_PLATFORM
|
|
141
|
+
when /darwin/
|
|
142
|
+
opener = "open"
|
|
143
|
+
description = ConfigLoader.message('health.macos_opener')
|
|
144
|
+
when /linux/
|
|
145
|
+
opener = "xdg-open"
|
|
146
|
+
description = ConfigLoader.message('health.linux_opener')
|
|
147
|
+
when /mswin|mingw|cygwin/
|
|
148
|
+
opener = "explorer"
|
|
149
|
+
description = ConfigLoader.message('health.windows_opener')
|
|
150
|
+
else
|
|
151
|
+
return {
|
|
152
|
+
status: :warning,
|
|
153
|
+
message: "#{ConfigLoader.message('health.unknown_platform')}: #{RUBY_PLATFORM}",
|
|
154
|
+
details: ConfigLoader.message('health.file_open_may_not_work')
|
|
155
|
+
}
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
if system("which #{opener} > /dev/null 2>&1") || RUBY_PLATFORM =~ /mswin|mingw|cygwin/
|
|
159
|
+
{
|
|
160
|
+
status: :ok,
|
|
161
|
+
message: description,
|
|
162
|
+
details: nil
|
|
163
|
+
}
|
|
164
|
+
else
|
|
165
|
+
{
|
|
166
|
+
status: :warning,
|
|
167
|
+
message: "#{opener} #{ConfigLoader.message('health.tool_not_found')}",
|
|
168
|
+
details: ConfigLoader.message('health.file_open_may_not_work')
|
|
169
|
+
}
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
def install_instruction_for(tool)
|
|
174
|
+
case RUBY_PLATFORM
|
|
175
|
+
when /darwin/
|
|
176
|
+
case tool
|
|
177
|
+
when 'fzf'
|
|
178
|
+
"#{ConfigLoader.message('health.install_brew')} fzf"
|
|
179
|
+
when 'rga'
|
|
180
|
+
"#{ConfigLoader.message('health.install_brew')} rga"
|
|
181
|
+
when 'zoxide'
|
|
182
|
+
"#{ConfigLoader.message('health.install_brew')} zoxide"
|
|
183
|
+
end
|
|
184
|
+
when /linux/
|
|
185
|
+
case tool
|
|
186
|
+
when 'fzf'
|
|
187
|
+
"#{ConfigLoader.message('health.install_apt')} fzf (Ubuntu/Debian) or check your package manager"
|
|
188
|
+
when 'rga'
|
|
189
|
+
ConfigLoader.message('health.rga_releases')
|
|
190
|
+
when 'zoxide'
|
|
191
|
+
"#{ConfigLoader.message('health.install_apt')} zoxide (Ubuntu/Debian) or check your package manager"
|
|
192
|
+
end
|
|
193
|
+
else
|
|
194
|
+
ConfigLoader.message('health.install_guide')
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
def print_check_result(name, result)
|
|
199
|
+
status_icon = case result[:status]
|
|
200
|
+
when :ok
|
|
201
|
+
@pastel.green("✓")
|
|
202
|
+
when :warning
|
|
203
|
+
@pastel.yellow("⚠")
|
|
204
|
+
when :error
|
|
205
|
+
@pastel.red("✗")
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
status_color = case result[:status]
|
|
209
|
+
when :ok
|
|
210
|
+
:green
|
|
211
|
+
when :warning
|
|
212
|
+
:yellow
|
|
213
|
+
when :error
|
|
214
|
+
:red
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
puts "#{status_icon} #{name.ljust(20)} #{@pastel.decorate(result[:message], status_color)}"
|
|
218
|
+
|
|
219
|
+
if result[:details]
|
|
220
|
+
puts " #{@pastel.dim(result[:details])}"
|
|
221
|
+
end
|
|
222
|
+
end
|
|
223
|
+
|
|
224
|
+
def print_summary(results)
|
|
225
|
+
ok_count = results.count { |r| r[:status] == :ok }
|
|
226
|
+
warning_count = results.count { |r| r[:status] == :warning }
|
|
227
|
+
error_count = results.count { |r| r[:status] == :error }
|
|
228
|
+
|
|
229
|
+
puts "#{ConfigLoader.message('health.summary')}"
|
|
230
|
+
puts " #{@pastel.green("✓ #{ok_count} #{ConfigLoader.message('health.ok')}")}"
|
|
231
|
+
puts " #{@pastel.yellow("⚠ #{warning_count} #{ConfigLoader.message('health.warnings')}")}}" if warning_count > 0
|
|
232
|
+
puts " #{@pastel.red("✗ #{error_count} #{ConfigLoader.message('health.errors')}")}}" if error_count > 0
|
|
233
|
+
|
|
234
|
+
if error_count > 0
|
|
235
|
+
puts
|
|
236
|
+
puts @pastel.red(ConfigLoader.message('health.critical_missing'))
|
|
237
|
+
elsif warning_count > 0
|
|
238
|
+
puts
|
|
239
|
+
puts @pastel.yellow(ConfigLoader.message('health.optional_missing'))
|
|
240
|
+
else
|
|
241
|
+
puts
|
|
242
|
+
puts @pastel.green(ConfigLoader.message('health.all_passed'))
|
|
243
|
+
end
|
|
244
|
+
end
|
|
245
|
+
end
|
|
246
|
+
end
|