Class: FluentTools::CommandExecutor
- Inherits:
-
Object
- Object
- FluentTools::CommandExecutor
- Defined in:
- lib/fluent_tools/command_executor.rb
Overview
Core command executor class that interfaces with the fluent-tools Rust binary Handles file validation, output directory creation, and command execution
Instance Method Summary collapse
-
#android_to_fluent(input_path, output_path, original_fluent: nil) ⇒ Object
Convert Android XML to Fluent file.
-
#fluent_to_android(input_path, output_path) ⇒ Object
Convert Fluent file to Android XML.
-
#fluent_to_po(input_path, output_path, locale: 'en-US') ⇒ Object
Convert Fluent file to PO.
-
#initialize ⇒ CommandExecutor
constructor
A new instance of CommandExecutor.
-
#po_to_fluent(input_path, output_path) ⇒ Object
Convert PO file to Fluent.
Constructor Details
#initialize ⇒ CommandExecutor
Returns a new instance of CommandExecutor.
11 12 13 |
# File 'lib/fluent_tools/command_executor.rb', line 11 def initialize @binary_path = find_binary_path end |
Instance Method Details
#android_to_fluent(input_path, output_path, original_fluent: nil) ⇒ Object
Convert Android XML to Fluent file
25 26 27 28 29 30 31 32 33 |
# File 'lib/fluent_tools/command_executor.rb', line 25 def android_to_fluent(input_path, output_path, original_fluent: nil) validate_input_file!(input_path) ensure_output_directory(output_path) cmd = [@binary_path, 'android', 'to-fluent', '-i', input_path, '-o', output_path] cmd += ['--original-fluent', original_fluent] if original_fluent execute_command(cmd) end |
#fluent_to_android(input_path, output_path) ⇒ Object
Convert Fluent file to Android XML
16 17 18 19 20 21 22 |
# File 'lib/fluent_tools/command_executor.rb', line 16 def fluent_to_android(input_path, output_path) validate_input_file!(input_path) ensure_output_directory(output_path) cmd = [@binary_path, 'android', 'from-fluent', '-i', input_path, '-o', output_path] execute_command(cmd) end |
#fluent_to_po(input_path, output_path, locale: 'en-US') ⇒ Object
Convert Fluent file to PO
36 37 38 39 40 41 42 |
# File 'lib/fluent_tools/command_executor.rb', line 36 def fluent_to_po(input_path, output_path, locale: 'en-US') validate_input_file!(input_path) ensure_output_directory(output_path) cmd = [@binary_path, 'po', 'from-fluent', '-i', input_path, '-o', output_path, '-l', locale] execute_command(cmd) end |
#po_to_fluent(input_path, output_path) ⇒ Object
Convert PO file to Fluent
45 46 47 48 49 50 51 |
# File 'lib/fluent_tools/command_executor.rb', line 45 def po_to_fluent(input_path, output_path) validate_input_file!(input_path) ensure_output_directory(output_path) cmd = [@binary_path, 'po', 'to-fluent', '-i', input_path, '-o', output_path] execute_command(cmd) end |