-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
48 additions
and
7 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
lib/commands/upload/snapshots/client_libraries/roborazzi.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module EmergeCLI | ||
module Commands | ||
module Upload | ||
module ClientLibraries | ||
class Roborazzi | ||
def initialize(project_root) | ||
@project_root = project_root | ||
end | ||
|
||
def image_files | ||
Dir.glob(File.join(@project_root, '**/build/outputs/roborazzi/**/*.png')) | ||
end | ||
|
||
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 | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters