cocoapods-anker-ar 1.1.0 → 1.2.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/cocoapods_anker_ar.rb +1 -1
- data/lib/coding_ar_command.rb +3 -2
- data/lib/coding_ar_source.rb +87 -23
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a12a0c8334bae3fa0d0b53a6a5cf0480ca0d0fa2fec3d3b9a0eb324b67534a05
|
|
4
|
+
data.tar.gz: d8bff5397f7262b366e5ad61b22424defe4d4a74dd36860c3df1014ec7ba8919
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: de8a4b20398dff205da4f52e982b5edbc5e5fdd428e3e51c0c1e2b9f18d1e732f6aa8c4633a0e52b82c7e07cee39763f7a0bbd985ae07b9900bb3eb399f8b0f6
|
|
7
|
+
data.tar.gz: 2a18ff5a74d03cb4c790e70961b581bb82623ffa0cbc56157afae15bb80f7c41814766862a03572d0926cb4d40d02b7abf20dd433a6c0c3b65a8966d8e407eaa
|
data/lib/cocoapods_anker_ar.rb
CHANGED
data/lib/coding_ar_command.rb
CHANGED
|
@@ -110,8 +110,9 @@ module Pod
|
|
|
110
110
|
pod_root = File.dirname Pathname(@podspec).realpath
|
|
111
111
|
path_list = Pod::Sandbox::PathList.new(pod_root)
|
|
112
112
|
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
all_specs = [spec] + spec.recursive_subspecs
|
|
114
|
+
file_accessors ||= spec.available_platforms.flat_map do |platform|
|
|
115
|
+
all_specs.map { |s| Pod::Sandbox::FileAccessor.new(path_list, s.consumer(platform)) }
|
|
115
116
|
end
|
|
116
117
|
|
|
117
118
|
pod_files = Pod::Sandbox::FileAccessor.all_files(file_accessors).map do |path|
|
data/lib/coding_ar_source.rb
CHANGED
|
@@ -92,45 +92,109 @@ module Pod
|
|
|
92
92
|
def update(_show_output)
|
|
93
93
|
require 'json'
|
|
94
94
|
require 'coding_ar_util'
|
|
95
|
+
require 'typhoeus'
|
|
96
|
+
require 'etc'
|
|
95
97
|
|
|
96
98
|
changed_spec_paths = []
|
|
97
99
|
UI.puts "Updating CODING-AR-backed repo #{name}".yellow if _show_output
|
|
98
|
-
|
|
100
|
+
|
|
101
|
+
files = Pathname.glob(repo.join('**/*/*.json'))
|
|
102
|
+
spec_requests = []
|
|
103
|
+
|
|
104
|
+
files.each do |f|
|
|
99
105
|
begin
|
|
100
106
|
origin_content = File.read(f)
|
|
101
|
-
spec = JSON.parse
|
|
107
|
+
spec = JSON.parse(origin_content)
|
|
102
108
|
spec_url = "#{url}/Specs/#{spec['name']}/#{spec['version']}/#{spec['name']}.podspec.json"
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
rescue RuntimeError => e
|
|
111
|
-
if e.message.include?('Spec not found')
|
|
112
|
-
UI.puts "- Skipping #{spec['name']} #{spec['version']}: Spec not found".yellow if _show_output
|
|
113
|
-
next
|
|
114
|
-
elsif e.message.include?('URL using bad/illegal format') || e.message.include?('missing URL')
|
|
115
|
-
UI.puts "- Skipping #{spec['name']} #{spec['version']}: Invalid URL format".yellow if _show_output
|
|
116
|
-
next
|
|
117
|
-
else
|
|
118
|
-
UI.puts "- Skipping #{spec['name']} #{spec['version']}: #{e.message}".yellow if _show_output
|
|
119
|
-
next
|
|
120
|
-
end
|
|
109
|
+
spec_requests << {
|
|
110
|
+
file: f,
|
|
111
|
+
url: spec_url,
|
|
112
|
+
origin_content: origin_content,
|
|
113
|
+
spec_name: spec['name'],
|
|
114
|
+
spec_version: spec['version']
|
|
115
|
+
}
|
|
121
116
|
rescue JSON::ParserError => e
|
|
122
117
|
UI.puts "- Skipping #{f}: Invalid JSON format".yellow if _show_output
|
|
123
|
-
next
|
|
124
118
|
rescue => e
|
|
125
119
|
UI.puts "- Skipping #{f}: #{e.message}".yellow if _show_output
|
|
126
|
-
next
|
|
127
120
|
end
|
|
128
121
|
end
|
|
129
|
-
UI.puts "Successfully update CODING-AR-backed repo #{name}".green if _show_output
|
|
130
122
|
|
|
123
|
+
return [] if spec_requests.empty?
|
|
124
|
+
|
|
125
|
+
max_concurrency = [[Etc.nprocessors * 2, 4].max, 20].min
|
|
126
|
+
UI.puts "Fetching #{spec_requests.size} specs with #{max_concurrency} concurrent connections...".yellow if _show_output
|
|
127
|
+
|
|
128
|
+
start_time = Time.now
|
|
129
|
+
hydra = Typhoeus::Hydra.new(max_concurrency: max_concurrency)
|
|
130
|
+
|
|
131
|
+
spec_requests.each do |req|
|
|
132
|
+
request = Typhoeus::Request.new(
|
|
133
|
+
req[:url],
|
|
134
|
+
method: :get,
|
|
135
|
+
netrc: :optional,
|
|
136
|
+
netrc_file: ENV[CodingArUtil::CODING_AR_NETRC_PATH_ENV] || Netrc.default_path,
|
|
137
|
+
followlocation: true,
|
|
138
|
+
headers: { 'User-Agent' => CodingArUtil::USER_AGENT }
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
request.on_complete do |response|
|
|
142
|
+
handle_spec_response(response, req, changed_spec_paths, _show_output)
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
hydra.queue(request)
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
hydra.run
|
|
149
|
+
elapsed = Time.now - start_time
|
|
150
|
+
|
|
151
|
+
UI.puts "Fetched #{spec_requests.size} specs in #{elapsed.round(2)}s (#{(spec_requests.size / elapsed).round(1)} specs/sec)".green if _show_output
|
|
152
|
+
UI.puts "Successfully update CODING-AR-backed repo #{name}".green if _show_output
|
|
131
153
|
[]
|
|
132
154
|
end
|
|
133
155
|
|
|
156
|
+
def handle_spec_response(response, req, changed_spec_paths, show_output)
|
|
157
|
+
file = req[:file]
|
|
158
|
+
spec_name = req[:spec_name]
|
|
159
|
+
spec_version = req[:spec_version]
|
|
160
|
+
origin_content = req[:origin_content]
|
|
161
|
+
|
|
162
|
+
UI.puts "- Fetch #{req[:url]}" if show_output
|
|
163
|
+
|
|
164
|
+
if response.code == 0
|
|
165
|
+
UI.puts "- Skipping #{spec_name} #{spec_version}: #{response.return_message}".yellow if show_output
|
|
166
|
+
return
|
|
167
|
+
elsif response.code != 200
|
|
168
|
+
error_msg = response.body.to_s
|
|
169
|
+
if error_msg.include?('Spec not found') || error_msg.include?('not found')
|
|
170
|
+
UI.puts "- Skipping #{spec_name} #{spec_version}: Spec not found".yellow if show_output
|
|
171
|
+
elsif error_msg.include?('URL using bad/illegal format') || error_msg.include?('missing URL')
|
|
172
|
+
UI.puts "- Skipping #{spec_name} #{spec_version}: Invalid URL format".yellow if show_output
|
|
173
|
+
else
|
|
174
|
+
UI.puts "- Skipping #{spec_name} #{spec_version}: HTTP #{response.code}".yellow if show_output
|
|
175
|
+
end
|
|
176
|
+
return
|
|
177
|
+
end
|
|
178
|
+
|
|
179
|
+
begin
|
|
180
|
+
latest_content = response.body
|
|
181
|
+
if latest_content.to_s.start_with?('Pod not found')
|
|
182
|
+
FileUtils.rm_rf(File.dirname(file))
|
|
183
|
+
return
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
JSON.parse(latest_content)
|
|
187
|
+
FileUtils.mkdir_p(File.dirname(file))
|
|
188
|
+
File.open(file, 'wb') { |f| f << latest_content }
|
|
189
|
+
|
|
190
|
+
changed_spec_paths.push(file) if origin_content != latest_content
|
|
191
|
+
rescue JSON::ParserError => e
|
|
192
|
+
UI.puts "- Skipping #{spec_name} #{spec_version}: Invalid JSON in response".yellow if show_output
|
|
193
|
+
rescue => e
|
|
194
|
+
UI.puts "- Skipping #{spec_name} #{spec_version}: #{e.message}".yellow if show_output
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
|
|
134
198
|
def updateable?
|
|
135
199
|
true
|
|
136
200
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: cocoapods-anker-ar
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Dark Liu
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-03-31 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|