rufio 0.50.0 → 0.60.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.
@@ -1,68 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'fileutils'
4
- require 'time'
5
-
6
- module Rufio
7
- # プロジェクトログ - コマンド実行ログを管理する
8
- class ProjectLog
9
- def initialize(log_dir)
10
- @log_dir = log_dir
11
- FileUtils.mkdir_p(@log_dir) unless Dir.exist?(@log_dir)
12
- end
13
-
14
- # ログを保存する
15
- # @param project_name [String] プロジェクト名
16
- # @param command [String] 実行したコマンド
17
- # @param output [String] コマンドの出力
18
- # @return [String] 保存したログファイルのパス
19
- def save(project_name, command, output)
20
- timestamp = Time.now.strftime('%Y%m%d_%H%M%S')
21
- log_filename = "#{project_name}_#{timestamp}.log"
22
- log_path = File.join(@log_dir, log_filename)
23
-
24
- log_content = <<~LOG
25
- Project: #{project_name}
26
- Command: #{command}
27
- Timestamp: #{Time.now}
28
-
29
- Output:
30
- #{output}
31
- LOG
32
-
33
- File.write(log_path, log_content)
34
- log_path
35
- end
36
-
37
- # ログディレクトリに移動する
38
- # @return [Hash] ログディレクトリ情報
39
- def navigate_to_log_dir
40
- {
41
- path: @log_dir
42
- }
43
- end
44
-
45
- # ログファイルの一覧を取得(新しい順)
46
- # @return [Array<String>] ログファイル名の配列
47
- def list_log_files
48
- log_files = Dir.glob(File.join(@log_dir, '*.log'))
49
-
50
- # ファイルの更新時刻でソート(新しい順)
51
- log_files.sort_by { |f| -File.mtime(f).to_i }
52
- .map { |f| File.basename(f) }
53
- end
54
-
55
- # ログファイルのプレビューを取得
56
- # @param filename [String] ログファイル名
57
- # @return [String] ログファイルの内容
58
- def preview(filename)
59
- log_path = File.join(@log_dir, filename)
60
-
61
- return '' unless File.exist?(log_path)
62
-
63
- File.read(log_path)
64
- rescue StandardError
65
- ''
66
- end
67
- end
68
- end
@@ -1,58 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Rufio
4
- # プロジェクトモード - ブックマークしたプロジェクトの管理とコマンド実行
5
- class ProjectMode
6
- attr_reader :selected_path, :selected_name
7
-
8
- def initialize(bookmark, log_dir)
9
- @bookmark = bookmark
10
- @log_dir = log_dir
11
- @active = false
12
- @selected_path = nil
13
- @selected_name = nil
14
- end
15
-
16
- # プロジェクトモードをアクティブにする
17
- def activate
18
- @active = true
19
- end
20
-
21
- # プロジェクトモードを非アクティブにする
22
- def deactivate
23
- @active = false
24
- @selected_path = nil
25
- @selected_name = nil
26
- end
27
-
28
- # プロジェクトモードがアクティブかどうか
29
- def active?
30
- @active
31
- end
32
-
33
- # ブックマーク一覧を取得
34
- def list_bookmarks
35
- return [] unless @active
36
-
37
- @bookmark.list
38
- end
39
-
40
- # ブックマークを番号で選択
41
- def select_bookmark(number)
42
- return false unless @active
43
-
44
- bookmark = @bookmark.find_by_number(number)
45
- return false unless bookmark
46
-
47
- @selected_path = bookmark[:path]
48
- @selected_name = bookmark[:name]
49
- true
50
- end
51
-
52
- # 選択をクリア
53
- def clear_selection
54
- @selected_path = nil
55
- @selected_name = nil
56
- end
57
- end
58
- end