Class: Rufio::Application
- Inherits:
-
Object
- Object
- Rufio::Application
- Defined in:
- lib/rufio/application.rb
Constant Summary collapse
- BACKTRACE_LINES =
Error display constants
5
Instance Method Summary collapse
-
#initialize(start_directory = Dir.pwd) ⇒ Application
constructor
Number of backtrace lines to show.
- #run(test_mode: false) ⇒ Object
Constructor Details
#initialize(start_directory = Dir.pwd) ⇒ Application
Number of backtrace lines to show
10 11 12 13 14 |
# File 'lib/rufio/application.rb', line 10 def initialize(start_directory = Dir.pwd) @start_directory = File.(start_directory) # Load configuration including language settings ConfigLoader.load_config end |
Instance Method Details
#run(test_mode: false) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/rufio/application.rb', line 16 def run(test_mode: false) # 各コンポーネントを初期化 directory_listing = DirectoryListing.new(@start_directory) keybind_handler = KeybindHandler.new file_preview = FilePreview.new terminal_ui = TerminalUI.new(test_mode: test_mode) # バックグラウンドコマンド実行用の設定 log_dir = File.join(Dir.home, '.config', 'rufio', 'logs') FileUtils.mkdir_p(log_dir) unless Dir.exist?(log_dir) command_logger = CommandLogger.new(log_dir) background_executor = BackgroundCommandExecutor.new(command_logger) # アプリケーション開始 terminal_ui.start(directory_listing, keybind_handler, file_preview, background_executor) rescue Interrupt puts "\n\n#{ConfigLoader.('app.interrupted')}" rescue StandardError => e puts "\n#{ConfigLoader.('app.error_occurred')}: #{e.}" puts e.backtrace.first(BACKTRACE_LINES).join("\n") end |