Class: EmergeCLI::Commands::Upload::ClientLibraries::Roborazzi
- Inherits:
-
Object
- Object
- EmergeCLI::Commands::Upload::ClientLibraries::Roborazzi
- Defined in:
- lib/commands/upload/snapshots/client_libraries/roborazzi.rb
Instance Method Summary collapse
- #image_files ⇒ Object
-
#initialize(project_root) ⇒ Roborazzi
constructor
A new instance of Roborazzi.
- #parse_file_info(image_path) ⇒ Object
Constructor Details
#initialize(project_root) ⇒ Roborazzi
Returns a new instance of Roborazzi.
6 7 8 |
# File 'lib/commands/upload/snapshots/client_libraries/roborazzi.rb', line 6 def initialize(project_root) @project_root = project_root end |
Instance Method Details
#image_files ⇒ Object
10 11 12 |
# File 'lib/commands/upload/snapshots/client_libraries/roborazzi.rb', line 10 def image_files Dir.glob(File.join(@project_root, '**/build/outputs/roborazzi/**/*.png')) end |
#parse_file_info(image_path) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/commands/upload/snapshots/client_libraries/roborazzi.rb', line 14 def parse_file_info(image_path) file_name = image_path.split('build/outputs/roborazzi/').last base_name = File.basename(file_name, '.png') parts = base_name.split('.') # Get the last two parts regardless of whether there's a package name in the file name # For "com.example.MyTest.testName" -> ["MyTest", "testName"] # For "MyTest.testName" -> ["MyTest", "testName"] relevant_parts = parts.last(2) { file_name:, group_name: relevant_parts[0], variant_name: relevant_parts[1] } end |