emerge 0.4.0 → 0.6.0
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 +4 -4
- data/lib/commands/autofixes/exported_symbols.rb +62 -0
- data/lib/commands/autofixes/minify_strings.rb +99 -0
- data/lib/commands/autofixes/strip_binary_symbols.rb +116 -0
- data/lib/commands/build_distribution/download_and_install.rb +139 -0
- data/lib/commands/build_distribution/validate_app.rb +164 -0
- data/lib/commands/order_files/validate_xcode_project.rb +71 -0
- data/lib/commands/upload/build.rb +140 -0
- data/lib/emerge_cli.rb +24 -0
- data/lib/reaper/ast_parser.rb +17 -16
- data/lib/reaper/code_deleter.rb +3 -1
- data/lib/utils/environment.rb +7 -0
- data/lib/utils/git.rb +8 -0
- data/lib/utils/network.rb +2 -2
- data/lib/utils/xcode_device_manager.rb +158 -0
- data/lib/utils/xcode_physical_device.rb +108 -0
- data/lib/utils/xcode_simulator.rb +114 -0
- data/lib/version.rb +1 -1
- data/parsers/libtree-sitter-objc-darwin-arm64.dylib +0 -0
- data/parsers/libtree-sitter-objc-linux-x86_64.so +0 -0
- metadata +32 -5
@@ -0,0 +1,114 @@
|
|
1
|
+
require 'English'
|
2
|
+
require 'zip'
|
3
|
+
require 'cfpropertylist'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
module EmergeCLI
|
7
|
+
class XcodeSimulator
|
8
|
+
attr_reader :device_id
|
9
|
+
|
10
|
+
def initialize(device_id, environment: Environment.new)
|
11
|
+
@device_id = device_id
|
12
|
+
@environment = environment
|
13
|
+
end
|
14
|
+
|
15
|
+
def boot
|
16
|
+
Logger.info "Booting simulator #{@device_id}..."
|
17
|
+
output = @environment.execute_command("xcrun simctl boot #{@device_id}")
|
18
|
+
raise 'Failed to boot simulator' if output.include?('error') || output.include?('failed')
|
19
|
+
end
|
20
|
+
|
21
|
+
def install_app(ipa_path)
|
22
|
+
raise "Non-IPA file provided: #{ipa_path}" unless ipa_path.end_with?('.ipa')
|
23
|
+
|
24
|
+
Dir.mktmpdir do |tmp_dir|
|
25
|
+
Logger.debug "Extracting .app from .ipa in temporary directory: #{tmp_dir}"
|
26
|
+
|
27
|
+
Zip::File.open(ipa_path) do |zip_file|
|
28
|
+
# Debug: List all entries to see what's in the IPA
|
29
|
+
Logger.debug 'IPA contents:'
|
30
|
+
zip_file.each do |entry|
|
31
|
+
Logger.debug " #{entry.name}"
|
32
|
+
end
|
33
|
+
|
34
|
+
# Try different patterns to find the .app directory
|
35
|
+
app_entry = zip_file.glob('**/*.app/').first ||
|
36
|
+
zip_file.glob('**/*.app').first ||
|
37
|
+
zip_file.find { |entry| entry.name.end_with?('.app/') || entry.name.end_with?('.app') }
|
38
|
+
|
39
|
+
raise 'No .app found in .ipa file' unless app_entry
|
40
|
+
Logger.debug "Found app entry: #{app_entry.name}"
|
41
|
+
|
42
|
+
# Extract the .app directory and its contents
|
43
|
+
app_dir = app_entry.name.end_with?('/') ? app_entry.name.chomp('/') : app_entry.name
|
44
|
+
pattern = "#{File.dirname(app_dir)}/#{File.basename(app_dir)}/**/*"
|
45
|
+
Logger.debug "Using glob pattern: #{pattern}"
|
46
|
+
|
47
|
+
zip_file.glob(pattern).each do |entry|
|
48
|
+
entry_path = File.join(tmp_dir, entry.name)
|
49
|
+
FileUtils.mkdir_p(File.dirname(entry_path))
|
50
|
+
zip_file.extract(entry, entry_path) unless File.exist?(entry_path)
|
51
|
+
end
|
52
|
+
|
53
|
+
extracted_app = Dir.glob(File.join(tmp_dir, '**/*.app')).first
|
54
|
+
raise 'Failed to extract .app from .ipa' unless extracted_app
|
55
|
+
Logger.debug "Extracted app at: #{extracted_app}"
|
56
|
+
|
57
|
+
install_extracted_app(extracted_app)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def launch_app(bundle_id)
|
63
|
+
command = "xcrun simctl launch #{@device_id} #{bundle_id}"
|
64
|
+
Logger.debug "Running command: #{command}"
|
65
|
+
|
66
|
+
output = `#{command} 2>&1`
|
67
|
+
success = $CHILD_STATUS.success?
|
68
|
+
|
69
|
+
unless success
|
70
|
+
Logger.debug "Launch command output: #{output}"
|
71
|
+
raise "Failed to launch app #{bundle_id} on simulator"
|
72
|
+
end
|
73
|
+
|
74
|
+
true
|
75
|
+
end
|
76
|
+
|
77
|
+
private
|
78
|
+
|
79
|
+
def install_extracted_app(app_path)
|
80
|
+
command = "xcrun simctl install #{@device_id} \"#{app_path}\""
|
81
|
+
Logger.debug "Running command: #{command}"
|
82
|
+
|
83
|
+
output = `#{command} 2>&1`
|
84
|
+
success = $CHILD_STATUS.success?
|
85
|
+
|
86
|
+
return if success
|
87
|
+
Logger.debug "Install command output: #{output}"
|
88
|
+
check_simulator_compatibility(app_path)
|
89
|
+
raise "Failed to install build on simulator #{@device_id}"
|
90
|
+
end
|
91
|
+
|
92
|
+
def check_simulator_compatibility(app_path)
|
93
|
+
supported_platforms = if app_path.end_with?('.ipa')
|
94
|
+
XcodeDeviceManager.get_supported_platforms(app_path)
|
95
|
+
else
|
96
|
+
info_plist_path = File.join(app_path, 'Info.plist')
|
97
|
+
raise 'Info.plist not found in app bundle' unless File.exist?(info_plist_path)
|
98
|
+
|
99
|
+
plist = CFPropertyList::List.new(file: info_plist_path)
|
100
|
+
info_plist = CFPropertyList.native_types(plist.value)
|
101
|
+
info_plist['CFBundleSupportedPlatforms'] || []
|
102
|
+
end
|
103
|
+
|
104
|
+
Logger.debug "Supported platforms: #{supported_platforms.join(', ')}"
|
105
|
+
|
106
|
+
unless supported_platforms.include?('iPhoneSimulator')
|
107
|
+
raise 'This build is not compatible with simulators. ' \
|
108
|
+
'Please use a real device or make your build compatible with simulators.'
|
109
|
+
end
|
110
|
+
|
111
|
+
Logger.debug 'Build is compatible with simulators'
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
data/lib/version.rb
CHANGED
Binary file
|
Binary file
|
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.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Emerge Tools
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2025-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: async-http
|
@@ -114,6 +114,20 @@ dependencies:
|
|
114
114
|
- - "~>"
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '1.9'
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: rubyzip
|
119
|
+
requirement: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - "~>"
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: 2.3.0
|
124
|
+
type: :runtime
|
125
|
+
prerelease: false
|
126
|
+
version_requirements: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - "~>"
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: 2.3.0
|
117
131
|
- !ruby/object:Gem::Dependency
|
118
132
|
name: tty-prompt
|
119
133
|
requirement: !ruby/object:Gem::Requirement
|
@@ -167,14 +181,21 @@ files:
|
|
167
181
|
- CHANGELOG.md
|
168
182
|
- README.md
|
169
183
|
- exe/emerge
|
184
|
+
- lib/commands/autofixes/exported_symbols.rb
|
185
|
+
- lib/commands/autofixes/minify_strings.rb
|
186
|
+
- lib/commands/autofixes/strip_binary_symbols.rb
|
187
|
+
- lib/commands/build_distribution/download_and_install.rb
|
188
|
+
- lib/commands/build_distribution/validate_app.rb
|
170
189
|
- lib/commands/config/orderfiles/orderfiles_ios.rb
|
171
190
|
- lib/commands/config/snapshots/snapshots_ios.rb
|
172
191
|
- lib/commands/global_options.rb
|
173
192
|
- lib/commands/integrate/fastlane.rb
|
174
193
|
- lib/commands/order_files/download_order_files.rb
|
175
194
|
- lib/commands/order_files/validate_linkmaps.rb
|
195
|
+
- lib/commands/order_files/validate_xcode_project.rb
|
176
196
|
- lib/commands/reaper/reaper.rb
|
177
197
|
- lib/commands/snapshots/validate_app.rb
|
198
|
+
- lib/commands/upload/build.rb
|
178
199
|
- lib/commands/upload/snapshots/client_libraries/default.rb
|
179
200
|
- lib/commands/upload/snapshots/client_libraries/paparazzi.rb
|
180
201
|
- lib/commands/upload/snapshots/client_libraries/roborazzi.rb
|
@@ -183,6 +204,7 @@ files:
|
|
183
204
|
- lib/emerge_cli.rb
|
184
205
|
- lib/reaper/ast_parser.rb
|
185
206
|
- lib/reaper/code_deleter.rb
|
207
|
+
- lib/utils/environment.rb
|
186
208
|
- lib/utils/git.rb
|
187
209
|
- lib/utils/git_info_provider.rb
|
188
210
|
- lib/utils/git_result.rb
|
@@ -193,11 +215,16 @@ files:
|
|
193
215
|
- lib/utils/profiler.rb
|
194
216
|
- lib/utils/project_detector.rb
|
195
217
|
- lib/utils/version_check.rb
|
218
|
+
- lib/utils/xcode_device_manager.rb
|
219
|
+
- lib/utils/xcode_physical_device.rb
|
220
|
+
- lib/utils/xcode_simulator.rb
|
196
221
|
- lib/version.rb
|
197
222
|
- parsers/libtree-sitter-java-darwin-arm64.dylib
|
198
223
|
- parsers/libtree-sitter-java-linux-x86_64.so
|
199
224
|
- parsers/libtree-sitter-kotlin-darwin-arm64.dylib
|
200
225
|
- parsers/libtree-sitter-kotlin-linux-x86_64.so
|
226
|
+
- parsers/libtree-sitter-objc-darwin-arm64.dylib
|
227
|
+
- parsers/libtree-sitter-objc-linux-x86_64.so
|
201
228
|
- parsers/libtree-sitter-swift-darwin-arm64.dylib
|
202
229
|
- parsers/libtree-sitter-swift-linux-x86_64.so
|
203
230
|
homepage: https://github.com/EmergeTools/emerge-cli
|
@@ -208,7 +235,7 @@ metadata:
|
|
208
235
|
source_code_uri: https://github.com/EmergeTools/emerge-cli
|
209
236
|
changelog_uri: https://github.com/EmergeTools/emerge-cli/blob/main/CHANGELOG.md
|
210
237
|
rubygems_mfa_required: 'true'
|
211
|
-
post_install_message:
|
238
|
+
post_install_message:
|
212
239
|
rdoc_options: []
|
213
240
|
require_paths:
|
214
241
|
- lib
|
@@ -224,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
251
|
version: '0'
|
225
252
|
requirements: []
|
226
253
|
rubygems_version: 3.5.11
|
227
|
-
signing_key:
|
254
|
+
signing_key:
|
228
255
|
specification_version: 4
|
229
256
|
summary: Emerge CLI
|
230
257
|
test_files: []
|