rufio 0.70.0 → 0.71.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: f7c56fe39c80425ba94128d7e8531584e1d7530d9eb78d323b59d34563df1fe3
4
- data.tar.gz: 659fe182e9aace392e902151caac5a289b969db060f31f7176c2545e22d452c8
3
+ metadata.gz: b269821deb0be4866afdc75e58a1369de3448324cee49e6c4f7e68febbae9fff
4
+ data.tar.gz: 835570061c06d6a5adc439d2dfb67c62313fccf101cdb6fb068976f5d72d5607
5
5
  SHA512:
6
- metadata.gz: 01fe9fe08f1e494eafcfc18aeb1a8b208c6406b60525d81a6b0ebebe3131fa8388f3b86631d7ae2ea15ec02f20eaf21d3daaa01eec6a011174050750b5f51fb4
7
- data.tar.gz: 4920c3320a0df0d87b0af4b410b59722efce3163f53f5098c5ceadcb45f5124b49f4c0774d9e22daef1d293f3417a1fa397977932946a776210f4452bf141ecb
6
+ metadata.gz: 8ba615e62db5874737085807f29825e92c3447a094aeb7349c77b8d0adab4e39fc2ce4bfe40fa53f354b23057e81a29077a7177a6f31379cf140ff876bd2bbc7
7
+ data.tar.gz: b8ac577e995fb0a1cbc7776246f3443e2d137914a84fa94b02b013a3bca5f9124b30b42b03cb6fedbe8bb5d33fcadfbea4d9622023b446df5abb5288871bf978
data/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.71.0] - 2026-02-16
11
+
12
+ ### Added
13
+ - **Script Arguments**: Pass arguments to scripts via command mode (e.g., `@retag.sh v0.70.0`)
14
+ - Supports both ScriptRunner and LocalScriptScanner
15
+ - **Script/Rake Execution Logging**: Log execution results of `@script` and `rake:task` commands to CommandLogger
16
+ - Covers both synchronous and background execution
17
+
18
+ ### Fixed
19
+ - **Selection across directories**: Clear selection state when navigating to a different directory
20
+ - **Help/Log viewer entries**: Exclude `..` entry in help mode and log viewer mode
21
+
10
22
  ## [0.70.0] - 2026-02-14
11
23
 
12
24
  ### Added
@@ -28,7 +28,8 @@ module Rufio
28
28
  @job_manager = job_manager
29
29
  @script_runner = ScriptRunner.new(
30
30
  script_paths: script_paths,
31
- job_manager: job_manager
31
+ job_manager: job_manager,
32
+ command_logger: @background_executor&.command_logger
32
33
  )
33
34
  end
34
35
 
@@ -41,7 +42,8 @@ module Rufio
41
42
  # ScriptRunnerも設定(ScriptPathManagerのパスを使用)
42
43
  @script_runner = ScriptRunner.new(
43
44
  script_paths: @script_path_manager.paths,
44
- job_manager: job_manager
45
+ job_manager: job_manager,
46
+ command_logger: @background_executor&.command_logger
45
47
  )
46
48
  end
47
49
 
@@ -237,22 +239,27 @@ module Rufio
237
239
 
238
240
  # スクリプトを実行する(@プレフィックス用)
239
241
  # ScriptRunner → LocalScriptScanner の順にフォールバック
240
- # @param script_name [String] スクリプト名
242
+ # @param script_input [String] スクリプト名(引数を含む場合あり)
241
243
  # @param working_dir [String, nil] 作業ディレクトリ
242
244
  # @return [String] 実行結果メッセージ
243
- def execute_script(script_name, working_dir)
245
+ def execute_script(script_input, working_dir)
244
246
  working_dir ||= Dir.pwd
245
247
 
248
+ # スクリプト名と引数を分離(例: "retag.sh v0.70.0" → name="retag.sh", args="v0.70.0")
249
+ parts = script_input.split(' ', 2)
250
+ script_name = parts[0]
251
+ script_args = parts[1]
252
+
246
253
  # ScriptRunnerで検索
247
254
  if @script_runner
248
- job = @script_runner.run(script_name, working_dir: working_dir)
255
+ job = @script_runner.run(script_name, working_dir: working_dir, args: script_args)
249
256
  return "🚀 ジョブを開始: #{script_name}" if job
250
257
  end
251
258
 
252
259
  # LocalScriptScannerにフォールバック
253
260
  local_script = @local_script_scanner.find_script(script_name)
254
261
  if local_script
255
- return execute_local_script(local_script, working_dir)
262
+ return execute_local_script(local_script, working_dir, script_args)
256
263
  end
257
264
 
258
265
  # どちらにも見つからない
@@ -266,33 +273,57 @@ module Rufio
266
273
  # ローカルスクリプトを実行する
267
274
  # @param script [Hash] スクリプト情報 { name:, path:, dir: }
268
275
  # @param working_dir [String] 作業ディレクトリ
269
- # @return [String] 実行結果メッセージ
270
- def execute_local_script(script, working_dir)
276
+ # @param args [String, nil] スクリプトに渡す引数
277
+ # @return [String, Hash] 実行結果メッセージ
278
+ def execute_local_script(script, working_dir, args = nil)
279
+ command = build_script_command(script)
280
+ command = "#{command} #{args}" if args && !args.empty?
281
+
271
282
  if @job_manager
272
283
  job = @job_manager.add_job(
273
284
  name: script[:name],
274
285
  path: working_dir,
275
- command: build_script_command(script)
286
+ command: command
276
287
  )
277
288
  job.start
278
289
 
279
290
  Thread.new do
280
- execute_script_in_background(job, script, working_dir)
291
+ execute_script_in_background(job, script, working_dir, command)
281
292
  end
282
293
 
283
294
  "🚀 ジョブを開始: #{script[:name]}"
284
295
  else
285
296
  # 同期実行
286
- command = build_script_command(script)
287
297
  stdout, stderr, status = Open3.capture3(command, chdir: working_dir)
288
- {
298
+ result = {
289
299
  success: status.success?,
290
300
  output: stdout.strip,
291
301
  stderr: stderr.strip
292
302
  }
303
+
304
+ # Logsに記録
305
+ log_execution("@#{script[:name]}", result)
306
+
307
+ result
293
308
  end
294
309
  end
295
310
 
311
+ # 実行結果をCommandLoggerに記録
312
+ # @param command_name [String] コマンド名
313
+ # @param result [Hash] 実行結果 { success:, output:, stderr:, error: }
314
+ def log_execution(command_name, result)
315
+ logger = @background_executor&.command_logger
316
+ return unless logger
317
+
318
+ output = [result[:output], result[:stderr]].compact.reject(&:empty?).join("\n")
319
+ logger.log(
320
+ command_name,
321
+ output,
322
+ success: result[:success],
323
+ error: result[:error]
324
+ )
325
+ end
326
+
296
327
  # スクリプトの実行コマンドを構築
297
328
  # @param script [Hash] スクリプト情報
298
329
  # @return [String] 実行コマンド
@@ -319,8 +350,7 @@ module Rufio
319
350
  end
320
351
 
321
352
  # ローカルスクリプトをバックグラウンドで実行
322
- def execute_script_in_background(job, script, working_dir)
323
- command = build_script_command(script)
353
+ def execute_script_in_background(job, script, working_dir, command)
324
354
  stdout, stderr, status = Open3.capture3(command, chdir: working_dir)
325
355
 
326
356
  job.append_log(stdout) unless stdout.empty?
@@ -332,10 +362,18 @@ module Rufio
332
362
  job.fail(exit_code: status.exitstatus)
333
363
  end
334
364
 
365
+ # Logsに記録
366
+ log_execution("@#{script[:name]}", {
367
+ success: status.success?,
368
+ output: stdout.strip,
369
+ stderr: stderr.strip
370
+ })
371
+
335
372
  @job_manager&.notify_completion(job)
336
373
  rescue StandardError => e
337
374
  job.append_log("Error: #{e.message}")
338
375
  job.fail(exit_code: -1)
376
+ log_execution("@#{script[:name]}", { success: false, output: '', stderr: e.message })
339
377
  @job_manager&.notify_completion(job)
340
378
  end
341
379
 
@@ -368,11 +406,18 @@ module Rufio
368
406
  result[:error] = "コマンドが失敗しました (終了コード: #{status.exitstatus})"
369
407
  end
370
408
 
409
+ # Logsに記録
410
+ log_execution("rake:#{task_name}", result)
411
+
371
412
  result
372
413
  rescue Errno::ENOENT => e
373
- { success: false, error: "rakeが見つかりません: #{e.message}" }
414
+ result = { success: false, error: "rakeが見つかりません: #{e.message}" }
415
+ log_execution("rake:#{task_name}", result)
416
+ result
374
417
  rescue StandardError => e
375
- { success: false, error: "rake実行エラー: #{e.message}" }
418
+ result = { success: false, error: "rake実行エラー: #{e.message}" }
419
+ log_execution("rake:#{task_name}", result)
420
+ result
376
421
  end
377
422
  end
378
423
 
@@ -218,10 +218,15 @@ module Rufio
218
218
  end
219
219
 
220
220
  def get_active_entries
221
- if @filter_manager.filter_active?
222
- @filter_manager.filtered_entries
221
+ entries = if @filter_manager.filter_active?
222
+ @filter_manager.filtered_entries
223
+ else
224
+ @directory_listing&.list_entries || []
225
+ end
226
+ if @in_help_mode || @in_log_viewer_mode
227
+ entries.reject { |e| e[:name] == '..' }
223
228
  else
224
- @directory_listing&.list_entries || []
229
+ entries
225
230
  end
226
231
  end
227
232
 
@@ -11,9 +11,11 @@ module Rufio
11
11
 
12
12
  # @param script_paths [Array<String>] スクリプトを検索するディレクトリのリスト
13
13
  # @param job_manager [JobManager, nil] ジョブマネージャー(nilの場合は同期実行)
14
- def initialize(script_paths:, job_manager: nil)
14
+ # @param command_logger [CommandLogger, nil] コマンドロガー
15
+ def initialize(script_paths:, job_manager: nil, command_logger: nil)
15
16
  @script_paths = script_paths.map { |p| File.expand_path(p) }
16
17
  @job_manager = job_manager
18
+ @command_logger = command_logger
17
19
  @scripts_cache = nil
18
20
  end
19
21
 
@@ -54,15 +56,16 @@ module Rufio
54
56
  # スクリプトをジョブとして実行
55
57
  # @param name [String] スクリプト名
56
58
  # @param working_dir [String] 作業ディレクトリ
59
+ # @param args [String, nil] スクリプトに渡す引数
57
60
  # @param selected_file [String, nil] 選択中のファイル
58
61
  # @param selected_dir [String, nil] 選択中のディレクトリ
59
62
  # @return [TaskStatus, nil] 作成されたジョブ、またはスクリプトが見つからない場合nil
60
- def run(name, working_dir:, selected_file: nil, selected_dir: nil)
63
+ def run(name, working_dir:, args: nil, selected_file: nil, selected_dir: nil)
61
64
  script = find_script(name)
62
65
  return nil unless script
63
66
 
64
67
  env = build_environment(working_dir, selected_file, selected_dir)
65
- execute_script(script, working_dir, env)
68
+ execute_script(script, working_dir, env, args)
66
69
  end
67
70
 
68
71
  # キャッシュをクリア
@@ -130,9 +133,11 @@ module Rufio
130
133
  # @param script [Hash] スクリプト情報
131
134
  # @param working_dir [String] 作業ディレクトリ
132
135
  # @param env [Hash] 環境変数
136
+ # @param args [String, nil] スクリプトに渡す引数
133
137
  # @return [TaskStatus] 作成されたジョブ
134
- def execute_script(script, working_dir, env = {})
138
+ def execute_script(script, working_dir, env = {}, args = nil)
135
139
  command = build_command(script)
140
+ command = "#{command} #{args}" if args && !args.empty?
136
141
 
137
142
  if @job_manager
138
143
  # ジョブマネージャーにジョブを追加
@@ -205,12 +210,24 @@ module Rufio
205
210
  job.fail(exit_code: status.exitstatus)
206
211
  end
207
212
 
213
+ # CommandLoggerに記録
214
+ log_to_command_logger(job.name, stdout, stderr, status.success?)
215
+
208
216
  # 通知を送信
209
217
  @job_manager&.notify_completion(job)
210
218
  rescue StandardError => e
211
219
  job.append_log("Error: #{e.message}")
212
220
  job.fail(exit_code: -1)
221
+ log_to_command_logger(job.name, '', e.message, false)
213
222
  @job_manager&.notify_completion(job)
214
223
  end
224
+
225
+ # CommandLoggerに実行結果を記録
226
+ def log_to_command_logger(name, stdout, stderr, success)
227
+ return unless @command_logger
228
+
229
+ output = [stdout, stderr].compact.map(&:strip).reject(&:empty?).join("\n")
230
+ @command_logger.log("@#{name}", output, success: success)
231
+ end
215
232
  end
216
233
  end
@@ -17,6 +17,12 @@ module Rufio
17
17
  def toggle_selection(entry, current_directory = nil)
18
18
  return false unless entry
19
19
 
20
+ # 異なるディレクトリで選択した場合、古い選択をクリアしてリセット
21
+ if current_directory && @source_directory && current_directory != @source_directory
22
+ @selected_items.clear
23
+ @source_directory = nil
24
+ end
25
+
20
26
  if @selected_items.include?(entry[:name])
21
27
  @selected_items.delete(entry[:name])
22
28
  # Clear source_directory if no items are selected
@@ -216,6 +216,7 @@ module Rufio
216
216
  last_frame_time = Time.now
217
217
  current_fps = 0.0
218
218
  last_fps_update = Time.now
219
+ @last_displayed_fps = 0.0
219
220
 
220
221
  # 再描画フラグ
221
222
  needs_redraw = false
@@ -237,8 +238,11 @@ module Rufio
237
238
  last_fps_update = start
238
239
  end
239
240
 
240
- # test_modeでは毎フレーム描画してFPS計測の精度を上げる
241
- needs_redraw = true
241
+ # FPS表示の更新タイミングで再描画(1秒ごと)
242
+ if current_fps != @last_displayed_fps
243
+ @last_displayed_fps = current_fps
244
+ needs_redraw = true
245
+ end
242
246
  end
243
247
 
244
248
  # UPDATE phase - ノンブロッキング入力処理
data/lib/rufio/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rufio
4
- VERSION = '0.70.0'
4
+ VERSION = '0.71.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rufio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.70.0
4
+ version: 0.71.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - masisz
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-15 00:00:00.000000000 Z
11
+ date: 2026-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: io-console