emerge 0.7.3 → 0.7.5

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0eeb092bc3889613fa27a5e513ac667031a602ed92ea8d3da3936b4db228f816
4
- data.tar.gz: a2e8f5b498adfbeda356e5ae8010826eaf21429f0556c2b65f452947df102844
3
+ metadata.gz: 66e8055e5a23225c6e3d4ca58ba5a65c5f57eb05cfd1aa0dec5a3003cdaa977d
4
+ data.tar.gz: 7f3ad2aaf92ee59ee9e6e1557b0ae04311ebe83ce40ae14955c4e72a77945e39
5
5
  SHA512:
6
- metadata.gz: 2a5166082c6668bf0fd0c2a5d431b54a2a70ae58bef468967b6d3120173e9215576fb7ecbe94acc6f8d3ee747d85f0bff0b09232e1343666622f07532f8e783d
7
- data.tar.gz: d9638a7b631a4c2831b6d676994bde76a1b4b9e0077effe211ef5c2f1a0f0cf88ebd8f908be6ec72c1ae8b49f56cad71efa82be877be891d5270cbc0944d326e
6
+ metadata.gz: 130fb2b9274a259ea6f61d85deafacbc6c916616a5bc5a746071a0d38074f45ed1b814298c14d85b7a108124afee8f1f6bd5600f1aa2b01d913fe04f3275fde9
7
+ data.tar.gz: 5dd9b9f7dbec27f9ab52fc1193541d4ff7be89f32d83f18dd5f7ade9ebd5e5a877cb9935ff68e408b500df1454fca3486fb6c79e0b6d6f2eaef20da592ad783a
data/README.md CHANGED
@@ -4,137 +4,6 @@ The official CLI for Emerge Tools.
4
4
 
5
5
  [Emerge](https://emergetools.com) offers a suite of products to help optimize app size, performance, and quality by detecting regressions before they make it to production. This plugin provides a set of actions to interact with the Emerge API.
6
6
 
7
- ## Installation
7
+ # Documentation
8
8
 
9
- This tool is packaged as a Ruby Gem which can be installed by:
10
-
11
- ```
12
- gem install emerge
13
- ```
14
-
15
- ## API Key
16
-
17
- Follow our guide to obtain an [API key](https://docs.emergetools.com/docs/uploading-basics#obtain-an-api-key) for your organization. The API Token is used by the CLI to authenticate with the Emerge API. The CLI will automatically pick up the API key if configured as an `EMERGE_API_TOKEN` environment variable, or you can manually pass it into individual commands with the `--api-token` option.
18
-
19
- ## Snapshots
20
-
21
- Uploads a directory of images to be used in [Emerge Snapshot Testing](https://docs.emergetools.com/docs/snapshot-testing).
22
-
23
- Run `emerge upload snapshots -h` for a full list of supported options.
24
-
25
- Example:
26
-
27
- ```shell
28
- emerge upload snapshots \
29
- --name "AwesomeApp" \
30
- --id "com.emerge.awesomeapp" \
31
- --repo-name "EmergeTools/AwesomeApp" \
32
- path/to/snapshot/images
33
- ```
34
-
35
- ### Git Configuration
36
-
37
- For CI diffs to work, Emerge needs the appropriate Git `sha` and `base_sha` values set on each build. Emerge will automatically compare a build at `sha` against the build we find matching the `base_sha` for a given application id. We also recommend setting `pr_number`, `branch`, and `repo_name` for the best experience.
38
-
39
- For example:
40
-
41
- - `sha`: `pr-branch-commit-1`
42
- - `base_sha`: `main-branch-commit-1`
43
- - `pr_number`: `42`
44
- - `branch`: `my-awesome-feature`
45
- - `repo_name`: `EmergeTools/hackernews`
46
-
47
- Will compare the snapshot diffs of your pull request changes.
48
-
49
- This plugin will automatically configure Git values for you assuming certain Github workflow triggers:
50
-
51
- ```yaml
52
- on:
53
- # Produce base builds with a 'sha' when commits are pushed to the main branch
54
- push:
55
- branches: [main]
56
-
57
- # Produce branch comparison builds with `sha` and `base_sha` when commits are pushed
58
- # to open pull requests
59
- pull_request:
60
- branches: [main]
61
- ...
62
- ```
63
-
64
- If this doesn't cover your use-case, manually set the `sha` and `base_sha` values when calling the Emerge plugin.
65
-
66
- ### Using with swift-snapshot-testing
67
-
68
- Snapshots generated via [swift-snapshot-testing](https://github.com/pointfreeco/swift-snapshot-testing) are natively supported by the CLI by setting `--client-library swift-snapshot-testing` and a `--project-root` directory. This will scan your project for all images found in `__Snapshot__` directories.
69
-
70
- Example:
71
-
72
- ```shell
73
- emerge upload snapshots \
74
- --name "AwesomeApp swift-snapshot-testing" \
75
- --id "com.emerge.awesomeapp.swift-snapshot-testing" \
76
- --repo-name "EmergeTools/AwesomeApp" \
77
- --client-library swift-snapshot-testing \
78
- --project-root /my/awesomeapp/ios/repo
79
- ```
80
-
81
- ### Using with Paparazzi
82
-
83
- Snapshots generated via [Paparazzi](https://github.com/cashapp/paparazzi) are natively supported by the CLI by setting `--client-library paparazzi` and a `--project-root` directory. This will scan your project for all images found in `src/test/snapshots/images` directories.
84
-
85
- Example:
86
-
87
- ```shell
88
- emerge upload snapshots \
89
- --name "AwesomeApp Paparazzi" \
90
- --id "com.emerge.awesomeapp.paparazzi" \
91
- --repo-name "EmergeTools/AwesomeApp" \
92
- --client-library paparazzi \
93
- --project-root /my/awesomeapp/android/repo
94
- ```
95
-
96
- ### Using with Roborazzi
97
-
98
- Snapshots generated via [Roborazzi](https://github.com/takahirom/roborazzi) are natively supported by the CLI by setting `--client-library roborazzi` and a `--project-root` directory. This will scan your project for all images found in `**/build/outputs/roborazzi` directories.
99
-
100
- Example:
101
-
102
- ```shell
103
- emerge upload snapshots \
104
- --name "AwesomeApp Roborazzi" \
105
- --id "com.emerge.awesomeapp.roborazzi" \
106
- --repo-name "EmergeTools/AwesomeApp" \
107
- --client-library roborazzi \
108
- --project-root /my/awesomeapp/android/repo
109
- ```
110
-
111
- ## Reaper
112
-
113
- Experimental support has been added to interactively examine [Reaper](https://docs.emergetools.com/docs/reaper) results and also **delete them from your codebase**.
114
-
115
- Use the `reaper` subcommand to get started, e.g.:
116
-
117
- ```shell
118
- emerge reaper --upload-id 40f1dfe7-6c57-47c3-bc52-b621aec0ba8d \
119
- --project-root /path/to/your/repo
120
- ```
121
-
122
- After which it will prompt you to select classes to delete.
123
-
124
- ### How it works
125
-
126
- Under the hood we are using [Tree Sitter](https://tree-sitter.github.io/tree-sitter/) to parse your source files into an AST which is then used for deletions. There are some obvious limitations to this approach, namely that Tree Sitter is designed for source code editors and only looks at a single file at a time. We are exploring some better long-term approaches but this works well enough for now!
127
-
128
- ### Supported languages
129
-
130
- We currently support the following languages:
131
-
132
- - Swift
133
- - Kotlin
134
- - Java
135
-
136
- Please open an issue if you need an additional language grammar.
137
-
138
- ### Building
139
-
140
- Because many of the language grammars we use are third-party, we have to package them with our CLI tool as shared libraries for distribution. We depend on [tsdl](https://github.com/stackmystack/tsdl) to build the grammars from our `parsers.toml` file.
9
+ See [Emerge CLI](https://docs.emergetools.com/docs/emerge-cli#/) for our full documentation.
@@ -3,8 +3,9 @@ module EmergeCLI
3
3
  module Upload
4
4
  module ClientLibraries
5
5
  class Default
6
- def initialize(image_paths)
6
+ def initialize(image_paths, group_delimiter)
7
7
  @image_paths = image_paths
8
+ @group_delimiter = group_delimiter
8
9
  end
9
10
 
10
11
  def image_files
@@ -13,10 +14,14 @@ module EmergeCLI
13
14
 
14
15
  def parse_file_info(image_path)
15
16
  file_name = File.basename(image_path)
17
+ file_name_without_extension = File.basename(file_name, '.*')
18
+ parts = file_name_without_extension.split(@group_delimiter)
19
+ group_name = parts.first
20
+ variant_name = parts[1..].join(@group_delimiter)
16
21
  {
17
22
  file_name:,
18
- group_name: File.basename(image_path, '.*'),
19
- variant_name: nil
23
+ group_name:,
24
+ variant_name:
20
25
  }
21
26
  end
22
27
  end
@@ -27,7 +27,8 @@ module EmergeCLI
27
27
  option :base_sha, type: :string, required: false, desc: 'Base SHA'
28
28
  option :previous_sha, type: :string, required: false, desc: 'Previous SHA'
29
29
  option :pr_number, type: :string, required: false, desc: 'PR number'
30
- option :concurrency, type: :integer, default: 5, desc: 'Number of concurrency for parallel uploads'
30
+ option :concurrency, type: :integer, default: 5,
31
+ desc: 'Number of concurrency for parallel image uploads when not using batch mode'
31
32
 
32
33
  option :client_library, type: :string, required: false, values: %w[swift-snapshot-testing paparazzi roborazzi],
33
34
  desc: 'Client library used for snapshots'
@@ -35,8 +36,8 @@ module EmergeCLI
35
36
 
36
37
  option :profile, type: :boolean, default: false, desc: 'Enable performance profiling metrics'
37
38
 
38
- option :batch, type: :boolean, default: false, desc: 'Upload images in batch using zip file'
39
-
39
+ option :batch, type: :boolean, default: true, desc: 'Upload images in batch using zip file'
40
+ option :group_delimiter, type: :string, default: '__', desc: 'Delimiter for group and variant names'
40
41
  argument :image_paths, type: :array, required: false, desc: 'Paths to folders containing images'
41
42
 
42
43
  def initialize(network: nil, git_info_provider: nil)
@@ -119,7 +120,7 @@ module EmergeCLI
119
120
  raise "Unsupported client library: #{@options[:client_library]}"
120
121
  end
121
122
  else
122
- ClientLibraries::Default.new(image_paths)
123
+ ClientLibraries::Default.new(image_paths, @options[:group_delimiter])
123
124
  end
124
125
  end
125
126
 
data/lib/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module EmergeCLI
2
- VERSION = '0.7.3'.freeze
2
+ VERSION = '0.7.5'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: emerge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.7.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emerge Tools
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-02-10 00:00:00.000000000 Z
11
+ date: 2025-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-http